-
- Downloads
LoongArch: Disable relaxation if the assembler don't support conditional...
LoongArch: Disable relaxation if the assembler don't support conditional branch relaxation [PR112330] As the commit message of r14-4674 has indicated, if the assembler does not support conditional branch relaxation, a relocation overflow may happen on conditional branches when relaxation is enabled because the number of NOP instructions inserted by the assembler will be more than the number estimated by GCC. To work around this issue, disable relaxation by default if the assembler is detected incapable to perform conditional branch relaxation at GCC build time. We also need to pass -mno-relax to the assembler to really disable relaxation. But, if the assembler does not support -mrelax option at all, we should not pass -mno-relax to the assembler or it will immediately error out. Also handle this with the build time assembler capability probing, and add a pair of options -m[no-]pass-mrelax-to-as to allow using a different assembler from the build-time one. With this change, if GCC is built with GAS 2.41, relaxation will be disabled by default. So the default value of -mexplicit-relocs= is also changed to 'always' if -mno-relax is specified or implied by the build-time default, because using assembler macros for symbol addresses produces no benefit when relaxation is disabled. gcc/ChangeLog: PR target/112330 * config/loongarch/genopts/loongarch.opt.in: Add -m[no]-pass-relax-to-as. Change the default of -m[no]-relax to account conditional branch relaxation support status. * config/loongarch/loongarch.opt: Regenerate. * configure.ac (gcc_cv_as_loongarch_cond_branch_relax): Check if the assembler supports conditional branch relaxation. * configure: Regenerate. * config.in: Regenerate. Note that there are some unrelated changes introduced by r14-5424 (which does not contain a config.in regeneration). * config/loongarch/loongarch-opts.h (HAVE_AS_COND_BRANCH_RELAXATION): Define to 0 if not defined. * config/loongarch/loongarch-driver.h (ASM_MRELAX_DEFAULT): Define. (ASM_MRELAX_SPEC): Define. (ASM_SPEC): Use ASM_MRELAX_SPEC instead of "%{mno-relax}". * config/loongarch/loongarch.cc: Take the setting of -m[no-]relax into account when determining the default of -mexplicit-relocs=. * doc/invoke.texi: Document -m[no-]relax and -m[no-]pass-mrelax-to-as for LoongArch. Update the default value of -mexplicit-relocs=.
Showing
- gcc/config.in 34 additions, 1 deletiongcc/config.in
- gcc/config/loongarch/genopts/loongarch.opt.in 5 additions, 1 deletiongcc/config/loongarch/genopts/loongarch.opt.in
- gcc/config/loongarch/loongarch-driver.h 15 additions, 1 deletiongcc/config/loongarch/loongarch-driver.h
- gcc/config/loongarch/loongarch-opts.h 4 additions, 0 deletionsgcc/config/loongarch/loongarch-opts.h
- gcc/config/loongarch/loongarch.cc 1 addition, 1 deletiongcc/config/loongarch/loongarch.cc
- gcc/config/loongarch/loongarch.opt 5 additions, 1 deletiongcc/config/loongarch/loongarch.opt
- gcc/configure 35 additions, 0 deletionsgcc/configure
- gcc/configure.ac 10 additions, 0 deletionsgcc/configure.ac
- gcc/doc/invoke.texi 28 additions, 8 deletionsgcc/doc/invoke.texi
Loading
Please register or sign in to comment