[PATCH] ld: Add elf{32,64}[lb]riscv_fbsd emulations and riscv{32,64}{,be}-*-freebsd* triples

Jessica Clarke jrtc27@jrtc27.com
Tue Feb 2 03:17:23 GMT 2021


On Sat, Jan 30, 2021 at 11:07:05PM -0800, Fangrui Song wrote:
> Relax an ABI compatibility check so that ELFOSABI_FREEBSD output can
> subsume ELFOSABI_NONE/ELFOSABI_GNU input object files.
>
>     PR 27296
> bfd/
>     * config.bfd: Add riscvbe-*-freebsd*, riscv32be-*-freebsd*,
>     riscv-*-freebsd*, riscv32*-*-freebsd*, riscv64be-*-freebsd*,
>     riscv64*-*-freebsd*.
>     * configure.ac: Add riscv_elf32_fbsd_vec, riscv_elf32_fbsd_vec,
>     riscv_elf32_fbsd_vec, riscv_elf32_fbsd_vec.
>     * elfnn-riscv.c (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME,
>     TARGET_BIG_SYM, TARGET_BIG_NAME, ELF_OSABI, elf32_bed, elf64_bed):
>     Define for freebsd.
>     * targets.c (riscv_elf32_fbsd_vec, riscv_elf32_fbsd_vec,
>     riscv_elf32_fbsd_vec, riscv_elf32_fbsd_vec): Declare.
>     (_bfd_target_vector): Add them.
>     * configure: Regenerate.
> ld/
>     * Makefile.am (ALL_EMULATION_SOURCES): Add eelf32lriscv_fbsd.c and
>     eelf32briscv_fbsd.c.
>     (ALL_64_EMULATION_SOURCES): Add eelf64lriscv_fbsd.c and
>     eelf64briscv_fbsd.c.
>     Include $(DEPDIR)/eelf*lriscv_fbsd* files.
>     * configure.tgt: Add riscvbe-*-freebsd*, riscv32be-*-freebsd*,
>     riscv-*-freebsd*, riscv32*-*-freebsd*, riscv64be-*-freebsd*,
>     riscv64*-*-freebsd*.
>     * emulparams/elf32lriscv_bsd.sh: New file.
>     * emulparams/elf32briscv_bsd.sh: New file.
>     * emulparams/elf64lriscv_bsd.sh: New file.
>     * emulparams/elf64briscv_bsd.sh: New file.
>     * Makefile.in: Regenerate.
>     * po/BLD-POTFILES.in: Regenerate.

As FreeBSD and LLVM developers, and as dicussed on IRC, we do not
believe the emulations are needed, as FreeBSD has been using ELF notes
to brand executables for many years rather than the inflexible EI_OSABI.
AArch64 does not use an _fbsd emulation with an LLVM toolchain (though
for some unknown reason, likely not understanding the situation, BFD did
gain one for it), and I do not think there is a need to pollute RISC-V
with such legacy junk.

Jess


More information about the Binutils mailing list