This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: ld is broken on Linux/alpha
On Fri, Nov 23, 2001 at 10:00:41PM -0800, H . J . Lu wrote:
> On Fri, Nov 23, 2001 at 05:37:28PM -0800, H . J . Lu wrote:
> > Today's ld from CVS is broken on Linux/alpha. I got many
> >
> > child killed: segmentation violation
> > FAIL: visibility (hidden_normal) (non PIC, load offset)
> >
>
> Hi Jakub,
>
> Your patch
>
> http://sources.redhat.com/ml/binutils/2001-11/msg00580.html
>
> breaks Linux/alpha. I got
>
> while (gotent->gotobj != gotobj || gotent->addend != addend)
> gotent = gotent->next;
>
> with gotent == NULL. That is
>
> (gdb) p/x addend
> $63 = 0xffffffffffffffe9
> (gdb) p/x gotent->addend
> $59 = 0x87
> (gdb) gotent->gotobj
> $60 = 0x1200f74e0
> (gdb) p/x gotobj
> $61 = 0x1200f74e0
> (gdb) p h
> $62 = (struct alpha_elf_link_hash_entry *) 0x0
>
> Could you please fix it?
>
> Thanks.
>
>
This patch makes "make check" pass on Linux/alpha. I have no ideas if
it is correct at all. I suspect Linux/alpha may not be the only
platform which is broken by that patch. The main issue is you will only
see the problem if your gcc supports the SHF_MERGE sections. That means
we may not know there is a problem even if it exists.
H.J.
----
--- bfd/elf64-alpha.c.merge Fri Nov 23 11:54:42 2001
+++ bfd/elf64-alpha.c Fri Nov 23 22:28:17 2001
@@ -3270,7 +3270,7 @@ elf64_alpha_relocate_section (output_bfd
struct alpha_elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
bfd_vma relocation;
- bfd_vma addend;
+ bfd_vma addend, addend_merge;
bfd_reloc_status_type r;
r_type = ELF64_R_TYPE(rel->r_info);
@@ -3313,6 +3313,7 @@ elf64_alpha_relocate_section (output_bfd
h = NULL;
sym = NULL;
sec = NULL;
+ addend_merge = rel->r_addend;
if (r_symndx < symtab_hdr->sh_info)
{
@@ -3404,7 +3405,8 @@ elf64_alpha_relocate_section (output_bfd
BFD_ASSERT(gotent != NULL);
- while (gotent->gotobj != gotobj || gotent->addend != addend)
+ while (gotent->gotobj != gotobj
+ || gotent->addend != addend_merge)
gotent = gotent->next;
BFD_ASSERT(gotent->use_count >= 1);