aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-intl.h
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2025-04-25 19:22:42 +0100
committerNick Alcock <nick.alcock@oracle.com>2025-04-25 21:23:07 +0100
commit4db605353c33245acb436d76129610131916574a (patch)
treeaffe00b8212d52300ad90886e090260f9061f825 /libctf/ctf-intl.h
parent6b8885cfc9de8b20fa3495a152e457103cfc6c95 (diff)
downloadbinutils-4db605353c33245acb436d76129610131916574a.zip
binutils-4db605353c33245acb436d76129610131916574a.tar.gz
binutils-4db605353c33245acb436d76129610131916574a.tar.bz2
libctf: dedup: datasecs and vars
These are a bit trickier than previous things. Datasecs are unusual: the content they contain for a given variable is conceptually part of that variable, in that a variable can only appear in one datasec: so if two TUs have different datasec values for a variable, you'll want to emit two conflicting variables with different datasec entries. Equally, if they have entries in different datasecs, they're conflicting. But the *index* of a variable in a datasec has nothing to do with the variable: it's just a property of how many other variables are in the datasec. So we turn the type graph upside down for them. We track the variable -> datasec mappings for every variable we are dedupping, and use this to hash variables with datasec entries *twice*: firstly, as purely variable type, name, and promoted-to-non-extern linkage, and secondly with all of that plus the datasec name, offset and size: we indicate that the non-extern hash *replaces* the extern one, and use this later on. The datasec itself is not hashed at all! We skip it at both hashing and emission time (without breaking anything else, because nothing points at datasecs, so nothing will ever recurse down into one). The popcount code (used to find the "most popular" type, the one to put in the shared dict) changes to say that replaced types (extern vars) popcounts are added to the counts of the types that replace them (the corresponding non-extern vars). At emission time, replaced variables (extern variables) are skipped, ensuring that extern vars with non-conflicting non-extern counterparts are skipped in favour of the non-extern ones. ctf_add_section_variable then takes care of emitting both the var and its corresponding datasec for us.
Diffstat (limited to 'libctf/ctf-intl.h')
0 files changed, 0 insertions, 0 deletions