Skip to content

LLVM target's OS/ABI is lost #97535

Closed
@mkroening

Description

@mkroening

When compiling for x86_64-unknown-hermit, the resulting binaries should have the OS/ABI (EI_OSABI) field in the ELF header set to Standalone (0xff) as per the x86_64-unknown-hermit LLVM target, which it did before nightly-2022-04-26. Now, it is set to "UNIX - System V", which I only tested on Linux.

git-bisect identified the introduction of synthetic object files for exported symbols 773f533 from #95604 to have changed this:

773f533eae25129cea7241b74e54f26ce5eebb62 is the first bad commit
commit 773f533eae25129cea7241b74e54f26ce5eebb62
Author: Gary Guo <[email protected]>
Date:   Sat Apr 2 22:54:51 2022 +0100

    Synthesis object file for `#[used]` and exported symbols

 compiler/rustc_codegen_ssa/src/back/link.rs        | 69 ++++++++++++++++++++++
 compiler/rustc_codegen_ssa/src/back/linker.rs      | 46 +++++++++++++++
 compiler/rustc_codegen_ssa/src/back/metadata.rs    |  2 +-
 .../rustc_codegen_ssa/src/back/symbol_export.rs    | 54 ++++++++++++++---
 compiler/rustc_codegen_ssa/src/base.rs             |  7 +++
 compiler/rustc_codegen_ssa/src/lib.rs              |  2 +
 .../rustc_middle/src/middle/exported_symbols.rs    | 10 ++++
 7 files changed, 182 insertions(+), 8 deletions(-)

I did not have a deep dive into the code yet, but I assume the synthetic object file has the host's OS/ABI, which is prevalent over the other OS/ABI.

@nbdd0121, do you have any insight?

Related: hermit-os/hermit-rs#300

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-untriagedUntriaged performance or correctness regression.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions