[lld] 6467649 - [ELF] Make --trace-symbol track preempted shared definitions
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue May 19 08:56:43 PDT 2020
Author: Fangrui Song
Date: 2020-05-19T08:56:35-07:00
New Revision: 64676499741cb985146ab982a67da859ff8f4f4d
URL: https://github.com/llvm/llvm-project/commit/64676499741cb985146ab982a67da859ff8f4f4d
DIFF: https://github.com/llvm/llvm-project/commit/64676499741cb985146ab982a67da859ff8f4f4d.diff
LOG: [ELF] Make --trace-symbol track preempted shared definitions
Note, we still name a preempted SharedSymbol "shared definition",
instead of "reference" as printed by GNU ld. This difference should not matter.
```
// GNU ld
ld.bfd: t: definition of f at v1
ld.bfd: t.so: reference to f at v1
```
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D80143
Added:
Modified:
lld/ELF/Symbols.cpp
lld/test/ELF/trace-symbols.s
Removed:
################################################################################
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index f1b44069405e..ff1e600fa2d5 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -726,5 +726,6 @@ void Symbol::resolveShared(const SharedSymbol &other) {
uint8_t bind = binding;
replace(other);
binding = bind;
- }
+ } else if (traced)
+ printTraceSymbol(&other);
}
diff --git a/lld/test/ELF/trace-symbols.s b/lld/test/ELF/trace-symbols.s
index b6f8bea79d12..f5211b367eb4 100644
--- a/lld/test/ELF/trace-symbols.s
+++ b/lld/test/ELF/trace-symbols.s
@@ -13,6 +13,11 @@
# RUN: rm -f %t2.a
# RUN: llvm-ar rcs %t2.a %t2
+# RUN: ld.lld -y foo -shared %t1 %t1.so -o /dev/null | \
+# RUN: FileCheck --check-prefix=PREEMPT %s --implicit-check-not=foo
+# PREEMPT: trace-symbols.s.tmp1: definition of foo
+# PREEMPT-NEXT: trace-symbols.s.tmp1.so: shared definition of foo
+
# RUN: ld.lld -y foo -trace-symbol common -trace-symbol=hsymbol \
# RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTRFOO %s
# OBJECTRFOO: trace-symbols.s.tmp: reference to foo
More information about the llvm-commits
mailing list