[llvm-commits] [llvm] r126330 - in /llvm/trunk: lib/MC/ELFObjectWriter.cpp test/MC/ELF/pr9292.s
Rafael Espindola
rafael.espindola at gmail.com
Wed Feb 23 12:22:07 PST 2011
Author: rafael
Date: Wed Feb 23 14:22:07 2011
New Revision: 126330
URL: http://llvm.org/viewvc/llvm-project?rev=126330&view=rev
Log:
Put in the symbol table symbols only used in a .globl statement.
Fixes PR9292.
Added:
llvm/trunk/test/MC/ELF/pr9292.s
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=126330&r1=126329&r2=126330&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Wed Feb 23 14:22:07 2011
@@ -833,7 +833,11 @@
return true;
const MCSymbol &A = Symbol.AliasedSymbol();
- if (!A.isVariable() && A.isUndefined() && !Data.isCommon())
+ if (Symbol.isVariable() && !A.isVariable() && A.isUndefined())
+ return false;
+
+ bool IsGlobal = GetBinding(Data) == ELF::STB_GLOBAL;
+ if (!Symbol.isVariable() && Symbol.isUndefined() && !IsGlobal)
return false;
if (!Asm.isSymbolLinkerVisible(Symbol) && !Symbol.isUndefined())
Added: llvm/trunk/test/MC/ELF/pr9292.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/pr9292.s?rev=126330&view=auto
==============================================================================
--- llvm/trunk/test/MC/ELF/pr9292.s (added)
+++ llvm/trunk/test/MC/ELF/pr9292.s Wed Feb 23 14:22:07 2011
@@ -0,0 +1,26 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that both foo and bar are undefined.
+
+.globl foo
+.globl bar
+mov %eax,bar
+
+
+// CHECK: (('st_name', 0x00000005) # 'bar'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000005
+// CHECK-NEXT: (('st_name', 0x00000001) # 'foo'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
More information about the llvm-commits
mailing list