From c4c787ff1b1f33defe1da576fa3f83321e5c1555 Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Wed, 27 Feb 2019 14:03:33 -0800 Subject: Remove .llvm_addrsig sections from crt.o files --- csu/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- cgit v1.1