binutils-gdb/libctf
Nick Alcock fdb4c2e02e libctf: adding CU mappings should be idempotent
When CTF finds conflicting types, it usually shoves each definition
into a CTF dictionary named after the compilation unit.

The intent of the obscure "cu-mapped link" feature is to allow you to
implement custom linkers that shove the definitions into other, more
coarse-grained units (say, one per kernel module, even if a module consists
of more than one compilation unit): conflicting types within one of these
larger components are hidden from name lookup so you can only look up (an
arbitrary one of) them by name, but can still be found by chasing type graph
links and are still fully deduplicated.

You do this by calling
ctf_link_add_cu_mapping (fp, "CU name", "bigger lump name"), repeatedly,
with different "CU name"s: the ctf_link() following that will put all
conflicting types found in "CU name"s sharing a "bigger lump name" into a
child dict in an archive member named "bigger lump name".

So it's clear enough what happens if you call it repeatedly with the same
"bigger lump name" more than once, because that's the whole point of it: but
what if you call it with the same "CU name" repeatedly?

ctf_link_add_cu_mapping (fp, "CU name", "bigger lump name");
ctf_link_add_cu_mapping (fp, "CU name", "other name");

This is meant to be the same as just doing the second of these, as if the
first was never called.  Alas, this isn't what happens, and what you get is
instead a bit of an inconsistent mess: more or less, the first takes
precedence, which is the exact opposite of what we wanted.

Fix this to work the right way round.

(I plan to add support for CU-mapped links to GNU ld, mainly so that we can
properly *test* this machinery.)

libctf/ChangeLog:

	* ctf-link.c (ctf_create_per_cu): Note the behaviour of
	repeatedly adding FROMs.
	(ctf_link_add_cu_mapping): Implement that behavour.
2023-11-20 12:31:41 +00:00
..
doc
testsuite libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
.gitignore
aclocal.m4 Finalized intl-update patches 2023-11-15 12:53:04 +00:00
ChangeLog Finalized intl-update patches 2023-11-15 12:53:04 +00:00
ChangeLog-2020
config.h.in Finalized intl-update patches 2023-11-15 12:53:04 +00:00
configure Finalized intl-update patches 2023-11-15 12:53:04 +00:00
configure.ac Finalized intl-update patches 2023-11-15 12:53:04 +00:00
ctf-archive.c
ctf-create.c libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
ctf-decl.c
ctf-decls.h
ctf-dedup.c libctf: Sanitize error types for PR 30836 2023-10-17 17:31:20 +02:00
ctf-dump.c
ctf-endian.h
ctf-error.c
ctf-hash.c
ctf-impl.h libctf: Sanitize error types for PR 30836 2023-10-17 17:31:20 +02:00
ctf-inlines.h libctf: Sanitize error types for PR 30836 2023-10-17 17:31:20 +02:00
ctf-intl.h
ctf-labels.c
ctf-link.c libctf: adding CU mappings should be idempotent 2023-11-20 12:31:41 +00:00
ctf-lookup.c libctf: Sanitize error types for PR 30836 2023-10-17 17:31:20 +02:00
ctf-open-bfd.c
ctf-open.c
ctf-qsort_r.c
ctf-serialize.c
ctf-sha1.c
ctf-sha1.h
ctf-string.c libctf: fix creation-time parent/child dict confusions 2023-10-20 18:09:54 +01:00
ctf-subr.c
ctf-types.c libctf: Return CTF_ERR in ctf_type_resolve_unsliced PR 30836 2023-10-18 09:39:59 +02:00
ctf-util.c libctf: Sanitize error types for PR 30836 2023-10-17 17:31:20 +02:00
elf.h
libctf.ver
Makefile.am Finalized intl-update patches 2023-11-15 12:53:04 +00:00
Makefile.in Finalized intl-update patches 2023-11-15 12:53:04 +00:00
NEWS
swap.h