]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: riscv: pr110812_*.c needs medany on rv32
authorAlexandre Oliva <oliva@adacore.com>
Sun, 1 Feb 2026 07:35:56 +0000 (04:35 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Sun, 1 Feb 2026 08:36:22 +0000 (05:36 -0300)
When linking the pr110812 units with lto after compiling them with a
riscv(32?) compiler that defaults to the medlow code model, the
compiler uses HI20 relocations that overflow with our linker scripts.

I suppose the test expects PC-relative relocations for symbol
resolution, as in the medany code model, so select that explicitly.

for  gcc/testsuite/ChangeLog

* gcc.target/riscv/lto/pr110812_0.c: Set cmodel explicitly.
* gcc.target/riscv/lto/pr110812_1.c: Likewise.

gcc/testsuite/gcc.target/riscv/lto/pr110812_0.c
gcc/testsuite/gcc.target/riscv/lto/pr110812_1.c

index a2f70928b1621a0f64147efd9f92c72d8542e99e..ab745e5ffec38788cef12fd323274f143c588bb0 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-lto-do link } */
-/* { dg-lto-options { { -flto -march=rv64gc -mabi=lp64d } } } */
+/* { dg-lto-options { { -flto -march=rv64gc -mabi=lp64d -mcmodel=medany } } } */
 /* { dg-extra-ld-options "-nostdlib" } */
 
 void foo();
index 34d7cbbbcbbb1ba562c01957c05e6ffd2941d47b..a84f92c6627d63b8f80e86e53ac0bb18cf781b4d 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-options { -flto -march=rv64gcv -mabi=lp64d } } */
+/* { dg-options { -flto -march=rv64gcv -mabi=lp64d -mcmodel=medany } } */
 
 #include "riscv_vector.h"
 uint8_t *x, *y;