mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
[MC][COFF] Emit weak symbols to the correct section. Patch by Dmitry Puzirev!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167877 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -701,8 +701,19 @@ getCOFFSectionFlags(SectionKind K) {
|
||||
const MCSection *TargetLoweringObjectFileCOFF::
|
||||
getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||
Mangler *Mang, const TargetMachine &TM) const {
|
||||
return getContext().getCOFFSection(GV->getSection(),
|
||||
getCOFFSectionFlags(Kind),
|
||||
int Selection = 0;
|
||||
unsigned Characteristics = getCOFFSectionFlags(Kind);
|
||||
SmallString<128> Name(GV->getSection().c_str());
|
||||
if (GV->isWeakForLinker()) {
|
||||
Selection = COFF::IMAGE_COMDAT_SELECT_ANY;
|
||||
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
|
||||
MCSymbol *Sym = Mang->getSymbol(GV);
|
||||
Name.append("$");
|
||||
Name.append(Sym->getName().begin() + 1, Sym->getName().end());
|
||||
}
|
||||
return getContext().getCOFFSection(Name,
|
||||
Characteristics,
|
||||
Selection,
|
||||
Kind);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user