diff options
Diffstat (limited to 'contrib/llvm/lib/MC/MCSectionELF.cpp')
| -rw-r--r-- | contrib/llvm/lib/MC/MCSectionELF.cpp | 45 | 
1 files changed, 32 insertions, 13 deletions
diff --git a/contrib/llvm/lib/MC/MCSectionELF.cpp b/contrib/llvm/lib/MC/MCSectionELF.cpp index 587b28f71b7d..78fe01cca24a 100644 --- a/contrib/llvm/lib/MC/MCSectionELF.cpp +++ b/contrib/llvm/lib/MC/MCSectionELF.cpp @@ -7,23 +7,23 @@  //  //===----------------------------------------------------------------------===// -#include "llvm/MC/MCSectionELF.h" +#include "llvm/ADT/Triple.h"  #include "llvm/MC/MCAsmInfo.h" -#include "llvm/MC/MCContext.h"  #include "llvm/MC/MCExpr.h" -#include "llvm/MC/MCSymbol.h" +#include "llvm/MC/MCSectionELF.h"  #include "llvm/Support/ELF.h" +#include "llvm/Support/ErrorHandling.h"  #include "llvm/Support/raw_ostream.h" +#include <cassert>  using namespace llvm; -MCSectionELF::~MCSectionELF() {} // anchor. +MCSectionELF::~MCSectionELF() = default; // anchor.  // Decides whether a '.section' directive  // should be printed before the section name.  bool MCSectionELF::ShouldOmitSectionDirective(StringRef Name,                                                const MCAsmInfo &MAI) const { -    if (isUnique())      return false; @@ -53,10 +53,9 @@ static void printName(raw_ostream &OS, StringRef Name) {    OS << '"';  } -void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, +void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,                                          raw_ostream &OS,                                          const MCExpr *Subsection) const { -    if (ShouldOmitSectionDirective(SectionName, MAI)) {      OS << '\t' << getSectionName();      if (Subsection) { @@ -104,14 +103,21 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,      OS << 'S';    if (Flags & ELF::SHF_TLS)      OS << 'T'; +  if (Flags & ELF::SHF_LINK_ORDER) +    OS << 'o';    // If there are target-specific flags, print them. -  if (Flags & ELF::XCORE_SHF_CP_SECTION) -    OS << 'c'; -  if (Flags & ELF::XCORE_SHF_DP_SECTION) -    OS << 'd'; -  if (Flags & ELF::SHF_ARM_PURECODE) -    OS << 'y'; +  Triple::ArchType Arch = T.getArch(); +  if (Arch == Triple::xcore) { +    if (Flags & ELF::XCORE_SHF_CP_SECTION) +      OS << 'c'; +    if (Flags & ELF::XCORE_SHF_DP_SECTION) +      OS << 'd'; +  } else if (Arch == Triple::arm || Arch == Triple::armeb || +             Arch == Triple::thumb || Arch == Triple::thumbeb) { +    if (Flags & ELF::SHF_ARM_PURECODE) +      OS << 'y'; +  }    OS << '"'; @@ -137,6 +143,13 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,      OS << "progbits";    else if (Type == ELF::SHT_X86_64_UNWIND)      OS << "unwind"; +  else if (Type == ELF::SHT_MIPS_DWARF) +    // Print hex value of the flag while we do not have +    // any standard symbolic representation of the flag. +    OS << "0x7000001e"; +  else +    report_fatal_error("unsupported type 0x" + Twine::utohexstr(Type) + +                       " for section " + getSectionName());    if (EntrySize) {      assert(Flags & ELF::SHF_MERGE); @@ -149,6 +162,12 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,      OS << ",comdat";    } +  if (Flags & ELF::SHF_LINK_ORDER) { +    assert(AssociatedSymbol); +    OS << ","; +    printName(OS, AssociatedSymbol->getName()); +  } +    if (isUnique())      OS << ",unique," << UniqueID;  | 
