[PATCH] ld: Add lib32 directories for 32-bit emulation on FreeBSD/amd64

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Wed Dec 13 09:33:05 GMT 2023


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ld-freebsd-lib32.patch
Type: text/x-patch
Size: 332 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20231213/c874955d/attachment.bin>


More information about the Binutils mailing list