[llvm] r207757 - Don't force symbols to be globals in .thumb_set.
Rafael Espindola
rafael.espindola at gmail.com
Thu May 1 05:45:43 PDT 2014
Author: rafael
Date: Thu May 1 07:45:43 2014
New Revision: 207757
URL: http://llvm.org/viewvc/llvm-project?rev=207757&view=rev
Log:
Don't force symbols to be globals in .thumb_set.
We currently force symbols to be globals in .thumb_set. The intent
seems to be that given
.thumb_set foo, bar
we emit an undefined symbol to bar if it is never defined. The side
effect is that we mark bar as global, even if it is defined, which gas
does not.
Producing an undefined reference to bar is a general difference from MC and gas.
For example, given
a = b
gas will produce an undefined reference to b, MC will not. I would be surprised
if any code depends on this, but it it does, we should fix the general
difference, not special case .thumb_set.
Modified:
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
llvm/trunk/test/MC/ARM/thumb_set.s
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp?rev=207757&r1=207756&r2=207757&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp Thu May 1 07:45:43 2014
@@ -1003,11 +1003,8 @@ ARMTargetELFStreamer::AnnotateTLSDescrip
void ARMTargetELFStreamer::emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) {
if (const MCSymbolRefExpr *SRE = dyn_cast<MCSymbolRefExpr>(Value)) {
- // FIXME: Doing a lookup in here is a hack.
- MCSymbol *Sym =
- getStreamer().getContext().LookupSymbol(SRE->getSymbol().getName());
- if (!Sym->isDefined()) {
- getStreamer().EmitSymbolAttribute(Sym, MCSA_Global);
+ const MCSymbol &Sym = SRE->getSymbol();
+ if (!Sym.isDefined()) {
getStreamer().EmitAssignment(Symbol, Value);
return;
}
Modified: llvm/trunk/test/MC/ARM/thumb_set.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb_set.s?rev=207757&r1=207756&r2=207757&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/thumb_set.s (original)
+++ llvm/trunk/test/MC/ARM/thumb_set.s Thu May 1 07:45:43 2014
@@ -59,8 +59,6 @@ beta:
.thumb_set beta, alpha
- .thumb_set alias_undefined, undefined
-
@ CHECK: Symbol {
@ CHECK: Name: alias_arm_func
@ CHECK: Value: 0x1
@@ -109,6 +107,16 @@ beta:
@ CHECK: Type: Function
@ CHECK: }
+@ CHECK: Symbol {
+@ CHECK: Name: badblood
+@ CHECK-NEXT: Value: 0x0
+@ CHECK-NEXT: Size: 0
+@ CHECK-NEXT: Binding: Local
+@ CHECK-NEXT: Type: Object
+@ CHECK-NEXT: Other: 0
+@ CHECK-NEXT: Section: .data
+@ CHECK-NEXT: }
+
@ CHECK: Symbol {
@ CHECK: Name: bedazzle
@ CHECK: Value: 0x4
@@ -144,16 +152,3 @@ beta:
@ CHECK: Value: 0x5
@ CHECK: Type: Function
@ CHECK: }
-
-@ CHECK: Symbol {
-@ CHECK: Name: badblood
-@ CHECK: Value: 0x0
-@ CHECK: Type: Object
-@ CHECK: }
-
-@ CHECK: Symbol {
-@ CHECK: Name: undefined
-@ CHECK: Value: 0x0
-@ CHECK: Type: None
-@ CHECK: }
-
More information about the llvm-commits
mailing list