[PATCH] D131270: MC: make section classification a bit more thorough
Saleem Abdulrasool via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 19 09:47:02 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG73a9dfcee24d: MC: make section classification a bit more thorough (authored by compnerd).
Changed prior to commit:
https://reviews.llvm.org/D131270?vs=450318&id=454050#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131270/new/
https://reviews.llvm.org/D131270
Files:
llvm/lib/MC/MCContext.cpp
Index: llvm/lib/MC/MCContext.cpp
===================================================================
--- llvm/lib/MC/MCContext.cpp
+++ llvm/lib/MC/MCContext.cpp
@@ -564,8 +564,24 @@
Kind = SectionKind::getExecuteOnly();
else if (Flags & ELF::SHF_EXECINSTR)
Kind = SectionKind::getText();
- else
+ else if (~Flags & ELF::SHF_WRITE)
Kind = SectionKind::getReadOnly();
+ else if (Flags & ELF::SHF_TLS)
+ // FIXME: should we differentiate 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());
MCSectionELF *Result =
createELFSectionImpl(CachedName, Type, Flags, Kind, EntrySize, GroupSym,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131270.454050.patch
Type: text/x-patch
Size: 1345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220819/d50e8c1e/attachment.bin>
More information about the llvm-commits
mailing list