summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-15 04:12:33 +0000
committerChris Lattner <sabre@nondot.org>2009-07-15 04:12:33 +0000
commit55452c2bea203f6476530c297ae27310268392e4 (patch)
tree62ea6f29ae4c28b9937446c493e5bc93942d87f9 /llvm/lib
parent53fe736214200e471f10a1276f57b8967e260834 (diff)
downloadbcm5719-llvm-55452c2bea203f6476530c297ae27310268392e4.tar.gz
bcm5719-llvm-55452c2bea203f6476530c297ae27310268392e4.zip
fix an arm codegen bug (the same as PR4482 on ppc) where available_externally
symbols were not getting stubs. While I'm at it, add a big testcase for stub generation to make sure I don't break anything. llvm-svn: 75737
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM/ARMISelLowering.cpp7
-rw-r--r--llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp6
2 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index a9ef3920ab4..22743dd7753 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -935,8 +935,7 @@ SDValue ARMTargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG) {
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) {
GlobalValue *GV = G->getGlobal();
isDirect = true;
- bool isExt = (GV->isDeclaration() || GV->hasWeakLinkage() ||
- GV->hasLinkOnceLinkage());
+ bool isExt = GV->isDeclaration() || GV->isWeakForLinker();
bool isStub = (isExt && Subtarget->isTargetDarwin()) &&
getTargetMachine().getRelocationModel() != Reloc::Static;
isARMFunc = !Subtarget->isThumb() || isStub;
@@ -1179,7 +1178,7 @@ ARMTargetLowering::LowerToTLSExecModels(GlobalAddressSDNode *GA,
// Get the Thread Pointer
SDValue ThreadPointer = DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT);
- if (GV->isDeclaration()){
+ if (GV->isDeclaration()) {
// initial exec model
unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8;
ARMConstantPoolValue *CPV =
@@ -1254,7 +1253,7 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,
static bool GVIsIndirectSymbol(GlobalValue *GV, Reloc::Model RelocM) {
// If symbol visibility is hidden, the extra load is not needed if
// the symbol is definitely defined in the current translation unit.
- bool isDecl = GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode();
+ bool isDecl = GV->isDeclaration() || GV->hasAvailableExternallyLinkage();
if (GV->hasHiddenVisibility() && (!isDecl && !GV->hasCommonLinkage()))
return false;
return RelocM != Reloc::Static && (isDecl || GV->isWeakForLinker());
diff --git a/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
index a62ec4582fc..758488e2d08 100644
--- a/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
+++ b/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
@@ -346,8 +346,7 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
bool isCallOp = Modifier && !strcmp(Modifier, "call");
GlobalValue *GV = MO.getGlobal();
std::string Name = Mang->getMangledName(GV);
- bool isExt = (GV->isDeclaration() || GV->hasWeakLinkage() ||
- GV->hasLinkOnceLinkage());
+ bool isExt = GV->isDeclaration() || GV->isWeakForLinker();
if (isExt && isCallOp && Subtarget->isTargetDarwin() &&
TM.getRelocationModel() != Reloc::Static) {
printSuffixedName(Name, "$stub");
@@ -1185,6 +1184,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
if (Subtarget->isTargetDarwin()) {
SwitchToDataSection("");
+ O << '\n';
// Output stubs for dynamically-linked functions
for (StringSet<>::iterator I = FnStubs.begin(), E = FnStubs.end();
I != E; ++I) {
@@ -1227,7 +1227,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
O << "\t.indirect_symbol " << p << "\n";
O << "\t.long\tdyld_stub_binding_helper\n";
}
- O << "\n";
+ O << '\n';
// Output non-lazy-pointers for external and common global variables.
if (!GVNonLazyPtrs.empty()) {
OpenPOWER on IntegriCloud