[lld] r357997 - Move tests in r357996 to correct location within monorepo
Chih-Mao Chen via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 04:46:47 PDT 2019
Author: pkmx
Date: Tue Apr 9 04:46:47 2019
New Revision: 357997
URL: http://llvm.org/viewvc/llvm-project?rev=357997&view=rev
Log:
Move tests in r357996 to correct location within monorepo
Added:
lld/trunk/test/ELF/riscv-branch.s
lld/trunk/test/ELF/riscv-call.s
lld/trunk/test/ELF/riscv-hi20-lo12.s
lld/trunk/test/ELF/riscv-jal.s
lld/trunk/test/ELF/riscv-pcrel-hilo.s
Added: lld/trunk/test/ELF/riscv-branch.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv-branch.s?rev=357997&view=auto
==============================================================================
--- lld/trunk/test/ELF/riscv-branch.s (added)
+++ lld/trunk/test/ELF/riscv-branch.s Tue Apr 9 04:46:47 2019
@@ -0,0 +1,32 @@
+# REQUIRES: riscv
+
+# RUN: llvm-mc -filetype=obj -triple=riscv32-unknown-elf -mattr=-relax %s -o %t.rv32.o
+# RUN: llvm-mc -filetype=obj -triple=riscv64-unknown-elf -mattr=-relax %s -o %t.rv64.o
+
+# RUN: ld.lld %t.rv32.o --defsym foo=_start+4 --defsym bar=_start -o %t.rv32
+# RUN: ld.lld %t.rv64.o --defsym foo=_start+4 --defsym bar=_start -o %t.rv64
+# RUN: llvm-objdump -d %t.rv32 | FileCheck %s
+# RUN: llvm-objdump -d %t.rv64 | FileCheck %s
+# CHECK: 63 02 00 00 beqz zero, 4
+# CHECK: e3 1e 00 fe bnez zero, -4
+#
+# RUN: ld.lld %t.rv32.o --defsym foo=_start+0xffe --defsym bar=_start+4-0x1000 -o %t.rv32.limits
+# RUN: ld.lld %t.rv64.o --defsym foo=_start+0xffe --defsym bar=_start+4-0x1000 -o %t.rv64.limits
+# RUN: llvm-objdump -d %t.rv32.limits | FileCheck --check-prefix=LIMITS %s
+# RUN: llvm-objdump -d %t.rv64.limits | FileCheck --check-prefix=LIMITS %s
+# LIMITS: e3 0f 00 7e beqz zero, 4094
+# LIMITS-NEXT: 63 10 00 80 bnez zero, -4096
+
+# RUN: not ld.lld %t.rv32.o --defsym foo=_start+0x1000 --defsym bar=_start+4-0x1002 -o %t 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x1000 --defsym bar=_start+4-0x1002 -o %t 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
+# ERROR-RANGE: relocation R_RISCV_BRANCH out of range: 2048 is not in [-2048, 2047]
+# ERROR-RANGE-NEXT: relocation R_RISCV_BRANCH out of range: -2049 is not in [-2048, 2047]
+
+# RUN: not ld.lld %t.rv32.o --defsym foo=_start+1 --defsym bar=_start-1 -o %t 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+1 --defsym bar=_start-1 -o %t 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
+# ERROR-ALIGN: improper alignment for relocation R_RISCV_BRANCH: 0x1 is not aligned to 2 bytes
+
+.global _start
+_start:
+ beq x0, x0, foo
+ bne x0, x0, bar
Added: lld/trunk/test/ELF/riscv-call.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv-call.s?rev=357997&view=auto
==============================================================================
--- lld/trunk/test/ELF/riscv-call.s (added)
+++ lld/trunk/test/ELF/riscv-call.s Tue Apr 9 04:46:47 2019
@@ -0,0 +1,32 @@
+# REQUIRES: riscv
+
+# RUN: llvm-mc -filetype=obj -triple=riscv32-unknown-elf -mattr=-relax %s -o %t.rv32.o
+# RUN: llvm-mc -filetype=obj -triple=riscv64-unknown-elf -mattr=-relax %s -o %t.rv64.o
+
+# RUN: ld.lld %t.rv32.o --defsym foo=_start+8 --defsym bar=_start -o %t.rv32
+# RUN: ld.lld %t.rv64.o --defsym foo=_start+8 --defsym bar=_start -o %t.rv64
+# RUN: llvm-objdump -d %t.rv32 | FileCheck %s
+# RUN: llvm-objdump -d %t.rv64 | FileCheck %s
+# CHECK: 97 00 00 00 auipc ra, 0
+# CHECK-NEXT: e7 80 80 00 jalr ra, ra, 8
+# CHECK: 97 00 00 00 auipc ra, 0
+# CHECK-NEXT: e7 80 80 ff jalr ra, ra, -8
+
+# RUN: ld.lld %t.rv32.o --defsym foo=_start+0x7ffff7ff --defsym bar=_start+8-0x80000800 -o %t.rv32.limits
+# RUN: ld.lld %t.rv64.o --defsym foo=_start+0x7ffff7ff --defsym bar=_start+8-0x80000800 -o %t.rv64.limits
+# RUN: llvm-objdump -d %t.rv32.limits | FileCheck --check-prefix=LIMITS %s
+# RUN: llvm-objdump -d %t.rv64.limits | FileCheck --check-prefix=LIMITS %s
+# LIMITS: 97 f0 ff 7f auipc ra, 524287
+# LIMITS-NEXT: e7 80 f0 7f jalr ra, ra, 2047
+# LIMITS-NEXT: 97 00 00 80 auipc ra, 524288
+# LIMITS-NEXT: e7 80 00 80 jalr ra, ra, -2048
+
+# RUN: ld.lld %t.rv32.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+8-0x80000801 -o %t
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+8-0x80000801 -o %t 2>&1 | FileCheck --check-prefix=ERROR %s
+# ERROR: relocation R_RISCV_CALL out of range: 524288 is not in [-524288, 524287]
+# ERROR-NEXT: relocation R_RISCV_CALL out of range: -524289 is not in [-524288, 524287]
+
+.global _start
+_start:
+ call foo
+ call bar
Added: lld/trunk/test/ELF/riscv-hi20-lo12.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv-hi20-lo12.s?rev=357997&view=auto
==============================================================================
--- lld/trunk/test/ELF/riscv-hi20-lo12.s (added)
+++ lld/trunk/test/ELF/riscv-hi20-lo12.s Tue Apr 9 04:46:47 2019
@@ -0,0 +1,40 @@
+# REQUIRES: riscv
+
+# RUN: llvm-mc -filetype=obj -triple=riscv32-unknown-elf -mattr=-relax %s -o %t.rv32.o
+# RUN: llvm-mc -filetype=obj -triple=riscv64-unknown-elf -mattr=-relax %s -o %t.rv64.o
+
+# RUN: ld.lld %t.rv32.o --defsym foo=0 --defsym bar=42 -o %t.rv32
+# RUN: ld.lld %t.rv64.o --defsym foo=0 --defsym bar=42 -o %t.rv64
+# RUN: llvm-objdump -d %t.rv32 | FileCheck %s
+# RUN: llvm-objdump -d %t.rv64 | FileCheck %s
+# CHECK: 37 05 00 00 lui a0, 0
+# CHECK-NEXT: 13 05 05 00 mv a0, a0
+# CHECK-NEXT: 23 20 a5 00 sw a0, 0(a0)
+# CHECK-NEXT: b7 05 00 00 lui a1, 0
+# CHECK-NEXT: 93 85 a5 02 addi a1, a1, 42
+# CHECK-NEXT: 23 a5 b5 02 sw a1, 42(a1)
+
+# RUN: ld.lld %t.rv32.o --defsym foo=0x7ffff7ff --defsym bar=0x7ffff800 -o %t.rv32.limits
+# RUN: ld.lld %t.rv64.o --defsym foo=0x7ffff7ff --defsym bar=0xffffffff7ffff800 -o %t.rv64.limits
+# RUN: llvm-objdump -d %t.rv32.limits | FileCheck --check-prefix=LIMITS %s
+# RUN: llvm-objdump -d %t.rv64.limits | FileCheck --check-prefix=LIMITS %s
+# LIMITS: 37 f5 ff 7f lui a0, 524287
+# LIMITS-NEXT: 13 05 f5 7f addi a0, a0, 2047
+# LIMITS-NEXT: a3 2f a5 7e sw a0, 2047(a0)
+# LIMITS-NEXT: b7 05 00 80 lui a1, 524288
+# LIMITS-NEXT: 93 85 05 80 addi a1, a1, -2048
+# LIMITS-NEXT: 23 a0 b5 80 sw a1, -2048(a1)
+
+# RUN: not ld.lld %t.rv64.o --defsym foo=0x7ffff800 --defsym bar=0xffffffff7ffff7ff -o %t 2>&1 | FileCheck --check-prefix ERROR %s
+# ERROR: relocation R_RISCV_HI20 out of range: 524288 is not in [-524288, 524287]
+# ERROR-NEXT: relocation R_RISCV_HI20 out of range: -524289 is not in [-524288, 524287]
+
+.global _start
+
+_start:
+ lui a0, %hi(foo)
+ addi a0, a0, %lo(foo)
+ sw a0, %lo(foo)(a0)
+ lui a1, %hi(bar)
+ addi a1, a1, %lo(bar)
+ sw a1, %lo(bar)(a1)
Added: lld/trunk/test/ELF/riscv-jal.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv-jal.s?rev=357997&view=auto
==============================================================================
--- lld/trunk/test/ELF/riscv-jal.s (added)
+++ lld/trunk/test/ELF/riscv-jal.s Tue Apr 9 04:46:47 2019
@@ -0,0 +1,34 @@
+# REQUIRES: riscv
+
+# RUN: llvm-mc -filetype=obj -triple=riscv32-unknown-elf -mattr=-relax %s -o %t.rv32.o
+# RUN: llvm-mc -filetype=obj -triple=riscv64-unknown-elf -mattr=-relax %s -o %t.rv64.o
+
+# RUN: ld.lld %t.rv32.o --defsym foo=_start+4 --defsym bar=_start -o %t.rv32
+# RUN: ld.lld %t.rv64.o --defsym foo=_start+4 --defsym bar=_start -o %t.rv64
+# RUN: llvm-objdump -d %t.rv32 | FileCheck %s
+# RUN: llvm-objdump -d %t.rv64 | FileCheck %s
+# CHECK: 6f 00 40 00 j 4
+# CHECK: ef f0 df ff jal -4
+
+# RUN: ld.lld %t.rv32.o --defsym foo=_start+0xffffe --defsym bar=_start+4-0x100000 -o %t.rv32.limits
+# RUN: ld.lld %t.rv64.o --defsym foo=_start+0xffffe --defsym bar=_start+4-0x100000 -o %t.rv64.limits
+# RUN: llvm-objdump -d %t.rv32.limits | FileCheck --check-prefix=LIMITS %s
+# RUN: llvm-objdump -d %t.rv64.limits | FileCheck --check-prefix=LIMITS %s
+# LIMITS: 6f f0 ff 7f j 1048574
+# LIMITS-NEXT: ef 00 00 80 jal -1048576
+
+# RUN: not ld.lld %t.rv32.o --defsym foo=_start+0x100000 --defsym bar=_start+4-0x100002 -o %t 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x100000 --defsym bar=_start+4-0x100002 -o %t 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
+# ERROR-RANGE: relocation R_RISCV_JAL out of range: 524288 is not in [-524288, 524287]
+# ERROR-RANGE-NEXT: relocation R_RISCV_JAL out of range: -524289 is not in [-524288, 524287]
+
+# RUN: not ld.lld %t.rv32.o --defsym foo=_start+1 --defsym bar=_start+4+3 -o %t 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+1 --defsym bar=_start+4+3 -o %t 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
+# ERROR-ALIGN: improper alignment for relocation R_RISCV_JAL: 0x1 is not aligned to 2 bytes
+# ERROR-ALIGN-NEXT: improper alignment for relocation R_RISCV_JAL: 0x3 is not aligned to 2 bytes
+
+.global _start
+
+_start:
+ jal x0, foo
+ jal x1, bar
Added: lld/trunk/test/ELF/riscv-pcrel-hilo.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv-pcrel-hilo.s?rev=357997&view=auto
==============================================================================
--- lld/trunk/test/ELF/riscv-pcrel-hilo.s (added)
+++ lld/trunk/test/ELF/riscv-pcrel-hilo.s Tue Apr 9 04:46:47 2019
@@ -0,0 +1,41 @@
+# REQUIRES: riscv
+
+# RUN: llvm-mc -filetype=obj -triple=riscv32-unknown-elf -mattr=-relax %s -o %t.rv32.o
+# RUN: llvm-mc -filetype=obj -triple=riscv64-unknown-elf -mattr=-relax %s -o %t.rv64.o
+
+# RUN: ld.lld %t.rv32.o --defsym foo=_start+12 --defsym bar=_start -o %t.rv32
+# RUN: ld.lld %t.rv64.o --defsym foo=_start+12 --defsym bar=_start -o %t.rv64
+# RUN: llvm-objdump -d %t.rv32 | FileCheck %s
+# RUN: llvm-objdump -d %t.rv64 | FileCheck %s
+# CHECK: 17 05 00 00 auipc a0, 0
+# CHECK-NEXT: 13 05 c5 00 addi a0, a0, 12
+# CHECK-NEXT: 23 26 05 00 sw zero, 12(a0)
+# CHECK: 17 05 00 00 auipc a0, 0
+# CHECK-NEXT: 13 05 45 ff addi a0, a0, -12
+# CHECK-NEXT: 23 2a 05 fe sw zero, -12(a0)
+
+# RUN: ld.lld %t.rv32.o --defsym foo=_start+0x7ffff7ff --defsym bar=_start+12-0x80000800 -o %t.rv32.limits
+# RUN: ld.lld %t.rv64.o --defsym foo=_start+0x7ffff7ff --defsym bar=_start+12-0x80000800 -o %t.rv64.limits
+# RUN: llvm-objdump -d %t.rv32.limits | FileCheck --check-prefix=LIMITS %s
+# RUN: llvm-objdump -d %t.rv64.limits | FileCheck --check-prefix=LIMITS %s
+# LIMITS: 17 f5 ff 7f auipc a0, 524287
+# LIMITS-NEXT: 13 05 f5 7f addi a0, a0, 2047
+# LIMITS-NEXT: a3 2f 05 7e sw zero, 2047(a0)
+# LIMITS: 17 05 00 80 auipc a0, 524288
+# LIMITS-NEXT: 13 05 05 80 addi a0, a0, -2048
+# LIMITS-NEXT: 23 20 05 80 sw zero, -2048(a0)
+
+# RUN: ld.lld %t.rv32.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+12-0x80000801 -o %t
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+12-0x80000801 -o %t 2>&1 | FileCheck --check-prefix=ERROR %s
+# ERROR: relocation R_RISCV_PCREL_HI20 out of range: 524288 is not in [-524288, 524287]
+# ERROR-NEXT: relocation R_RISCV_PCREL_HI20 out of range: -524289 is not in [-524288, 524287]
+
+.global _start
+_start:
+ auipc a0, %pcrel_hi(foo)
+ addi a0, a0, %pcrel_lo(_start)
+ sw x0, %pcrel_lo(_start)(a0)
+.L1:
+ auipc a0, %pcrel_hi(bar)
+ addi a0, a0, %pcrel_lo(.L1)
+ sw x0, %pcrel_lo(.L1)(a0)
More information about the llvm-commits
mailing list