llvm.org GIT mirror llvm / d60da49
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 Bill Wendling 13 years ago
7 changed file(s) with 39 addition(s) and 23 deletion(s). Raw diff Collapse all Expand all
109109 const char *FunctionAddrPrefix; // Defaults to ""
110110 const char *FunctionAddrSuffix; // Defaults to ""
111111
112 /// PersonalityPrefix/Suffix - If these are nonempty, these strings will
113 /// enclose any personality function in the common frame section.
114 ///
115 const char *PersonalityPrefix; // Defaults to ""
116 const char *PersonalitySuffix; // Defaults to ""
117
112118 /// InlineAsmStart/End - If these are nonempty, they contain a directive to
113119 /// emit before and after an inline assembly statement.
114120 const char *InlineAsmStart; // Defaults to "#APP\n"
427433 const char *getFunctionAddrSuffix() const {
428434 return FunctionAddrSuffix;
429435 }
436 const char *getPersonalityPrefix() const {
437 return PersonalityPrefix;
438 }
439 const char *getPersonalitySuffix() const {
440 return PersonalitySuffix;
441 }
430442 const char *getInlineAsmStart() const {
431443 return InlineAsmStart;
432444 }
27882788 if (Personality) {
27892789 Asm->EmitULEB128Bytes(7);
27902790 Asm->EOL("Augmentation Size");
2791 Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4);
2792 Asm->EOL("Personality (pcrel sdata4)");
2793
2794 if (TAI->needsSet()) {
2795 O << "\t.set\t";
2796 PrintLabelName("set", SetCounter);
2797 O << ",";
2798 Asm->EmitExternalGlobal((const GlobalVariable *)(Personality));
2799 O << "-" << TAI->getPCSymbol();
2800 Asm->EOL("Set Personality");
2801 PrintRelDirective();
2802 PrintLabelName("set", SetCounter);
2803 Asm->EOL("Personality");
2804 ++SetCounter;
2805 } else {
2806 PrintRelDirective();
2807 Asm->EmitExternalGlobal((const GlobalVariable *)(Personality));
2808 O << "-" << TAI->getPCSymbol();
2809 Asm->EOL("Personality");
2810 }
2791 Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect);
2792 Asm->EOL("Personality (pcrel sdata4 indirect)");
2793
2794 PrintRelDirective();
2795 O << TAI->getPersonalityPrefix();
2796 Asm->EmitExternalGlobal((const GlobalVariable *)(Personality));
2797 O << TAI->getPersonalitySuffix();
2798 O << "-" << TAI->getPCSymbol();
2799 Asm->EOL("Personality");
28112800
28122801 Asm->EmitULEB128Bytes(DW_EH_PE_pcrel);
28132802 Asm->EOL("LSDA Encoding (pcrel)");
32963285 const std::vector Personalities = MMI->getPersonalities();
32973286 for (unsigned i =0; i < Personalities.size(); ++i)
32983287 EmitCommonEHFrame(Personalities[i], i);
3299
3288
33003289 for (std::vector::iterator I = EHFrames.begin(),
33013290 E = EHFrames.end(); I != E; ++I)
33023291 EmitEHFrame(*I);
3737 GlobalVarAddrSuffix(""),
3838 FunctionAddrPrefix(""),
3939 FunctionAddrSuffix(""),
40 PersonalityPrefix(""),
41 PersonalitySuffix(""),
4042 InlineAsmStart("#APP"),
4143 InlineAsmEnd("#NO_APP"),
4244 AssemblerDialect(0),
7373 if (TAI->doesSupportDebugInformation()) {
7474 // Let PassManager know we need debug information and relay
7575 // the MachineModuleInfo address on to DwarfWriter.
76 DW.SetModuleInfo(&getAnalysis());
76 MMI = &getAnalysis();
77 DW.SetModuleInfo(MMI);
7778 }
7879
7980 SetupMachineFunction(MF);
351351
352352 O << "\n";
353353
354 if (MMI) {
355 // Add the (possibly multiple) personalities to the set of global values.
356 const std::vector& Personalities = MMI->getPersonalities();
357
358 for (std::vector::const_iterator I = Personalities.begin(),
359 E = Personalities.end(); I != E; ++I)
360 if (*I) GVStubs.insert("_" + (*I)->getName());
361 }
362
354363 // Output stubs for external and common global variables.
355364 if (GVStubs.begin() != GVStubs.end())
356365 SwitchToDataSection(
2929
3030 struct VISIBILITY_HIDDEN X86SharedAsmPrinter : public AsmPrinter {
3131 DwarfWriter DW;
32 MachineModuleInfo *MMI;
3233
3334 X86SharedAsmPrinter(std::ostream &O, X86TargetMachine &TM,
3435 const TargetAsmInfo *T)
35 : AsmPrinter(O, TM, T), DW(O, this, T) {
36 : AsmPrinter(O, TM, T), DW(O, this, T), MMI(0) {
3637 Subtarget = &TM.getSubtarget();
3738 }
3839
6767 StaticCtorsSection = ".mod_init_func";
6868 StaticDtorsSection = ".mod_term_func";
6969 }
70 PersonalityPrefix = "L";
71 PersonalitySuffix = "$non_lazy_ptr";
7072 InlineAsmStart = "# InlineAsm Start";
7173 InlineAsmEnd = "# InlineAsm End";
7274 SetDirective = "\t.set";