Page MenuHomeFreeBSD

D43910.1789856512.diff
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

D43910.1789856512.diff

diff --git a/lib/libc/Makefile b/lib/libc/Makefile
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -62,6 +62,10 @@
#
LDFLAGS+= -nodefaultlibs
LIBADD+= compiler_rt
+LIBADD+= sys
+.if defined(COMPAT_libcompat)
+LDFLAGS+= -Wl,--rpath=/usr/lib${COMPAT_libcompat}
+.endif
LDFLAGS+=-Wl,--auxiliary,libsys.so.7
diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile
--- a/lib/libc/tests/ssp/Makefile
+++ b/lib/libc/tests/ssp/Makefile
@@ -10,6 +10,7 @@
# override the sanitizer runtime libraries to be the ones installed on the
# target system.
CFLAGS.h_raw+= -fsanitize=bounds
+LIBADD+=sys
.elif ${COMPILER_TYPE} == "gcc"
CFLAGS.h_raw+= --param ssp-buffer-size=1
LDADD+= -lssp
diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile
--- a/lib/libsys/Makefile
+++ b/lib/libsys/Makefile
@@ -57,6 +57,9 @@
MIASM=
NOASM=
+SYM_MAPS+= ${LIBSYS_SRCTOP}/Symbol.map
+SRCS+= auxv.c
+
.include "${LIBSYS_SRCTOP}/Makefile.sys"
SYM_MAPS+= ${LIBSYS_SRCTOP}/Symbol.thr.map
diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys
--- a/lib/libsys/Makefile.sys
+++ b/lib/libsys/Makefile.sys
@@ -47,8 +47,6 @@
NOASM+= sched_getcpu.o
PSEUDO+= _sched_getcpu.o
-SRCS+= auxv.c
-
SRCS+= brk.c
SRCS+= closefrom.c
SRCS+= pipe.c
@@ -58,6 +56,14 @@
SRCS+= compat-stub.c
+.if ${LIB} == "c"
+# Trapping stubs in dynamic libc to be filtered by libsys.
+SOBJS+= libc_stubs.pico
+
+# Link the full implementation of ELF auxargs for static libc.
+STATICOBJS+= auxv.o
+.endif
+
INTERPOSED = \
accept \
accept4 \
diff --git a/lib/libsys/Symbol.map b/lib/libsys/Symbol.map
new file mode 100644
--- /dev/null
+++ b/lib/libsys/Symbol.map
@@ -0,0 +1,5 @@
+FBSDprivate_1.0 {
+ __elf_aux_vector;
+ __init_elf_aux_vector;
+ _elf_aux_info;
+};
diff --git a/lib/libsys/Symbol.sys.map b/lib/libsys/Symbol.sys.map
--- a/lib/libsys/Symbol.sys.map
+++ b/lib/libsys/Symbol.sys.map
@@ -433,12 +433,10 @@
FBSDprivate_1.0 {
/* Add entries in sort(1) order */
- __elf_aux_vector;
__libc_sigwait;
__libsys_interposing_slot;
__set_error_selector;
__sigwait;
- _elf_aux_info;
gssd_syscall;
nlm_syscall;
rpctls_syscall;
diff --git a/lib/libsys/libc_stubs.c b/lib/libsys/libc_stubs.c
new file mode 100644
--- /dev/null
+++ b/lib/libsys/libc_stubs.c
@@ -0,0 +1,11 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2024 SRI International
+ */
+
+#define STUB_FUNC(f) \
+ void (f)(void); \
+ void (f)(void) { __builtin_trap(); }
+
+STUB_FUNC(elf_aux_info);
diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile
--- a/lib/libthr/Makefile
+++ b/lib/libthr/Makefile
@@ -7,6 +7,11 @@
PACKAGE= clibs
SHLIBDIR?= /lib
+LIBADD= c sys
+.if defined(COMPAT_libcompat)
+LDFLAGS+= -Wl,--rpath=/usr/lib${COMPAT_libcompat}
+.endif
+
.include <src.opts.mk>
MK_SSP= no
diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk
--- a/share/mk/bsd.libnames.mk
+++ b/share/mk/bsd.libnames.mk
@@ -174,7 +174,7 @@
LIBZPOOL?= ${LIBDESTDIR}${LIBDIR_BASE}/libzpool.a
LIBZUTIL?= ${LIBDESTDIR}${LIBDIR_BASE}/libzutil.a
-# enforce the 2 -lpthread and -lc to always be the last in that exact order
+# enforce -lpthread, -lc, and -lsys to always be the last in that exact order
.if defined(LDADD)
.if ${LDADD:M-lpthread}
LDADD:= ${LDADD:N-lpthread} -lpthread
@@ -182,6 +182,9 @@
.if ${LDADD:M-lc}
LDADD:= ${LDADD:N-lc} -lc
.endif
+.if ${LDADD:M-lsys}
+LDADD:= ${LDADD:N-lsys} -lsys
+.endif
.endif
# Only do this for src builds.
diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk
--- a/share/mk/src.libnames.mk
+++ b/share/mk/src.libnames.mk
@@ -394,7 +394,7 @@
_DP_ztest= geom m nvpair umem zpool pthread avl zfs_core spl zutil zfs uutil icp
# The libc dependencies are not strictly needed but are defined to make the
# assert happy.
-_DP_c= compiler_rt
+_DP_c= compiler_rt sys
# Use libssp_nonshared only on i386 and power*. Other archs emit direct calls
# to __stack_chk_fail, not __stack_chk_fail_local provided by libssp_nonshared.
.if ${MK_SSP} != "no" && \
@@ -410,6 +410,10 @@
(${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH:Mpower*} != "")
_DP_sys+= ssp_nonshared
.endif
+.if !defined(BOOTSTRAPPING)
+_DP_thr= c sys
+_DP_pthread= ${_DP_thr}
+.endif
_DP_tacplus= md pam
_DP_ncursesw= tinfow
_DP_formw= ncursesw

File Metadata

Mime Type
text/plain
Expires
Sat, Sep 19, 10:21 PM (14 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29797513
Default Alt Text
D43910.1789856512.diff (4 KB)

Event Timeline