git: 39733922edc4 - main - rtld: actually resolve memcpy plt
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 07 Jul 2024 23:47:23 UTC
The branch main has been updated by rlibby:
URL: https://cgit.FreeBSD.org/src/commit/?id=39733922edc43001e8750307704daa835a14b5ac
commit 39733922edc43001e8750307704daa835a14b5ac
Author: Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-07-07 23:46:49 +0000
Commit: Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2024-07-07 23:46:49 +0000
rtld: actually resolve memcpy plt
The call to memcpy() meant to cause plt resolution in _thr_rtld_init()
was getting optimized by the compiler. Tell the compiler not to use its
builtins in thr_rtld.c. We could avoid just the memcpy builtin but
disabling all will be more robust against future changes.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D45891
---
lib/libthr/Makefile | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile
index 85c028f521a1..d3c69a7dc8b7 100644
--- a/lib/libthr/Makefile
+++ b/lib/libthr/Makefile
@@ -32,6 +32,10 @@ CFLAGS+=-I${SRCTOP}/lib/libthread_db
CFLAGS.thr_stack.c+= -Wno-cast-align
CFLAGS.rtld_malloc.c+= -Wno-cast-align
+# Disable compiler builtins so that the compiler does not optimize away rtld's
+# attempts to force early PLT resolution for certain functions that may be
+# replaced by builtins.
+CFLAGS.thr_rtld.c+= -fno-builtin
CFLAGS.thr_symbols.c+= -Wno-missing-variable-declarations
.if ${MK_ASAN} != "no"
# False-positive ASAN error claiming the local "struct sigaction act;" is