mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-19 10:53:55 +00:00
Bring r252305 back with a test fix.
We now create the .eh_frame section early, just like every other special section. This means that the special flags are visible in code that explicitly asks for ".eh_frame". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252313 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f7b07fc667
commit
012d959bc5
@ -47,10 +47,6 @@ protected:
|
|||||||
unsigned FDECFIEncoding;
|
unsigned FDECFIEncoding;
|
||||||
unsigned TTypeEncoding;
|
unsigned TTypeEncoding;
|
||||||
|
|
||||||
/// Section flags for eh_frame
|
|
||||||
unsigned EHSectionType;
|
|
||||||
unsigned EHSectionFlags;
|
|
||||||
|
|
||||||
/// Compact unwind encoding indicating that we should emit only an EH frame.
|
/// Compact unwind encoding indicating that we should emit only an EH frame.
|
||||||
unsigned CompactUnwindDwarfEHFrameOnly;
|
unsigned CompactUnwindDwarfEHFrameOnly;
|
||||||
|
|
||||||
@ -336,8 +332,6 @@ public:
|
|||||||
MCSection *getSXDataSection() const { return SXDataSection; }
|
MCSection *getSXDataSection() const { return SXDataSection; }
|
||||||
|
|
||||||
MCSection *getEHFrameSection() {
|
MCSection *getEHFrameSection() {
|
||||||
if (!EHFrameSection)
|
|
||||||
InitEHFrameSection();
|
|
||||||
return EHFrameSection;
|
return EHFrameSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,9 +351,6 @@ private:
|
|||||||
void initELFMCObjectFileInfo(Triple T);
|
void initELFMCObjectFileInfo(Triple T);
|
||||||
void initCOFFMCObjectFileInfo(Triple T);
|
void initCOFFMCObjectFileInfo(Triple T);
|
||||||
|
|
||||||
/// Initialize EHFrameSection on demand.
|
|
||||||
void InitEHFrameSection();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const Triple &getTargetTriple() const { return TT; }
|
const Triple &getTargetTriple() const { return TT; }
|
||||||
};
|
};
|
||||||
|
@ -49,6 +49,12 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(Triple T) {
|
|||||||
// MachO
|
// MachO
|
||||||
SupportsWeakOmittedEHFrame = false;
|
SupportsWeakOmittedEHFrame = false;
|
||||||
|
|
||||||
|
EHFrameSection = Ctx->getMachOSection(
|
||||||
|
"__TEXT", "__eh_frame",
|
||||||
|
MachO::S_COALESCED | MachO::S_ATTR_NO_TOC |
|
||||||
|
MachO::S_ATTR_STRIP_STATIC_SYMS | MachO::S_ATTR_LIVE_SUPPORT,
|
||||||
|
SectionKind::getReadOnly());
|
||||||
|
|
||||||
if (T.isOSDarwin() && T.getArch() == Triple::aarch64)
|
if (T.isOSDarwin() && T.getArch() == Triple::aarch64)
|
||||||
SupportsCompactUnwindWithoutEHFrame = true;
|
SupportsCompactUnwindWithoutEHFrame = true;
|
||||||
|
|
||||||
@ -416,12 +422,13 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(Triple T) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
EHSectionType = T.getArch() == Triple::x86_64 ? ELF::SHT_X86_64_UNWIND
|
unsigned EHSectionType = T.getArch() == Triple::x86_64
|
||||||
: ELF::SHT_PROGBITS;
|
? ELF::SHT_X86_64_UNWIND
|
||||||
|
: ELF::SHT_PROGBITS;
|
||||||
|
|
||||||
// Solaris requires different flags for .eh_frame to seemingly every other
|
// Solaris requires different flags for .eh_frame to seemingly every other
|
||||||
// platform.
|
// platform.
|
||||||
EHSectionFlags = ELF::SHF_ALLOC;
|
unsigned EHSectionFlags = ELF::SHF_ALLOC;
|
||||||
if (T.isOSSolaris() && T.getArch() != Triple::x86_64)
|
if (T.isOSSolaris() && T.getArch() != Triple::x86_64)
|
||||||
EHSectionFlags |= ELF::SHF_WRITE;
|
EHSectionFlags |= ELF::SHF_WRITE;
|
||||||
|
|
||||||
@ -546,9 +553,17 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(Triple T) {
|
|||||||
|
|
||||||
FaultMapSection =
|
FaultMapSection =
|
||||||
Ctx->getELFSection(".llvm_faultmaps", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
|
Ctx->getELFSection(".llvm_faultmaps", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
|
||||||
|
|
||||||
|
EHFrameSection =
|
||||||
|
Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCObjectFileInfo::initCOFFMCObjectFileInfo(Triple T) {
|
void MCObjectFileInfo::initCOFFMCObjectFileInfo(Triple T) {
|
||||||
|
EHFrameSection = Ctx->getCOFFSection(
|
||||||
|
".eh_frame", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
|
||||||
|
COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_MEM_WRITE,
|
||||||
|
SectionKind::getDataRel());
|
||||||
|
|
||||||
bool IsWoA = T.getArch() == Triple::arm || T.getArch() == Triple::thumb;
|
bool IsWoA = T.getArch() == Triple::arm || T.getArch() == Triple::thumb;
|
||||||
|
|
||||||
CommDirectiveSupportsAlignment = true;
|
CommDirectiveSupportsAlignment = true;
|
||||||
@ -822,24 +837,3 @@ MCSection *MCObjectFileInfo::getDwarfTypesSection(uint64_t Hash) const {
|
|||||||
return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP,
|
return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP,
|
||||||
0, utostr(Hash));
|
0, utostr(Hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCObjectFileInfo::InitEHFrameSection() {
|
|
||||||
if (Env == IsMachO)
|
|
||||||
EHFrameSection =
|
|
||||||
Ctx->getMachOSection("__TEXT", "__eh_frame",
|
|
||||||
MachO::S_COALESCED |
|
|
||||||
MachO::S_ATTR_NO_TOC |
|
|
||||||
MachO::S_ATTR_STRIP_STATIC_SYMS |
|
|
||||||
MachO::S_ATTR_LIVE_SUPPORT,
|
|
||||||
SectionKind::getReadOnly());
|
|
||||||
else if (Env == IsELF)
|
|
||||||
EHFrameSection =
|
|
||||||
Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags);
|
|
||||||
else
|
|
||||||
EHFrameSection =
|
|
||||||
Ctx->getCOFFSection(".eh_frame",
|
|
||||||
COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
|
|
||||||
COFF::IMAGE_SCN_MEM_READ |
|
|
||||||
COFF::IMAGE_SCN_MEM_WRITE,
|
|
||||||
SectionKind::getDataRel());
|
|
||||||
}
|
|
||||||
|
@ -133,6 +133,8 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
|
|||||||
OS << "note";
|
OS << "note";
|
||||||
else if (Type == ELF::SHT_PROGBITS)
|
else if (Type == ELF::SHT_PROGBITS)
|
||||||
OS << "progbits";
|
OS << "progbits";
|
||||||
|
else if (Type == ELF::SHT_X86_64_UNWIND)
|
||||||
|
OS << "unwind";
|
||||||
|
|
||||||
if (EntrySize) {
|
if (EntrySize) {
|
||||||
assert(Flags & ELF::SHF_MERGE);
|
assert(Flags & ELF::SHF_MERGE);
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
@bar1 = constant i8* bitcast (i32* @foo to i8*), section "my_bar1", align 8
|
@bar1 = constant i8* bitcast (i32* @foo to i8*), section "my_bar1", align 8
|
||||||
|
|
||||||
|
|
||||||
; STATIC: .section .eh_frame,"a",@progbits
|
; STATIC: .section .eh_frame,"a",@unwind
|
||||||
; STATIC: .section my_bar1,"a",@progbits
|
; STATIC: .section my_bar1,"a",@progbits
|
||||||
|
|
||||||
; PIC: .section .eh_frame,"a",@progbits
|
; PIC: .section .eh_frame,"a",@unwind
|
||||||
; PIC: .section my_bar1,"aw",@progbits
|
; PIC: .section my_bar1,"aw",@progbits
|
||||||
|
Loading…
x
Reference in New Issue
Block a user