summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-01-30 04:46:41 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-01-30 04:46:41 +0000
commit09f38a0ef13bf542f7b3f1862d718e33e7de587b (patch)
treec82a746a55e2173bda6e65335d953fcaf7d13eab /test
parent459c9497772f7d4e8567233a99f126198ec93b68 (diff)
downloadllvm-09f38a0ef13bf542f7b3f1862d718e33e7de587b.tar.gz
llvm-09f38a0ef13bf542f7b3f1862d718e33e7de587b.tar.bz2
llvm-09f38a0ef13bf542f7b3f1862d718e33e7de587b.tar.xz
ARM IAS: support .object_arch
The .object_arch directive indicates an alternative architecture to be specified in the object file. The directive does *not* effect the enabled feature bits for the object file generation. This is particularly useful when the code performs runtime detection and would like to indicate a lower architecture as the requirements than the actual instructions used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200451 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/MC/ARM/directive-object_arch-2.s22
-rw-r--r--test/MC/ARM/directive-object_arch-3.s11
-rw-r--r--test/MC/ARM/directive-object_arch-diagnostics.s23
-rw-r--r--test/MC/ARM/directive-object_arch.s22
4 files changed, 78 insertions, 0 deletions
diff --git a/test/MC/ARM/directive-object_arch-2.s b/test/MC/ARM/directive-object_arch-2.s
new file mode 100644
index 0000000000..3aca434a1e
--- /dev/null
+++ b/test/MC/ARM/directive-object_arch-2.s
@@ -0,0 +1,22 @@
+@ RUN: llvm-mc -triple armv7-eabi -filetype obj -o - %s \
+@ RUN: | llvm-readobj -arm-attributes | FileCheck %s
+
+ .syntax unified
+
+ .object_arch armv4
+ .arch armv7
+
+@ CHECK: FileAttributes {
+@ CHECK: Attribute {
+@ CHECK: Tag: 5
+@ CHECK: TagName: CPU_name
+@ CHECK: Value: 7
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 6
+@ CHEKC: Value: 1
+@ CHECK: TagName: CPU_arch
+@ CHECK: Description: ARM v4
+@ CHECK: }
+@ CHECK: }
+
diff --git a/test/MC/ARM/directive-object_arch-3.s b/test/MC/ARM/directive-object_arch-3.s
new file mode 100644
index 0000000000..5dd26197ab
--- /dev/null
+++ b/test/MC/ARM/directive-object_arch-3.s
@@ -0,0 +1,11 @@
+@ RUN: llvm-mc -triple armv7-eabi -filetype asm -o - %s | FileCheck %s
+
+ .syntax unified
+
+ .arch armv7
+ .object_arch armv4
+
+@ CHECK: .text
+@ CHECK: .arch armv7
+@ CHECK: .object_arch armv4
+
diff --git a/test/MC/ARM/directive-object_arch-diagnostics.s b/test/MC/ARM/directive-object_arch-diagnostics.s
new file mode 100644
index 0000000000..91b15c8d2d
--- /dev/null
+++ b/test/MC/ARM/directive-object_arch-diagnostics.s
@@ -0,0 +1,23 @@
+@ RUN: not llvm-mc -triple armv7-eabi -filetype asm -o /dev/null %s 2>&1 \
+@ RUN: | FileCheck %s
+
+ .syntax unified
+
+ .object_arch i686
+
+@ CHECK: error: unknown architecture 'i686'
+@ CHECK: .object_arch i686
+@ CHECK: ^
+
+ .object_arch armv4!
+
+@ CHECK: error: unexpected token
+@ CHECK: .object_arch armv4!
+@ CHECK: ^
+
+ .object_arch, invalid
+
+@ CHECK: error: unexpected token
+@ CHECK: .object_arch, invalid
+@ CHECK: ^
+
diff --git a/test/MC/ARM/directive-object_arch.s b/test/MC/ARM/directive-object_arch.s
new file mode 100644
index 0000000000..0707077630
--- /dev/null
+++ b/test/MC/ARM/directive-object_arch.s
@@ -0,0 +1,22 @@
+@ RUN: llvm-mc -triple armv7-eabi -filetype obj -o - %s \
+@ RUN: | llvm-readobj -arm-attributes | FileCheck %s
+
+ .syntax unified
+
+ .arch armv7
+ .object_arch armv4
+
+@ CHECK: FileAttributes {
+@ CHECK: Attribute {
+@ CHECK: Tag: 5
+@ CHECK: TagName: CPU_name
+@ CHECK: Value: 7
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 6
+@ CHEKC: Value: 1
+@ CHECK: TagName: CPU_arch
+@ CHECK: Description: ARM v4
+@ CHECK: }
+@ CHECK: }
+