diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/ARM/ARMAsmPrinter.cpp | 14 | ||||
| -rw-r--r-- | llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp | 1 | 
2 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp index 093dd6db17c..5eadee20db1 100644 --- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp @@ -63,6 +63,8 @@ namespace {        : AsmPrinter(O, TM, T) {      } +    std::set<std::string> ExtWeakSymbols; +      /// We name each basic block in a Function with a unique number, so      /// that we can consistently refer to them later. This is cleared      /// at the beginning of each call to runOnMachineFunction(). @@ -127,7 +129,7 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {      break;    case Function::WeakLinkage:    case Function::LinkOnceLinkage: -    O << "\t.weak\t" << CurrentFnName << "\n"; +    O << TAI->getWeakRefDirective() << CurrentFnName << "\n";      break;    }    EmitAlignment(2, F); @@ -244,6 +246,9 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int opNum) {      GlobalValue *GV = MO.getGlobal();      std::string Name = Mang->getValueName(GV);      O << Name; +    if (GV->hasExternalWeakLinkage()) { +      ExtWeakSymbols.insert(Name); +    }    }      break;    case MachineOperand::MO_ExternalSymbol: @@ -325,6 +330,13 @@ bool ARMAsmPrinter::doFinalization(Module &M) {      }    } +  if (ExtWeakSymbols.begin() != ExtWeakSymbols.end()) +    SwitchToDataSection(""); +  for (std::set<std::string>::iterator i = ExtWeakSymbols.begin(), +         e = ExtWeakSymbols.end(); i != e; ++i) { +    O << TAI->getWeakRefDirective() << *i << "\n"; +  } +    AsmPrinter::doFinalization(M);    return false; // success  } diff --git a/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp b/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp index 90db4666763..510c0092ff5 100644 --- a/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp +++ b/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp @@ -23,4 +23,5 @@ ARMTargetAsmInfo::ARMTargetAsmInfo(const ARMTargetMachine &TM) {    CommentString = "@";    ConstantPoolSection = "\t.text\n";    AlignmentIsInBytes = false; +  WeakRefDirective = "\t.weak\t";  }  | 

