Remove .llvm_addrsig sections from crt.o files

This commit is contained in:
Stan Shebs 2019-02-27 14:03:33 -08:00 committed by Fangrui Song
parent b1ecb7cf85
commit c4c787ff1b

View 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