This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
powerpc64-linux-nm
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Wed, 29 May 2002 14:29:19 +0930
- Subject: powerpc64-linux-nm
For the object generated from the following simple file:
extern int test (void);
int
main (void)
{
return test ();
}
nm on powerpc64-linux currently reports:
$ powerpc64-linux-nm global.o
0000000000000000 T .main
U .test
0000000000000000 ? main
"main" is the function descriptor symbol in the ".opd" section, ".main"
is the function code symbol in ".text". The `?' was confusing ltconfig,
so I'm inclined to switch to a `D' for symbols in .opd.
bfd/ChangeLog
* elf64-ppc.c (ppc64_elf_get_symbol_info): New function.
(bfd_elf64_get_symbol_info): Define.
* elfxx-target.h (bfd_elfNN_get_symbol_info): Only define if undef.
binutils/testsuite/ChangeLog
* binutils-all/objcopy.exp (strip_test_with_saving_a_symbol):
Revert 2001-11-15. Instead allow `D main'.
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.45
diff -u -p -r1.45 elf64-ppc.c
--- bfd/elf64-ppc.c 25 May 2002 10:13:23 -0000 1.45
+++ bfd/elf64-ppc.c 28 May 2002 08:48:12 -0000
@@ -55,6 +55,8 @@ static bfd_reloc_status_type ppc64_elf_t
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static bfd_reloc_status_type ppc64_elf_unhandled_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static void ppc64_elf_get_symbol_info
+ PARAMS ((bfd *, asymbol *, symbol_info *));
static boolean ppc64_elf_set_private_flags
PARAMS ((bfd *, flagword));
static boolean ppc64_elf_merge_private_bfd_data
@@ -1631,6 +1633,22 @@ ppc64_elf_unhandled_reloc (abfd, reloc_e
return bfd_reloc_dangerous;
}
+/* Return symbol info as per usual for ELF targets, except that
+ symbols in .opd are given 'd' or 'D' for type. */
+
+static void
+ppc64_elf_get_symbol_info (abfd, symbol, ret)
+ bfd *abfd;
+ asymbol *symbol;
+ symbol_info *ret;
+{
+ _bfd_elf_get_symbol_info (abfd, symbol, ret);
+ if (ret->type == '?'
+ && (symbol->flags & (BSF_GLOBAL | BSF_LOCAL)) != 0
+ && strcmp (symbol->section->name, ".opd") == 0)
+ ret->type = (symbol->flags & BSF_GLOBAL) != 0 ? 'D' : 'd';
+}
+
/* Function to set whether a module needs the -mrelocatable bit set. */
static boolean
@@ -6108,6 +6126,7 @@ ppc64_elf_finish_dynamic_sections (outpu
#define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data
#define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create
#define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free
+#define bfd_elf64_get_symbol_info ppc64_elf_get_symbol_info
#define elf_backend_section_from_shdr ppc64_elf_section_from_shdr
#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections
Index: bfd/elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.41
diff -u -p -r1.41 elfxx-target.h
--- bfd/elfxx-target.h 15 May 2002 00:18:57 -0000 1.41
+++ bfd/elfxx-target.h 28 May 2002 08:48:12 -0000
@@ -44,7 +44,9 @@ Foundation, Inc., 59 Temple Place - Suit
#ifndef bfd_elfNN_get_reloc_upper_bound
#define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
#endif
+#ifndef bfd_elfNN_get_symbol_info
#define bfd_elfNN_get_symbol_info _bfd_elf_get_symbol_info
+#endif
#define bfd_elfNN_get_symtab _bfd_elf_get_symtab
#define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
#if 0 /* done in elf-bfd.h */
Index: binutils/testsuite/binutils-all/objcopy.exp
===================================================================
RCS file: /cvs/src/src/binutils/testsuite/binutils-all/objcopy.exp,v
retrieving revision 1.13
diff -u -p -r1.13 objcopy.exp
--- binutils/testsuite/binutils-all/objcopy.exp 18 Feb 2002 09:13:48 -0000 1.13
+++ binutils/testsuite/binutils-all/objcopy.exp 28 May 2002 08:48:14 -0000
@@ -412,7 +412,7 @@ proc strip_test_with_saving_a_symbol { }
}
set exec_output [binutils_run $NM "$NMFLAGS $objfile"]
- if {![regexp {^([0-9a-fA-F]+)?[ ]+[T\?] main} $exec_output] \
+ if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
&& ![regexp {^([0-9a-fA-F]+)?[ ]+T _main} $exec_output]} {
fail $test
return
--
Alan Modra
IBM OzLabs - Linux Technology Centre