[PATCH] D15678: [ELF][gcc compatibility]: support section names with special characters (e.g. "/")
Marina Yatsina via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 22 04:28:30 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL264038: [ELF][gcc compatibility]: support section names with special characters (e.g. (authored by myatsina).
Changed prior to commit:
http://reviews.llvm.org/D15678?vs=51107&id=51270#toc
Repository:
rL LLVM
http://reviews.llvm.org/D15678
Files:
llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
llvm/trunk/test/MC/ELF/section.s
Index: llvm/trunk/test/MC/ELF/section.s
===================================================================
--- llvm/trunk/test/MC/ELF/section.s
+++ llvm/trunk/test/MC/ELF/section.s
@@ -6,11 +6,15 @@
.section .note.GNU-stack2,"",%progbits
.section .note.GNU-,"", at progbits
.section -.note.GNU,"","progbits"
+.section src/stack.c,"", at progbits
+.section ~!@$%^&*()_-+={[}]|\\:<>,"", at 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
Index: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
===================================================================
--- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
+++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
@@ -229,22 +229,23 @@
}
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15678.51270.patch
Type: text/x-patch
Size: 1652 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160322/12468e67/attachment.bin>
More information about the llvm-commits
mailing list