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
testsuite libctf: propagate errors from parents correctly 2023-04-08 16:07:17 +01:00
.gitignore
aclocal.m4
ChangeLog
ChangeLog-2020
config.h.in
configure
configure.ac
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
ctf-decls.h
ctf-dedup.c libctf: fix a comment typo 2023-03-24 13:37:32 +00:00
ctf-dump.c
ctf-endian.h
ctf-error.c
ctf-hash.c
ctf-impl.h
ctf-inlines.h
ctf-intl.h
ctf-labels.c
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
ctf-open.c ctf segfaults 2023-03-19 22:19:19 +10:30
ctf-qsort_r.c
ctf-serialize.c
ctf-sha1.c
ctf-sha1.h
ctf-string.c
ctf-subr.c
ctf-types.c libctf: propagate errors from parents correctly 2023-04-08 16:07:17 +01:00
ctf-util.c
elf.h
libctf.ver
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
swap.h