+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * readelf.c (dump_ctf_symtab_name): Give default value.
+ (dump_ctf_strtab_name): Likewise.
+ (dump_section_as_ctf): Allow for the null string.
+
2019-07-08 Nick Alcock <nick.alcock@oracle.com>
* objdump.c (dump_ctf_archive_member): Dump the CTF header.
@item --ctf-symbols=@var{section}
@item --ctf-strings=@var{section}
Specify the name of another section from which the CTF file can inherit
-strings and symbols.
+strings and symbols. By default, the @code{.symtab} and its linked
+string table are used.
If either of @option{--ctf-symbols} or @option{--ctf-strings} is specified, the
other must be specified as well.
data = get_section_contents (section, filedata);
ctfsect.cts_data = data;
- if (dump_ctf_symtab_name)
+ if (!dump_ctf_symtab_name)
+ dump_ctf_symtab_name = strdup (".symtab");
+
+ if (!dump_ctf_strtab_name)
+ dump_ctf_strtab_name = strdup (".strtab");
+
+ if (dump_ctf_symtab_name && dump_ctf_symtab_name[0] != 0)
{
if ((symtab_sec = find_section (filedata, dump_ctf_symtab_name)) == NULL)
{
symsectp = shdr_to_ctf_sect (&symsect, symtab_sec, filedata);
symsect.cts_data = symdata;
}
- if (dump_ctf_strtab_name)
+ if (dump_ctf_strtab_name && dump_ctf_symtab_name[0] != 0)
{
if ((strtab_sec = find_section (filedata, dump_ctf_strtab_name)) == NULL)
{