binutils-gdb/libctf
Nick Alcock 869a750c0e libctf, link: fix CU-mapped links with CTF_LINK_EMPTY_CU_MAPPINGS
This is a bug in the intersection of two obscure options that cannot
even be invoked from ld with a feature added to stop ld of the
same input file repeatedly from crashing the linker.

The latter fix involved tracking input files (internally to libctf) not
just with their input CU name but with a version of their input CU name
that was augmented with a numeric prefix if their linker input file name
was changed, to prevent distinct CTF dicts with the same cuname from
overwriting each other. (We can't use just the linker input file name
because one linker input can contain many CU dicts, particularly under
ld -r).  If these inputs then produced conflicting types, those types
were emitted into similarly-named output dicts, so we needed similar
machinery to detect clashing output dicts and add a numeric prefix to
them as well.

This works fine, except that if you used the cu-mapping feature to force
double-linking of CTF (so that your CTF can be grouped into output dicts
larger than a single translation unit) and then also used
CTF_LINK_EMPTY_CU_MAPPINGS to force every possible output dict in the
mapping to be created (even if empty), we did the creation of empty dicts
first, and then all the actual content got considered to be a clash. So
you ended up with a pile of useless empty dicts and then all the content
was in full dicts with the same names suffixed with a #0.  This seems
likely to confuse consumers that use this facility.

Fixed by generating all the EMPTY_CU_MAPPINGS empty dicts after linking
is complete, not before it runs.

No impact on ld, which does not do cu-mapped links or pass
CTF_LINK_EMPTY_CU_MAPPINGS to ctf_link().

libctf/
	* ctf-link.c (ctf_create_per_cu): Don't create new dicts iff one
        already exists and we are making one for no input in particular.
        (ctf_link): Emit empty CTF dicts corresponding to no input in
        particular only after linkiing is complete.
2023-04-08 16:07:17 +01:00
..
doc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
testsuite libctf: propagate errors from parents correctly 2023-04-08 16:07:17 +01:00
.gitignore libctf: restructure error handling to reduce relocations 2020-07-22 17:57:20 +01:00
aclocal.m4 libctf: remove unnecessary zstd constructs 2022-12-12 10:53:39 -08:00
ChangeLog Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ChangeLog-2020 libctf: fix old ChangeLog typo 2021-01-05 14:53:40 +00:00
config.h.in libctf: remove unnecessary zstd constructs 2022-12-12 10:53:39 -08:00
configure libctf: update regexp to allow makeinfo to build document 2023-01-16 23:18:38 +08:00
configure.ac libctf: update regexp to allow makeinfo to build document 2023-01-16 23:18:38 +08:00
ctf-archive.c libctf: unused variable 2023-03-20 16:06:40 +10:30
ctf-create.c libctf: propagate errors from parents correctly 2023-04-08 16:07:17 +01:00
ctf-decl.c Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-decls.h Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-dedup.c libctf: fix a comment typo 2023-03-24 13:37:32 +00:00
ctf-dump.c Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-endian.h Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-error.c Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-hash.c Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-impl.h Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-inlines.h Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-intl.h Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-labels.c Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-link.c libctf, link: fix CU-mapped links with CTF_LINK_EMPTY_CU_MAPPINGS 2023-04-08 16:07:17 +01:00
ctf-lookup.c libctf: propagate errors from parents correctly 2023-04-08 16:07:17 +01:00
ctf-open-bfd.c Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-open.c ctf segfaults 2023-03-19 22:19:19 +10:30
ctf-qsort_r.c Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-serialize.c Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-sha1.c Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-sha1.h Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-string.c Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-subr.c Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ctf-types.c libctf: propagate errors from parents correctly 2023-04-08 16:07:17 +01:00
ctf-util.c Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elf.h Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
libctf.ver Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
Makefile.am libctf, tests: do not assume host and target have identical field offsets 2023-04-08 16:07:17 +01:00
Makefile.in libctf, tests: do not assume host and target have identical field offsets 2023-04-08 16:07:17 +01:00
NEWS include, libctf, ld: extend variable section to contain functions too 2022-03-23 13:48:32 +00:00
swap.h Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30