On 7/6/2026 8:53 PM, Kito Cheng wrote:
TL;DR: I still prefer directly adding -ffat-lto-objects.
The reason is that we have already used several different ways to
handle the issue with Thin LTO objects.
So far, I found the following four ways to handle this issue in our
RISC-V testsuite directory:
1. /* { dg-skip-if "" { *-*-* } { "-flto" } } */
2. /* { dg-final { scan-assembler-times {...} 4 { target { no-opts
"-flto" } } } } */
3. /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
4. /* { dg-options "-ffat-lto-objects" } */
Some statistics:
$ pwd
/home/kitoc/riscv-gnu-workspace/riscv-gnu-toolchain-trunk/gcc/gcc/testsuite/gcc.target/riscv
$ grep flto * -R | grep dg-skip-if | wc -l
220
$ grep flto * -R | grep no-opts | wc -l
83
Directly adding -ffat-lto-objects can simplify our testcases.
Using dg-options or dg-skip-if also works, but I think using
-ffat-lto-objects by default should be a good trade-off. It only adds
few extra compile time, since Thin LTO does not need real code
generation, and in return we can simplify the whole testsuite.
When you say "directly adding -ffat-lto-objects" are you referring to
adding it to the test or adding "required-options" capability to the
check-function-bodies framework. As I noted, I didn't know
required-options existed, but it seems perfectly suited for this and
would avoid us having to muck around in individual tests.
Jeff