mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
WinCOFF: Add support for -fdata-sections
This is a pretty straight forward translation for COFF, we just need to stick the data in a COMDAT section marked as IMAGE_COMDAT_SELECT_NODUPLICATES. N.B. We must be careful to avoid sticking entities with private linkage in COMDAT groups. COFF is pretty hostile to the renaming of entities so we must be careful to disallow GlobalVariables with unstable names. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204703 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -770,12 +770,18 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||
Mangler &Mang, const TargetMachine &TM) const {
|
||||
// If we have -ffunction-sections then we should emit the global value to a
|
||||
// uniqued section specifically for it.
|
||||
// TODO: Implement -fdata-sections.
|
||||
bool EmitUniquedSection = Kind.isText() && TM.getFunctionSections();
|
||||
bool EmitUniquedSection;
|
||||
if (Kind.isText())
|
||||
EmitUniquedSection = TM.getFunctionSections();
|
||||
else
|
||||
EmitUniquedSection = TM.getDataSections();
|
||||
|
||||
// If this global is linkonce/weak and the target handles this by emitting it
|
||||
// into a 'uniqued' section name, create and return the section now.
|
||||
if (GV->isWeakForLinker() || EmitUniquedSection) {
|
||||
// Section names depend on the name of the symbol which is not feasible if the
|
||||
// symbol has private linkage.
|
||||
if ((GV->isWeakForLinker() || EmitUniquedSection) &&
|
||||
!GV->hasPrivateLinkage()) {
|
||||
const char *Name = getCOFFSectionNameForUniqueGlobal(Kind);
|
||||
unsigned Characteristics = getCOFFSectionFlags(Kind);
|
||||
|
||||
|
Reference in New Issue
Block a user