lib{c,thr}: add DT_RUNPATH for gcc -m32

To allow gcc -m32 to work, link libc and libthr with --rpath-/usr/lib32.
When called with -m32, gcc is currently unable to communicate to
the bfd linker that it should look in /usr/lib32 to resolve needed (as
opposed to explicitly linked) libraries so we need to provide a hint.

See also: https://sourceware.org/bugzilla/show_bug.cgi?id=31395

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D43910
This commit is contained in:
Brooks Davis 2024-02-19 22:44:08 +00:00
parent 99ea675731
commit eb90239d08
2 changed files with 10 additions and 0 deletions

View file

@ -63,6 +63,11 @@ CFLAGS+= -ftls-model=initial-exec
LDFLAGS+= -nodefaultlibs
LIBADD+= compiler_rt
LIBADD+= sys
.if defined(COMPAT_libcompat)
# XXX: work around gcc -m32 + bfd ld path issue for DT_NEEDED symbols.
# https://sourceware.org/bugzilla/show_bug.cgi?id=31395
LDFLAGS+= -Wl,--rpath=/usr/lib${COMPAT_libcompat}
.endif
LDFLAGS+=-Wl,--auxiliary,libsys.so.7

View file

@ -8,6 +8,11 @@ PACKAGE= clibs
SHLIBDIR?= /lib
LIBADD= c sys
.if defined(COMPAT_libcompat)
# XXX: work around gcc -m32 + bfd ld path issue for DT_NEEDED symbols.
# https://sourceware.org/bugzilla/show_bug.cgi?id=31395
LDFLAGS+= -Wl,--rpath=/usr/lib${COMPAT_libcompat}
.endif
.include <src.opts.mk>
MK_SSP= no