[PATCH] D95755: [ELF] Support a few elf32lriscv_* & elf64lriscv_* emulations

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 1 11:50:18 PST 2021


MaskRay marked 2 inline comments as done.
MaskRay added a comment.

I took a skim in binutils-gdb/ld/emulparams and I am not sure _ilp32/_ilp32f/_lp64/_lp64f are how binutils traditionally solve minor ABI variant problems.
For architectures which provide very different flavors, e.g. x86-64's ILP32 ABI, elf32_x86_64, that emulation is there because ILP32 is entirely different.
If we read the file, we will notice that it changes many defaults, not just default library search paths.

Let's take a look at GCC: gcc/config/arm/linux-elf.h does not change emulation due to floating point ABI differences.
gcc/config/mips/linux.h has 3 variants but they are for fundamentally different ABIs.
RISC-V is currently unique in this matter.

LLD by design does not wants default library search paths. It actually works surprisingly well. We don't need special code for ARM/AArch64/mips/PowerPC/etc.
Different platforms have different customization needs. Some may want /lib, some may want /lib64, some may want in another location.
As jrtc27 said users should just do that via the compiler driver, and if they really need to invoke ld directly (I'd say in 99.9% cases they are inferior choices), they can specify explicit -L instead of passing through a magic -m.

I certainly want LLD to be used by GCC, but I'd also want it to be maintainable and readable. I'd be conservative taking these unnecessary quirks. https://maskray.me/blog/2020-12-19-lld-and-gnu-linker-incompatibilities

"One reason that I am subscribed to the binutils mailing list is I want to participate in its design processes (I am proud to say that I have managed to find some early issues of various new things)."

I'd hope future GCC versions can be changed to not rely on -m emulations. They can pass -L regardless of `-fuse-ld={bfd,gold,lld}`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95755



More information about the llvm-commits mailing list