1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

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
This commit is contained in:
Rafael Espindola 2015-04-06 16:34:41 +00:00
parent 2458a92e2b
commit 6fa49967ca
8 changed files with 18 additions and 10 deletions

View File

@ -178,10 +178,10 @@ For example, the following code creates two sections named ``.text``.
.. code-block:: gas .. code-block:: gas
.section .text,"ax",@progbits,unique 1 .section .text,"ax",@progbits,unique,1
nop nop
.section .text,"ax",@progbits,unique 2 .section .text,"ax",@progbits,unique,2
nop nop

View File

@ -470,6 +470,9 @@ bool ELFAsmParser::ParseSectionArguments(bool IsPush, SMLoc loc) {
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
if (UniqueStr != "unique") if (UniqueStr != "unique")
return TokError("expected 'unique'"); return TokError("expected 'unique'");
if (getLexer().isNot(AsmToken::Comma))
return TokError("expected commma");
Lex();
if (getParser().parseAbsoluteExpression(UniqueID)) if (getParser().parseAbsoluteExpression(UniqueID))
return true; return true;
if (UniqueID < 0) if (UniqueID < 0)

View File

@ -149,7 +149,7 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
} }
if (isUnique()) if (isUnique())
OS << ",unique " << UniqueID; OS << ",unique," << UniqueID;
OS << '\n'; OS << '\n';

View File

@ -2,4 +2,4 @@
// CHECK: error: expected absolute expression // CHECK: error: expected absolute expression
.section .text,"ax",@progbits,unique "abc" .section .text,"ax",@progbits,unique, "abc"

View File

@ -2,4 +2,4 @@
// CHECK: error: unique id must be positive // CHECK: error: unique id must be positive
.section .text,"ax",@progbits,unique -1 .section .text,"ax",@progbits,unique, -1

View File

@ -2,4 +2,4 @@
// CHECK: error: unique id is too large // CHECK: error: unique id is too large
.section .text,"ax",@progbits,unique 4294967295 .section .text,"ax",@progbits,unique, 4294967295

View File

@ -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

View 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 -o - | FileCheck %s
// RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj -t | FileCheck %s --check-prefix=OBJ // 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 .globl f
f: f:
nop nop
.section .text,"ax",@progbits,unique 4294967294 .section .text,"ax",@progbits,unique, 4294967294
.globl g .globl g
g: g:
nop nop
// test that f and g are in different sections. // 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: f:
// CHECK: .section .text,"ax",@progbits,unique 4294967294 // CHECK: .section .text,"ax",@progbits,unique,4294967294
// CHECK: g: // CHECK: g:
// OBJ: Symbol { // OBJ: Symbol {