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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 20:22:20 PST 2021


MaskRay created this revision.
MaskRay added reviewers: jhenderson, pcc, peter.smith.
Herald added subscribers: arichardson, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The current diagnostic has confused users. The new wording is adapted from one suggested by Ian Lance Taylor.


Repository:
  rG LLVM Github Monorepo

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 .llvm_addrsig 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,9 @@
         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 "
+                                ".llvm_addrsig 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.320980.patch
Type: text/x-patch
Size: 1265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210203/97c8bfee/attachment.bin>


More information about the llvm-commits mailing list