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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 09:37:48 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5f4d7b2f0ab2: [ELF] Improve --icf=safe diagnostic (authored by MaskRay).

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.321805.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210205/83ef094b/attachment-0001.bin>


More information about the llvm-commits mailing list