public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ld: Add lib32 directories for 32-bit emulation on FreeBSD/amd64
@ 2023-12-13  9:33 Rainer Orth
  2023-12-19 22:23 ` Rainer Orth
  0 siblings, 1 reply; 7+ messages in thread
From: Rainer Orth @ 2023-12-13  9:33 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 989 bytes --]

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.

Ok for trunk?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-12-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	ld:
	* emulparams/elf_i386.sh (LIBPATH_SUFFIX, LIBPATH_SUFFIX_SKIP)
	[x86_64*-freebsd*]: Set for i386 emulation.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ld-freebsd-lib32.patch --]
[-- Type: text/x-patch, Size: 332 bytes --]

diff --git a/ld/emulparams/elf_i386.sh b/ld/emulparams/elf_i386.sh
--- 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] 7+ messages in thread

end of thread, other threads:[~2023-12-21 12:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-13  9:33 [PATCH] ld: Add lib32 directories for 32-bit emulation on FreeBSD/amd64 Rainer Orth
2023-12-19 22:23 ` Rainer Orth
2023-12-20  7:35   ` Jan Beulich
2023-12-20  9:12     ` Rainer Orth
2023-12-20 17:47       ` John Baldwin
2023-12-21  7:25         ` Jan Beulich
2023-12-21 12:03         ` 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).