aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Shebs <stanshebs@google.com>2019-02-27 14:03:33 -0800
committerFangrui Song <i@maskray.me>2021-08-27 17:26:00 -0700
commitc4c787ff1b1f33defe1da576fa3f83321e5c1555 (patch)
treee0d409c949fa9c08ca8892cb6af6fd323bc486f3
parentb1ecb7cf858fa28a8fc24f606d4eec89b03d545b (diff)
downloadglibc-c4c787ff1b1f33defe1da576fa3f83321e5c1555.zip
glibc-c4c787ff1b1f33defe1da576fa3f83321e5c1555.tar.gz
glibc-c4c787ff1b1f33defe1da576fa3f83321e5c1555.tar.bz2
Remove .llvm_addrsig sections from crt.o files
-rw-r--r--csu/Makefile8
1 files changed, 7 insertions, 1 deletions
diff --git a/csu/Makefile b/csu/Makefile
index f349896..7460bcb 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -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