* [binutils-gdb] ld: Add lib32 directories for 32-bit emulation on FreeBSD/amd64
@ 2023-12-21 11:51 Rainer Orth
0 siblings, 0 replies; only message in thread
From: Rainer Orth @ 2023-12-21 11:51 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=333a6b1a6399992cc98ac34727acf38136b770e6
commit 333a6b1a6399992cc98ac34727acf38136b770e6
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date: Thu Dec 21 12:51:26 2023 +0100
ld: Add lib32 directories for 32-bit emulation on FreeBSD/amd64
GNU ld currently fails to link 32-bit executables on FreeBSD/amd64 when
the linked libraries have dependencies on shared objects themselves:
$ gcc -m32 -o ei ei.c -lexecinfo
/var/gcc/binutils/amd64/lib/gcc/amd64-pc-freebsd14.0/13.2.0/../../../../amd64-pc-freebsd14.0/bin/ld:
warning: libelf.so.2, needed by /usr/lib/../lib32/libexecinfo.so, not found
(try using -rpath or -rpath-link)
/var/gcc/binutils/amd64/lib/gcc/amd64-pc-freebsd14.0/13.2.0/../../../../amd64-pc-freebsd14.0/bin/ld:
/usr/lib/../lib32/libexecinfo.so: undefined reference to `elf_begin@R1.0'
[...]
Fixed by handling FreeBSD/amd64 like Linux/x86.
Tested on amd64-pc-freebsd14.0.
Diff:
---
ld/ChangeLog | 5 +++++
ld/emulparams/elf_i386.sh | 8 ++++++++
2 files changed, 13 insertions(+)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index cbcb29de0a0..82cb270de06 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2023-12-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * emulparams/elf_i386.sh (LIBPATH_SUFFIX, LIBPATH_SUFFIX_SKIP)
+ [x86_64*-freebsd*]: Set for i386 emulation.
+
2023-12-12 Georg-Johann Lay <avr@gjlay.de>
PR 31124
diff --git a/ld/emulparams/elf_i386.sh b/ld/emulparams/elf_i386.sh
index ae17bb4b3f7..3f124356d02 100644
--- a/ld/emulparams/elf_i386.sh
+++ b/ld/emulparams/elf_i386.sh
@@ -39,4 +39,12 @@ case "$target" in
;;
esac
;;
+ x86_64*-freebsd*)
+ case "$EMULATION_NAME" in
+ *i386*)
+ LIBPATH_SUFFIX=32
+ LIBPATH_SUFFIX_SKIP=64
+ ;;
+ esac
+ ;;
esac
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-12-21 11:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-21 11:51 [binutils-gdb] ld: Add lib32 directories for 32-bit emulation on FreeBSD/amd64 Rainer Orth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).