[llvm-commits] [llvm] r98218 - /llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
Bill Wendling
isanbard at gmail.com
Wed Mar 10 17:18:13 PST 2010
Author: void
Date: Wed Mar 10 19:18:13 2010
New Revision: 98218
URL: http://llvm.org/viewvc/llvm-project?rev=98218&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=98218&r1=98217&r2=98218&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Wed Mar 10 19:18:13 2010
@@ -1137,15 +1137,16 @@
// L_foo$stub:
OutStreamer.EmitLabel(Stubs[i].first);
// .indirect_symbol _foo
- MCSymbol *MCSym = Stubs[i].second.getPointer();
- OutStreamer.EmitSymbolAttribute(MCSym, MCSA_IndirectSymbol);
+ MachineModuleInfoImpl::StubValueTy &MCSym = Stubs[i].second;
+ OutStreamer.EmitSymbolAttribute(MCSym.getPointer(),MCSA_IndirectSymbol);
- if (MCSym->isUndefined())
+ if (MCSym.getInt())
// External to current translation unit.
OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
else
// Internal to current translation unit.
- OutStreamer.EmitValue(MCSymbolRefExpr::Create(MCSym, OutContext),
+ OutStreamer.EmitValue(MCSymbolRefExpr::Create(MCSym.getPointer(),
+ OutContext),
4/*size*/, 0/*addrspace*/);
}
More information about the llvm-commits
mailing list