aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/MC/MCSectionMachO.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2024-07-27 23:34:35 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-10-23 18:26:01 +0000
commit0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583 (patch)
tree6cf5ab1f05330c6773b1f3f64799d56a9c7a1faa /contrib/llvm-project/llvm/lib/MC/MCSectionMachO.cpp
parent6b9f7133aba44189d9625c352bc2c2a59baf18ef (diff)
parentac9a064cb179f3425b310fa2847f8764ac970a4d (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/MC/MCSectionMachO.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/MC/MCSectionMachO.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/contrib/llvm-project/llvm/lib/MC/MCSectionMachO.cpp b/contrib/llvm-project/llvm/lib/MC/MCSectionMachO.cpp
index f7eedac3f2d1..67453cea53a2 100644
--- a/contrib/llvm-project/llvm/lib/MC/MCSectionMachO.cpp
+++ b/contrib/llvm-project/llvm/lib/MC/MCSectionMachO.cpp
@@ -92,8 +92,9 @@ ENTRY("" /*FIXME*/, S_ATTR_LOC_RELOC)
MCSectionMachO::MCSectionMachO(StringRef Segment, StringRef Section,
unsigned TAA, unsigned reserved2, SectionKind K,
MCSymbol *Begin)
- : MCSection(SV_MachO, Section, K, Begin), TypeAndAttributes(TAA),
- Reserved2(reserved2) {
+ : MCSection(SV_MachO, Section, K.isText(),
+ MachO::isVirtualSection(TAA & MachO::SECTION_TYPE), Begin),
+ TypeAndAttributes(TAA), Reserved2(reserved2) {
assert(Segment.size() <= 16 && Section.size() <= 16 &&
"Segment or section string too long");
for (unsigned i = 0; i != 16; ++i) {
@@ -106,7 +107,7 @@ MCSectionMachO::MCSectionMachO(StringRef Segment, StringRef Section,
void MCSectionMachO::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
- const MCExpr *Subsection) const {
+ uint32_t Subsection) const {
OS << "\t.section\t" << getSegmentName() << ',' << getName();
// Get the section type and attributes.
@@ -172,12 +173,6 @@ bool MCSectionMachO::useCodeAlign() const {
return hasAttribute(MachO::S_ATTR_PURE_INSTRUCTIONS);
}
-bool MCSectionMachO::isVirtualSection() const {
- return (getType() == MachO::S_ZEROFILL ||
- getType() == MachO::S_GB_ZEROFILL ||
- getType() == MachO::S_THREAD_LOCAL_ZEROFILL);
-}
-
/// ParseSectionSpecifier - Parse the section specifier indicated by "Spec".
/// This is a string that can appear after a .section directive in a mach-o
/// flavored .s file. If successful, this fills in the specified Out
@@ -291,3 +286,15 @@ Error MCSectionMachO::ParseSectionSpecifier(StringRef Spec, // In.
return Error::success();
}
+
+void MCSectionMachO::allocAtoms() {
+ auto *L = curFragList();
+ if (L->Tail)
+ Atoms.resize(L->Tail->getLayoutOrder() + 1);
+}
+
+const MCSymbol *MCSectionMachO::getAtom(size_t I) const {
+ return I < Atoms.size() ? Atoms[I] : nullptr;
+}
+
+void MCSectionMachO::setAtom(size_t I, const MCSymbol *Sym) { Atoms[I] = Sym; }