mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
Put each jump table in an independent section if the function is too.
This allows the linker to GC both, fixing pr22557. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228937 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -334,6 +334,28 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||
return DataRelROSection;
|
||||
}
|
||||
|
||||
const MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable(
|
||||
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
|
||||
// If the function can be removed, produce a unique section so that
|
||||
// the table doesn't prevent the removal.
|
||||
const Comdat *C = F.getComdat();
|
||||
bool EmitUniqueSection = TM.getFunctionSections() || C;
|
||||
if (!EmitUniqueSection)
|
||||
return ReadOnlySection;
|
||||
|
||||
SmallString<128> Name(".rodata.");
|
||||
TM.getNameWithPrefix(Name, &F, Mang, true);
|
||||
|
||||
unsigned Flags = ELF::SHF_ALLOC;
|
||||
StringRef Group = "";
|
||||
if (C) {
|
||||
Flags |= ELF::SHF_GROUP;
|
||||
Group = C->getName();
|
||||
}
|
||||
|
||||
return getContext().getELFSection(Name, ELF::SHT_PROGBITS, Flags, 0, Group);
|
||||
}
|
||||
|
||||
/// getSectionForConstant - Given a mergeable constant with the
|
||||
/// specified size and relocation information, return a section that it
|
||||
/// should be placed in.
|
||||
|
Reference in New Issue
Block a user