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"
const char *getFunctionAddrSuffix() const {
return FunctionAddrSuffix;
}
+ const char *getPersonalityPrefix() const {
+ return PersonalityPrefix;
+ }
+ const char *getPersonalitySuffix() const {
+ return PersonalitySuffix;
+ }
const char *getInlineAsmStart() const {
return InlineAsmStart;
}
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)");
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);
GlobalVarAddrSuffix(""),
FunctionAddrPrefix(""),
FunctionAddrSuffix(""),
+ PersonalityPrefix(""),
+ PersonalitySuffix(""),
InlineAsmStart("#APP"),
InlineAsmEnd("#NO_APP"),
AssemblerDialect(0),
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);
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(
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>();
}
StaticCtorsSection = ".mod_init_func";
StaticDtorsSection = ".mod_term_func";
}
+ PersonalityPrefix = "L";
+ PersonalitySuffix = "$non_lazy_ptr";
InlineAsmStart = "# InlineAsm Start";
InlineAsmEnd = "# InlineAsm End";
SetDirective = "\t.set";