Skip to content

Commit 4b5dbc7

Browse files
committed
[ELF][test] Improve aarch64 tests
1 parent 28d3132 commit 4b5dbc7

File tree

6 files changed

+52
-51
lines changed

6 files changed

+52
-51
lines changed

lld/test/ELF/aarch64-abs16.s

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
// REQUIRES: aarch64
2-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
3-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs255.s -o %t255.o
4-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs256.s -o %t256.o
5-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs257.s -o %t257.o
2+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
3+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs255.s -o %t255.o
4+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs256.s -o %t256.o
5+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs257.s -o %t257.o
66

77
.globl _start
88
_start:
99
.data
1010
.hword foo + 0xfeff
1111
.hword foo - 0x8100
1212

13-
// RUN: ld.lld %t.o %t256.o -o %t2
14-
// RUN: llvm-objdump -s --section=.data %t2 | FileCheck %s
13+
// RUN: ld.lld %t.o %t256.o -o %t
14+
// RUN: llvm-objdump -s --section=.data %t | FileCheck %s --check-prefixes=CHECK,LE
1515

1616
// CHECK: Contents of section .data:
1717
// 220158: S = 0x100, A = 0xfeff
1818
// S + A = 0xffff
1919
// 22015c: S = 0x100, A = -0x8100
2020
// S + A = 0x8000
21-
// CHECK-NEXT: 220158 ffff0080
21+
// LE-NEXT: 220158 ffff0080
2222

2323
// RUN: not ld.lld %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
2424
// OVERFLOW1: relocation R_AARCH64_ABS16 out of range: -32769 is not in [-32768, 65535]; references foo

lld/test/ELF/aarch64-abs32.s

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
// REQUIRES: aarch64
2-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
3-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs255.s -o %t255.o
4-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs256.s -o %t256.o
5-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs257.s -o %t257.o
2+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
3+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs255.s -o %t255.o
4+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs256.s -o %t256.o
5+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs257.s -o %t257.o
66

77
.globl _start
88
_start:
99
.data
1010
.word foo + 0xfffffeff
1111
.word foo - 0x80000100
1212

13-
// RUN: ld.lld %t.o %t256.o -o %t2
14-
// RUN: llvm-objdump -s --section=.data %t2 | FileCheck %s
13+
// RUN: ld.lld %t.o %t256.o -o %t
14+
// RUN: llvm-objdump -s --section=.data %t | FileCheck %s --check-prefixes=CHECK,LE
1515

1616
// CHECK: Contents of section .data:
1717
// 220158: S = 0x100, A = 0xfffffeff
1818
// S + A = 0xffffffff
1919
// 22015c: S = 0x100, A = -0x80000100
2020
// S + A = 0x80000000
21-
// CHECK-NEXT: 220158 ffffffff 00000080
21+
// LE-NEXT: 220158 ffffffff 00000080
2222

2323
// RUN: not ld.lld %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
2424
// OVERFLOW1: relocation R_AARCH64_ABS32 out of range: -2147483649 is not in [-2147483648, 4294967295]; references foo

lld/test/ELF/aarch64-data-relocs.s

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: aarch64
2-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t
3-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs256.s -o %t256.o
4-
// RUN: ld.lld %t %t256.o -o %t2
5-
// RUN: llvm-objdump -s %t2 | FileCheck %s
2+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
3+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs256.s -o %t256.o
4+
// RUN: ld.lld %t.o %t256.o -o %t
5+
// RUN: llvm-objdump -s %t | FileCheck %s --check-prefixes=CHECK,LE
66

77
.globl _start
88
_start:
@@ -12,11 +12,11 @@ _start:
1212
// S = 0x100, A = 0x24
1313
// S + A = 0x124
1414
// CHECK: Contents of section .R_AARCH64_ABS64:
15-
// CHECK-NEXT: 210120 24010000 00000000
15+
// LE-NEXT: 210120 24010000 00000000
1616

