summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-04-06 16:34:41 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-04-06 16:34:41 +0000
commit41e2b5c55fafe4ed6030be2a3f362e119df0c085 (patch)
tree339f6ada3c15946a1942a6690495e7682029363a
parent981d2a04b7b46c1bcc9344a8c0797ad43bd40a0b (diff)
downloadbcm5719-llvm-41e2b5c55fafe4ed6030be2a3f362e119df0c085.tar.gz
bcm5719-llvm-41e2b5c55fafe4ed6030be2a3f362e119df0c085.zip
Use a comma after the unique keyword.
H.J. Lu noted that all .section options are separated by a comma. This patch changes the syntax of unique to require one. llvm-svn: 234174
-rw-r--r--llvm/docs/Extensions.rst4
-rw-r--r--llvm/lib/MC/MCParser/ELFAsmParser.cpp3
-rw-r--r--llvm/lib/MC/MCSectionELF.cpp2
-rw-r--r--llvm/test/MC/ELF/section-unique-err1.s2
-rw-r--r--llvm/test/MC/ELF/section-unique-err2.s2
-rw-r--r--llvm/test/MC/ELF/section-unique-err3.s2
-rw-r--r--llvm/test/MC/ELF/section-unique-err4.s5
-rw-r--r--llvm/test/MC/ELF/section-unique.s8
8 files changed, 18 insertions, 10 deletions
diff --git a/llvm/docs/Extensions.rst b/llvm/docs/Extensions.rst
index 12eac5e0ed8..c8ff07c2b0c 100644
--- a/llvm/docs/Extensions.rst
+++ b/llvm/docs/Extensions.rst
@@ -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
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
index 4cb3dfe9308..a19339da3ed 100644
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -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)
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index 2b9b8c63007..3cd84538425 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/lib/MC/MCSectionELF.cpp
@@ -149,7 +149,7 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
}
if (isUnique())
- OS << ",unique " << UniqueID;
+ OS << ",unique," << UniqueID;
OS << '\n';
diff --git a/llvm/test/MC/ELF/section-unique-err1.s b/llvm/test/MC/ELF/section-unique-err1.s
index 0b4985ba1d6..3a997d17766 100644
--- a/llvm/test/MC/ELF/section-unique-err1.s
+++ b/llvm/test/MC/ELF/section-unique-err1.s
@@ -2,4 +2,4 @@
// CHECK: error: expected absolute expression
- .section .text,"ax",@progbits,unique "abc"
+ .section .text,"ax",@progbits,unique, "abc"
diff --git a/llvm/test/MC/ELF/section-unique-err2.s b/llvm/test/MC/ELF/section-unique-err2.s
index b2ac4f8aecf..7b7cd5f79d9 100644
--- a/llvm/test/MC/ELF/section-unique-err2.s
+++ b/llvm/test/MC/ELF/section-unique-err2.s
@@ -2,4 +2,4 @@
// CHECK: error: unique id must be positive
- .section .text,"ax",@progbits,unique -1
+ .section .text,"ax",@progbits,unique, -1
diff --git a/llvm/test/MC/ELF/section-unique-err3.s b/llvm/test/MC/ELF/section-unique-err3.s
index 67e962bfac7..bbccd24b4af 100644
--- a/llvm/test/MC/ELF/section-unique-err3.s
+++ b/llvm/test/MC/ELF/section-unique-err3.s
@@ -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/llvm/test/MC/ELF/section-unique-err4.s b/llvm/test/MC/ELF/section-unique-err4.s
new file mode 100644
index 00000000000..3c82682e15a
--- /dev/null
+++ b/llvm/test/MC/ELF/section-unique-err4.s
@@ -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
diff --git a/llvm/test/MC/ELF/section-unique.s b/llvm/test/MC/ELF/section-unique.s
index ffd11d944c5..3fe727127af 100644
--- a/llvm/test/MC/ELF/section-unique.s
+++ b/llvm/test/MC/ELF/section-unique.s
@@ -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 {
OpenPOWER on IntegriCloud