llvm.org GIT mirror llvm / 1b68a68
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207757 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
2 changed file(s) with 12 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
10021002
10031003 void ARMTargetELFStreamer::emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) {
10041004 if (const MCSymbolRefExpr *SRE = dyn_cast(Value)) {
1005 // FIXME: Doing a lookup in here is a hack.
1006 MCSymbol *Sym =
1007 getStreamer().getContext().LookupSymbol(SRE->getSymbol().getName());
1008 if (!Sym->isDefined()) {
1009 getStreamer().EmitSymbolAttribute(Sym, MCSA_Global);
1005 const MCSymbol &Sym = SRE->getSymbol();
1006 if (!Sym.isDefined()) {
10101007 getStreamer().EmitAssignment(Symbol, Value);
10111008 return;
10121009 }
5858
5959 .thumb_set beta, alpha
6060
61 .thumb_set alias_undefined, undefined
62
6361 @ CHECK: Symbol {
6462 @ CHECK: Name: alias_arm_func
6563 @ CHECK: Value: 0x1
108106 @ CHECK: Type: Function
109107 @ CHECK: }
110108
109 @ CHECK: Symbol {
110 @ CHECK: Name: badblood
111 @ CHECK-NEXT: Value: 0x0
112 @ CHECK-NEXT: Size: 0
113 @ CHECK-NEXT: Binding: Local
114 @ CHECK-NEXT: Type: Object
115 @ CHECK-NEXT: Other: 0
116 @ CHECK-NEXT: Section: .data
117 @ CHECK-NEXT: }
118
111119 @ CHECK: Symbol {
112120 @ CHECK: Name: bedazzle
113121 @ CHECK: Value: 0x4
143151 @ CHECK: Value: 0x5
144152 @ CHECK: Type: Function
145153 @ CHECK: }
146
147 @ CHECK: Symbol {
148 @ CHECK: Name: badblood
149 @ CHECK: Value: 0x0
150 @ CHECK: Type: Object
151 @ CHECK: }
152
153 @ CHECK: Symbol {
154 @ CHECK: Name: undefined
155 @ CHECK: Value: 0x0
156 @ CHECK: Type: None
157 @ CHECK: }
158