mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
Fix a few issues with comdat handling on COFF.
* Section association cannot use just the section name as many sections can have the same name. With this patch, the comdat symbol in an assoc section is interpreted to mean a symbol in the associated section and the mapping is discovered from it. * Comdat symbols were not being set correctly. Instead we were getting whatever was output first for that section. A consequence is that associative sections now must use .section to set the association. Using .linkonce would not work since it is not possible to change a sections comdat symbol (it is used to decide if we should create a new section or reuse an existing one). This includes r210298, which was reverted because it was asserting on an associated section having the same comdat as the associated section. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210367 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -273,9 +273,7 @@ namespace llvm {
|
||||
const MCSectionCOFF *getCOFFSection(StringRef Section,
|
||||
unsigned Characteristics,
|
||||
SectionKind Kind,
|
||||
StringRef COMDATSymName,
|
||||
int Selection,
|
||||
const MCSectionCOFF *Assoc = nullptr);
|
||||
StringRef COMDATSymName, int Selection);
|
||||
|
||||
const MCSectionCOFF *getCOFFSection(StringRef Section,
|
||||
unsigned Characteristics,
|
||||
|
||||
@@ -42,24 +42,15 @@ class MCSymbol;
|
||||
/// it is a COMDAT section (Characteristics & IMAGE_SCN_LNK_COMDAT) != 0
|
||||
mutable int Selection;
|
||||
|
||||
/// Assoc - This is name of the associated section, if it is a COMDAT
|
||||
/// section (Characteristics & IMAGE_SCN_LNK_COMDAT) != 0 with an
|
||||
/// associative Selection (IMAGE_COMDAT_SELECT_ASSOCIATIVE).
|
||||
mutable const MCSectionCOFF *Assoc;
|
||||
|
||||
private:
|
||||
friend class MCContext;
|
||||
MCSectionCOFF(StringRef Section, unsigned Characteristics,
|
||||
const MCSymbol *COMDATSymbol, int Selection,
|
||||
const MCSectionCOFF *Assoc, SectionKind K)
|
||||
const MCSymbol *COMDATSymbol, int Selection, SectionKind K)
|
||||
: MCSection(SV_COFF, K), SectionName(Section),
|
||||
Characteristics(Characteristics), COMDATSymbol(COMDATSymbol),
|
||||
Selection(Selection), Assoc(Assoc) {
|
||||
Selection(Selection) {
|
||||
assert ((Characteristics & 0x00F00000) == 0 &&
|
||||
"alignment must not be set upon section creation");
|
||||
assert ((Selection == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE) ==
|
||||
(Assoc != nullptr) &&
|
||||
"associative COMDAT section must have an associated section");
|
||||
}
|
||||
~MCSectionCOFF();
|
||||
|
||||
@@ -76,11 +67,10 @@ class MCSymbol;
|
||||
return SectionName.str() + "_end";
|
||||
}
|
||||
unsigned getCharacteristics() const { return Characteristics; }
|
||||
const MCSymbol *getCOMDATSymbol() const { return COMDATSymbol; }
|
||||
int getSelection() const { return Selection; }
|
||||
const MCSectionCOFF *getAssocSection() const { return Assoc; }
|
||||
|
||||
void setSelection(int Selection,
|
||||
const MCSectionCOFF *Assoc = nullptr) const;
|
||||
void setSelection(int Selection) const;
|
||||
|
||||
void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
|
||||
const MCExpr *Subsection) const override;
|
||||
|
||||
Reference in New Issue
Block a user