From owner-freebsd-sparc Wed Nov 13 4:40:12 2002 Delivered-To: freebsd-sparc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DD7BE37B401 for ; Wed, 13 Nov 2002 04:40:07 -0800 (PST) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 8C7D843E4A for ; Wed, 13 Nov 2002 04:40:05 -0800 (PST) (envelope-from tmoestl@gmx.net) Received: (qmail 19554 invoked by uid 0); 13 Nov 2002 12:40:02 -0000 Received: from p508e72b4.dip.t-dialin.net (HELO forge.local) (80.142.114.180) by mail.gmx.net (mp011-rz3) with SMTP; 13 Nov 2002 12:40:02 -0000 Received: from tmm by forge.local with local (Exim 4.10 #1) id 18BwoI-0000SZ-00; Wed, 13 Nov 2002 13:39:58 +0100 Date: Wed, 13 Nov 2002 13:39:58 +0100 From: Thomas Moestl To: Kris Kennaway Cc: sparc64@FreeBSD.org Subject: Re: Package build in progress Message-ID: <20021113123958.GA1009@crow.dom2ip.de> References: <20021113111147.GA82735@rot13.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="pWyiEgJYm5f9v55/" Content-Disposition: inline In-Reply-To: <20021113111147.GA82735@rot13.obsecurity.org> User-Agent: Mutt/1.4i Sender: owner-freebsd-sparc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, 2002/11/13 at 03:11:48 -0800, Kris Kennaway wrote: > Thanks to the generous donation of a hard drive, I've started a new > sparc64 package build on my ultra 30..it should be finished in a > couple of weeks :) If it takes long to complete, could you please apply the two attached patches in src/contrib/binutils/bfd, rebuild and reinstall binutils an restart the build? Otherwise, some binaries (e.g. C++ libraries and binaries with very many externally defined functions) will be broken due to linker bugs. If this is going to be the final package run for DP2, it would be nice to avoid this. Both of these patches are already in the binutils CVS repository, and I hope that they will hit src/contrib soon. The third attached patch is required if you use kernel modules; it removes a workaround for one of the bugs, and requires a kernel module flag day (i.e. modules built with the old ld will not work with new kernels and vice versa). Thanks, - Thomas -- Thomas Moestl http://www.tu-bs.de/~y0015675/ http://people.FreeBSD.org/~tmm/ PGP fingerprint: 1C97 A604 2BD0 E492 51D0 9C0F 1FE6 4F1D 419C 776C --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bfd2-amodra.diff" Index: bfd/elf64-sparc.c =================================================================== RCS file: /cvs/src/src/bfd/elf64-sparc.c,v retrieving revision 1.60 diff -u -p -r1.60 elf64-sparc.c --- bfd/elf64-sparc.c 24 Sep 2002 15:54:22 -0000 1.60 +++ bfd/elf64-sparc.c 5 Nov 2002 04:19:52 -0000 @@ -2164,11 +2164,9 @@ sparc64_elf_relocate_section (output_bfd } else { + outrel.r_addend = relocation + rel->r_addend; if (r_type == R_SPARC_64) - { - outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE); - outrel.r_addend = relocation + rel->r_addend; - } + outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE); else { long indx; @@ -2198,6 +2196,13 @@ sparc64_elf_relocate_section (output_bfd osec = sec->output_section; indx = elf_section_data (osec)->dynindx; + /* We are turning this relocation into one + against a section symbol, so subtract out + the output section's address but not the + offset of the input section in the output + section. */ + outrel.r_addend -= osec->vma; + /* FIXME: we really should be able to link non-pic shared libraries. */ if (indx == 0) @@ -2216,7 +2221,6 @@ sparc64_elf_relocate_section (output_bfd ELF64_R_TYPE_INFO ( ELF64_R_TYPE_DATA (rel->r_info), r_type)); - outrel.r_addend = relocation + rel->r_addend; } } --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bfd-hiplt.diff" Index: elf64-sparc.c =================================================================== RCS file: /d/ncvs/src/contrib/binutils/bfd/elf64-sparc.c,v retrieving revision 1.1.1.10 diff -u -r1.1.1.10 elf64-sparc.c --- elf64-sparc.c 11 Oct 2002 05:59:11 -0000 1.1.1.10 +++ elf64-sparc.c 9 Nov 2002 21:00:39 -0000 @@ -1563,6 +1563,9 @@ if (s->_raw_size == 0) s->_raw_size = PLT_HEADER_SIZE; + /* To simplify matters later, just store the plt index here. */ + h->plt.offset = s->_raw_size / PLT_ENTRY_SIZE; + /* If this symbol is not defined in a regular file, and we are not generating a shared library, then set the symbol to this location in the .plt. This is required to make function @@ -1572,12 +1575,9 @@ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) { h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; + h->root.u.def.value = sparc64_elf_plt_entry_offset (h->plt.offset); } - /* To simplify matters later, just store the plt index here. */ - h->plt.offset = s->_raw_size / PLT_ENTRY_SIZE; - /* Make room for this entry. */ s->_raw_size += PLT_ENTRY_SIZE; --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="elf_machdep.diff" Index: sys/sparc64/sparc64/elf_machdep.c =================================================================== RCS file: /d/ncvs/src/sys/sparc64/sparc64/elf_machdep.c,v retrieving revision 1.11 diff -u -r1.11 elf_machdep.c --- sys/sparc64/sparc64/elf_machdep.c 19 Oct 2002 19:16:03 -0000 1.11 +++ sys/sparc64/sparc64/elf_machdep.c 13 Nov 2002 12:39:06 -0000 @@ -240,7 +240,6 @@ elf_reloc(linker_file_t lf, const void *data, int type) { const Elf_Rela *rela; - const Elf_Sym *sym; Elf_Addr relocbase; Elf_Half *where32; Elf_Addr *where; @@ -272,24 +271,10 @@ value = rela->r_addend; if (RELOC_RESOLVE_SYMBOL(rtype)) { - /* - * Work around what appears to be confusion between binutils - * and the v9 ABI. LO10 and HI22 relocations are listed as - * S + A, but for STB_LOCAL symbols it seems that the value - * in the Elf_Sym refered to by the symbol index is wrong, - * instead the value is in the addend field of the Elf_Rela - * record. So if the symbol is local don't look it up, just - * use the addend as its value and add in the relocbase. - */ - sym = elf_get_sym(lf, symidx); - if (ELF_ST_BIND(sym->st_info) == STB_LOCAL) - value += relocbase; - else { - addr = elf_lookup(lf, symidx, 1); - if (addr == 0) - return (-1); - value += addr; - } + addr = elf_lookup(lf, symidx, 1); + if (addr == 0) + return (-1); + value += addr; } if (RELOC_PC_RELATIVE(rtype)) --pWyiEgJYm5f9v55/-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-sparc" in the body of the message