RFC: Patch to fix MIPS -mno-shared with multi-got...
Richard Sandiford
rsandifo@redhat.com
Thu Mar 3 21:48:00 GMT 2005
David Daney <ddaney@avtrex.com> writes:
> Possible problems are code that use relocations other than R_MIPS_HI16,
> R_MIPS_LO16, R_MIPS16_HI16 and R_MIPS16_LO16 against "_gp" as they would
> now be illegal.
Couldn't you get around that by:
> @@ -3135,6 +3137,20 @@ mips_elf_calculate_relocation (bfd *abfd
>
> gp_disp_p = TRUE;
> }
> + /* See if this is the special _gp symbol. Note that such a
> + symbol must always be a global symbol. */
> + else if (strcmp (*namep, "_gp") == 0
> + && ! NEWABI_P (input_bfd))
> + {
> + /* Relocations against _gp are permitted only with
> + R_MIPS_HI16 and R_MIPS_LO16 relocations. */
> + if (r_type != R_MIPS_HI16 && r_type != R_MIPS_LO16
> + && r_type != R_MIPS16_HI16 && r_type != R_MIPS16_LO16)
> + return bfd_reloc_notsupported;
> +
> + gp_p = TRUE;
> + }
setting "symbol" to the local _gp value here? There would then be
no need for the gp_p variable.
(Not tested of course. Just wondering if you'd tried that and rejected
it for some reason.)
WRT possible breakge to things expecting the real "_gp": I agree that
might be a problem. One possibility would be to define a new symbol,
something like __gnu_local_gp, and make -mno-shared use that instead
of plain _gp. -mno-shared is a new option, so there's no backwards
compatiblity problem.
Richard
More information about the Binutils
mailing list