[PATCH] D88945: [ELF] Don't change binding to STB_WEAK for an undefined specified by -u
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 7 08:45:41 PDT 2020
MaskRay updated this revision to Diff 296697.
MaskRay marked an inline comment as done.
MaskRay added a comment.
Improve tests
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88945/new/
https://reviews.llvm.org/D88945
Files:
lld/ELF/Driver.cpp
lld/test/ELF/weak-undef-lib.s
Index: lld/test/ELF/weak-undef-lib.s
===================================================================
--- lld/test/ELF/weak-undef-lib.s
+++ lld/test/ELF/weak-undef-lib.s
@@ -17,6 +17,17 @@
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Undefined
+## -u specifies a STB_DEFAULT undefined symbol, so the definition from %t2.o is
+## fetched.
+# RUN: ld.lld -u foo %t1.o --start-lib %t2.o -o %t1
+# RUN: llvm-readobj --syms %t1 | FileCheck %s --check-prefix=CHECK-U
+
+# CHECK-U: Name: foo
+# CHECK-U: Binding:
+# CHECK-U-SAME: Global
+# CHECK-U: Section:
+# CHECK-U-SAME: .text
+
.weak foo
call foo at PLT
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -1992,7 +1992,7 @@
// Handle -u/--undefined before input files. If both a.a and b.so define foo,
// -u foo a.a b.so will fetch a.a.
for (StringRef name : config->undefined)
- addUnusedUndefined(name);
+ addUnusedUndefined(name)->referenced = true;
// Add all files to the symbol table. This will add almost all
// symbols that we need to the symbol table. This process might
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88945.296697.patch
Type: text/x-patch
Size: 1185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201007/5016cf1f/attachment.bin>
More information about the llvm-commits
mailing list