[PATCH] D95917: [ELF] Improve --icf=safe diagnostic

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 10:21:55 PST 2021


MaskRay updated this revision to Diff 321147.
MaskRay added a comment.

comment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95917/new/

https://reviews.llvm.org/D95917

Files:
  lld/ELF/InputFiles.cpp
  lld/test/ELF/icf-safe.s


Index: lld/test/ELF/icf-safe.s
===================================================================
--- lld/test/ELF/icf-safe.s
+++ lld/test/ELF/icf-safe.s
@@ -89,7 +89,7 @@
 # ALL-EXPORT:   removing identical section {{.*}}:(.text.non_addrsig2)
 # ALL-EXPORT-NOT: selected section
 
-# OBJCOPY: --icf=safe is incompatible with object files created using objcopy or ld -r
+# OBJCOPY: --icf=safe conservatively ignores SHT_LLVM_ADDRSIG [index [[#]]] with sh_link=0 (likely created using objcopy or ld -r)
 
 .section .text.f1,"ax", at progbits
 .globl f1
Index: lld/ELF/InputFiles.cpp
===================================================================
--- lld/ELF/InputFiles.cpp
+++ lld/ELF/InputFiles.cpp
@@ -592,8 +592,12 @@
         if (sec.sh_link != 0)
           this->addrsigSec = &sec;
         else if (config->icf == ICFLevel::Safe)
-          warn(toString(this) + ": --icf=safe is incompatible with object "
-                                "files created using objcopy or ld -r");
+          warn(toString(this) +
+               ": --icf=safe conservatively ignores "
+               "SHT_LLVM_ADDRSIG [index " +
+               Twine(i) +
+               "] with sh_link=0 "
+               "(likely created using objcopy or ld -r)");
       }
       this->sections[i] = &InputSection::discarded;
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95917.321147.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210203/78043e23/attachment.bin>


More information about the llvm-commits mailing list