[lld] 4b5dbc7 - [ELF][test] Improve aarch64 tests

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 6 11:51:07 PST 2021


Author: Fangrui Song
Date: 2021-02-06T11:50:57-08:00
New Revision: 4b5dbc7a3b98d1dd62a9c278dfd1c2526d699d96

URL: https://github.com/llvm/llvm-project/commit/4b5dbc7a3b98d1dd62a9c278dfd1c2526d699d96
DIFF: https://github.com/llvm/llvm-project/commit/4b5dbc7a3b98d1dd62a9c278dfd1c2526d699d96.diff

LOG: [ELF][test] Improve aarch64 tests

Added: 
    

Modified: 
    lld/test/ELF/aarch64-abs16.s
    lld/test/ELF/aarch64-abs32.s
    lld/test/ELF/aarch64-data-relocs.s
    lld/test/ELF/aarch64-prel16.s
    lld/test/ELF/aarch64-prel32.s
    lld/test/ELF/emulation-aarch64.s

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/aarch64-abs16.s b/lld/test/ELF/aarch64-abs16.s
index ee878ce7f565..a0abe0fa79d7 100644
--- a/lld/test/ELF/aarch64-abs16.s
+++ b/lld/test/ELF/aarch64-abs16.s
@@ -1,8 +1,8 @@
 // REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs255.s -o %t255.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs256.s -o %t256.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs257.s -o %t257.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs255.s -o %t255.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs256.s -o %t256.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs257.s -o %t257.o
 
 .globl _start
 _start:
@@ -10,15 +10,15 @@ _start:
   .hword foo + 0xfeff
   .hword foo - 0x8100
 
-// RUN: ld.lld %t.o %t256.o -o %t2
-// RUN: llvm-objdump -s --section=.data %t2 | FileCheck %s
+// RUN: ld.lld %t.o %t256.o -o %t
+// RUN: llvm-objdump -s --section=.data %t | FileCheck %s --check-prefixes=CHECK,LE
 
 // CHECK: Contents of section .data:
 // 220158: S = 0x100, A = 0xfeff
 //         S + A = 0xffff
 // 22015c: S = 0x100, A = -0x8100
 //         S + A = 0x8000
-// CHECK-NEXT: 220158 ffff0080
+// LE-NEXT: 220158 ffff0080
 
 // RUN: not ld.lld %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
 // OVERFLOW1: relocation R_AARCH64_ABS16 out of range: -32769 is not in [-32768, 65535]; references foo

diff  --git a/lld/test/ELF/aarch64-abs32.s b/lld/test/ELF/aarch64-abs32.s
index 147bdc0758cb..42a7ca803e8e 100644
--- a/lld/test/ELF/aarch64-abs32.s
+++ b/lld/test/ELF/aarch64-abs32.s
@@ -1,8 +1,8 @@
 // REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs255.s -o %t255.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs256.s -o %t256.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs257.s -o %t257.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs255.s -o %t255.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs256.s -o %t256.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs257.s -o %t257.o
 
 .globl _start
 _start:
@@ -10,15 +10,15 @@ _start:
   .word foo + 0xfffffeff
   .word foo - 0x80000100
 
-// RUN: ld.lld %t.o %t256.o -o %t2
-// RUN: llvm-objdump -s --section=.data %t2 | FileCheck %s
+// RUN: ld.lld %t.o %t256.o -o %t
+// RUN: llvm-objdump -s --section=.data %t | FileCheck %s --check-prefixes=CHECK,LE
 
 // CHECK: Contents of section .data:
 // 220158: S = 0x100, A = 0xfffffeff
 //         S + A = 0xffffffff
 // 22015c: S = 0x100, A = -0x80000100
 //         S + A = 0x80000000
-// CHECK-NEXT: 220158 ffffffff 00000080
+// LE-NEXT: 220158 ffffffff 00000080
 
 // RUN: not ld.lld %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
 // OVERFLOW1: relocation R_AARCH64_ABS32 out of range: -2147483649 is not in [-2147483648, 4294967295]; references foo

diff  --git a/lld/test/ELF/aarch64-data-relocs.s b/lld/test/ELF/aarch64-data-relocs.s
index 9927215a585c..aa55cce4b7aa 100644
--- a/lld/test/ELF/aarch64-data-relocs.s
+++ b/lld/test/ELF/aarch64-data-relocs.s
@@ -1,8 +1,8 @@
 // REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs256.s -o %t256.o
