libsys: link symbolic

so that libc/libthr do not preempt libsys symbols, esp. errno-related.

The issue is, if libsys is linked with DT_BIND_NOW flag, and then loaded
as filter, rtld tries to relocate its PLT symbols immediately, not as
filter.  There, during symbol lookup, rtld finds filtering symbols in
libc, and since libc is in loading filters mode, the resolution stops
there.  The end result is that libsys links to libc.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D44027
This commit is contained in:
Konstantin Belousov 2024-02-22 23:13:02 +02:00
parent 0085afdceb
commit baa7d0741b

View file

@ -43,6 +43,7 @@ CFLAGS+= -ftls-model=initial-exec
# Link with static libcompiler_rt.a.
#
LDFLAGS+= -nodefaultlibs
LDFLAGS+= -Wl,-Bsymbolic
LIBADD+= compiler_rt
.if ${MK_SSP} != "no" && \