diff options
| author | Dale Johannesen <dalej@apple.com> | 2007-11-20 23:24:42 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2007-11-20 23:24:42 +0000 |
| commit | 763e110a9fe7b5bb6c7d176aa2871ca8a634f20f (patch) | |
| tree | 46b6ea800502f205e9f294a3dbebfe128976a80d /llvm/lib/Target/PowerPC | |
| parent | 8b9ecdad0cb1c1523f7f08299e799016cb723650 (diff) | |
| download | bcm5719-llvm-763e110a9fe7b5bb6c7d176aa2871ca8a634f20f.tar.gz bcm5719-llvm-763e110a9fe7b5bb6c7d176aa2871ca8a634f20f.zip | |
Fix .eh table linkage issues on Darwin. Some EH support
for Darwin PPC, but it's not fully working yet.
llvm-svn: 44258
Diffstat (limited to 'llvm/lib/Target/PowerPC')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 18 | ||||
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp | 3 |
2 files changed, 17 insertions, 4 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index da758877371..bac735a17b6 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -322,10 +322,11 @@ namespace { struct VISIBILITY_HIDDEN DarwinAsmPrinter : public PPCAsmPrinter { DwarfWriter DW; + MachineModuleInfo *MMI; DarwinAsmPrinter(std::ostream &O, PPCTargetMachine &TM, const TargetAsmInfo *T) - : PPCAsmPrinter(O, TM, T), DW(O, this, T) { + : PPCAsmPrinter(O, TM, T), DW(O, this, T), MMI(0) { } virtual const char *getPassName() const { @@ -774,11 +775,13 @@ std::string DarwinAsmPrinter::getSectionForFunction(const Function &F) const { /// method to print assembly for each instruction. /// bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) { - DW.SetModuleInfo(&getAnalysis<MachineModuleInfo>()); + // We need this for Personality functions. + MMI = &getAnalysis<MachineModuleInfo>(); + DW.SetModuleInfo(MMI); SetupMachineFunction(MF); O << "\n\n"; - + // Print out constants referenced by the function EmitConstantPool(MF.getConstantPool()); @@ -1054,6 +1057,15 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { O << "\n"; + if (ExceptionHandling && TAI->doesSupportExceptionHandling() && MMI) { + // Add the (possibly multiple) personalities to the set of global values. + const std::vector<Function *>& Personalities = MMI->getPersonalities(); + + for (std::vector<Function *>::const_iterator I = Personalities.begin(), + E = Personalities.end(); I != E; ++I) + if (*I) GVStubs.insert("_" + (*I)->getName()); + } + // Output stubs for external and common global variables. if (!GVStubs.empty()) { SwitchToDataSection(".non_lazy_symbol_pointer"); diff --git a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp index 992b090edd5..ee1d06316ef 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp @@ -43,7 +43,6 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) PrivateGlobalPrefix = "L"; ConstantPoolSection = "\t.const\t"; JumpTableDataSection = ".const"; - GlobalDirective = "\t.globl\t"; CStringSection = "\t.cstring"; FourByteConstantSection = "\t.literal4\n"; EightByteConstantSection = "\t.literal8\n"; @@ -56,6 +55,7 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) StaticDtorsSection = ".mod_term_func"; } UsedDirective = "\t.no_dead_strip\t"; + WeakDefDirective = "\t.weak_definition\t"; WeakRefDirective = "\t.weak_reference\t"; HiddenDirective = "\t.private_extern\t"; SupportsExceptionHandling = false; @@ -66,6 +66,7 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug"; DwarfLineSection = ".section __DWARF,__debug_line,regular,debug"; DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug"; + GlobalEHDirective = "\t.globl\t"; DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug"; DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug"; DwarfStrSection = ".section __DWARF,__debug_str,regular,debug"; |

