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.

Jeffrey Law <[email protected]> 於 2026年7月7日週二 上午1:50寫道:
>
>
>
> On 7/6/2026 2:32 AM, Jim Lin wrote:
> > This is a dg-do compile test using check-function-bodies.  Under slim
> > LTO (-flto -fno-fat-lto-objects) a compile-only run emits only LTO
> > bytecode with no assembly, and no LTRANS output is produced since the
> > test never links, so check-function-bodies finds no output file to scan.
> > Unlike scan-assembler*, check-function-bodies has no required-options
> > hook to force -ffat-lto-objects.  Skip the -flto variant.
> >
> > gcc/testsuite/ChangeLog:
> >
> >       * gcc.target/riscv/ext-dce-3.c: Skip under -flto.
> >       * gcc.target/riscv/ext-dce-4.c: Skip under -flto.
> I'm obviously working backwards here.  When I replied to Kito I had only
> scanned this message.  Now that I've really read it, it may make more
> sense to use the required-options framework for check-function-bodies; I
> didn't even it existed or that we were utilizing it in scan-assembler*.
>
> Jeff

Reply via email to