aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorRobert Clausecker <fuz@FreeBSD.org>2023-06-28 17:18:15 +0000
committerRobert Clausecker <fuz@FreeBSD.org>2023-07-16 15:41:55 +0000
commitc1e63e352e34b55ad577011fa4729f0638fb3fdf (patch)
treef7ef08c68a99604afa484d3437d6292bd130b396 /libexec
parent1005d3d05362de368b1ea7aeb8eb20cee993e122 (diff)
downloadsrc-c1e63e352e34b55ad577011fa4729f0638fb3fdf.tar.gz
src-c1e63e352e34b55ad577011fa4729f0638fb3fdf.zip
libexec/rtld-elf/rtld-libc/Makefile.inc: do not use machdep string functions
With ifunc based SIMD dispatch, we cannot use the amd64 assembly implementations of string functions. Modify rtld to instead use the generic functions. To avoid an architecture-specific special case, this change is applied to all architectures. This change is a prerequisite to and formerly part of D40693. Sponsored by: FreeBSD Foundation Approved by: kib See also: D40693 Differential Revision: https://reviews.freebsd.org/D41050
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/rtld-libc/Makefile.inc22
1 files changed, 16 insertions, 6 deletions
diff --git a/libexec/rtld-elf/rtld-libc/Makefile.inc b/libexec/rtld-elf/rtld-libc/Makefile.inc
index 99da16d06509..5033b2207e32 100644
--- a/libexec/rtld-elf/rtld-libc/Makefile.inc
+++ b/libexec/rtld-elf/rtld-libc/Makefile.inc
@@ -38,11 +38,21 @@ SRCS+= errlst.c getcwd.c getprogname.c raise.c sigsetops.c sysctlnametomib.c \
# errlst.c needs the errlst.h header from libc:
CFLAGS.errlst.c+=-I${LIBC_SRCTOP}/include
-# Use the string and memory .o files from libc instead of rebuilding them (they
-# might be using optimized assembly and duplicating that logic here is awkward).
-_libc_string_objects= bcmp bcopy bzero memset memchr memcmp memcpy memmove \
- stpncpy strcat strchr strchrnul strcmp stpcpy strcpy strcspn strdup \
- strlcat strlcpy strlen strncmp strncpy strrchr strsep strspn strstr strtok
+# use generic versions of string functions to avoid potential ifunc dispatch
+.PATH: ${LIBC_SRCTOP}/string
+SRCS+= bcopy.c bzero.c memchr.c memcmp.c memcpy.c memmove.c memset.c strcat.c \
+ strchr.c strchrnul.c strcmp.c strcpy.c strcspn.c strdup.c strlcat.c \
+ strlcpy.c strlen.c strncmp.c strncpy.c strrchr.c strsep.c strspn.c \
+ strstr.c strtok.c
+CFLAGS.memchr.c+=-Wno-cast-qual
+CFLAGS.strchr.c+=-Wno-cast-qual
+CFLAGS.strchrnul.c+=-Wno-cast-qual
+CFLAGS.strcspn.c+=-Wno-sign-compare
+CFLAGS.strrchr.c+=-Wno-cast-qual
+CFLAGS.strspn.c+=-Wno-sign-compare
+CFLAGS.strstr.c+=-Wno-cast-qual -Wno-sign-compare
+CFLAGS.strtok.c+=-Wno-cast-qual
+
# Also use all the syscall .o files from libc_nossp_pic:
_libc_other_objects= sigsetjmp lstat stat fstat fstatat fstatfs syscall \
cerror geteuid getegid sigfastblock munmap mprotect \
@@ -71,7 +81,7 @@ _libc_other_objects+=syncicache
# we don't accidentally pull in the interposing table or similar by linking
# directly against libc_nossp_pic.a
_rtld_libc_objs=
-.for _obj in ${_libc_other_objects} ${_libc_string_objects}
+.for _obj in ${_libc_other_objects}
_rtld_libc_objs+=${_obj}.nossppico
CLEANFILES+=${_obj}.nossppico
# LDFLAGS+= -Wl,--trace-symbol=${_obj}