[PATCH] D15678: [ELF][gcc compatibility]: support section names with special characters (e.g. "/")

Marina Yatsina via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 19 03:15:07 PDT 2016


myatsina retitled this revision from "[ELF][gcc compatibility]: support section names with "/"" to "[ELF][gcc compatibility]: support section names with special characters (e.g. "/")".
myatsina updated the summary for this revision.
myatsina set the repository for this revision to rL LLVM.
myatsina updated this revision to Diff 51107.
myatsina added a comment.

Added missing check


Repository:
  rL LLVM

http://reviews.llvm.org/D15678

Files:
  lib/MC/MCParser/ELFAsmParser.cpp
  test/MC/ELF/section.s

Index: lib/MC/MCParser/ELFAsmParser.cpp
===================================================================
--- lib/MC/MCParser/ELFAsmParser.cpp
+++ 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);
 
Index: test/MC/ELF/section.s
===================================================================
--- test/MC/ELF/section.s
+++ 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
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15678.51107.patch
Type: text/x-patch
Size: 1586 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160319/37e95d77/attachment.bin>


More information about the llvm-commits mailing list