Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144367217
D43910.id134402.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D43910.id134402.diff
View Options
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -62,6 +62,7 @@
#
LDFLAGS+= -nodefaultlibs
LIBADD+= compiler_rt
+LIBADD+= sys
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/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" && \
diff --git a/usr.bin/ldd32/Makefile b/usr.bin/ldd32/Makefile
--- a/usr.bin/ldd32/Makefile
+++ b/usr.bin/ldd32/Makefile
@@ -6,5 +6,10 @@
MAN=
MLINKS= ldd.1 ldd32.1
+# XXX: gnu ld looks for implicitly required libraries in the wrong place
+# in -m32 mode, but the right places for explicitly required ones to
+# explicitly link with libsys here.
+LDFLAGS+=-lsys
+
.PATH: ${SRCTOP}/usr.bin/ldd
.include "${SRCTOP}/usr.bin/ldd/Makefile"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 9, 2:09 AM (11 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28524289
Default Alt Text
D43910.id134402.diff (3 KB)
Attached To
Mode
D43910: lib{c,sys}: move auxargs more firmly into libsys
Attached
Detach File
Event Timeline
Log In to Comment