mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Add support for having multiple sections with the same name and comdat.
Using this in combination with -ffunction-sections allows LLVM to output a .o file with mulitple sections named .text. This saves space by avoiding long unique names of the form .text.<C++ mangled name>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228980 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -378,6 +378,8 @@ bool ELFAsmParser::ParseSectionArguments(bool IsPush, SMLoc loc) {
|
||||
unsigned Flags = 0;
|
||||
const MCExpr *Subsection = nullptr;
|
||||
bool UseLastGroup = false;
|
||||
StringRef UniqueStr;
|
||||
bool Unique = false;
|
||||
|
||||
// Set the defaults first.
|
||||
if (SectionName == ".fini" || SectionName == ".init" ||
|
||||
@@ -462,6 +464,14 @@ bool ELFAsmParser::ParseSectionArguments(bool IsPush, SMLoc loc) {
|
||||
return TokError("Linkage must be 'comdat'");
|
||||
}
|
||||
}
|
||||
if (getLexer().is(AsmToken::Comma)) {
|
||||
Lex();
|
||||
if (getParser().parseIdentifier(UniqueStr))
|
||||
return TokError("expected identifier in directive");
|
||||
if (UniqueStr != "unique")
|
||||
return TokError("expected 'unique'");
|
||||
Unique = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,8 +519,8 @@ EndStmt:
|
||||
}
|
||||
}
|
||||
|
||||
const MCSection *ELFSection =
|
||||
getContext().getELFSection(SectionName, Type, Flags, Size, GroupName);
|
||||
const MCSection *ELFSection = getContext().getELFSection(
|
||||
SectionName, Type, Flags, Size, GroupName, Unique);
|
||||
getStreamer().SwitchSection(ELFSection, Subsection);
|
||||
|
||||
if (getContext().getGenDwarfForAssembly()) {
|
||||
|
Reference in New Issue
Block a user