git: 78661696e639 - main - loader: i386: use -z nostart-stop-gc for bfd as well
Date: Thu, 08 May 2025 19:47:22 UTC
The branch main has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=78661696e639836c9c41313020308f132057189a
commit 78661696e639836c9c41313020308f132057189a
Author: Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2025-05-08 19:47:16 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2025-05-08 19:47:16 +0000
loader: i386: use -z nostart-stop-gc for bfd as well
binutils 2.37 seems to have added the knob, so let's just use that
version here (it's not clear if GC'ing start/stop symbols was actually
made the default at the time, and it didn't seem worth it to dig much
further). This fixes misbehavior when built with more recent binutils,
as we do rely on linker sets for loader commands that we use.
Reported by: sjg
Reviewed by: dim, sjg
Differential Revision: https://reviews.freebsd.org/D50252
---
stand/i386/loader/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile
index bb9111c3dcce..e1f0298403b3 100644
--- a/stand/i386/loader/Makefile
+++ b/stand/i386/loader/Makefile
@@ -90,7 +90,8 @@ ORG= 0x0
CFLAGS+= -Wall
LDFLAGS+= -static ${LDFLAGS_ORG} -Wl,--gc-sections
-.if ${LINKER_TYPE} == "lld" && ${LINKER_VERSION} >= 130000
+.if (${LINKER_TYPE} == "lld" && ${LINKER_VERSION} >= 130000) || \
+ (${LINKER_TYPE} == "bfd" && ${LINKER_VERSION} >= 23700)
# lld 13 and higher default to garbage collecting start/stop symbols,
# completely ruining our linker sets. For now, work around it by
# disabling this un-feature.