[PATCH] D95370: [ELF] Infer OSABI from input files for -m options without explicit OSABI

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 25 09:11:52 PST 2021


jrtc27 added a comment.

In D95370#2520240 <https://reviews.llvm.org/D95370#2520240>, @MaskRay wrote:

> Can you give links why this is needed to change in the linker?

For older FreeBSD ports, the emulation has always been `foo_fbsd`. For AArch64, it was for a long time just using the unsuffixed version. At some point a few years ago, GNU toolchains started to use the `_fbsd`-suffixed emulation, but Clang continues to pass the unsuffixed one. For RISC-V, neither the GNU toolchain nor Clang include the suffix.

It's debatable whether this should be done in the linker. But the .o's coming out of Clang have ELFOSABI_FREEBSD and the linker loses that information if you pass an explicit non-suffixed emulation (if you don't pass anything it defaults to the first file's).

It's all a bit strange, and differs from Linux where you almost always see ELFOSABI_NONE rather than ELFOSABI_LINUX. But I would like to see the significance of EI_OSABI be decreased such that it's only about the ELF extensions used and not about the OS it expects to run in, as we have much more expressive ELF notes for the latter.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95370/new/

https://reviews.llvm.org/D95370



More information about the llvm-commits mailing list