1717
.section .R_AARCH64_PREL64, "ax",@progbits
1818
.xword foo - . + 0x24
1919

2020
// S + A - P = 0x100 + 0x24 - 0x210128 = 0xffffffffffdefffc
2121
// CHECK: Contents of section .R_AARCH64_PREL64:
22-
// CHECK-NEXT: 210128 fcffdeff ffffffff
22+
// LE-NEXT: 210128 fcffdeff ffffffff

lld/test/ELF/aarch64-prel16.s

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: aarch64
2-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
3-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs255.s -o %t255.o
4-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs256.s -o %t256.o
5-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs257.s -o %t257.o
2+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
3+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs255.s -o %t255.o
4+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs256.s -o %t256.o
5+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs257.s -o %t257.o
66

77
.globl _start
88
_start:
@@ -14,15 +14,15 @@ _start:
1414
// the change of the address of the .data section.
1515
// You may found the correct address in the aarch64_abs16.s test,
1616
// if it is already fixed. Then, update addends accordingly.
17-
// RUN: ld.lld -z max-page-size=4096 %t.o %t256.o -o %t2
18-
// RUN: llvm-objdump -s --section=.data %t2 | FileCheck %s
17+
// RUN: ld.lld -z max-page-size=4096 %t.o %t256.o -o %t
18+
// RUN: llvm-objdump -s --section=.data %t | FileCheck %s --check-prefixes=CHECK,LE
1919

2020
// CHECK: Contents of section .data:
2121
// 202158: S = 0x100, A = 0x212157, P = 0x202158
2222
// S + A - P = 0xffff
2323
// 212a5a: S = 0x100, A = 0x1fa05a, P = 0x20215a
2424
// S + A - P = 0x8000
25-
// CHECK-NEXT: 202158 ffff0080
25+
// LE-NEXT: 202158 ffff0080
2626

2727
// RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
2828
// OVERFLOW1: relocation R_AARCH64_PREL16 out of range: -32769 is not in [-32768, 65535]; references foo

lld/test/ELF/aarch64-prel32.s

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: aarch64
2-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
3-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs255.s -o %t255.o
4-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs256.s -o %t256.o
5-
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs257.s -o %t257.o
2+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
3+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs255.s -o %t255.o
4+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs256.s -o %t256.o
5+
// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs257.s -o %t257.o
66

77
.globl _start
88
_start:
@@ -14,15 +14,15 @@ _start:
1414
// the change of the address of the .data section.
1515
// You may found the correct address in the aarch64_abs32.s test,
1616
// if it is already fixed. Then, update addends accordingly.
17-
// RUN: ld.lld -z max-page-size=4096 %t.o %t256.o -o %t2
18-
// RUN: llvm-objdump -s --section=.data %t2 | FileCheck %s
17+
// RUN: ld.lld -z max-page-size=4096 %t.o %t256.o -o %t
18+
// RUN: llvm-objdump -s --section=.data %t | FileCheck %s --check-prefixes=CHECK,LE
1919

2020
// CHECK: Contents of section .data:
2121
// 202158: S = 0x100, A = 0x100202057, P = 0x202158
2222
// S + A - P = 0xffffffff
2323
// 20215c: S = 0x100, A = -0x7fdfdfa4, P = 0x20215c
2424
// S + A - P = 0x80000000
25-
// CHECK-NEXT: 202158 ffffffff 00000080
25+
// LE-NEXT: 202158 ffffffff 00000080
2626

2727
// RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
2828
// OVERFLOW1: relocation R_AARCH64_PREL32 out of range: -2147483649 is not in [-2147483648, 4294967295]; references foo

