mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-10 02:25:47 +00:00
Refactor to make the .bss, .data and .text sections available for other uses.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195653 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -94,36 +94,39 @@ private:
|
|||||||
DF->getContents().append(Code.begin(), Code.end());
|
DF->getContents().append(Code.begin(), Code.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSection(StringRef Section,
|
const MCSectionCOFF *getSectionText() {
|
||||||
unsigned Characteristics,
|
return getContext().getCOFFSection(
|
||||||
SectionKind Kind) {
|
".text", COFF::IMAGE_SCN_CNT_CODE | COFF::IMAGE_SCN_MEM_EXECUTE |
|
||||||
SwitchSection(getContext().getCOFFSection(Section, Characteristics, Kind));
|
COFF::IMAGE_SCN_MEM_READ,
|
||||||
|
SectionKind::getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
const MCSectionCOFF *getSectionData() {
|
||||||
|
return getContext().getCOFFSection(
|
||||||
|
".data", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
|
||||||
|
COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_MEM_WRITE,
|
||||||
|
SectionKind::getDataRel());
|
||||||
|
}
|
||||||
|
|
||||||
|
const MCSectionCOFF *getSectionBSS() {
|
||||||
|
return getContext().getCOFFSection(
|
||||||
|
".bss", COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA |
|
||||||
|
COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_MEM_WRITE,
|
||||||
|
SectionKind::getBSS());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSectionText() {
|
void SetSectionText() {
|
||||||
SetSection(".text",
|
SwitchSection(getSectionText());
|
||||||
COFF::IMAGE_SCN_CNT_CODE
|
|
||||||
| COFF::IMAGE_SCN_MEM_EXECUTE
|
|
||||||
| COFF::IMAGE_SCN_MEM_READ,
|
|
||||||
SectionKind::getText());
|
|
||||||
EmitCodeAlignment(4, 0);
|
EmitCodeAlignment(4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSectionData() {
|
void SetSectionData() {
|
||||||
SetSection(".data",
|
SwitchSection(getSectionData());
|
||||||
COFF::IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
||||||
| COFF::IMAGE_SCN_MEM_READ
|
|
||||||
| COFF::IMAGE_SCN_MEM_WRITE,
|
|
||||||
SectionKind::getDataRel());
|
|
||||||
EmitCodeAlignment(4, 0);
|
EmitCodeAlignment(4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSectionBSS() {
|
void SetSectionBSS() {
|
||||||
SetSection(".bss",
|
SwitchSection(getSectionBSS());
|
||||||
COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA
|
|
||||||
| COFF::IMAGE_SCN_MEM_READ
|
|
||||||
| COFF::IMAGE_SCN_MEM_WRITE,
|
|
||||||
SectionKind::getBSS());
|
|
||||||
EmitCodeAlignment(4, 0);
|
EmitCodeAlignment(4, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user