binutils-gdb/include
Nick Alcock 2f6ecaed66 libctf, binutils: support CTF archives like objdump
objdump and readelf have one major CTF-related behavioural difference:
objdump can read .ctf sections that contain CTF archives and extract and
dump their members, while readelf cannot.  Since the linker often emits
CTF archives, this means that readelf intermittently and (from the
user's perspective) randomly fails to read CTF in files that ld emits,
with a confusing error message wrongly claiming that the CTF content is
corrupt.  This is purely because the archive-opening code in libctf was
needlessly tangled up with the BFD code, so readelf couldn't use it.

Here, we disentangle it, moving ctf_new_archive_internal from
ctf-open-bfd.c into ctf-archive.c and merging it with the helper
function in ctf-archive.c it was already using.  We add a new public API
function ctf_arc_bufopen, that looks very like ctf_bufopen but returns
an archive given suitable section data rather than a ctf_file_t: the
archive is a ctf_archive_t, so it can be called on raw CTF dictionaries
(with no archive present) and will return a single-member synthetic
"archive".

There is a tiny lifetime tweak here: before now, the archive code could
assume that the symbol section in the ctf_archive_internal wrapper
structure was always owned by BFD if it was present and should always be
freed: now, the caller can pass one in via ctf_arc_bufopen, wihch has
the usual lifetime rules for such sections (caller frees): so we add an
extra field to track whether this is an internal call from ctf-open-bfd,
in which case we still free the symbol section.

include/
	* ctf-api.h (ctf_arc_bufopen): New.
libctf/
	* ctf-impl.h (ctf_new_archive_internal): Declare.
	(ctf_arc_bufopen): Remove.
	(ctf_archive_internal) <ctfi_free_symsect>: New.
	* ctf-archive.c (ctf_arc_close): Use it.
	(ctf_arc_bufopen): Fuse into...
	(ctf_new_archive_internal): ... this, moved across from...
	* ctf-open-bfd.c: ... here.
	(ctf_bfdopen_ctfsect): Use ctf_arc_bufopen.
	* libctf.ver: Add it.
binutils/
	* readelf.c (dump_section_as_ctf): Support .ctf archives using
	ctf_arc_bufopen.  Automatically load the .ctf member of such
	archives as the parent of all other members, unless specifically
	overridden via --ctf-parent.  Split out dumping code into...
	(dump_ctf_archive_member): ... here, as in objdump, and call
	it once per archive member.
	(dump_ctf_indent_lines): Code style fix.
2020-06-26 15:56:39 +01:00
..
aout Fixes for the magic number used in PDP11 AOUT binaries. 2020-04-14 14:41:27 +01:00
cgen Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
coff coff-go32-exe: support variable-length stubs 2020-04-02 14:31:43 +01:00
elf m68k: tag floating-point ABI used 2020-06-26 14:42:19 +09:30
gdb Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mach-o Recognize some new Mach-O load commands 2020-06-22 14:29:20 +01:00
opcode aarch64: Normalize and sort feature bit macros 2020-06-22 14:51:04 +01:00
som ubsan: som: left shift of 1 by 31 places 2020-03-10 17:58:02 +10:30
vms Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
COPYING Update the address and phone number of the FSF organization 2005-05-10 10:21:13 +00:00
COPYING3 * COPYING3: New file. Contains version 3 of the GNU General Public License. 2007-07-17 13:50:23 +00:00
ChangeLog libctf, binutils: support CTF archives like objdump 2020-06-26 15:56:39 +01:00
ChangeLog-0415 binutils ChangeLog rotation 2016-01-01 22:59:17 +10:30
ChangeLog-2016 ChangeLog rotation 2017-01-02 13:55:05 +10:30
ChangeLog-2017 ChangeLog rotation 2018-01-03 17:49:42 +10:30
ChangeLog-2018 ChangeLog rotation 2019-01-01 21:25:40 +10:30
ChangeLog-2019 ChangeLog rotation 2020-01-01 18:12:08 +10:30
ChangeLog-9103 Add copyright notices 2012-12-10 12:48:03 +00:00
MAINTAINERS Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
alloca-conf.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
ansidecl.h Update libiberty sources with changes in the gcc mainline. 2020-01-17 14:13:22 +00:00
bfdlink.h gold, ld: Implement -z start-stop-visibility=... option. 2020-06-15 11:45:02 -07:00
binary-io.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
bout.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
ctf-api.h libctf, binutils: support CTF archives like objdump 2020-06-26 15:56:39 +01:00
ctf.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
demangle.h Update libiberty sources with changes in the gcc mainline. 2020-01-17 14:13:22 +00:00
diagnostics.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
dis-asm.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
dwarf2.def Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
dwarf2.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
dyn-string.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
environ.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
fibheap.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
filenames.h Sync config, include and libiberty with GCC 2020-06-24 16:52:48 -07:00
floatformat.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
fnmatch.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
fopen-bin.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
fopen-same.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
fopen-vms.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
gcc-c-fe.def Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
gcc-c-interface.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
gcc-cp-fe.def Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
gcc-cp-interface.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
gcc-interface.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
getopt.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
hashtab.h Merge upstream GCC changes for include/ and libiberty/ directories 2020-02-25 17:04:42 +00:00
hp-symtab.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
leb128.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
libiberty.h Remove the use of the register keyword in the libiberty.h header file - it is deprecated and incompatible with C++17. 2020-06-25 11:16:42 +01:00
longlong.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
lto-symtab.h include: Sync lto-symtab.h and plugin-api.h with GCC 2020-03-21 03:39:18 -07:00
md5.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
oasys.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
objalloc.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
obstack.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
os9k.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
partition.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
plugin-api.h include: Sync plugin-api.h with GCC 2020-04-01 02:36:11 -07:00
progress.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
safe-ctype.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
sha1.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
simple-object.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
sort.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
splay-tree.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
symcat.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
timeval-utils.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
vtv-change-permission.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
xregex.h merge from gcc 2011-07-25 17:11:48 +00:00
xregex2.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
xtensa-config.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
xtensa-isa-internal.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
xtensa-isa.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30