From f2cc2b5433a394c05955e7da3dae8bd9cfffd9f6 Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Wed, 7 Aug 2024 13:27:45 -0700 Subject: [PATCH] - Incorporate comment suggestion from @magicus. Also applied some additional minor adjustments on top of the suggestion. --- make/common/native/Link.gmk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/make/common/native/Link.gmk b/make/common/native/Link.gmk index eb67c49dc751b..ca03c6ee6b12f 100644 --- a/make/common/native/Link.gmk +++ b/make/common/native/Link.gmk @@ -109,9 +109,9 @@ define CreateStaticLibrary $(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \ $$($1_LD) $(LDFLAGS_CXX_PARTIAL_LINKING) $$($1_SYSROOT_LDFLAGS) \ -o $$($1_TARGET_RELOCATABLE) $$($1_LD_OBJ_ARG)) - # Linking with '-Wl,--icf=safe' using objects created by 'ld -r' may not work - # and could cause errors like the following: - # ld: --icf=safe conservatively ignores SHT_LLVM_ADDRSIG [...] with sh_link=0 (likely created using objcopy or ld -r) + # 'ld -r' might invalidate the .llvm_addrsig section, and this will cause subsequent + # calls to lld (with '-Wl,--icf=safe') to fail when linking with this library, so + # remove that section. $$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_objcopy_remove_llvm_addrsig_section, \ $$($1_OBJCOPY) --remove-section=.llvm_addrsig $$($1_TARGET_RELOCATABLE)) endif