diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2019-04-24 12:04:33 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2019-05-28 17:09:45 +0100 |
commit | 7d9813f196bd1a98d49c2b9b7b90351cb2435b0d (patch) | |
tree | a98af01fd572cc1e662a1304c7c8f771e2b59873 /ld | |
parent | 0e65dfbaf3a0299e4837216a103c28625d4b4f1d (diff) | |
download | gdb-7d9813f196bd1a98d49c2b9b7b90351cb2435b0d.zip gdb-7d9813f196bd1a98d49c2b9b7b90351cb2435b0d.tar.gz gdb-7d9813f196bd1a98d49c2b9b7b90351cb2435b0d.tar.bz2 |
binutils: CTF support for objdump and readelf
This introduces CTF support for objdump and readelf. objdump has the
following new arguments:
--ctf=SECTION: display CTF in the given SECTION
--ctf-parent=SECTION: name of CTF section that is the parent of this section
readelf has the above, and these two as well:
--ctf-symbols=SECTION: name of symbol table section (optional)
--ctf-strings=SECTION: name of string table section (optional)
(objdump can always use BFD machinery to determine the applicable string
and symbol tables automatically, so these arguments are unnecessary.)
Nearly all the work is done by the ctf_dump machinery in libctf: most of
the remaining work is option-processing and section-reading, and thus is
different for objdump and readelf: the minimal amount of similar code
remaining is, in my view, too small to share, particularly given that
objdump uses ctf_bfdopen() and readelf uses ctf_simple_open() since it
doesn't have a bfd.
I am not particularly satisfied with the way resources are freed in
either of these (I was forced to do it at the top level, for lack of
anywhere else to free resources allocated during option processing), but
I can't see any better way to do it without introducing new
infrastructure for no other purpose.
There are essentially arbitrary ordering changes to the Makefile.in's
order of libtool-related stuff that I can't get rid of, but they have no
semantic effect. (It is possible that some hunks of these changes could
be dropped, but that seems a bit risky to me.)
binutils/
* objdump.c (ctf-api.h): New include.
(dump_ctf_section_info): New variable.
(dump_ctf_section_name): Likewise.
(usage): Describe new options.
(enum option_values): Add OPTION_CTF and OPTION_CTF_PARENT.
(main): Use them to add --ctf and --ctf-parent.
(read_section_stabs): Add new parameter, entsize_ptr.
(find_stabs_section): Adjust accordingly.
(make_ctfsect): New.
(dump_ctf_indent_lines): New.
(dump_ctf_archive_member): New.
(dump_ctf): New.
(dump_bfd): Call it. Free resources afterwards.
* readelf.c (ctf-api.h): New include.
(CTF_DUMP): New.
(static bfd_boolean do_ctf): Likewise.
(dump_ctf_parent_name): Likewise.
(dump_ctf_symtab_name): Likewise.
(dump_ctf_strtab_name): Likewise.
(OPTION_CTF_DUMP): Likewise.
(OPTION_CTF_PARENT): Likewise.
(OPTION_CTF_SYMBOLS): Likewise.
(OPTION_CTF_STRINGS): Likewise.
(options): Add them.
(usage): Likewise.
(parse_args): Handle the new options, requesting CTF_DUMP.
(process_section_contents): Handle CTF_DUMP.
(shdr_to_ctf_sect): New.
(dump_ctf_indent_lines): New.
(dump_section_as_ctf): New.
(main): Free resources.
* Makefile.am (LIBCTF): New variable.
(objdump_DEPENDENCIES): Use it.
(readelf_DEPENDENCIES): Likewise.
(objdump_LDADD): Likewise.
(readelf_LDADD): Likewise.
* aclocal.m4: Regenerated.
* Makefile.in: Likewise.
* doc/binutils.texi (objdump): Document the new options.
(readelf): Likewise.
* doc/ctf.options.texi: New.
* doc/Makefile.in: Regenerated.
* NEWS: Mention the new feature.
Diffstat (limited to 'ld')
0 files changed, 0 insertions, 0 deletions