diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2007-09-02 22:07:21 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2007-09-02 22:07:21 +0000 |
commit | 5ef8670c228668fe8ff65702b15e8323cb44c7b8 (patch) | |
tree | 48cc51dd16614af4ba33ed8685fa17aa9c1e73ae | |
parent | 8b7533e8e478c8705e229ce1b77be23025a2d4cb (diff) | |
download | external_llvm-5ef8670c228668fe8ff65702b15e8323cb44c7b8.zip external_llvm-5ef8670c228668fe8ff65702b15e8323cb44c7b8.tar.gz external_llvm-5ef8670c228668fe8ff65702b15e8323cb44c7b8.tar.bz2 |
Emit proper "secrel" directive, where possible. This fixes invalid asm syntax of debug info on mingw32. Also, cleanup
some stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41675 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/DwarfWriter.cpp | 71 |
1 files changed, 28 insertions, 43 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp index 959170b..232c5c4 100644 --- a/lib/CodeGen/DwarfWriter.cpp +++ b/lib/CodeGen/DwarfWriter.cpp @@ -823,17 +823,24 @@ public: MachineModuleInfo *getMMI() const { return MMI; } const TargetAsmInfo *getTargetAsmInfo() const { return TAI; } + void PrintRelDirective(bool Force32Bit = false, bool isInSection = false) + const { + if (isInSection && TAI->getDwarfSectionOffsetDirective()) + O << TAI->getDwarfSectionOffsetDirective(); + else if (Force32Bit || TAI->getAddressSize() == sizeof(int32_t)) + O << TAI->getData32bitsDirective(); + else + O << TAI->getData64bitsDirective(); + } + /// PrintLabelName - Print label name in form used by Dwarf writer. /// void PrintLabelName(DWLabel Label) const { PrintLabelName(Label.Tag, Label.Number); } - void PrintLabelName(const char *Tag, unsigned Number, - bool isInSection = false) const { - if (isInSection && TAI->getDwarfSectionOffsetDirective()) - O << TAI->getDwarfSectionOffsetDirective() << Tag; - else - O << TAI->getPrivateGlobalPrefix() << Tag; + void PrintLabelName(const char *Tag, unsigned Number) const { + + O << TAI->getPrivateGlobalPrefix() << Tag; if (Number) O << Number; } @@ -854,21 +861,14 @@ public: } void EmitReference(const char *Tag, unsigned Number, bool IsPCRelative = false) const { - if (TAI->getAddressSize() == sizeof(int32_t)) - O << TAI->getData32bitsDirective(); - else - O << TAI->getData64bitsDirective(); - + PrintRelDirective(); PrintLabelName(Tag, Number); if (IsPCRelative) O << "-" << TAI->getPCSymbol(); } void EmitReference(const std::string &Name, bool IsPCRelative = false) const { - if (TAI->getAddressSize() == sizeof(int32_t)) - O << TAI->getData32bitsDirective(); - else - O << TAI->getData64bitsDirective(); - + PrintRelDirective(); + O << Name; if (IsPCRelative) O << "-" << TAI->getPCSymbol(); @@ -894,20 +894,14 @@ public: O << "-"; PrintLabelName(TagLo, NumberLo); O << "\n"; - - if (IsSmall || TAI->getAddressSize() == sizeof(int32_t)) - O << TAI->getData32bitsDirective(); - else - O << TAI->getData64bitsDirective(); + + PrintRelDirective(IsSmall); PrintLabelName("set", SetCounter); ++SetCounter; } else { - if (IsSmall || TAI->getAddressSize() == sizeof(int32_t)) - O << TAI->getData32bitsDirective(); - else - O << TAI->getData64bitsDirective(); + PrintRelDirective(IsSmall); PrintLabelName(TagHi, NumberHi); O << "-"; @@ -923,7 +917,7 @@ public: O << "\t.set\t"; PrintLabelName("set", SetCounter); O << ","; - PrintLabelName(Label, LabelNumber, true); + PrintLabelName(Label, LabelNumber); if (isEH) printAbsolute = TAI->isAbsoluteEHSectionOffsets(); @@ -935,21 +929,15 @@ public: PrintLabelName(Section, SectionNumber); } O << "\n"; - - if (IsSmall || TAI->getAddressSize() == sizeof(int32_t)) - O << TAI->getData32bitsDirective(); - else - O << TAI->getData64bitsDirective(); + + PrintRelDirective(IsSmall); PrintLabelName("set", SetCounter); ++SetCounter; } else { - if (IsSmall || TAI->getAddressSize() == sizeof(int32_t)) - O << TAI->getData32bitsDirective(); - else - O << TAI->getData64bitsDirective(); + PrintRelDirective(IsSmall, true); - PrintLabelName(Label, LabelNumber, true); + PrintLabelName(Label, LabelNumber); if (isEH) printAbsolute = TAI->isAbsoluteEHSectionOffsets(); @@ -2811,12 +2799,12 @@ private: Asm->EmitExternalGlobal((const GlobalVariable *)(Personality)); O << "-" << TAI->getPCSymbol(); Asm->EOL("Set Personality"); - O << TAI->getData32bitsDirective(); + PrintRelDirective(); PrintLabelName("set", SetCounter); Asm->EOL("Personality"); ++SetCounter; } else { - O << TAI->getData32bitsDirective(); + PrintRelDirective(); Asm->EmitExternalGlobal((const GlobalVariable *)(Personality)); O << "-" << TAI->getPCSymbol(); Asm->EOL("Personality"); @@ -3188,11 +3176,8 @@ private: // Emit the type ids. for (unsigned M = TypeInfos.size(); M; --M) { GlobalVariable *GV = TypeInfos[M - 1]; - - if (TAI->getAddressSize() == sizeof(int32_t)) - O << TAI->getData32bitsDirective(); - else - O << TAI->getData64bitsDirective(); + + PrintRelDirective(); if (GV) O << Asm->getGlobalLinkName(GV); |