diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2025-05-30 15:26:26 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2025-06-04 12:51:24 +0100 |
commit | 002957be18e3b34e3e4863279335f58ae357cee5 (patch) | |
tree | 82b3ec1ba30c626143053bcbcfd75890fc53c69d /libctf/ctf-impl.h | |
parent | 75e514cfa56c202d4d481626c1f0ba74eb61ff86 (diff) | |
download | binutils-002957be18e3b34e3e4863279335f58ae357cee5.zip binutils-002957be18e3b34e3e4863279335f58ae357cee5.tar.gz binutils-002957be18e3b34e3e4863279335f58ae357cee5.tar.bz2 |
libctf: dedup: improve hiding of conflicting types in the same dict
If types are conflicting, they are usually moved into separate child dicts
-- but not always. If they are added to the same dict by the cu-mapping
mechanism (as used e.g. for multi-TU kernel modules), we can easily end
up adding multiple conflicting types with the same name to the same dict.
The mechanism used for turning on the non-root-visible flag in order to do
this had a kludge attached which always hid types with the same name,
whether or not they were conflicting. This is unnecessary and can hide
types that should not be hidden, as well as hiding bugs. Remove it, and
replace it with two different approaches:
- for everything but cu-mapped links (the in-memory first phase of a link
with ctf_link_add_cu_mapping in force), check for duplicate names if
types are conflicting, and mark them as hidden if the names are found.
This will never happen in normal links (in an upcoming commit we will
suppress doing even this much in such cases).
- for cu-mapped links, the only case that merges multiple distinct target
dicts into one, we apply a big hammer and simply hide everything! The
non-root flag will be ignored in the next link phase anyway (which dedups
the cu-mapped pieces against each other), and this way we can be sure
that merging multiple types cannot incur name clashes at this stage.
The result seems to work: the only annoyance is that when enums with
conflicting enumerators are found in a single cu-mapped child (so, really
multiple merged children), you may end up with every instance of that enum
being hidden for reasons of conflictingness. I don't see a real way to
avoid that.
libctf/
PR libctf/33047
* ctf-dedup.c (ctf_dedup_emit_type): Only consider non
conflicting types. Improve type hiding in the presence of clashing
enumerators. Hide everything when doing a cu-mapped link: they will
be unhidden by the next link pass if nonconflicting.
Diffstat (limited to 'libctf/ctf-impl.h')
0 files changed, 0 insertions, 0 deletions