[@option{-e}|@option{--headers}]
[@option{-s}|@option{--syms}|@option{--symbols}]
[@option{--dyn-syms}|@option{--lto-syms}]
+ [@option{--sym-base=[0|8|10|16]}]
[@option{--demangle@var{=style}}|@option{--no-demangle}]
[@option{--quiet}]
[@option{--recurse-limit}|@option{--no-recurse-limit}]
@cindex LTO symbol table
Displays the contents of any LTO symbol tables in the file.
+@item --sym-base=[0|8|10|16]
+@cindex symbol table size base
+Forces the size field of the symbol table to use the given base. Any
+unrecognized options will be treated as @samp{0}. @option{--sym-base=0}
+represents the default and legacy behaviour. This will output sizes as decimal
+for numbers less than 100000. For sizes 100000 and greater hexadecimal notation
+will be used with a 0x prefix.
+@option{--sym-base=8} will give the symbol sizes in octal.
+@option{--sym-base=10} will always give the symbol sizes in decimal.
+@option{--sym-base=16} will always give the symbol sizes in hexadecimal with a
+0x prefix.
+
@item -C
@itemx --demangle[=@var{style}]
@cindex demangling in nm
static bool do_demangle = false; /* Pretty print C++ symbol names. */
static bool process_links = false;
static int demangle_flags = DMGL_ANSI | DMGL_PARAMS;
+static int sym_base = 0;
static char *dump_ctf_parent_name;
static char *dump_ctf_symtab_name;
typedef enum print_mode
{
HEX,
+ HEX_5,
DEC,
DEC_5,
UNSIGNED,
+ UNSIGNED_5,
PREFIX_HEX,
+ PREFIX_HEX_5,
FULL_HEX,
- LONG_HEX
+ LONG_HEX,
+ OCTAL,
+ OCTAL_5
}
print_mode;
case HEX:
return nc + printf ("%" BFD_VMA_FMT "x", vma);
+ case PREFIX_HEX_5:
+ nc = printf ("0x");
+ /* Fall through. */
+ case HEX_5:
+ return nc + printf ("%05" BFD_VMA_FMT "x", vma);
+
case DEC:
return printf ("%" BFD_VMA_FMT "d", vma);
case UNSIGNED:
return printf ("%" BFD_VMA_FMT "u", vma);
+ case UNSIGNED_5:
+ return printf ("%5" BFD_VMA_FMT "u", vma);
+
+ case OCTAL:
+ return printf ("%" BFD_VMA_FMT "o", vma);
+
+ case OCTAL_5:
+ return printf ("%5" BFD_VMA_FMT "o", vma);
+
default:
/* FIXME: Report unrecognised mode ? */
return 0;
}
}
+
/* Display a symbol on stdout. Handles the display of control characters and
multibye characters (assuming the host environment supports them).
OPTION_WITH_SYMBOL_VERSIONS,
OPTION_RECURSE_LIMIT,
OPTION_NO_RECURSE_LIMIT,
- OPTION_NO_DEMANGLING
+ OPTION_NO_DEMANGLING,
+ OPTION_SYM_BASE
};
static struct option options[] =
{"ctf-strings", required_argument, 0, OPTION_CTF_STRINGS},
{"ctf-parent", required_argument, 0, OPTION_CTF_PARENT},
#endif
+ {"sym-base", optional_argument, 0, OPTION_SYM_BASE},
{0, no_argument, 0, 0}
};
--symbols An alias for --syms\n\
--dyn-syms Display the dynamic symbol table\n\
--lto-syms Display LTO symbol tables\n\
+ --sym-base=[0|8|10|16] \n\
+ Force base for symbol sizes. The options are \n\
+ mixed (the default), octal, decimal, hexadecimal.\n\
-C --demangle[=STYLE] Decode low-level symbol names into user-level names\n\
The STYLE, if specified, can be `auto' (the default),\n\
`gnu', `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n\
/* Ignored for backward compatibility. */
break;
+ case OPTION_SYM_BASE:
+ sym_base = 0;
+ if (optarg != NULL)
+ {
+ sym_base = strtoul (optarg, NULL, 0);
+ switch (sym_base)
+ {
+ case 0:
+ case 8:
+ case 10:
+ case 16:
+ break;
+
+ default:
+ sym_base = 0;
+ break;
+ }
+ }
+ break;
+
default:
/* xgettext:c-format */
error (_("Invalid option '-%c'\n"), c);
if (filedata->is_separate)
printf (_("Section groups in linked file '%s'\n"), filedata->file_name);
-
+
for (i = 0, section = filedata->section_headers, group = filedata->section_groups;
i < filedata->file_header.e_shnum;
i++, section++)
printf
(_("\n'%s' relocation section at offset 0x%lx contains %ld bytes:\n"),
name, rel_offset, rel_size);
-
dump_relocations (filedata,
offset_from_vma (filedata, rel_offset, rel_size),
section->sh_info),
printable_section_name (filedata, section),
section->sh_info);
-
+
printf (_(" Addr: 0x"));
printf_vma (section->sh_addr);
printf (_(" Offset: %#08lx Link: %u (%s)\n"),
section->sh_info),
printable_section_name (filedata, section),
section->sh_info);
-
+
printf (_(" Addr: 0x"));
printf_vma (section->sh_addr);
printf (_(" Offset: %#08lx Link: %u (%s)\n"),
return NULL;
}
+/* Display a symbol size on stdout. Format is based on --sym-base setting. */
+
+static unsigned int
+print_dynamic_symbol_size (bfd_vma vma, int base)
+{
+ switch (base)
+ {
+ case 8:
+ return print_vma (vma, OCTAL_5);
+
+ case 10:
+ return print_vma (vma, UNSIGNED_5);
+
+ case 16:
+ return print_vma (vma, PREFIX_HEX_5);
+
+ case 0:
+ default:
+ return print_vma (vma, DEC_5);
+ }
+}
+
static void
print_dynamic_symbol (Filedata *filedata, unsigned long si,
Elf_Internal_Sym *symtab,
printf ("%6ld: ", si);
print_vma (psym->st_value, LONG_HEX);
putchar (' ');
- print_vma (psym->st_size, DEC_5);
+ print_dynamic_symbol_size (psym->st_size, sym_base);
printf (" %-7s", get_symbol_type (filedata, ELF_ST_TYPE (psym->st_info)));
printf (" %-6s", get_symbol_binding (filedata, ELF_ST_BIND (psym->st_info)));
if (filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_SOLARIS)
else
printf (_("\nLTO Symbol table '%s' is empty!\n"),
printable_section_name (filedata, section));
-
+
return true;
}
if (filedata->is_separate && ! process_links)
dump &= DEBUG_DUMP;
-
+
#ifdef SUPPORT_DISASSEMBLY
if (dump & DISASS_DUMP)
{