-// RUN: ld.lld %t %t256.o -o %t2
-// RUN: llvm-objdump -s %t2 | FileCheck %s
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs256.s -o %t256.o
+// RUN: ld.lld %t.o %t256.o -o %t
+// RUN: llvm-objdump -s %t | FileCheck %s --check-prefixes=CHECK,LE
 
 .globl _start
 _start:
@@ -12,11 +12,11 @@ _start:
 // S = 0x100, A = 0x24
 // S + A = 0x124
 // CHECK: Contents of section .R_AARCH64_ABS64:
-// CHECK-NEXT: 210120 24010000 00000000
+// LE-NEXT: 210120 24010000 00000000
 
 .section .R_AARCH64_PREL64, "ax", at progbits
   .xword foo - . + 0x24
 
 // S + A - P = 0x100 + 0x24 - 0x210128 = 0xffffffffffdefffc
 // CHECK: Contents of section .R_AARCH64_PREL64:
-// CHECK-NEXT: 210128 fcffdeff ffffffff
+// LE-NEXT: 210128 fcffdeff ffffffff

diff  --git a/lld/test/ELF/aarch64-prel16.s b/lld/test/ELF/aarch64-prel16.s
index 2335dfb5cd70..cdebd2dabee5 100644
--- a/lld/test/ELF/aarch64-prel16.s
+++ b/lld/test/ELF/aarch64-prel16.s
@@ -1,8 +1,8 @@
 // REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs255.s -o %t255.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs256.s -o %t256.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs257.s -o %t257.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs255.s -o %t255.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs256.s -o %t256.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs257.s -o %t257.o
 
 .globl _start
 _start:
@@ -14,15 +14,15 @@ _start:
 //       the change of the address of the .data section.
 //       You may found the correct address in the aarch64_abs16.s test,
 //       if it is already fixed. Then, update addends accordingly.
-// RUN: ld.lld -z max-page-size=4096 %t.o %t256.o -o %t2
-// RUN: llvm-objdump -s --section=.data %t2 | FileCheck %s
+// RUN: ld.lld -z max-page-size=4096 %t.o %t256.o -o %t
+// RUN: llvm-objdump -s --section=.data %t | FileCheck %s --check-prefixes=CHECK,LE
 
 // CHECK: Contents of section .data:
 // 202158: S = 0x100, A = 0x212157, P = 0x202158
 //         S + A - P = 0xffff
 // 212a5a: S = 0x100, A = 0x1fa05a, P = 0x20215a
 //         S + A - P = 0x8000
-// CHECK-NEXT: 202158 ffff0080
+// LE-NEXT: 202158 ffff0080
 
 // RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
 // OVERFLOW1: relocation R_AARCH64_PREL16 out of range: -32769 is not in [-32768, 65535]; references foo

diff  --git a/lld/test/ELF/aarch64-prel32.s b/lld/test/ELF/aarch64-prel32.s
index 8dd71792e2ed..0fd72b96dcb5 100644
--- a/lld/test/ELF/aarch64-prel32.s
+++ b/lld/test/ELF/aarch64-prel32.s
@@ -1,8 +1,8 @@
 // REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs255.s -o %t255.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs256.s -o %t256.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %S/Inputs/abs257.s -o %t257.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs255.s -o %t255.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs256.s -o %t256.o
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/abs257.s -o %t257.o
 
 .globl _start
 _start:
@@ -14,15 +14,15 @@ _start:
 //       the change of the address of the .data section.
 //       You may found the correct address in the aarch64_abs32.s test,
 //       if it is already fixed. Then, update addends accordingly.
-// RUN: ld.lld -z max-page-size=4096 %t.o %t256.o -o %t2
-// RUN: llvm-objdump -s --section=.data %t2 | FileCheck %s
+// RUN: ld.lld -z max-page-size=4096 %t.o %t256.o -o %t
+// RUN: llvm-objdump -s --section=.data %t | FileCheck %s --check-prefixes=CHECK,LE
 
 // CHECK: Contents of section .data:
 // 202158: S = 0x100, A = 0x100202057, P = 0x202158
 //         S + A - P = 0xffffffff
 // 20215c: S = 0x100, A = -0x7fdfdfa4, P = 0x20215c
 //         S + A - P = 0x80000000
-// CHECK-NEXT: 202158 ffffffff 00000080
+// LE-NEXT: 202158 ffffffff 00000080
 
 // RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
 // OVERFLOW1: relocation R_AARCH64_PREL32 out of range: -2147483649 is not in [-2147483648, 4294967295]; references foo

