From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20160 invoked by alias); 10 Dec 2004 14:04:47 -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 20018 invoked from network); 10 Dec 2004 14:04:37 -0000 Received: from unknown (HELO gizmo12bw.bigpond.com) (144.140.70.43) by sourceware.org with SMTP; 10 Dec 2004 14:04:37 -0000 Received: (qmail 2240 invoked from network); 10 Dec 2004 14:04:35 -0000 Received: from unknown (HELO bwmam12.bigpond.com) (144.135.24.103) by gizmo12bw.bigpond.com with SMTP; 10 Dec 2004 14:04:35 -0000 Received: from cpe-144-136-221-26.sa.bigpond.net.au ([144.136.221.26]) by bwmam12.bigpond.com(MAM REL_3_4_2a 189/5557151) with SMTP id 5557151; Sat, 11 Dec 2004 00:04:34 +1000 Received: by bubble.modra.org (Postfix, from userid 500) id 9AFA014B4E3; Sat, 11 Dec 2004 00:34:31 +1030 Date: Fri, 10 Dec 2004 14:04:00 -0000 From: Alan Modra To: Hans-Peter Nilsson , binutils@sources.redhat.com Subject: Re: RFA: Don't canonicalize STT_SECTION syms Message-ID: <20041210140431.GF12046@bubble.modra.org> Mail-Followup-To: Hans-Peter Nilsson , binutils@sources.redhat.com References: <20041208215011.GA8795@nevyn.them.org> <20041210032132.GA15282@nevyn.them.org> <20041210121423.GD12046@bubble.modra.org> <20041210125624.GE12046@bubble.modra.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041210125624.GE12046@bubble.modra.org> User-Agent: Mutt/1.4i X-SW-Source: 2004-12/txt/msg00122.txt.bz2 On Fri, Dec 10, 2004 at 11:26:25PM +1030, Alan Modra wrote: > I'm also renaming bfd_elf_local_sym_name because it works perfectly well > on global syms. While I was at it, I should have committed a change to pass the symbol table header too. We're going to need to be able to look up dynamic syms too. * elf.c (bfd_elf_sym_name): Add symtab_hdr param. (group_signature): Update call. * elf-bfd.h (bfd_elf_sym_name): Update. * elf32-ppc.c (ppc_elf_relocate_section): Update. * elf64-ppc.c (ppc64_elf_edit_opd, ppc64_elf_edit_toc) (ppc64_elf_relocate_section): Update * elflink.c (elf_link_input_bfd): Update. Index: bfd/elf-bfd.h =================================================================== RCS file: /cvs/src/src/bfd/elf-bfd.h,v retrieving revision 1.165 diff -u -p -r1.165 elf-bfd.h --- bfd/elf-bfd.h 10 Dec 2004 13:18:38 -0000 1.165 +++ bfd/elf-bfd.h 10 Dec 2004 14:00:12 -0000 @@ -1358,7 +1358,7 @@ extern Elf_Internal_Sym *bfd_elf_get_elf (bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *, Elf_External_Sym_Shndx *); extern const char *bfd_elf_sym_name - (bfd *, Elf_Internal_Sym *); + (bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *); extern bfd_boolean _bfd_elf_copy_private_bfd_data (bfd *, bfd *); Index: bfd/elf.c =================================================================== RCS file: /cvs/src/src/bfd/elf.c,v retrieving revision 1.257 diff -u -p -r1.257 elf.c --- bfd/elf.c 10 Dec 2004 13:18:37 -0000 1.257 +++ bfd/elf.c 10 Dec 2004 14:00:19 -0000 @@ -405,10 +405,12 @@ bfd_elf_get_elf_syms (bfd *ibfd, /* Look up a symbol name. */ const char * -bfd_elf_sym_name (bfd *abfd, Elf_Internal_Sym *isym) +bfd_elf_sym_name (bfd *abfd, + Elf_Internal_Shdr *symtab_hdr, + Elf_Internal_Sym *isym) { unsigned int iname = isym->st_name; - unsigned int shindex = elf_tdata (abfd)->symtab_hdr.sh_link; + unsigned int shindex = symtab_hdr->sh_link; if (iname == 0 && ELF_ST_TYPE (isym->st_info) == STT_SECTION /* Check for a bogus st_shndx to avoid crashing. */ && isym->st_shndx < elf_numsections (abfd) @@ -451,7 +453,7 @@ group_signature (bfd *abfd, Elf_Internal &isym, esym, &eshndx) == NULL) return NULL; - return bfd_elf_sym_name (abfd, &isym); + return bfd_elf_sym_name (abfd, hdr, &isym); } /* Set next_in_group list pointer, and group name for NEWSECT. */ Index: bfd/elf32-ppc.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-ppc.c,v retrieving revision 1.130 diff -u -p -r1.130 elf32-ppc.c --- bfd/elf32-ppc.c 10 Dec 2004 13:18:38 -0000 1.130 +++ bfd/elf32-ppc.c 10 Dec 2004 14:00:19 -0000 @@ -4694,7 +4694,7 @@ ppc_elf_relocate_section (bfd *output_bf { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - sym_name = bfd_elf_sym_name (input_bfd, sym); + sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym); relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } Index: bfd/elf64-ppc.c =================================================================== RCS file: /cvs/src/src/bfd/elf64-ppc.c,v retrieving revision 1.179 diff -u -p -r1.179 elf64-ppc.c --- bfd/elf64-ppc.c 10 Dec 2004 13:18:39 -0000 1.179 +++ bfd/elf64-ppc.c 10 Dec 2004 14:00:24 -0000 @@ -6006,7 +6006,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bf if (h != NULL) sym_name = h->root.root.string; else - sym_name = bfd_elf_sym_name (ibfd, sym); + sym_name = bfd_elf_sym_name (ibfd, symtab_hdr, sym); (*_bfd_error_handler) (_("%B: undefined sym `%s' in .opd section"), @@ -7051,7 +7051,7 @@ ppc64_elf_edit_toc (bfd *obfd ATTRIBUTE_ { (*_bfd_error_handler) (_("%s defined in removed toc entry"), - bfd_elf_sym_name (ibfd, sym)); + bfd_elf_sym_name (ibfd, symtab_hdr, sym)); sym->st_value = 0; sym->st_shndx = SHN_ABS; } @@ -9142,7 +9142,7 @@ ppc64_elf_relocate_section (bfd *output_ sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - sym_name = bfd_elf_sym_name (input_bfd, sym); + sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym); sym_type = ELF64_ST_TYPE (sym->st_info); relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); opd_adjust = get_opd_info (sec); Index: bfd/elflink.c =================================================================== RCS file: /cvs/src/src/bfd/elflink.c,v retrieving revision 1.120 diff -u -p -r1.120 elflink.c --- bfd/elflink.c 10 Dec 2004 13:18:40 -0000 1.120 +++ bfd/elflink.c 10 Dec 2004 14:00:31 -0000 @@ -6819,7 +6819,7 @@ elf_link_input_bfd (struct elf_final_lin { Elf_Internal_Sym *sym = isymbuf + r_symndx; ps = &finfo->sections[r_symndx]; - sym_name = bfd_elf_sym_name (input_bfd, sym); + sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym); } /* Complain if the definition comes from a -- Alan Modra IBM OzLabs - Linux Technology Centre