From 912815f079a8f3c40c0968ba5140619de079e199 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Tue, 21 Jun 2016 16:01:27 +0100 Subject: MIPS/GAS: Use the module level ISA setting for R6 relaxation Use the module level ISA setting rather than the last ISA selected with a `.set' directive in the source file in determination as to whether to keep PC-relative relocations and then with the original symbol referred, for the purpose of R6 linker relaxation. This is so that with e.g. code like this: b foo .set mips32r2 ... it's the command line options or any `.module' directive that decides how to encode any relocation for `foo' rather than the presence of `.set mips32r2'. gas/ * config/tc-mips.c (mips_force_relocation): Use `file_mips_opts' rather than `mips_opts' for the R6 ISA check. (mips_fix_adjustable): Likewise. * testsuite/gas/mips/pcrel-reloc-1.d: New test. * testsuite/gas/mips/pcrel-reloc-1-r6.d: New test. * testsuite/gas/mips/pcrel-reloc-2.d: New test. * testsuite/gas/mips/pcrel-reloc-2-r6.d: New test. * testsuite/gas/mips/pcrel-reloc-3.d: New test. * testsuite/gas/mips/pcrel-reloc-3-r6.d: New test. * testsuite/gas/mips/pcrel-reloc-1.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests. --- gas/config/tc-mips.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gas/config/tc-mips.c') diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 1a472a3..ed64b68 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -14768,7 +14768,7 @@ mips_force_relocation (fixS *fixp) return 1; /* We want all PC-relative relocations to be kept for R6 relaxation. */ - if (ISA_IS_R6 (mips_opts.isa) + if (ISA_IS_R6 (file_mips_opts.isa) && (fixp->fx_r_type == BFD_RELOC_16_PCREL_S2 || fixp->fx_r_type == BFD_RELOC_MIPS_21_PCREL_S2 || fixp->fx_r_type == BFD_RELOC_MIPS_26_PCREL_S2 @@ -17137,7 +17137,7 @@ mips_fix_adjustable (fixS *fixp) Also, PC relative relocations for MIPS R6 need to be symbol rather than section relative to allow linker relaxations to be performed later on. */ if (limited_pcrel_reloc_p (fixp->fx_r_type) - && (HAVE_IN_PLACE_ADDENDS || ISA_IS_R6 (mips_opts.isa))) + && (HAVE_IN_PLACE_ADDENDS || ISA_IS_R6 (file_mips_opts.isa))) return 0; /* R_MIPS16_26 relocations against non-MIPS16 functions might resolve -- cgit v1.1