[PATCH] Avoid R_IA64_NONE relocations when relaxing
H. J. Lu
Sat Aug 6 15:27:00 GMT 2005
On Sat, Aug 06, 2005 at 08:12:06AM -0700, H. J. Lu wrote:
> On Sat, Aug 06, 2005 at 04:43:08PM +0200, Andreas Schwab wrote:
> > "H. J. Lu" <email@example.com> writes:
> > > On Sat, Aug 06, 2005 at 02:57:00AM +0200, Andreas Schwab wrote:
> > >> "H. J. Lu" <firstname.lastname@example.org> writes:
> > >>
> > >> > The problem is when you reduced the size of .rela.got, gp became too
> > >> > high for relaxed R_IA64_LTOFF22X.
> > >>
> > >> I have a patch ready that just needs some testing. Stay tuned.
> > >>
> > >
> > > This patch seems to work for my testcase.
> > This an alternative patch that fixes the problem as explained in the
> > comment of elfNN_ia64_relax_section. It is tested with a glibc and gcc
> > build.
> Is it a good idea to reset gp after R_IA64_LTOFF22X relocations have
> been relaxed to R_IA64_GPREL22. Is that possible for gp to change in
> such a way that R_IA64_GPREL22 will overflow? If it won't happen, can
> we just reset gp in elfNN_ia64_final_link?
How about this patch? It also works for my testcase.
2005-08-06 H.J. Lu <email@example.com>
* elfxx-ia64.c (elfNN_ia64_final_link): Reset gp.
--- bfd/elfxx-ia64.c.xmov 2005-08-05 11:46:46.000000000 -0700
+++ bfd/elfxx-ia64.c 2005-08-06 08:17:55.967579696 -0700
@@ -3982,15 +3982,15 @@ elfNN_ia64_final_link (abfd, info)
/* Make sure we've got ourselves a nice fat __gp value. */
- bfd_vma gp_val = _bfd_get_gp_value (abfd);
+ bfd_vma gp_val;
struct elf_link_hash_entry *gp;
- if (gp_val == 0)
- if (! elfNN_ia64_choose_gp (abfd, info))
- return FALSE;
- gp_val = _bfd_get_gp_value (abfd);
+ /* We assume after gp is set, section size will only decrease. We
+ need to adjust gp for it. */
+ _bfd_set_gp_value (abfd, 0);
+ if (! elfNN_ia64_choose_gp (abfd, info))
+ return FALSE;
+ gp_val = _bfd_get_gp_value (abfd);
gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE,
More information about the Binutils