From: Alan Modra <amodra@bigpond.net.au>
To: Hans-Peter Nilsson <hp@bitrange.com>, binutils@sources.redhat.com
Subject: Re: RFA: Don't canonicalize STT_SECTION syms
Date: Fri, 10 Dec 2004 12:56:00 -0000 [thread overview]
Message-ID: <20041210125624.GE12046@bubble.modra.org> (raw)
In-Reply-To: <20041210121423.GD12046@bubble.modra.org>
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
next prev parent reply other threads:[~2004-12-10 12:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-08 21:50 Daniel Jacobowitz
2004-12-08 23:57 ` Alan Modra
2004-12-10 3:15 ` Hans-Peter Nilsson
2004-12-10 3:21 ` Daniel Jacobowitz
2004-12-10 12:14 ` Alan Modra
2004-12-10 12:56 ` Alan Modra [this message]
2004-12-10 14:04 ` Alan Modra
2004-12-10 15:14 ` Hans-Peter Nilsson
2004-12-10 15:19 ` Daniel Jacobowitz
2004-12-11 4:21 ` Alan Modra
2004-12-11 4:34 ` Daniel Jacobowitz
2004-12-11 4:57 ` Alan Modra
2004-12-11 5:08 ` Daniel Jacobowitz
2004-12-11 5:32 ` Alan Modra
2004-12-11 5:38 ` Daniel Jacobowitz
2004-12-11 5:59 ` Alan Modra
2004-12-11 6:11 ` Daniel Jacobowitz
2004-12-11 5:52 ` Alan Modra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041210125624.GE12046@bubble.modra.org \
--to=amodra@bigpond.net.au \
--cc=binutils@sources.redhat.com \
--cc=hp@bitrange.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).