]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Remove .llvm_addrsig sections from crt.o files
authorStan Shebs <stanshebs@google.com>
Wed, 27 Feb 2019 22:03:33 +0000 (14:03 -0800)
committerFangrui Song <i@maskray.me>
Sat, 28 Aug 2021 00:26:00 +0000 (17:26 -0700)
csu/Makefile

index f3498960f89e3b31f7cda6969e6eb3393a305241..7460bcb0cf1e6cb296cf76d6e8ed9e43044f89f9 100644 (file)
@@ -106,7 +106,13 @@ include ../Rules
 subdir_lib: $(extra-objs:%=$(objpfx)%)
 
 define link-relocatable
-$(CC) -nostdlib -nostartfiles -r -o $@ $^
+$(CC) -nostdlib -nostartfiles -r -o $@.precopy $^
+# Remove a section generated by clang for safe ICF; when lld links and
+# retains relocs, the section is garbled and causes errors in later
+# links done with --icf=safe.  The removal can be unconditional as it
+# is a no-op for non-clang/lld.
+$(OBJCOPY) --remove-section=.llvm_addrsig $@.precopy $@
+rm $@.precopy
 endef
 
 ifndef start-installed-name-rule