From 2a751e18fda1d29dc00a4342ef6ac54b918288bd Mon Sep 17 00:00:00 2001 From: George Rimar Date: Wed, 29 Aug 2018 09:04:52 +0000 Subject: [PATCH] Revert r340904 "[llvm-mc] - Allow to set custom flags for debug sections." It broke PPC64 BB: http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/23252 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340906 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 3 --- lib/MC/MCContext.cpp | 16 ++++------------ test/MC/ELF/section-flags.s | 12 ------------ 3 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 test/MC/ELF/section-flags.s diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 6944c532c08..7a5fd2985c7 100644 --- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -424,9 +424,6 @@ static SectionKind getELFKindForNamedSection(StringRef Name, SectionKind K) { Name.startswith(".llvm.linkonce.tb.")) return SectionKind::getThreadBSS(); - if (Name.startswith(".debug_")) - return SectionKind::getMetadata(); - return K; } diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index ef919d00923..341a1a4e3b4 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -394,15 +394,6 @@ MCSectionELF *MCContext::getELFSection(const Twine &Section, unsigned Type, auto IterBool = ELFUniquingMap.insert( std::make_pair(ELFSectionKey{Section.str(), Group, UniqueID}, nullptr)); auto &Entry = *IterBool.first; - MCSectionELF *&Sec = Entry.second; - if (!IterBool.second) { - // We want to let users add additional flags even for sections with - // defaults. For example, .debug_str has "MS" flags by default and user - // might want to add "E". - Sec->setFlags(Sec->getFlags() | Flags); - return Sec; - } - if (!IterBool.second) return Entry.second; @@ -416,9 +407,10 @@ MCSectionELF *MCContext::getELFSection(const Twine &Section, unsigned Type, else Kind = SectionKind::getReadOnly(); - Sec = createELFSectionImpl(CachedName, Type, Flags, Kind, EntrySize, GroupSym, - UniqueID, Associated); - return Sec; + MCSectionELF *Result = createELFSectionImpl( + CachedName, Type, Flags, Kind, EntrySize, GroupSym, UniqueID, Associated); + Entry.second = Result; + return Result; } MCSectionELF *MCContext::createELFGroupSection(const MCSymbolELF *Group) { diff --git a/test/MC/ELF/section-flags.s b/test/MC/ELF/section-flags.s deleted file mode 100644 index 077a9b497d5..00000000000 --- a/test/MC/ELF/section-flags.s +++ /dev/null @@ -1,12 +0,0 @@ -# RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -filetype=obj -o %t.o -# RUN: llvm-readobj -s --elf-output-style=GNU %t.o | FileCheck %s - -## Check we are able to set the custom flag ('E') for debug sections. -# CHECK: .debug_info {{.*}} E -# CHECK: .debug_str {{.*}} EMS - -.section .debug_info,"e" -nop - -.section .debug_str,"eMS",@progbits,1 -nop