[PATCH] D77630: [ELF] --warn-backrefs: don't warn if -u/--export-dynamic-symbol
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 8 09:46:14 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa27a7b98cd19: [ELF] --warn-backrefs: don't warn if -u/--export-dynamic-symbol (authored by MaskRay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77630/new/
https://reviews.llvm.org/D77630
Files:
lld/ELF/Driver.cpp
lld/test/ELF/warn-backrefs.s
Index: lld/test/ELF/warn-backrefs.s
===================================================================
--- lld/test/ELF/warn-backrefs.s
+++ lld/test/ELF/warn-backrefs.s
@@ -62,6 +62,12 @@
## --warn-backrefs does not warn.
# RUN: ld.lld --fatal-warnings --warn-backrefs %t2.a %t1.o %t2.so %t2.a -o /dev/null
+## In GNU linkers, -u does not make a backward reference.
+# RUN: ld.lld --fatal-warnings --warn-backrefs -u foo %t2.a %t1.o -o /dev/null
+
+## In GNU gold, --export-dynamic-symbol does not make a backward reference.
+# RUN: ld.lld --fatal-warnings --warn-backrefs --export-dynamic-symbol foo %t2.a %t1.o -o /dev/null
+
.globl _start, foo
_start:
call foo
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -1448,6 +1448,10 @@
// eliminate it. Mark the symbol as "used" to prevent it.
sym->isUsedInRegularObj = true;
+ // GNU linkers allow -u foo -ldef -lref. We should not treat it as a backward
+ // reference.
+ backwardReferences.erase(sym);
+
if (sym->isLazy())
sym->fetch();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77630.256049.patch
Type: text/x-patch
Size: 1113 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200408/6a982076/attachment.bin>
More information about the llvm-commits
mailing list