[lld] r369271 - [ELF] Simplify processRelocAux and allow a corner-case error
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 08:52:29 PDT 2019
Author: maskray
Date: Mon Aug 19 08:52:29 2019
New Revision: 369271
URL: http://llvm.org/viewvc/llvm-project?rev=369271&view=rev
Log:
[ELF] Simplify processRelocAux and allow a corner-case error
After D66007/r369262, if the control flow reaches `if (sym.isUndefined())`, we know:
* The relocation is not a link-time constant => symbol is preemptable => Undefined or SharedSymbol
* Not an undef weak.
* -no-pie.
* The symbol type is neither STT_OBJECT nor STT_FUNC.
ld.lld --export-dynamic --unresolved-symbols=ignore-all %t.o can satisfy
these conditions. Delete the isUndefined() test so that we error
`symbol '...' has no type`, because we don't know the type to make the
decision to create copy relocation/canonical PLT.
Modified:
lld/trunk/ELF/Relocations.cpp
lld/trunk/test/ELF/x86-64-dyn-rel-error.s
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=369271&r1=369270&r2=369271&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Mon Aug 19 08:52:29 2019
@@ -1077,10 +1077,6 @@ static void processRelocAux(InputSection
return;
}
- // If the symbol is undefined we already reported any relevant errors.
- if (sym.isUndefined())
- return;
-
errorOrWarn("symbol '" + toString(sym) + "' has no type" +
getLocation(sec, sym, offset));
}
Modified: lld/trunk/test/ELF/x86-64-dyn-rel-error.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-dyn-rel-error.s?rev=369271&r1=369270&r2=369271&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-dyn-rel-error.s (original)
+++ lld/trunk/test/ELF/x86-64-dyn-rel-error.s Mon Aug 19 08:52:29 2019
@@ -11,6 +11,7 @@ _start:
// CHECK: relocation R_X86_64_32 cannot be used against symbol zed; recompile with -fPIC
-// RUN: ld.lld --noinhibit-exec %t.o %t2.so -o %t 2>&1 | FileCheck --check-prefix=WARN %s
+// RUN: ld.lld --noinhibit-exec %t.o %t2.so -o /dev/null 2>&1 | FileCheck --check-prefix=WARN %s
+// RUN: not ld.lld --export-dynamic --unresolved-symbols=ignore-all %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=WARN %s
// WARN: symbol 'zed' has no type
More information about the llvm-commits
mailing list