mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-22 10:24:26 +00:00
Map ELf flags back to more specific section kinds.
With that, convert another llc -filetype=obj test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205031 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -269,11 +269,37 @@ bool ELFAsmParser::ParseSectionName(StringRef &SectionName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static SectionKind computeSectionKind(unsigned Flags) {
|
||||
static SectionKind computeSectionKind(unsigned Flags, unsigned ElemSize) {
|
||||
if (Flags & ELF::SHF_EXECINSTR)
|
||||
return SectionKind::getText();
|
||||
if (Flags & ELF::SHF_TLS)
|
||||
return SectionKind::getThreadData();
|
||||
if (Flags & ELF::SHF_MERGE) {
|
||||
if (Flags & ELF::SHF_STRINGS) {
|
||||
switch (ElemSize) {
|
||||
default:
|
||||
break;
|
||||
case 1:
|
||||
return SectionKind::getMergeable1ByteCString();
|
||||
case 2:
|
||||
return SectionKind::getMergeable2ByteCString();
|
||||
case 4:
|
||||
return SectionKind::getMergeable4ByteCString();
|
||||
}
|
||||
} else {
|
||||
switch (ElemSize) {
|
||||
default:
|
||||
break;
|
||||
case 4:
|
||||
return SectionKind::getMergeableConst4();
|
||||
case 8:
|
||||
return SectionKind::getMergeableConst8();
|
||||
case 16:
|
||||
return SectionKind::getMergeableConst16();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SectionKind::getDataRel();
|
||||
}
|
||||
|
||||
@ -518,7 +544,7 @@ EndStmt:
|
||||
}
|
||||
}
|
||||
|
||||
SectionKind Kind = computeSectionKind(Flags);
|
||||
SectionKind Kind = computeSectionKind(Flags, Size);
|
||||
getStreamer().SwitchSection(getContext().getELFSection(SectionName, Type,
|
||||
Flags, Kind, Size,
|
||||
GroupName),
|
||||
|
Reference in New Issue
Block a user