From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7613 invoked by alias); 24 Jul 2003 04:46:56 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 7590 invoked from network); 24 Jul 2003 04:46:49 -0000 Received: from unknown (HELO pippin.tausq.org) (64.81.244.94) by sources.redhat.com with SMTP; 24 Jul 2003 04:46:49 -0000 Received: by pippin.tausq.org (Postfix, from userid 1000) id C4F23CD2F8; Wed, 23 Jul 2003 21:50:24 -0700 (PDT) Date: Thu, 24 Jul 2003 04:46:00 -0000 From: Randolph Chung To: binutils@sources.redhat.com Subject: [patch] elf64-hppa handling for undefweak symbols Message-ID: <20030724045024.GA4581@tausq.org> Reply-To: Randolph Chung Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-PGP: for PGP key, see http://www.tausq.org/pgp.txt X-GPG: for GPG key, see http://www.tausq.org/gpg.txt User-Agent: Mutt/1.5.3i X-SW-Source: 2003-07/txt/msg00475.txt.bz2 We are seeing ld segfaults when compiling linux kernels for hppa64-linux. It looks like the linker does not properly handle LTOFF relocs against undefweak symbols. The following patch seems to allow me to build a working kernel. Comments appreciated. Pls apply if it's ok. thanks, randolph -- Randolph Chung Debian GNU/Linux Developer, hppa/ia64 ports http://www.tausq.org/ 2003-07-15 Randolph Chung * elf-hppa.h: fill in dyn_h to pass to elf_hppa_final_link_relocate * elf64-hppa.c: check to make sure symbol is defined before applying relocation Index: elf-hppa.h =================================================================== RCS file: /cvs/src/src/bfd/elf-hppa.h,v retrieving revision 1.62 diff -u -p -r1.62 elf-hppa.h --- elf-hppa.h 25 Jun 2003 06:40:19 -0000 1.62 +++ elf-hppa.h 16 Jul 2003 05:10:49 -0000 @@ -1496,7 +1496,22 @@ elf_hppa_relocate_section (output_bfd, i relocation = 0; } else if (h->root.type == bfd_link_hash_undefweak) - relocation = 0; + { + dyn_name = get_dyn_name (input_section, h, rel, + &dynh_buf, &dynh_buflen); + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + dyn_name, FALSE, FALSE); + + if (dyn_h == NULL) + { + (*_bfd_error_handler) + (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), + bfd_archive_filename (input_bfd), h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + relocation = 0; + } + relocation = 0; + } else { /* Ignore dynamic loader defined symbols. */ Index: elf64-hppa.c =================================================================== RCS file: /cvs/src/src/bfd/elf64-hppa.c,v retrieving revision 1.33 diff -u -p -r1.33 elf64-hppa.c --- elf64-hppa.c 25 Jun 2003 06:40:23 -0000 1.33 +++ elf64-hppa.c 16 Jul 2003 05:10:49 -0000 @@ -2269,7 +2269,9 @@ elf64_hppa_finalize_dlt (dyn_h, data) + hppa_info->opd_sec->output_offset + hppa_info->opd_sec->output_section->vma); } - else if (h->root.u.def.section) + else if (h->root.type != bfd_link_hash_undefined && + h->root.type != bfd_link_hash_undefweak && + h->root.u.def.section) { value = h->root.u.def.value + h->root.u.def.section->output_offset; if (h->root.u.def.section->output_section)