This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFC: Patch to fix MIPS -mno-shared with multi-got...
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: David Daney <ddaney at avtrex dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 03 Mar 2005 21:48:26 +0000
- Subject: Re: RFC: Patch to fix MIPS -mno-shared with multi-got...
- References: <42277C17.7030608@avtrex.com>
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