[llvm] 443d9a4 - Revert "MC: make section classification a bit more thorough"

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 18:04:17 PDT 2022


Author: Matthias Braun
Date: 2022-08-24T17:57:45-07:00
New Revision: 443d9a46a879991e09bc723e64bdb1484ca1b94a

URL: https://github.com/llvm/llvm-project/commit/443d9a46a879991e09bc723e64bdb1484ca1b94a
DIFF: https://github.com/llvm/llvm-project/commit/443d9a46a879991e09bc723e64bdb1484ca1b94a.diff

LOG: Revert "MC: make section classification a bit more thorough"

This reverts commit 73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6.

We started to hit assertions when compiling & assembling separately.
See comments in https://reviews.llvm.org/D131270

Added: 
    

Modified: 
    llvm/lib/MC/MCContext.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index eda266a55c8ec..29597088a212e 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -564,24 +564,8 @@ MCSectionELF *MCContext::getELFSection(const Twine &Section, unsigned Type,
     Kind = SectionKind::getExecuteOnly();
   else if (Flags & ELF::SHF_EXECINSTR)
     Kind = SectionKind::getText();
-  else if (~Flags & ELF::SHF_WRITE)
-    Kind = SectionKind::getReadOnly();
-  else if (Flags & ELF::SHF_TLS)
-    // FIXME: should we 
diff erentiate between SHT_PROGBITS and SHT_NOBITS?
-    Kind = SectionKind::getThreadData();
-  else if (CachedName.startswith(".debug_"))
-    Kind = SectionKind::getMetadata();
   else
-    Kind = llvm::StringSwitch<SectionKind>(CachedName)
-               .Case(".bss", SectionKind::getBSS())
-               .Case(".data", SectionKind::getData())
-               .Case(".data1", SectionKind::getMergeable1ByteCString())
-               .Case(".data.rel.ro", SectionKind::getReadOnlyWithRel())
-               .Case(".rodata", SectionKind::getReadOnly())
-               .Case(".rodata1", SectionKind::getReadOnly())
-               .Case(".tbss", SectionKind::getThreadBSS())
-               .Case(".tdata", SectionKind::getThreadData())
-               .Default(SectionKind::getText());
+    Kind = SectionKind::getReadOnly();
 
   MCSectionELF *Result =
       createELFSectionImpl(CachedName, Type, Flags, Kind, EntrySize, GroupSym,


        


More information about the llvm-commits mailing list