[PATCH] D129790: [ELF] Reword --no-allow-shlib-undefined diagnostic
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 14 11:07:10 PDT 2022
MaskRay created this revision.
MaskRay added reviewers: ikudrin, peter.smith.
Herald added subscribers: StephenFan, arichardson, emaste.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Use a format more similar to unresolved references from regular object
files.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D129790
Files:
lld/ELF/Writer.cpp
lld/test/ELF/allow-shlib-undefined.s
lld/test/ELF/unresolved-symbols.s
lld/test/ELF/wrap-shlib-undefined.s
Index: lld/test/ELF/wrap-shlib-undefined.s
===================================================================
--- lld/test/ELF/wrap-shlib-undefined.s
+++ lld/test/ELF/wrap-shlib-undefined.s
@@ -17,7 +17,7 @@
## --no-allow-shlib-undefined errors because __real_foo is not defined.
# RUN: not ld.lld %t/main.o %t/bar.so -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
-# ERR: {{.*}}.so: undefined reference to __real_foo [--no-allow-shlib-undefined]
+# ERR: error: undefined reference due to --no-allow-shlib-undefined: __real_foo
## --wrap=foo defines __real_foo.
# RUN: ld.lld %t/main.o %t/bar.so --wrap=foo -o %t2
Index: lld/test/ELF/unresolved-symbols.s
===================================================================
--- lld/test/ELF/unresolved-symbols.s
+++ lld/test/ELF/unresolved-symbols.s
@@ -36,7 +36,7 @@
## --unresolved-symbols overrides a previous --allow-shlib-undefined.
# RUN: not ld.lld %t1.o %t.so -o /dev/null --allow-shlib-undefined --unresolved-symbols=ignore-in-object-files 2>&1 | FileCheck %s --check-prefix=SHLIB
-# SHLIB: error: {{.*}}.so: undefined reference to undef [--no-allow-shlib-undefined]
+# SHLIB: error: undefined reference due to --no-allow-shlib-undefined: undef
## Ignoring undefines in shared should produce error for symbol from object.
# RUN: not ld.lld %t2.o -o /dev/null --unresolved-symbols=ignore-in-shared-libs 2>&1 | \
Index: lld/test/ELF/allow-shlib-undefined.s
===================================================================
--- lld/test/ELF/allow-shlib-undefined.s
+++ lld/test/ELF/allow-shlib-undefined.s
@@ -41,6 +41,9 @@
_start:
callq _shared at PLT
-# CHECK: error: {{.*}}.so: undefined reference to _unresolved [--no-allow-shlib-undefined]
-# CHECK2: error: {{.*}}2.so: undefined reference to _unresolved [--no-allow-shlib-undefined]
-# WARN: warning: {{.*}}.so: undefined reference to _unresolved [--no-allow-shlib-undefined]
+# CHECK: error: undefined reference due to --no-allow-shlib-undefined: _unresolved
+# CHECK-NEXT: >>> referenced by {{.*}}.so
+# CHECK2: error: undefined reference due to --no-allow-shlib-undefined: _unresolved
+# CHECK2-NEXT: >>> referenced by {{.*}}2.so
+# WARN: warning: undefined reference due to --no-allow-shlib-undefined: _unresolved
+# WARN-NEXT: >>> referenced by {{.*}}.so
Index: lld/ELF/Writer.cpp
===================================================================
--- lld/ELF/Writer.cpp
+++ lld/ELF/Writer.cpp
@@ -1973,8 +1973,8 @@
continue;
for (Symbol *sym : file->requiredSymbols)
if (sym->isUndefined() && !sym->isWeak())
- diagnose(toString(file) + ": undefined reference to " +
- toString(*sym) + " [--no-allow-shlib-undefined]");
+ diagnose("undefined reference due to --no-allow-shlib-undefined: " +
+ toString(*sym) + "\n>>> referenced by " + toString(file));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129790.444736.patch
Type: text/x-patch
Size: 2911 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220714/ee8d5639/attachment.bin>
More information about the llvm-commits
mailing list