git: baa7d0741b9a - main - libsys: link symbolic
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 23 Feb 2024 17:57:57 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=baa7d0741b9a2117410d558c6715906980723eed
commit baa7d0741b9a2117410d558c6715906980723eed
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-02-22 21:13:02 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-02-23 17:39:42 +0000
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
---
lib/libsys/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile
index 5e8c39deb463..aefa19f35193 100644
--- a/lib/libsys/Makefile
+++ b/lib/libsys/Makefile
@@ -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" && \