Maciej Rozycki <maciej.rozy...@imgtec.com> writes: > Fix `-mrelax-pic-calls' support for microMIPS code where the relocation > produced is supposed to be R_MICROMIPS_JALR rather than R_MIPS_JALR. > The lack of short delay support comes from a missed update to this code > for microMIPS support and can be relieved as JALRS and JRS instructions > can be relaxed to BALS and B instructions respectively, so do that as > well.
Thanks. I didn't follow the background to this optimisation when I added the compact branch support so opted to retain the pre-existing behaviour. > By doing so complement commit r196828 ("microMIPS gcc support"), > <https://gcc.gnu.org/ml/gcc-patches/2013-02/msg01103.html>, which is the > original change that introduced microMIPS support, in particular to > MIPS_CALL, which is where this code previously resided. > > Adjust the test suite accordingly, limiting R_MICROMIPS_JALR cases to Typo fwiw: Should say R_MIPS_JALR for MIPS code. > regular MIPS code only, and adding corresponding R_MICROMIPS_JALR cases > for microMIPS code. > > gcc/ > * config/mips/mips.c (mips_output_jump): Output R_MICROMIPS_JALR > rather than R_MIPS_JALR relocation in microMIPS code. Do not > cancel short delay slots in PIC call relaxation. > > gcc/testsuite/ > * gcc.target/mips/call-1.c (dg-options): Add `-mno-micromips'. > (dg-final): Remove microMIPS JALRS mnemonic matching. > * gcc.target/mips/call-2.c (dg-options): Add `-mno-micromips'. > (dg-final): Remove microMIPS JALRS mnemonic matching. > * gcc.target/mips/call-3.c (dg-options): Add `-mno-micromips'. > (dg-final): Remove microMIPS JALRS mnemonic matching. > * gcc.target/mips/call-4.c (dg-options): Add `-mno-micromips'. > * gcc.target/mips/call-5.c (dg-options): Add `-mno-micromips'. > * gcc.target/mips/call-6.c (dg-options): Add `-mno-micromips'. > * gcc.target/mips/call-1u.c: New test case. > * gcc.target/mips/call-2u.c: New test case. > * gcc.target/mips/call-3u.c: New test case. > * gcc.target/mips/call-4u.c: New test case. > * gcc.target/mips/call-5u.c: New test case. > * gcc.target/mips/call-6u.c: New test case. > --- > NB the use of this feature for microMIPS is limited because short > encodings of register jump instructions usually do not have their branch > counterparts and long encodings typically are not used. However at > least > tail calls can be converted if the jump target is in range, as can calls > in `-minsn32' code. Perhaps we could switch to producing `j[al]r[s].32' > in the `-mrelax-pic-calls' mode like GAS does with the `jal' and `j' > microMIPS macros in PIC code. Does the linker do anything for R_MICROMIPS_JALR currently? From memory I seem to think it was mostly ignored. Is there any risk with older linkers by introducing R_MICROMIPS_JALR in GCC generated code? > Let me know if the lack of microMIPS results would be a problem for > this > patch's acceptance. Not a problem. We will pick this up as part of testing for the release. There is a bit of coding style fuzz in the testcases but it is pre-existing from the code you duplicated so I don't think it needs fixing. > Otherwise, OK to apply? OK, as long as you can say there is no risk with the new reloc and older linkers. Thanks, Matthew