diff --git a/test/RISCV/standalone/Relaxation/UnalignedCrash-QTOOL-105850/Inputs/1.s b/test/RISCV/standalone/Relaxation/InsufficientAlignmentRelaxation/Inputs/1.s similarity index 78% rename from test/RISCV/standalone/Relaxation/UnalignedCrash-QTOOL-105850/Inputs/1.s rename to test/RISCV/standalone/Relaxation/InsufficientAlignmentRelaxation/Inputs/1.s index 9e5c60ffa..b4717da84 100644 --- a/test/RISCV/standalone/Relaxation/UnalignedCrash-QTOOL-105850/Inputs/1.s +++ b/test/RISCV/standalone/Relaxation/InsufficientAlignmentRelaxation/Inputs/1.s @@ -1,10 +1,9 @@ .text .globl foo .type foo, @function - call norelax - call norelax - call norelax - call norelax + .option rvc + j 1f + .option norvc .balign 32 foo: nop // Add a relaxation relocation as RISC-V ABI demands that R_ALIGN @@ -16,4 +15,5 @@ foo: nop ret .size foo, .-foo -.equ norelax, 0x40000000 +1: + nop diff --git a/test/RISCV/standalone/Relaxation/UnalignedCrash-QTOOL-105850/Inputs/1.t b/test/RISCV/standalone/Relaxation/InsufficientAlignmentRelaxation/Inputs/1.t similarity index 61% rename from test/RISCV/standalone/Relaxation/UnalignedCrash-QTOOL-105850/Inputs/1.t rename to test/RISCV/standalone/Relaxation/InsufficientAlignmentRelaxation/Inputs/1.t index fc879f60d..fa6583ca7 100644 --- a/test/RISCV/standalone/Relaxation/UnalignedCrash-QTOOL-105850/Inputs/1.t +++ b/test/RISCV/standalone/Relaxation/InsufficientAlignmentRelaxation/Inputs/1.t @@ -1,5 +1,5 @@ SECTIONS { - text (0xFE1) : { + text (0x0) : { *(.text) } } diff --git a/test/RISCV/standalone/Relaxation/InsufficientAlignmentRelaxation/InsufficientAlignmentRelaxation.test b/test/RISCV/standalone/Relaxation/InsufficientAlignmentRelaxation/InsufficientAlignmentRelaxation.test new file mode 100644 index 000000000..507d29f14 --- /dev/null +++ b/test/RISCV/standalone/Relaxation/InsufficientAlignmentRelaxation/InsufficientAlignmentRelaxation.test @@ -0,0 +1,12 @@ +#----------InsufficientAlignmentRelaxation.test----------------- Executable------------------# +# BEGIN_COMMENT +# This test checks that the linker correctly emits insufficient bytes for alignment +# relaxation error. +# END_COMMENT +# START_TEST +RUN: %clang %clangopts -c %p/Inputs/1.s -o %t.1.o +RUN: %objdump -dr %t.1.o +RUN: %not %link %linkopts -o %t.1.out %t.1.o -T %p/Inputs/1.t 2>&1 | %filecheck %s +# END_TEST + +CHECK: Error: Insufficient number of spare bytes for alignment relaxation: present 28, needed 30 in section .text+0x20 file {{.*}}1.o diff --git a/test/RISCV/standalone/Relaxation/UnalignedCrash-QTOOL-105850/UnalignedCrash-QTOOL-105850.test b/test/RISCV/standalone/Relaxation/UnalignedCrash-QTOOL-105850/UnalignedCrash-QTOOL-105850.test deleted file mode 100644 index a913e0d0a..000000000 --- a/test/RISCV/standalone/Relaxation/UnalignedCrash-QTOOL-105850/UnalignedCrash-QTOOL-105850.test +++ /dev/null @@ -1,9 +0,0 @@ -#----------UnalignedCrash-QTOOL-105850.test----------------- Executable------------------# -# BEGIN_COMMENT -# Test that the linker does not crash. -# END_COMMENT -# START_TEST -#RUN: %clang %clangopts -c %p/Inputs/1.s -o %t.o -#RUN: not %link %linkopts %t.o -T %p/Inputs/1.t -o %t.out 2>&1 | %filecheck %s -# CHECK: Error: Insufficient number of spare bytes for alignment relaxation: present 30, needed 31 in section .text+{{.+}} file {{.*}}.o -# END_TEST