The personality function on Darwin needs a global stub. We then refer to

that global stub instead of doing the ".set" thingy we were doing before.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41838 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2007-09-11 08:27:17 +00:00
parent 29ce95511f
commit d60da495cd
7 changed files with 38 additions and 22 deletions

View File

@ -110,6 +110,12 @@ namespace llvm {
const char *FunctionAddrPrefix; // Defaults to ""
const char *FunctionAddrSuffix; // Defaults to ""
/// PersonalityPrefix/Suffix - If these are nonempty, these strings will
/// enclose any personality function in the common frame section.
///
const char *PersonalityPrefix; // Defaults to ""
const char *PersonalitySuffix; // Defaults to ""
/// InlineAsmStart/End - If these are nonempty, they contain a directive to
/// emit before and after an inline assembly statement.
const char *InlineAsmStart; // Defaults to "#APP\n"
@ -428,6 +434,12 @@ namespace llvm {
const char *getFunctionAddrSuffix() const {
return FunctionAddrSuffix;
}
const char *getPersonalityPrefix() const {
return PersonalityPrefix;
}
const char *getPersonalitySuffix() const {
return PersonalitySuffix;
}
const char *getInlineAsmStart() const {
return InlineAsmStart;
}

View File

@ -2789,26 +2789,15 @@ private:
if (Personality) {
Asm->EmitULEB128Bytes(7);
Asm->EOL("Augmentation Size");
Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4);
Asm->EOL("Personality (pcrel sdata4)");
Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect);
Asm->EOL("Personality (pcrel sdata4 indirect)");
if (TAI->needsSet()) {
O << "\t.set\t";
PrintLabelName("set", SetCounter);
O << ",";
Asm->EmitExternalGlobal((const GlobalVariable *)(Personality));
O << "-" << TAI->getPCSymbol();
Asm->EOL("Set Personality");
PrintRelDirective();
PrintLabelName("set", SetCounter);
Asm->EOL("Personality");
++SetCounter;
} else {
PrintRelDirective();
Asm->EmitExternalGlobal((const GlobalVariable *)(Personality));
O << "-" << TAI->getPCSymbol();
Asm->EOL("Personality");
}
PrintRelDirective();
O << TAI->getPersonalityPrefix();
Asm->EmitExternalGlobal((const GlobalVariable *)(Personality));
O << TAI->getPersonalitySuffix();
O << "-" << TAI->getPCSymbol();
Asm->EOL("Personality");
Asm->EmitULEB128Bytes(DW_EH_PE_pcrel);
Asm->EOL("LSDA Encoding (pcrel)");
@ -3297,7 +3286,7 @@ public:
const std::vector<Function *> Personalities = MMI->getPersonalities();
for (unsigned i =0; i < Personalities.size(); ++i)
EmitCommonEHFrame(Personalities[i], i);
for (std::vector<FunctionEHFrameInfo>::iterator I = EHFrames.begin(),
E = EHFrames.end(); I != E; ++I)
EmitEHFrame(*I);

View File

@ -38,6 +38,8 @@ TargetAsmInfo::TargetAsmInfo() :
GlobalVarAddrSuffix(""),
FunctionAddrPrefix(""),
FunctionAddrSuffix(""),
PersonalityPrefix(""),
PersonalitySuffix(""),
InlineAsmStart("#APP"),
InlineAsmEnd("#NO_APP"),
AssemblerDialect(0),

View File

@ -74,7 +74,8 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
if (TAI->doesSupportDebugInformation()) {
// Let PassManager know we need debug information and relay
// the MachineModuleInfo address on to DwarfWriter.
DW.SetModuleInfo(&getAnalysis<MachineModuleInfo>());
MMI = &getAnalysis<MachineModuleInfo>();
DW.SetModuleInfo(MMI);
}
SetupMachineFunction(MF);

View File

@ -352,6 +352,15 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
O << "\n";
if (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.begin() != GVStubs.end())
SwitchToDataSection(

View File

@ -30,10 +30,11 @@ namespace llvm {
struct VISIBILITY_HIDDEN X86SharedAsmPrinter : public AsmPrinter {
DwarfWriter DW;
MachineModuleInfo *MMI;
X86SharedAsmPrinter(std::ostream &O, X86TargetMachine &TM,
const TargetAsmInfo *T)
: AsmPrinter(O, TM, T), DW(O, this, T) {
: AsmPrinter(O, TM, T), DW(O, this, T), MMI(0) {
Subtarget = &TM.getSubtarget<X86Subtarget>();
}

View File

@ -68,6 +68,8 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
StaticCtorsSection = ".mod_init_func";
StaticDtorsSection = ".mod_term_func";
}
PersonalityPrefix = "L";
PersonalitySuffix = "$non_lazy_ptr";
InlineAsmStart = "# InlineAsm Start";
InlineAsmEnd = "# InlineAsm End";
SetDirective = "\t.set";