aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-11-11 11:06:34 +0000
committerNick Clifton <nickc@redhat.com>2005-11-11 11:06:34 +0000
commit5e2b0d475efa4aa40e098f49074f3c2afd854f48 (patch)
treecb92876512ba88783179472896ed5039b98690c5 /binutils/readelf.c
parentff1e98b937b0538db997dcf79867f799152d7d33 (diff)
downloadgdb-5e2b0d475efa4aa40e098f49074f3c2afd854f48.zip
gdb-5e2b0d475efa4aa40e098f49074f3c2afd854f48.tar.gz
gdb-5e2b0d475efa4aa40e098f49074f3c2afd854f48.tar.bz2
PR 1150
* readelf.c (get_mips_symbol_other): New function. (get_symbol_other): New function. (process_symbol_table): Call get_symbol_other() to get a description of the st_other field if it contains more information than just the visibility. * elfxx-mips.c (mips_elf_calculate_relocation): Ignore an undefined symbol if it is optional. (_bfd_mips_elf_merge_symbol_attribute): Make sure that the optional flag is merged as well as the visibility. * elfxx-mips.h (_bfd_mips_elf_merge_symbol_attribute): Prototype. (elf_backend_merge_symbol_attribute): Define. * mips.h (STO_OPTIONAL): Define. (ELF_MIPS_IS_OPTIONAL): Define.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index d076a65..3e8eb20 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -6690,6 +6690,41 @@ get_symbol_visibility (unsigned int visibility)
}
static const char *
+get_mips_symbol_other (unsigned int other)
+{
+ switch (other)
+ {
+ case STO_OPTIONAL: return "OPTIONAL";
+ case STO_MIPS16: return "MIPS16";
+ default: return NULL;
+ }
+}
+
+static const char *
+get_symbol_other (unsigned int other)
+{
+ const char * result = NULL;
+ static char buff [32];
+
+ if (other == 0)
+ return "";
+
+ switch (elf_header.e_machine)
+ {
+ case EM_MIPS:
+ result = get_mips_symbol_other (other);
+ default:
+ break;
+ }
+
+ if (result)
+ return result;
+
+ snprintf (buff, sizeof buff, _("<other>: %x"), other);
+ return buff;
+}
+
+static const char *
get_symbol_index_type (unsigned int type)
{
static char buff[32];
@@ -6851,6 +6886,11 @@ process_symbol_table (FILE *file)
printf (" %6s", get_symbol_type (ELF_ST_TYPE (psym->st_info)));
printf (" %6s", get_symbol_binding (ELF_ST_BIND (psym->st_info)));
printf (" %3s", get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other)));
+ /* Check to see if any other bits in the st_other field are set.
+ Note - displaying this information disrupts the layout of the
+ table being generated, but for the moment this case is very rare. */
+ if (psym->st_other ^ ELF_ST_VISIBILITY (psym->st_other))
+ printf (" [%s] ", get_symbol_other (psym->st_other ^ ELF_ST_VISIBILITY (psym->st_other)));
printf (" %3.3s ", get_symbol_index_type (psym->st_shndx));
if (VALID_DYNAMIC_NAME (psym->st_name))
print_symbol (25, GET_DYNAMIC_NAME (psym->st_name));
@@ -6918,6 +6958,11 @@ process_symbol_table (FILE *file)
printf (" %-7s", get_symbol_type (ELF_ST_TYPE (psym->st_info)));
printf (" %-6s", get_symbol_binding (ELF_ST_BIND (psym->st_info)));
printf (" %-3s", get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other)));
+ /* Check to see if any other bits in the st_other field are set.
+ Note - displaying this information disrupts the layout of the
+ table being generated, but for the moment this case is very rare. */
+ if (psym->st_other ^ ELF_ST_VISIBILITY (psym->st_other))
+ printf (" [%s] ", get_symbol_other (psym->st_other ^ ELF_ST_VISIBILITY (psym->st_other)));
printf (" %4s ", get_symbol_index_type (psym->st_shndx));
print_symbol (25, psym->st_name < strtab_size
? strtab + psym->st_name : "<corrupt>");