[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Glibc-bsd-commits] r1827 - trunk/web/patches



Hi.

First the change from elf64-x86-64 to elf64-x86-64-freebsd breaks the
build of the kernel ("ld: target elf64-x86-64 not found"). This can
probably be fixed, but I wonder to know if this change is really
necessary? Plain FreeBSD amd64 seems to use elf64-x86-64.

The plain FreeBSD does it in "the right way" only
for two (first) ports - i386 and alpha. For all others they use hack
for seting ELFOSABI_FREEBSD. So the "target elf64-x86-64" generated on Linux is not same asthe one generated on FreeBSD :-(
It disallows building from the same source on both platforms,
cross compilers and so on.
IMO, the right way here is to use elf64-x86-64-freebsd in linker scripts.

Second this seems to cause some problems when trying to build a bi-arch
gcc. I get: File format is ambiguous. Matching formats:
elf32-i386-freebsd elf32-i386.

Changing the patch so that only elf64-x86-64 and elf32-i386-freebsd
format are supported seems to fix those problems. What do you think?

I hope you meant "elf64-x86-64-freebsd and elf32-i386-freebsd",
i.e. the right chunk of 2.17 patch should be:

diff -urN binutils-2.17/bfd/config.bfd binutils-2.17/bfd/config.bfd
--- binutils-2.17/bfd/config.bfd
+++ binutils-2.17/bfd/config.bfd
@@ -551,8 +551,8 @@
     targ_selvecs="bfd_elf32_i386_vec i386coff_vec"
     ;;
   x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
-    targ_defvec=bfd_elf64_x86_64_vec
-    targ_selvecs="bfd_elf32_i386_vec i386coff_vec bfd_efi_app_ia32_vec"
+    targ_defvec=bfd_elf64_x86_64_freebsd_vec
+    targ_selvecs="bfd_elf32_i386_freebsd_vec i386coff_vec bfd_efi_app_ia32_vec"
     ;;
   x86_64-*-netbsd* | x86_64-*-openbsd*)
     targ_defvec=bfd_elf64_x86_64_vec


This way there will be no ambiguity. It looks like the linker is able to solve ambiguity only partially - iff one of possible format is "targ_defvec". I overlooked this during preparation of the patch.
After testing, we should ask upstream
to just drop "bfd_elf32_i386_vec bfd_elf64_x86_64_vec" from targ_selvecs.


Petr



Reply to: