[PATCH] D53044: [ELF] Don't warn on undefined symbols when reading call graph profile

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 15:07:08 PDT 2018


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

.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D53044

Files:
  ELF/Driver.cpp
  test/ELF/cgprofile-shared-warn.s


Index: test/ELF/cgprofile-shared-warn.s
===================================================================
--- /dev/null
+++ test/ELF/cgprofile-shared-warn.s
@@ -0,0 +1,11 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: ld.lld --shared %t.o -o /dev/null 2>&1 | count 0
+# RUN: ld.lld -e A --unresolved-symbols=ignore-all %t.o -o /dev/null 2>&1 | count 0
+    .section    .text.A,"ax", at progbits
+    .globl  A
+A:
+    callq B
+
+    .cg_profile A, B, 10
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -681,7 +681,9 @@
 
 template <class ELFT> static void readCallGraphsFromObjectFiles() {
   auto FindSection = [&](const Symbol *Sym) -> const InputSectionBase * {
-    warnUnorderableSymbol(Sym);
+    if (!Sym->isUndefined() ||
+        Config->UnresolvedSymbols != UnresolvedPolicy::Ignore)
+      warnUnorderableSymbol(Sym);
     if (const auto *SymD = dyn_cast<Defined>(Sym))
       return dyn_cast_or_null<InputSectionBase>(SymD->Section);
     return nullptr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53044.168881.patch
Type: text/x-patch
Size: 1103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181009/40fb33c0/attachment.bin>


More information about the llvm-commits mailing list