diff  --git a/lld/test/ELF/emulation-aarch64.s b/lld/test/ELF/emulation-aarch64.s
index 2d2510674691..f7956f438690 100644
--- a/lld/test/ELF/emulation-aarch64.s
+++ b/lld/test/ELF/emulation-aarch64.s
@@ -1,21 +1,22 @@
 # REQUIRES: aarch64
-# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %taarch64
-# RUN: ld.lld -m aarch64linux %taarch64 -o %t2aarch64
-# RUN: llvm-readobj --file-headers %t2aarch64 | FileCheck --check-prefix=AARCH64 %s
-# RUN: ld.lld -m aarch64elf %taarch64 -o %t3aarch64
-# RUN: llvm-readobj --file-headers %t3aarch64 | FileCheck --check-prefix=AARCH64 %s
-# RUN: ld.lld -m aarch64_elf64_le_vec %taarch64 -o %t4aarch64
-# RUN: llvm-readobj --file-headers %t4aarch64 | FileCheck --check-prefix=AARCH64 %s
-# RUN: ld.lld %taarch64 -o %t5aarch64
-# RUN: llvm-readobj --file-headers %t5aarch64 | FileCheck --check-prefix=AARCH64 %s
-# RUN: echo 'OUTPUT_FORMAT(elf64-littleaarch64)' > %t4aarch64.script
-# RUN: ld.lld %t4aarch64.script %taarch64 -o %t4aarch64
-# RUN: llvm-readobj --file-headers %t4aarch64 | FileCheck --check-prefix=AARCH64 %s
+# RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-readobj --file-headers %t | FileCheck --check-prefixes=AARCH64,LE %s
+# RUN: ld.lld -m aarch64linux %t.o -o %t1
+# RUN: llvm-readobj --file-headers %t1 | FileCheck --check-prefixes=AARCH64,LE %s
+# RUN: ld.lld -m aarch64elf %t.o -o %t2
+# RUN: llvm-readobj --file-headers %t2 | FileCheck --check-prefixes=AARCH64,LE %s
+# RUN: echo 'OUTPUT_FORMAT(elf64-littleaarch64)' > %t.script
+# RUN: ld.lld %t.script %t.o -o %t3
+# RUN: llvm-readobj --file-headers %t3 | FileCheck --check-prefixes=AARCH64,LE %s
+# RUN: ld.lld -m aarch64_elf64_le_vec %t.o -o %taosp
+# RUN: llvm-readobj --file-headers %taosp | FileCheck --check-prefixes=AARCH64,LE %s
+
 # AARCH64:      ElfHeader {
 # AARCH64-NEXT:   Ident {
 # AARCH64-NEXT:     Magic: (7F 45 4C 46)
 # AARCH64-NEXT:     Class: 64-bit (0x2)
-# AARCH64-NEXT:     DataEncoding: LittleEndian (0x1)
+# LE-NEXT:          DataEncoding: LittleEndian (0x1)
 # AARCH64-NEXT:     FileVersion: 1
 # AARCH64-NEXT:     OS/ABI: SystemV (0x0)
 # AARCH64-NEXT:     ABIVersion: 0
@@ -30,10 +31,10 @@
 # AARCH64-NEXT:   Flags [ (0x0)
 # AARCH64-NEXT:   ]
 
-# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %taarch64fbsd
-# RUN: echo 'OUTPUT_FORMAT(elf64-aarch64-freebsd)' > %taarch64fbsd.script
-# RUN: ld.lld %taarch64fbsd.script %taarch64fbsd -o %t2aarch64fbsd
-# RUN: llvm-readobj --file-headers %t2aarch64fbsd | FileCheck --check-prefix=AARCH64-FBSD %s
+# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %tfbsd.o
+# RUN: echo 'OUTPUT_FORMAT(elf64-aarch64-freebsd)' > %tfbsd.script
+# RUN: ld.lld %tfbsd.script %tfbsd.o -o %tfbsd
+# RUN: llvm-readobj --file-headers %tfbsd | FileCheck --check-prefix=AARCH64-FBSD %s
 # AARCH64-FBSD:      ElfHeader {
 # AARCH64-FBSD-NEXT:   Ident {
 # AARCH64-FBSD-NEXT:     Magic: (7F 45 4C 46)


        


More information about the llvm-commits mailing list