[PATCH] D81028: [ELF] Append " [--no-allow-shlib-undefined]" to the corresponding diagnostics

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 08:12:23 PDT 2020


MaskRay updated this revision to Diff 268203.
MaskRay added a comment.

Add a missing prefix in an error


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81028/new/

https://reviews.llvm.org/D81028

Files:
  lld/ELF/Writer.cpp
  lld/test/ELF/allow-shlib-undefined.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
@@ -6,7 +6,7 @@
 
 ## --no-allow-shlib-undefined errors because __real_foo is not defined.
 # RUN: not ld.lld %t.o %t.so -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
-# ERR: undefined reference to __real_foo
+# ERR: {{.*}}.so: undefined reference to __real_foo [--no-allow-shlib-undefined]
 
 ## --wrap=foo defines __real_foo.
 # RUN: ld.lld %t.o %t.so --wrap=foo -o %t
Index: lld/test/ELF/allow-shlib-undefined.s
===================================================================
--- lld/test/ELF/allow-shlib-undefined.s
+++ lld/test/ELF/allow-shlib-undefined.s
@@ -9,6 +9,7 @@
 # RUN: not ld.lld --no-allow-shlib-undefined %t.o %t.so -o /dev/null 2>&1 | FileCheck %s
 # Executable defaults to --no-allow-shlib-undefined
 # RUN: not ld.lld %t.o %t.so -o /dev/null 2>&1 | FileCheck %s
+# RUN: ld.lld %t.o %t.so --noinhibit-exec -o /dev/null 2>&1 | FileCheck %s
 # -shared defaults to --allow-shlib-undefined
 # RUN: ld.lld -shared %t.o %t.so -o /dev/null
 
@@ -27,4 +28,4 @@
 _start:
   callq _shared at PLT
 
-# CHECK: undefined reference to _unresolved
+# CHECK: {{.*}}.so: undefined reference to _unresolved [--no-allow-shlib-undefined]
Index: lld/ELF/Writer.cpp
===================================================================
--- lld/ELF/Writer.cpp
+++ lld/ELF/Writer.cpp
@@ -1980,7 +1980,8 @@
       if (sym->isUndefined() && !sym->isWeak())
         if (auto *f = dyn_cast_or_null<SharedFile>(sym->file))
           if (f->allNeededIsKnown)
-            error(toString(f) + ": undefined reference to " + toString(*sym));
+            errorOrWarn(toString(f) + ": undefined reference to " +
+                        toString(*sym) + " [--no-allow-shlib-undefined]");
   }
 
   // Now that we have defined all possible global symbols including linker-


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81028.268203.patch
Type: text/x-patch
Size: 1956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200603/d63e6c0e/attachment.bin>


More information about the llvm-commits mailing list