[llvm] r373242 - Revert "[MC] Emit unused undefined symbol even if its binding is not set"
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 30 11:13:48 PDT 2019
Author: nico
Date: Mon Sep 30 11:13:48 2019
New Revision: 373242
URL: http://llvm.org/viewvc/llvm-project?rev=373242&view=rev
Log:
Revert "[MC] Emit unused undefined symbol even if its binding is not set"
This reverts r373168. It caused PR43511.
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/test/MC/ELF/undef.s
llvm/trunk/test/MC/ELF/weakref.s
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=373242&r1=373241&r2=373242&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon Sep 30 11:13:48 2019
@@ -615,6 +615,9 @@ bool ELFWriter::isInSymtab(const MCAsmLa
return false;
}
+ if (Symbol.isUndefined() && !Symbol.isBindingSet())
+ return false;
+
if (Symbol.isTemporary())
return false;
Modified: llvm/trunk/test/MC/ELF/undef.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/undef.s?rev=373242&r1=373241&r2=373242&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/undef.s (original)
+++ llvm/trunk/test/MC/ELF/undef.s Mon Sep 30 11:13:48 2019
@@ -18,8 +18,6 @@
.text
movsd .Lsym8(%rip), %xmm1
-.hidden hidden
-
test2_a = undef
test2_b = undef + 1
@@ -43,17 +41,6 @@ test2_b = undef + 1
// CHECK-NEXT: Section: .rodata.str1.1
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
-// CHECK-NEXT: Name: hidden
-// CHECK-NEXT: Value: 0x0
-// CHECK-NEXT: Size: 0
-// CHECK-NEXT: Binding: Global
-// CHECK-NEXT: Type: None
-// CHECK-NEXT: Other [
-// CHECK-NEXT: STV_HIDDEN
-// CHECK-NEXT: ]
-// CHECK-NEXT: Section: Undefined
-// CHECK-NEXT: }
-// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: sym6
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
@@ -62,13 +49,4 @@ test2_b = undef + 1
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
-// CHECK-NEXT: Symbol {
-// CHECK-NEXT: Name: undef
-// CHECK-NEXT: Value: 0x0
-// CHECK-NEXT: Size: 0
-// CHECK-NEXT: Binding: Global
-// CHECK-NEXT: Type: None
-// CHECK-NEXT: Other: 0
-// CHECK-NEXT: Section: Undefined
-// CHECK-NEXT: }
// CHECK-NEXT: ]
Modified: llvm/trunk/test/MC/ELF/weakref.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/weakref.s?rev=373242&r1=373241&r2=373242&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/weakref.s (original)
+++ llvm/trunk/test/MC/ELF/weakref.s Mon Sep 30 11:13:48 2019
@@ -125,15 +125,6 @@ bar15:
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
-// CHECK-NEXT: Name: bar1
-// CHECK-NEXT: Value: 0x0
-// CHECK-NEXT: Size: 0
-// CHECK-NEXT: Binding: Global
-// CHECK-NEXT: Type: None
-// CHECK-NEXT: Other: 0
-// CHECK-NEXT: Section: Undefined
-// CHECK-NEXT: }
-// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar10
// CHECK-NEXT: Value: 0x28
// CHECK-NEXT: Size: 0
More information about the llvm-commits
mailing list