Subject: re: sparc64-netbsd toolchain lossage :-(
To: None <port-sparc64@netbsd.org, tech-toolchain@netbsd.org>
From: matthew green <mrg@eterna.com.au>
List: port-sparc64
Date: 08/14/2001 19:22:39
i've located the change that has broken this (in bfd):
2000-08-16 Andrew Macleod <amacleod@cygnus.com>
* elf64-sparc.c (sparc64_elf_relocate_section): Set relocation address
for undefined symbols to be the beginning of the section.
* elf64-sparc.c (sparc64_elf_adjust_dynamic_symbol): Don't allocate
four extra entries at the beginning of the .rela.plt section.
(sparc64_elf_finish_dynamic_symbol): Adjust the offset in the .rela.plt
section to account for the four reserved entries in the .plt section.
part of the patch includes this comment:
/* Adjust for the first 4 reserved elements in the .plt section
when setting the offset in the .rela.plt section.
Sun forgot to read their own ABI and copied elf32-sparc behaviour,
thus .plt[4] has corresponding .rela.plt[0] and so on. */
so perhaps our ld.elf_so for sparc64 is wrong?
.mrg.
[ this is a reverse patch to `fix' our tree. ]
Index: elf64-sparc.c
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/bfd/elf64-sparc.c,v
retrieving revision 1.1.1.3
diff -p -r1.1.1.3 elf64-sparc.c
*** elf64-sparc.c 2001/04/23 12:25:27 1.1.1.3
--- elf64-sparc.c 2001/08/14 09:21:29
*************** sparc64_elf_adjust_dynamic_symbol (info,
*** 1553,1558 ****
--- 1553,1564 ----
s = bfd_get_section_by_name (dynobj, ".rela.plt");
BFD_ASSERT (s != NULL);
+ /* The first plt entries are reserved, and the relocations must
+ pair up exactly. */
+ if (s->_raw_size == 0)
+ s->_raw_size += (PLT_HEADER_SIZE/PLT_ENTRY_SIZE
+ * sizeof (Elf64_External_Rela));
+
s->_raw_size += sizeof (Elf64_External_Rela);
/* The procedure linkage table size is bounded by the magnitude
*************** sparc64_elf_relocate_section (output_bfd
*** 2068,2081 ****
(!info->shared || info->no_undefined
|| ELF_ST_VISIBILITY (h->other)))))
return false;
-
- /* To avoid generating warning messages about truncated
- relocations, set the relocation's address to be the same as
- the start of this section. */
-
- if (input_section->output_section != NULL)
- relocation = input_section->output_section->vma;
- else
relocation = 0;
}
}
--- 2074,2079 ----
*************** sparc64_elf_finish_dynamic_symbol (outpu
*** 2691,2704 ****
rela.r_offset += (splt->output_section->vma + splt->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_JMP_SLOT);
- /* Adjust for the first 4 reserved elements in the .plt section
- when setting the offset in the .rela.plt section.
- Sun forgot to read their own ABI and copied elf32-sparc behaviour,
- thus .plt[4] has corresponding .rela.plt[0] and so on. */
-
bfd_elf64_swap_reloca_out (output_bfd, &rela,
((Elf64_External_Rela *) srela->contents
! + (h->plt.offset - 4)));
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
--- 2689,2697 ----
rela.r_offset += (splt->output_section->vma + splt->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_JMP_SLOT);
bfd_elf64_swap_reloca_out (output_bfd, &rela,
((Elf64_External_Rela *) srela->contents
! + h->plt.offset));
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{