mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
Bug#9033: For the ELF assembler output, always quote the section name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126963 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -39,8 +39,22 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
|
||||
return;
|
||||
}
|
||||
|
||||
OS << "\t.section\t" << getSectionName();
|
||||
|
||||
StringRef name = getSectionName();
|
||||
OS << "\t.section\t\"";
|
||||
for (const char *b = name.begin(), *e = name.end(); b < e; ++b) {
|
||||
if (*b == '"') // Unquoted "
|
||||
OS << "\\\"";
|
||||
else if (*b != '\\') // Neither " or backslash
|
||||
OS << *b;
|
||||
else if (b + 1 == e) // Trailing backslash
|
||||
OS << "\\\\";
|
||||
else {
|
||||
OS << b[0] << b[1]; // Quoted character
|
||||
++b;
|
||||
}
|
||||
}
|
||||
OS << '"';
|
||||
|
||||
// Handle the weird solaris syntax if desired.
|
||||
if (MAI.usesSunStyleELFSectionSwitchSyntax() &&
|
||||
!(Flags & ELF::SHF_MERGE)) {
|
||||
|
Reference in New Issue
Block a user