mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 04:39:44 +00:00
[ELF][gcc compatibility]: support section names with special characters (e.g. "/")
Adding support for section names with special characters in them (e.g. "/"). GCC successfully compiles such section names. This also fixes PR24520. Differential Revision: http://reviews.llvm.org/D15678 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264038 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d4501fffa8
commit
02b7dd6f82
@ -229,22 +229,23 @@ bool ELFAsmParser::ParseSectionName(StringRef &SectionName) {
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
unsigned CurSize;
|
||||
|
||||
|
||||
SMLoc PrevLoc = getLexer().getLoc();
|
||||
if (getLexer().is(AsmToken::Minus)) {
|
||||
CurSize = 1;
|
||||
Lex(); // Consume the "-".
|
||||
} else if (getLexer().is(AsmToken::String)) {
|
||||
if (getLexer().is(AsmToken::Comma) ||
|
||||
getLexer().is(AsmToken::EndOfStatement))
|
||||
break;
|
||||
|
||||
unsigned CurSize;
|
||||
if (getLexer().is(AsmToken::String)) {
|
||||
CurSize = getTok().getIdentifier().size() + 2;
|
||||
Lex();
|
||||
} else if (getLexer().is(AsmToken::Identifier)) {
|
||||
CurSize = getTok().getIdentifier().size();
|
||||
Lex();
|
||||
} else {
|
||||
break;
|
||||
CurSize = getTok().getString().size();
|
||||
Lex();
|
||||
}
|
||||
|
||||
Size += CurSize;
|
||||
SectionName = StringRef(FirstLoc.getPointer(), Size);
|
||||
|
||||
|
@ -6,11 +6,15 @@
|
||||
.section .note.GNU-stack2,"",%progbits
|
||||
.section .note.GNU-,"",@progbits
|
||||
.section -.note.GNU,"","progbits"
|
||||
.section src/stack.c,"",@progbits
|
||||
.section ~!@$%^&*()_-+={[}]|\\:<>,"",@progbits
|
||||
|
||||
// CHECK: Name: .note.GNU-stack
|
||||
// CHECK: Name: .note.GNU-stack2
|
||||
// CHECK: Name: .note.GNU-
|
||||
// CHECK: Name: -.note.GNU
|
||||
// CHECK: Name: src/stack.c
|
||||
// CHECK: Name: ~!@$%^&*()_-+={[}]|\\:<>
|
||||
|
||||
// Test that the defaults are used
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user