From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4325 invoked by alias); 10 Dec 2004 12:56:51 -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 3652 invoked from network); 10 Dec 2004 12:56:28 -0000 Received: from unknown (HELO gizmo02ps.bigpond.com) (144.140.71.12) by sourceware.org with SMTP; 10 Dec 2004 12:56:28 -0000 Received: (qmail 15458 invoked from network); 10 Dec 2004 12:56:26 -0000 Received: from unknown (HELO psmam12.bigpond.com) (144.135.25.103) by gizmo02ps.bigpond.com with SMTP; 10 Dec 2004 12:56:26 -0000 Received: from cpe-144-136-221-26.sa.bigpond.net.au ([144.136.221.26]) by psmam12.bigpond.com(MAM REL_3_4_2a 234/3758542) with SMTP id 3758542; Fri, 10 Dec 2004 22:56:26 +1000 Received: by bubble.modra.org (Postfix, from userid 500) id CE739136F10; Fri, 10 Dec 2004 23:26:25 +1030 Date: Fri, 10 Dec 2004 12:56:00 -0000 From: Alan Modra To: Hans-Peter Nilsson , binutils@sources.redhat.com Subject: Re: RFA: Don't canonicalize STT_SECTION syms Message-ID: <20041210125624.GE12046@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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041210121423.GD12046@bubble.modra.org> User-Agent: Mutt/1.4i X-SW-Source: 2004-12/txt/msg00120.txt.bz2 On Fri, Dec 10, 2004 at 10:44:23PM +1030, Alan Modra wrote: > readelf won't show anything wrong. The problem is that objdump uses > the canonicalized symbol name, and the real ELF section symbols have > a name of "". So you get an empty string displayed instead of the > section name. I think the right thing to do is to give canonicalized section symbols a name. This of course will change "objdump -x", breaking other parts of the testsuite. Oh well. I'm also renaming bfd_elf_local_sym_name because it works perfectly well on global syms. This part I'll check in immediately, but the functional change I'll leave for a while, at least until I see how much damage this does to the testsuite. bfd/ChangeLog * elf.c (bfd_elf_sym_name): Rename from bfd_elf_local_sym_name. (group_signature): Update. * 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. * elfcode.h (elf_slurp_symbol_table): Use bfd_elf_sym_name. Index: bfd/elfcode.h =================================================================== RCS file: /cvs/src/src/bfd/elfcode.h,v retrieving revision 1.60 diff -u -p -r1.60 elfcode.h --- bfd/elfcode.h 9 Dec 2004 16:17:42 -0000 1.60 +++ bfd/elfcode.h 10 Dec 2004 12:46:55 -0000 @@ -1086,9 +1086,7 @@ elf_slurp_symbol_table (bfd *abfd, asymb memcpy (&sym->internal_elf_sym, isym, sizeof (Elf_Internal_Sym)); sym->symbol.the_bfd = abfd; - sym->symbol.name = bfd_elf_string_from_elf_section (abfd, - hdr->sh_link, - isym->st_name); + sym->symbol.name = bfd_elf_sym_name (abfd, isym); sym->symbol.value = isym->st_value; @@ -1217,7 +1215,7 @@ error_return: return -1; } -/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of +/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of them. */ static bfd_boolean Index: bfd/elf-bfd.h =================================================================== RCS file: /cvs/src/src/bfd/elf-bfd.h,v retrieving revision 1.164 diff -u -p -r1.164 elf-bfd.h --- bfd/elf-bfd.h 16 Nov 2004 10:16:27 -0000 1.164 +++ bfd/elf-bfd.h 10 Dec 2004 12:46:45 -0000 @@ -1357,7 +1357,7 @@ extern char *bfd_elf_get_str_section extern Elf_Internal_Sym *bfd_elf_get_elf_syms (bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *, Elf_External_Sym_Shndx *); -extern const char *bfd_elf_local_sym_name +extern const char *bfd_elf_sym_name (bfd *, Elf_Internal_Sym *); extern bfd_boolean _bfd_elf_copy_private_bfd_data Index: bfd/elf.c =================================================================== RCS file: /cvs/src/src/bfd/elf.c,v retrieving revision 1.255 diff -u -p -r1.255 elf.c --- bfd/elf.c 3 Dec 2004 13:59:36 -0000 1.255 +++ bfd/elf.c 10 Dec 2004 12:46:46 -0000 @@ -405,7 +405,7 @@ bfd_elf_get_elf_syms (bfd *ibfd, /* Look up a symbol name. */ const char * -bfd_elf_local_sym_name (bfd *abfd, Elf_Internal_Sym *isym) +bfd_elf_sym_name (bfd *abfd, Elf_Internal_Sym *isym) { unsigned int iname = isym->st_name; unsigned int shindex = elf_tdata (abfd)->symtab_hdr.sh_link; @@ -448,7 +448,7 @@ group_signature (bfd *abfd, Elf_Internal &isym, esym, &eshndx) == NULL) return NULL; - return bfd_elf_local_sym_name (abfd, &isym); + return bfd_elf_sym_name (abfd, &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.129 diff -u -p -r1.129 elf32-ppc.c --- bfd/elf32-ppc.c 21 Oct 2004 15:28:23 -0000 1.129 +++ bfd/elf32-ppc.c 10 Dec 2004 12:46:49 -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_local_sym_name (input_bfd, sym); + sym_name = bfd_elf_sym_name (input_bfd, 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.178 diff -u -p -r1.178 elf64-ppc.c --- bfd/elf64-ppc.c 4 Nov 2004 11:55:12 -0000 1.178 +++ bfd/elf64-ppc.c 10 Dec 2004 12:46:54 -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_local_sym_name (ibfd, sym); + sym_name = bfd_elf_sym_name (ibfd, 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_local_sym_name (ibfd, sym)); + bfd_elf_sym_name (ibfd, 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_local_sym_name (input_bfd, sym); + sym_name = bfd_elf_sym_name (input_bfd, 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.119 diff -u -p -r1.119 elflink.c --- bfd/elflink.c 1 Dec 2004 23:23:11 -0000 1.119 +++ bfd/elflink.c 10 Dec 2004 12:47:00 -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_local_sym_name (input_bfd, sym); + sym_name = bfd_elf_sym_name (input_bfd, sym); } /* Complain if the definition comes from a -- Alan Modra IBM OzLabs - Linux Technology Centre