More background around this patch: I didn't found this issue untill now since we got a PR to fix this issue by building GCC with the --with-spec option on riscv-gnu-toolchain, and I found our downstream doesn't hit this because we already has this change for loooong time, and we drop this part when upstream because I thought it didn't matter.
And this patch should be boring enough so I put it in "[to-be-committed]" queue [1] https://github.com/riscv-collab/riscv-gnu-toolchain/pull/1868 On Thu, Jun 4, 2026 at 10:59 PM Kito Cheng <[email protected]> wrote: > We have supported --with-cmodel for a while and set the default via > TARGET_DEFAULT_CMODEL. That works well in general, but not for > multilib, because GCC cannot detect the cmodel for the current multilib > correctly that way. So we still need to specify the default cmodel in > OPTION_DEFAULT_SPECS. > > gcc/ChangeLog: > > * config/riscv/riscv.h (OPTION_DEFAULT_SPECS): Specify default > cmodel. > --- > gcc/config/riscv/riscv.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h > index b98a4a4df60..cb821ae8b3a 100644 > --- a/gcc/config/riscv/riscv.h > +++ b/gcc/config/riscv/riscv.h > @@ -66,6 +66,7 @@ extern const char *riscv_arch_help (int argc, const char > **argv); > --with-tune is ignored if -mtune or -mcpu is specified. > --with-isa-spec is ignored if -misa-spec is specified. > --with-tls is ignored if -mtls-dialect is specified. > + --with-cmodel is ignored if -mcmodel is specified. > > Uses default values if -mcpu doesn't have a valid option. */ > #define OPTION_DEFAULT_SPECS \ > @@ -79,6 +80,7 @@ extern const char *riscv_arch_help (int argc, const char > **argv); > {"abi", "%{!mabi=*:-mabi=%(VALUE)}" }, \ > {"isa_spec", "%{!misa-spec=*:-misa-spec=%(VALUE)}" }, > \ > {"tls", "%{!mtls-dialect=*:-mtls-dialect=%(VALUE)}"}, \ > + {"cmodel", "%{!mcmodel=*:-mcmodel=%(VALUE)}" }, \ > > #ifdef IN_LIBGCC2 > #undef TARGET_64BIT > -- > 2.54.0 > >
