mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
Properly emit ctors / dtors with priorities into desired sections
and let linker handle the rest. This finally fixes PR5329 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148990 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -340,6 +340,32 @@ getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
||||
getExprForDwarfGlobalReference(GV, Mang, MMI, Encoding, Streamer);
|
||||
}
|
||||
|
||||
const MCSection *
|
||||
TargetLoweringObjectFileELF::getStaticCtorSection(unsigned Priority) const {
|
||||
// The default scheme is .ctor / .dtor, so we have to invert the priority
|
||||
// numbering.
|
||||
if (Priority == 65535)
|
||||
return StaticCtorSection;
|
||||
|
||||
std::string Name = std::string(".ctors.") + utostr(65535 - Priority);
|
||||
return getContext().getELFSection(Name, ELF::SHT_PROGBITS,
|
||||
ELF::SHF_ALLOC |ELF::SHF_WRITE,
|
||||
SectionKind::getDataRel());
|
||||
}
|
||||
|
||||
const MCSection *
|
||||
TargetLoweringObjectFileELF::getStaticDtorSection(unsigned Priority) const {
|
||||
// The default scheme is .ctor / .dtor, so we have to invert the priority
|
||||
// numbering.
|
||||
if (Priority == 65535)
|
||||
return StaticDtorSection;
|
||||
|
||||
std::string Name = std::string(".dtors.") + utostr(65535 - Priority);
|
||||
return getContext().getELFSection(Name, ELF::SHT_PROGBITS,
|
||||
ELF::SHF_ALLOC |ELF::SHF_WRITE,
|
||||
SectionKind::getDataRel());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// MachO
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Reference in New Issue
Block a user