diff options
| author | 2017-10-04 20:27:34 +0000 | |
|---|---|---|
| committer | 2017-10-04 20:27:34 +0000 | |
| commit | 31eb748944903b7f4f38afda9851951ca9dfc1ae (patch) | |
| tree | 9b95b6ea45d0874d75eb05b90c0840e191416439 /gnu/llvm/lib/MC/MCSectionELF.cpp | |
| parent | Don't try to handle IPv4-compatible IPv6 addresses (diff) | |
| download | wireguard-openbsd-31eb748944903b7f4f38afda9851951ca9dfc1ae.tar.xz wireguard-openbsd-31eb748944903b7f4f38afda9851951ca9dfc1ae.zip | |
Import LLVM 5.0.0 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/MC/MCSectionELF.cpp')
| -rw-r--r-- | gnu/llvm/lib/MC/MCSectionELF.cpp | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/gnu/llvm/lib/MC/MCSectionELF.cpp b/gnu/llvm/lib/MC/MCSectionELF.cpp index 587b28f71b7..2f4f61aa4d5 100644 --- a/gnu/llvm/lib/MC/MCSectionELF.cpp +++ b/gnu/llvm/lib/MC/MCSectionELF.cpp @@ -8,22 +8,22 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCSectionELF.h" +#include "llvm/ADT/Triple.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/MC/MCAsmInfo.h" -#include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" -#include "llvm/MC/MCSymbol.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,15 @@ 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 if (Type == ELF::SHT_LLVM_ODRTAB) + OS << "llvm_odrtab"; + else + report_fatal_error("unsupported type 0x" + Twine::utohexstr(Type) + + " for section " + getSectionName()); if (EntrySize) { assert(Flags & ELF::SHF_MERGE); @@ -149,6 +164,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; |