lld/test/ELF/emulation-aarch64.s

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
# REQUIRES: aarch64
2-
# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %taarch64
3-
# RUN: ld.lld -m aarch64linux %taarch64 -o %t2aarch64
4-
# RUN: llvm-readobj --file-headers %t2aarch64 | FileCheck --check-prefix=AARCH64 %s
5-
# RUN: ld.lld -m aarch64elf %taarch64 -o %t3aarch64
6-
# RUN: llvm-readobj --file-headers %t3aarch64 | FileCheck --check-prefix=AARCH64 %s
7-
# RUN: ld.lld -m aarch64_elf64_le_vec %taarch64 -o %t4aarch64
8-
# RUN: llvm-readobj --file-headers %t4aarch64 | FileCheck --check-prefix=AARCH64 %s
9-
# RUN: ld.lld %taarch64 -o %t5aarch64
10-
# RUN: llvm-readobj --file-headers %t5aarch64 | FileCheck --check-prefix=AARCH64 %s
11-
# RUN: echo 'OUTPUT_FORMAT(elf64-littleaarch64)' > %t4aarch64.script
12-
# RUN: ld.lld %t4aarch64.script %taarch64 -o %t4aarch64
13-
# RUN: llvm-readobj --file-headers %t4aarch64 | FileCheck --check-prefix=AARCH64 %s
2+
# RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
3+
# RUN: ld.lld %t.o -o %t
4+
# RUN: llvm-readobj --file-headers %t | FileCheck --check-prefixes=AARCH64,LE %s
5+
# RUN: ld.lld -m aarch64linux %t.o -o %t1
6+
# RUN: llvm-readobj --file-headers %t1 | FileCheck --check-prefixes=AARCH64,LE %s
7+
# RUN: ld.lld -m aarch64elf %t.o -o %t2
8+
# RUN: llvm-readobj --file-headers %t2 | FileCheck --check-prefixes=AARCH64,LE %s
9+
# RUN: echo 'OUTPUT_FORMAT(elf64-littleaarch64)' > %t.script
10+
# RUN: ld.lld %t.script %t.o -o %t3
11+
# RUN: llvm-readobj --file-headers %t3 | FileCheck --check-prefixes=AARCH64,LE %s
12+
# RUN: ld.lld -m aarch64_elf64_le_vec %t.o -o %taosp
13+
# RUN: llvm-readobj --file-headers %taosp | FileCheck --check-prefixes=AARCH64,LE %s
14+
1415
# AARCH64: ElfHeader {
1516
# AARCH64-NEXT: Ident {
1617
# AARCH64-NEXT: Magic: (7F 45 4C 46)
1718
# AARCH64-NEXT: Class: 64-bit (0x2)
18-
# AARCH64-NEXT: DataEncoding: LittleEndian (0x1)
19+
# LE-NEXT: DataEncoding: LittleEndian (0x1)
1920
# AARCH64-NEXT: FileVersion: 1
2021
# AARCH64-NEXT: OS/ABI: SystemV (0x0)
2122
# AARCH64-NEXT: ABIVersion: 0
@@ -30,10 +31,10 @@
3031
# AARCH64-NEXT: Flags [ (0x0)
3132
# AARCH64-NEXT: ]
3233

33-
# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %taarch64fbsd
34-
# RUN: echo 'OUTPUT_FORMAT(elf64-aarch64-freebsd)' > %taarch64fbsd.script
35-
# RUN: ld.lld %taarch64fbsd.script %taarch64fbsd -o %t2aarch64fbsd
36-
# RUN: llvm-readobj --file-headers %t2aarch64fbsd | FileCheck --check-prefix=AARCH64-FBSD %s
34+
# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %tfbsd.o
35+
# RUN: echo 'OUTPUT_FORMAT(elf64-aarch64-freebsd)' > %tfbsd.script
36+
# RUN: ld.lld %tfbsd.script %tfbsd.o -o %tfbsd
37+
# RUN: llvm-readobj --file-headers %tfbsd | FileCheck --check-prefix=AARCH64-FBSD %s
3738
# AARCH64-FBSD: ElfHeader {
3839
# AARCH64-FBSD-NEXT: Ident {
3940
# AARCH64-FBSD-NEXT: Magic: (7F 45 4C 46)

0 commit comments

Comments
 (0)