llvm.org GIT mirror llvm / 79dda2b
Fix couple of bugs connected with eh info: 1. Correct output offsets on Linux 2. Fix "style" of personality function. It shouldn't be indirect. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36633 91177308-0d34-0410-b5e6-96231b3b80d8 Anton Korobeynikov 13 years ago
4 changed file(s) with 46 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
262262
263263 //===--- Dwarf Emission Directives -----------------------------------===//
264264
265 /// AbsoluteSectionOffsets - True if we should emit abolute section
266 /// offsets. Defaults to false.
267 bool AbsoluteSectionOffsets;
268
265 /// AbsoluteDebugSectionOffsets - True if we should emit abolute section
266 /// offsets for debug information. Defaults to false.
267 bool AbsoluteDebugSectionOffsets;
268
269 /// AbsoluteEHSectionOffsets - True if we should emit abolute section
270 /// offsets for EH information. Defaults to false.
271 bool AbsoluteEHSectionOffsets;
272
269273 /// HasLEB128 - True if target asm supports leb128 directives.
270274 ///
271275 bool HasLEB128; // Defaults to false.
529533 const char *getProtectedDirective() const {
530534 return ProtectedDirective;
531535 }
532 bool isAbsoluteSectionOffsets() const {
533 return AbsoluteSectionOffsets;
536 bool isAbsoluteDebugSectionOffsets() const {
537 return AbsoluteDebugSectionOffsets;
538 }
539 bool isAbsoluteEHSectionOffsets() const {
540 return AbsoluteEHSectionOffsets;
534541 }
535542 bool hasLEB128() const {
536543 return HasLEB128;
913913
914914 void EmitSectionOffset(const char* Label, const char* Section,
915915 unsigned LabelNumber, unsigned SectionNumber,
916 bool IsSmall = false) {
916 bool IsSmall = false, bool isEH = false) {
917 bool printAbsolute = false;
917918 if (TAI->needsSet()) {
918919 O << "\t.set\t";
919920 PrintLabelName("set", SetCounter);
920921 O << ",";
921922 PrintLabelName(Label, LabelNumber, true);
922 if (!TAI->isAbsoluteSectionOffsets()) {
923
924 if (isEH)
925 printAbsolute = TAI->isAbsoluteEHSectionOffsets();
926 else
927 printAbsolute = TAI->isAbsoluteDebugSectionOffsets();
928
929 if (!printAbsolute) {
923930 O << "-";
924931 PrintLabelName(Section, SectionNumber);
925932 }
939946 O << TAI->getData64bitsDirective();
940947
941948 PrintLabelName(Label, LabelNumber, true);
942 if (!TAI->isAbsoluteSectionOffsets()) {
949
950 if (isEH)
951 printAbsolute = TAI->isAbsoluteEHSectionOffsets();
952 else
953 printAbsolute = TAI->isAbsoluteDebugSectionOffsets();
954
955 if (!printAbsolute) {
943956 O << "-";
944957 PrintLabelName(Section, SectionNumber);
945958 }
16871700 CompileUnit *NewCompileUnit(CompileUnitDesc *UnitDesc, unsigned ID) {
16881701 // Construct debug information entry.
16891702 DIE *Die = new DIE(DW_TAG_compile_unit);
1690 if (TAI->isAbsoluteSectionOffsets())
1703 if (TAI->isAbsoluteDebugSectionOffsets())
16911704 AddLabel(Die, DW_AT_stmt_list, DW_FORM_data4, DWLabel("section_line", 0));
16921705 else
16931706 AddDelta(Die, DW_AT_stmt_list, DW_FORM_data4, DWLabel("section_line", 0),
21062119
21072120 Asm->EmitInt32(ContentSize); Asm->EOL("Length of Compilation Unit Info");
21082121 Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF version number");
2109 EmitSectionOffset("abbrev_begin", "section_abbrev", 0, 0, true);
2122 EmitSectionOffset("abbrev_begin", "section_abbrev", 0, 0, true, false);
21102123 Asm->EOL("Offset Into Abbrev. Section");
21112124 Asm->EmitInt8(TAI->getAddressSize()); Asm->EOL("Address Size (in bytes)");
21122125
23652378
23662379 EmitLabel("frame_begin", SubprogramCount);
23672380
2368 EmitSectionOffset("frame_common_begin", "section_frame", 0, 0, true);
2381 EmitSectionOffset("frame_common_begin", "section_frame", 0, 0, true, false);
23692382 Asm->EOL("FDE CIE offset");
23702383
23712384 EmitReference("func_begin", SubprogramCount);
24002413
24012414 Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF Version");
24022415
2403 EmitSectionOffset("info_begin", "section_info", Unit->getID(), 0, true);
2416 EmitSectionOffset("info_begin", "section_info",
2417 Unit->getID(), 0, true, false);
24042418 Asm->EOL("Offset of Compilation Unit Info");
24052419
24062420 EmitDifference("info_end", Unit->getID(), "info_begin", Unit->getID(),true);
27682782 if (Personality) {
27692783 Asm->EmitULEB128Bytes(7);
27702784 Asm->EOL("Augmentation Size");
2771 Asm->EmitInt8(DW_EH_PE_indirect |
2772 DW_EH_PE_pcrel |
2773 DW_EH_PE_sdata4);
2774 Asm->EOL("Personality (indirect pcrel sdata4)");
2785 Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4);
2786 Asm->EOL("Personality (pcrel sdata4)");
27752787
27762788 O << TAI->getData32bitsDirective();
27772789 Asm->EmitExternalGlobal((const GlobalVariable *)(Personality));
28292841 EmitLabel("eh_frame_begin", SubprogramCount);
28302842
28312843 EmitSectionOffset("eh_frame_begin", "section_eh_frame",
2832 SubprogramCount, 0, true);
2844 SubprogramCount, 0, true, true);
28332845 Asm->EOL("FDE CIE offset");
28342846
28352847 EmitReference("eh_func_begin", SubprogramCount, true);
29933005 for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) {
29943006 const LandingPadInfo &LandingPad = LandingPads[i];
29953007 EmitSectionOffset("label", "eh_func_begin",
2996 LandingPad.BeginLabel, SubprogramCount);
3008 LandingPad.BeginLabel, SubprogramCount, false, true);
29973009 Asm->EOL("Region start");
29983010
29993011 EmitDifference("label", LandingPad.EndLabel,
30063018 else
30073019 Asm->EmitInt64(0);
30083020 } else {
3009 EmitSectionOffset("label", "eh_func_begin",
3010 LandingPad.LandingPadLabel, SubprogramCount);
3021 EmitSectionOffset("label", "eh_func_begin", LandingPad.LandingPadLabel,
3022 SubprogramCount, false, true);
30113023 }
30123024 Asm->EOL("Landing pad");
30133025
7474 WeakRefDirective(0),
7575 HiddenDirective("\t.hidden\t"),
7676 ProtectedDirective("\t.protected\t"),
77 AbsoluteSectionOffsets(false),
77 AbsoluteDebugSectionOffsets(false),
78 AbsoluteEHSectionOffsets(false),
7879 HasLEB128(false),
7980 HasDotLoc(false),
8081 HasDotFile(false),
9898 case X86Subtarget::isELF:
9999 // Set up DWARF directives
100100 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
101 AbsoluteSectionOffsets = true;
101 AbsoluteDebugSectionOffsets = true;
102 AbsoluteEHSectionOffsets = false;
102103 // bool HasLEB128; // Defaults to false.
103104 // hasDotLoc - True if target asm supports .loc directives.
104105 // bool HasDotLoc; // Defaults to false.
140141
141142 // Set up DWARF directives
142143 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
143 AbsoluteSectionOffsets = true;
144 AbsoluteDebugSectionOffsets = true;
145 AbsoluteEHSectionOffsets = false;
144146 PrivateGlobalPrefix = "L"; // Prefix for private global symbols
145147 WeakRefDirective = "\t.weak\t";
146148 SetDirective = "\t.set\t";