This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Fix Alpha FAIL: bootstrap with --relax
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 6 Feb 2003 17:10:09 +0100
- Subject: [PATCH] Fix Alpha FAIL: bootstrap with --relax
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
During bootstrap with relax, archive.o contains a bunch of R_ALPHA_LIT*
relocs but only against global syms and then some R_ALPHA_GPREL*
against local syms.
This means that local_got_entries is not allocated (all NEED_GOT_ENTRY
end up in some h->got_entries slots). When elf64_alpha_relax_sections
looks at one of the R_ALPHA_GPREL* relocs, r_symndx is local,
info.first_gotent gets set to
&((struct alpha_elf_got_entry **)NULL)[r_symndx]
and segfaults a few lines later.
Dunno if it is better to do it as below or instead set first_gotent
to NULL and handle first_gotent == NULL specially where it is used.
2003-02-06 Jakub Jelinek <jakub@redhat.com>
* elf64-alpha.c (elf64_alpha_relax_section): Don't crash if
local_got_entries is NULL.
--- bfd/elf64-alpha.c.jj 2003-02-06 10:53:56.000000000 -0500
+++ bfd/elf64-alpha.c 2003-02-06 10:53:56.000000000 -0500
@@ -2184,7 +2184,13 @@ elf64_alpha_relax_section (abfd, sec, li
info.h = NULL;
info.other = isym->st_other;
- info.first_gotent = &local_got_entries[r_symndx];
+ if (local_got_entries)
+ info.first_gotent = &local_got_entries[r_symndx];
+ else
+ {
+ info.first_gotent = &info.gotent;
+ info.gotent = NULL;
+ }
}
else
{
Jakub