[PATCH] D80143: [ELF] Make --trace-symbol track preempted shared definitions
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 18 10:48:08 PDT 2020
MaskRay created this revision.
MaskRay added reviewers: grimar, psmith, ruiu.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
MaskRay added a parent revision: D80059: [ELF] Parse SHT_GNU_verneed and respect versioned undefined symbols in shared objects.
MaskRay updated this revision to Diff 264678.
MaskRay added a comment.
Delete an empty line
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80143
Files:
lld/ELF/Symbols.cpp
lld/test/ELF/trace-symbols.s
lld/test/ELF/verneed-shared.s
Index: lld/test/ELF/verneed-shared.s
===================================================================
--- lld/test/ELF/verneed-shared.s
+++ lld/test/ELF/verneed-shared.s
@@ -7,6 +7,7 @@
# RUN: FileCheck --check-prefix=TRACE %s --implicit-check-not=f at v1
## TRACE: {{.*}}.o: definition of f at v1
+## TRACE-NEXT: {{.*}}.so: shared definition of f at v1
# RUN: echo '.symver f,f at v1; .symver g,g at v2; call f; call g' | \
# RUN: llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o
Index: lld/test/ELF/trace-symbols.s
===================================================================
--- lld/test/ELF/trace-symbols.s
+++ 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
@@ -48,7 +53,7 @@
# FOO_AND_COMMON: trace-symbols.s.tmp1.a: lazy definition of common
# RUN: ld.lld -y foo -y common %t %t1.so %t2 -o %t3 | \
-# RUN: FileCheck -check-prefix=SHLIBDCOMMON %s
+# RUN: FileCheck -check-prefix=SHLIBDCOMMON %s --implicit-check-not=bar
# SHLIBDCOMMON: trace-symbols.s.tmp1.so: shared definition of common
# RUN: ld.lld -y foo -y common %t %t2.so %t1.so -o %t3 | \
Index: lld/ELF/Symbols.cpp
===================================================================
--- lld/ELF/Symbols.cpp
+++ lld/ELF/Symbols.cpp
@@ -714,7 +714,8 @@
}
void Symbol::resolveShared(const SharedSymbol &other) {
-
+ if (traced)
+ printTraceSymbol(&other);
if (isCommon()) {
// See the comment in resolveCommon() above.
if (other.size > cast<CommonSymbol>(this)->size)
@@ -725,7 +726,10 @@
// An undefined symbol with non default visibility must be satisfied
// in the same DSO.
uint8_t bind = binding;
+ uint8_t trace = traced;
+ traced = false;
replace(other);
binding = bind;
+ traced = trace;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80143.264678.patch
Type: text/x-patch
Size: 2240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200518/d4f3e302/attachment.bin>
More information about the llvm-commits
mailing list