Skip to content

Commit e8e7952

Browse files
committed
When outputing a non-lazy pointer for a stub, we may need to fill in the value
for the NLP because the object it's pointing to may be internal to the file. This seems counter-intuitive, but bear with me. When we place the LSDA into the TEXT section, the type info pointers need to be indirect and pc-rel. We accomplish this by using NLPs. However, sometimes the types are local to the file. GCC gets around this by not using a NLP in this case, but a "regular" indirection like this: GCC_except_tbl: .long Lfoo-. __ZTIA: @ This is local ... Lfoo: .long __ZTIA LLVM prefers NLPs on Darwin. In fact, it's more optimal for load performance to use them. llvm-svn: 98218
1 parent f5e81ae commit e8e7952

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,15 +1137,16 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) {
11371137
// L_foo$stub:
11381138
OutStreamer.EmitLabel(Stubs[i].first);
11391139
// .indirect_symbol _foo
1140-
MCSymbol *MCSym = Stubs[i].second.getPointer();
1141-
OutStreamer.EmitSymbolAttribute(MCSym, MCSA_IndirectSymbol);
1140+
MachineModuleInfoImpl::StubValueTy &MCSym = Stubs[i].second;
1141+
OutStreamer.EmitSymbolAttribute(MCSym.getPointer(),MCSA_IndirectSymbol);
11421142

1143-
if (MCSym->isUndefined())
1143+
if (MCSym.getInt())
11441144
// External to current translation unit.
11451145
OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
11461146
else
11471147
// Internal to current translation unit.
1148-
OutStreamer.EmitValue(MCSymbolRefExpr::Create(MCSym, OutContext),
1148+
OutStreamer.EmitValue(MCSymbolRefExpr::Create(MCSym.getPointer(),
1149+
OutContext),
11491150
4/*size*/, 0/*addrspace*/);
11501151
}
11511152

0 commit comments

Comments
 (0)