binutils-gdb/include
Nick Alcock 791915db42 libctf: handle nonrepresentable types at link time
GCC can emit references to type 0 to indicate that this type is one that
is not representable in the version of CTF it emits (for instance,
version 3 cannot encode vector types).  Type 0 is already used in the
function section to indicate padding inserted to skip functions we do
not want to encode the type of, so using zero in this way is a good
extension of the format: but libctf reports such types as ECTF_BADID,
which is indistinguishable from file corruption via links to truly
nonexistent types with IDs like 0xDEADBEEF etc, which we really do want
to stop for.

In particular, this stops all traversals of types dead at this point,
preventing us from even dumping CTF files containing unrepresentable
types to see what's going on!

So add a new error, ECTF_NONREPRESENTABLE, which is returned by
recursive type resolution when a reference to a zero type is found.  (No
zero type is ever emitted into the CTF file by GCC, only references to
one).  We can't do much with types that are ultimately nonrepresentable,
but we can do enough to keep functioning.

Adjust ctf_add_type to ensure that top-level types of type zero and
structure and union members of ultimate type zero are simply skipped
without reporting an error, so we can copy structures and unions that
contain nonrepresentable members (skipping them and leaving a hole where
they would be, so no consumers downstream of the linker need to worry
about this): adjust the dumper so that we dump members of
nonrepresentable types in a simple form that indicates
nonrepresentability rather than terminating the dump, and do not falsely
assume all errors to be -ENOMEM: adjust the linker so that types that
fail to get added are simply skipped, so that both nonrepresentable
types and outright errors do not terminate the type addition, which
could skip many valid types and cause further errors when variables of
those types are added.

In future, when we gain the ability to call back to the linker to report
link-time type resolution errors, we should report failures to add all
but nonrepresentable types.  But we can't do that yet.

v5: Fix tabdamage.

include/
	* ctf-api.h (ECTF_NONREPRESENTABLE): New.
libctf/
	* ctf-types.c (ctf_type_resolve): Return ECTF_NONREPRESENTABLE on
	type zero.
	* ctf-create.c (ctf_add_type): Detect and skip nonrepresentable
	members and types.
	(ctf_add_variable): Likewise for variables pointing to them.
	* ctf-link.c (ctf_link_one_type): Do not warn for nonrepresentable
	type link failure, but do warn for others.
	* ctf-dump.c (ctf_dump_format_type): Likewise.  Do not assume all
	errors to be ENOMEM.
	(ctf_dump_member): Likewise.
	(ctf_dump_type): Likewise.
	(ctf_dump_header_strfield): Do not assume all errors to be ENOMEM.
	(ctf_dump_header_sectfield): Do not assume all errors to be ENOMEM.
	(ctf_dump_header): Likewise.
	(ctf_dump_label): likewise.
	(ctf_dump_objts): likewise.
	(ctf_dump_funcs): likewise.
	(ctf_dump_var): likewise.
	(ctf_dump_str): Likewise.
2019-10-03 17:04:56 +01:00
..
aout Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
cgen Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
coff Allow objdump to recognise the System.Runtime.dll files that get shipped with .NET Core 2.1. 2019-07-23 09:44:57 +01:00
elf ARM CMSE symbols 2019-08-22 14:14:23 +09:30
gdb Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
mach-o Use the correct name for various MACH-O based operating systems in comments. 2019-02-15 12:50:52 +00:00
opcode RISC-V: Gate opcode tables by enum rather than string. 2019-09-17 17:59:08 -07:00
som Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
vms Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +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: handle nonrepresentable types at link time 2019-10-03 17:04:56 +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-9103 Add copyright notices 2012-12-10 12:48:03 +00:00
MAINTAINERS Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
alloca-conf.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
ansidecl.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
bfdlink.h bfd, ld: add CTF section linking 2019-10-03 17:04:56 +01:00
binary-io.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
bout.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
ctf-api.h libctf: handle nonrepresentable types at link time 2019-10-03 17:04:56 +01:00
ctf.h libctf: support getting strings from the ELF strtab 2019-10-03 17:04:55 +01:00
demangle.h Sync libiberty sources with gcc master versions. 2019-01-10 09:44:13 +00:00
diagnostics.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
dis-asm.h PowerPC add initial -mfuture instruction support 2019-05-24 10:24:45 +09:30
dwarf2.def Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
dwarf2.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
dyn-string.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
environ.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
fibheap.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
filenames.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
floatformat.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
fnmatch.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
fopen-bin.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
fopen-same.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
fopen-vms.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
gcc-c-fe.def Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
gcc-c-interface.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
gcc-cp-fe.def Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
gcc-cp-interface.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
gcc-interface.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
getopt.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
hashtab.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
hp-symtab.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
leb128.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
libiberty.h Merge from gcc: use "cannot" instead of "can not" in libiberty and include. 2019-01-09 13:59:16 -08:00
longlong.h Merge libiberty from gcc 2019-04-07 20:49:49 +09:30
lto-symtab.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
md5.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
oasys.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
objalloc.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
obstack.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
os9k.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
partition.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
plugin-api.h Merge from gcc: use "cannot" instead of "can not" in libiberty and include. 2019-01-09 13:59:16 -08:00
progress.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
safe-ctype.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
sha1.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
simple-object.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
sort.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
splay-tree.h Fix splay tree KEY leak detected in GDB test gdb.base/macscp.exp 2019-02-12 06:06:19 -07:00
symcat.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
timeval-utils.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
vtv-change-permission.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +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 2019-01-01 22:06:53 +10:30
xtensa-config.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
xtensa-isa-internal.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
xtensa-isa.h Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30