]> granicus.if.org Git - llvm/commitdiff
Use a comma after the unique keyword.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 6 Apr 2015 16:34:41 +0000 (16:34 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 6 Apr 2015 16:34:41 +0000 (16:34 +0000)
H.J. Lu noted that all .section options are separated by a comma.

This patch changes the syntax of unique to require one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234174 91177308-0d34-0410-b5e6-96231b3b80d8

docs/Extensions.rst
lib/MC/MCParser/ELFAsmParser.cpp
lib/MC/MCSectionELF.cpp
test/MC/ELF/section-unique-err1.s
test/MC/ELF/section-unique-err2.s
test/MC/ELF/section-unique-err3.s
test/MC/ELF/section-unique-err4.s [new file with mode: 0644]
test/MC/ELF/section-unique.s

index 12eac5e0ed8878e00cd8ca4c747e9c48c2df2791..c8ff07c2b0ca20fcbbfa117559e785be2e8828bc 100644 (file)
@@ -178,10 +178,10 @@ For example, the following code creates two sections named ``.text``.
 
 .. code-block:: gas
 
-       .section        .text,"ax",@progbits,unique 1
+       .section        .text,"ax",@progbits,unique,1
         nop
 
-       .section        .text,"ax",@progbits,unique 2
+       .section        .text,"ax",@progbits,unique,2
         nop
 
 
index 4cb3dfe93089251534ed8ba6123c190903ea1e75..a19339da3eda35f57de4f0cba49123c850ccb3ca 100644 (file)
@@ -470,6 +470,9 @@ bool ELFAsmParser::ParseSectionArguments(bool IsPush, SMLoc loc) {
           return TokError("expected identifier in directive");
         if (UniqueStr != "unique")
           return TokError("expected 'unique'");
+        if (getLexer().isNot(AsmToken::Comma))
+          return TokError("expected commma");
+        Lex();
         if (getParser().parseAbsoluteExpression(UniqueID))
           return true;
         if (UniqueID < 0)
index 2b9b8c630071dcb59f3db3d43b1b2df3cd15da37..3cd84538425db0cc3970027cdd44265aa3357551 100644 (file)
@@ -149,7 +149,7 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
   }
 
   if (isUnique())
-    OS << ",unique " << UniqueID;
+    OS << ",unique," << UniqueID;
 
   OS << '\n';
 
index 0b4985ba1d62650849ccf2b32a75d3f4e07ef4b4..3a997d177667ccaba0a4f67fd7a883e2e55808e4 100644 (file)
@@ -2,4 +2,4 @@
 
 // CHECK:  error: expected absolute expression
 
-        .section       .text,"ax",@progbits,unique "abc"
+        .section       .text,"ax",@progbits,unique, "abc"
index b2ac4f8aecf31b6ac73beb45d32fb02190ad88fa..7b7cd5f79d9d22cc58131bd73c81948e28f67e44 100644 (file)
@@ -2,4 +2,4 @@
 
 // CHECK:  error: unique id must be positive
 
-        .section       .text,"ax",@progbits,unique -1
+        .section       .text,"ax",@progbits,unique, -1
index 67e962bfac7299227eac4164ea812d17b94fde13..bbccd24b4afd7fc44a2064de054cca1e29ee2a46 100644 (file)
@@ -2,4 +2,4 @@
 
 // CHECK:  error: unique id is too large
 
-        .section       .text,"ax",@progbits,unique 4294967295
+        .section       .text,"ax",@progbits,unique, 4294967295
diff --git a/test/MC/ELF/section-unique-err4.s b/test/MC/ELF/section-unique-err4.s
new file mode 100644 (file)
index 0000000..3c82682
--- /dev/null
@@ -0,0 +1,5 @@
+// RUN: not llvm-mc -triple x86_64-pc-linux-gnu %s -o - 2>&1 | FileCheck %s
+
+// CHECK:  error: expected commma
+
+        .section       .text,"ax",@progbits,unique 1
index ffd11d944c5a7ade7091942ddaa94f98db73264a..3fe727127afd228a4226c93aded081e96c176a49 100644 (file)
@@ -1,22 +1,22 @@
 // RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s
 // RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj -t | FileCheck %s --check-prefix=OBJ
 
-       .section        .text,"ax",@progbits,unique 4294967293
+       .section        .text,"ax",@progbits,unique, 4294967293
         .globl f
 f:
         nop
 
-       .section        .text,"ax",@progbits,unique 4294967294
+       .section        .text,"ax",@progbits,unique, 4294967294
         .globl g
 g:
         nop
 
 // test that f and g are in different sections.
 
-// CHECK: .section     .text,"ax",@progbits,unique 4294967293
+// CHECK: .section     .text,"ax",@progbits,unique,4294967293
 // CHECK: f:
 
-// CHECK: .section     .text,"ax",@progbits,unique 4294967294
+// CHECK: .section     .text,"ax",@progbits,unique,4294967294
 // CHECK: g:
 
 // OBJ: Symbol {