libctf, include, binutils, gdb, ld: rename ctf_file_t to ctf_dict_t
The naming of the ctf_file_t type in libctf is a historical curiosity. Back in the Solaris days, CTF dictionaries were originally generated as a separate file and then (sometimes) merged into objects: hence the datatype was named ctf_file_t, and known as a "CTF file". Nowadays, raw CTF is essentially never written to a file on its own, and the datatype changed name to a "CTF dictionary" years ago. So the term "CTF file" refers to something that is never a file! This is at best confusing. The type has also historically been known as a 'CTF container", which is even more confusing now that we have CTF archives which are *also* a sort of container (they contain CTF dictionaries), but which are never referred to as containers in the source code. So fix this by completing the renaming, renaming ctf_file_t to ctf_dict_t throughout, and renaming those few functions that refer to CTF files by name (keeping compatibility aliases) to refer to dicts instead. Old users who still refer to ctf_file_t will see (harmless) pointer-compatibility warnings at compile time, but the ABI is unchanged (since C doesn't mangle names, and ctf_file_t was always an opaque type) and things will still compile fine as long as -Werror is not specified. All references to CTF containers and CTF files in the source code are fixed to refer to CTF dicts instead. Further (smaller) renamings of annoyingly-named functions to come, as part of the process of souping up queries across whole archives at once (needed for the function info and data object sections). binutils/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * objdump.c (dump_ctf_errs): Rename ctf_file_t to ctf_dict_t. (dump_ctf_archive_member): Likewise. (dump_ctf): Likewise. Use ctf_dict_close, not ctf_file_close. * readelf.c (dump_ctf_errs): Rename ctf_file_t to ctf_dict_t. (dump_ctf_archive_member): Likewise. (dump_section_as_ctf): Likewise. Use ctf_dict_close, not ctf_file_close. gdb/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ctfread.c: Change uses of ctf_file_t to ctf_dict_t. (ctf_fp_info::~ctf_fp_info): Call ctf_dict_close, not ctf_file_close. include/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ctf-api.h (ctf_file_t): Rename to... (ctf_dict_t): ... this. Keep ctf_file_t around for compatibility. (struct ctf_file): Likewise rename to... (struct ctf_dict): ... this. (ctf_file_close): Rename to... (ctf_dict_close): ... this, keeping compatibility function. (ctf_parent_file): Rename to... (ctf_parent_dict): ... this, keeping compatibility function. All callers adjusted. * ctf.h: Rename references to ctf_file_t to ctf_dict_t. (struct ctf_archive) <ctfa_nfiles>: Rename to... <ctfa_ndicts>: ... this. ld/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ldlang.c (ctf_output): This is a ctf_dict_t now. (lang_ctf_errs_warnings): Rename ctf_file_t to ctf_dict_t. (ldlang_open_ctf): Adjust comment. (lang_merge_ctf): Use ctf_dict_close, not ctf_file_close. * ldelfgen.h (ldelf_examine_strtab_for_ctf): Rename ctf_file_t to ctf_dict_t. Change opaque declaration accordingly. * ldelfgen.c (ldelf_examine_strtab_for_ctf): Adjust. * ldemul.h (examine_strtab_for_ctf): Likewise. (ldemul_examine_strtab_for_ctf): Likewise. * ldeuml.c (ldemul_examine_strtab_for_ctf): Likewise. libctf/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ctf-impl.h: Rename ctf_file_t to ctf_dict_t: all declarations adjusted. (ctf_fileops): Rename to... (ctf_dictops): ... this. (ctf_dedup_t) <cd_id_to_file_t>: Rename to... <cd_id_to_dict_t>: ... this. (ctf_file_t): Fix outdated comment. <ctf_fileops>: Rename to... <ctf_dictops>: ... this. (struct ctf_archive_internal) <ctfi_file>: Rename to... <ctfi_dict>: ... this. * ctf-archive.c: Rename ctf_file_t to ctf_dict_t. Rename ctf_archive.ctfa_nfiles to ctfa_ndicts. Rename ctf_file_close to ctf_dict_close. All users adjusted. * ctf-create.c: Likewise. Refer to CTF dicts, not CTF containers. (ctf_bundle_t) <ctb_file>: Rename to... <ctb_dict): ... this. * ctf-decl.c: Rename ctf_file_t to ctf_dict_t. * ctf-dedup.c: Likewise. Rename ctf_file_close to ctf_dict_close. Refer to CTF dicts, not CTF containers. * ctf-dump.c: Likewise. * ctf-error.c: Likewise. * ctf-hash.c: Likewise. * ctf-inlines.h: Likewise. * ctf-labels.c: Likewise. * ctf-link.c: Likewise. * ctf-lookup.c: Likewise. * ctf-open-bfd.c: Likewise. * ctf-string.c: Likewise. * ctf-subr.c: Likewise. * ctf-types.c: Likewise. * ctf-util.c: Likewise. * ctf-open.c: Likewise. (ctf_file_close): Rename to... (ctf_dict_close): ...this. (ctf_file_close): New trivial wrapper around ctf_dict_close, for compatibility. (ctf_parent_file): Rename to... (ctf_parent_dict): ... this. (ctf_parent_file): New trivial wrapper around ctf_parent_dict, for compatibility. * libctf.ver: Add ctf_dict_close and ctf_parent_dict.
This commit is contained in:
parent
cbbcd7a716
commit
139633c307
34 changed files with 916 additions and 801 deletions
|
@ -55,7 +55,7 @@
|
|||
*global type ID* or 'GID', a pair of an array offset and a ctf_id_t. Since
|
||||
both are already 32 bits or less or can easily be constrained to that range,
|
||||
we can pack them both into a single 64-bit hash word for easy lookups, which
|
||||
would be much more annoying to do with a ctf_file_t * and a ctf_id_t. (On
|
||||
would be much more annoying to do with a ctf_dict_t * and a ctf_id_t. (On
|
||||
32-bit platforms, we must do that anyway, since pointers, and thus hash keys
|
||||
and values, are only 32 bits wide). We track which inputs are parents of
|
||||
which other inputs so that we can correctly recognize that types we have
|
||||
|
@ -294,23 +294,23 @@
|
|||
approach, but with a smaller key, this is all we can do. */
|
||||
|
||||
static void *
|
||||
id_to_packed_id (ctf_file_t *fp, int input_num, ctf_id_t type)
|
||||
id_to_packed_id (ctf_dict_t *fp, int input_num, ctf_id_t type)
|
||||
{
|
||||
const void *lookup;
|
||||
ctf_type_id_key_t *dynkey = NULL;
|
||||
ctf_type_id_key_t key = { input_num, type };
|
||||
|
||||
if (!ctf_dynhash_lookup_kv (fp->ctf_dedup.cd_id_to_file_t,
|
||||
if (!ctf_dynhash_lookup_kv (fp->ctf_dedup.cd_id_to_dict_t,
|
||||
&key, &lookup, NULL))
|
||||
{
|
||||
if ((dynkey = malloc (sizeof (ctf_type_id_key_t))) == NULL)
|
||||
goto oom;
|
||||
memcpy (dynkey, &key, sizeof (ctf_type_id_key_t));
|
||||
|
||||
if (ctf_dynhash_insert (fp->ctf_dedup.cd_id_to_file_t, dynkey, NULL) < 0)
|
||||
if (ctf_dynhash_insert (fp->ctf_dedup.cd_id_to_dict_t, dynkey, NULL) < 0)
|
||||
goto oom;
|
||||
|
||||
ctf_dynhash_lookup_kv (fp->ctf_dedup.cd_id_to_file_t,
|
||||
ctf_dynhash_lookup_kv (fp->ctf_dedup.cd_id_to_dict_t,
|
||||
dynkey, &lookup, NULL);
|
||||
}
|
||||
/* We use a raw assert() here because there isn't really a way to get any sort
|
||||
|
@ -368,7 +368,7 @@ make_set_element (ctf_dynhash_t *set, const void *key)
|
|||
|
||||
/* Initialize the dedup atoms table. */
|
||||
int
|
||||
ctf_dedup_atoms_init (ctf_file_t *fp)
|
||||
ctf_dedup_atoms_init (ctf_dict_t *fp)
|
||||
{
|
||||
if (fp->ctf_dedup_atoms)
|
||||
return 0;
|
||||
|
@ -387,7 +387,7 @@ ctf_dedup_atoms_init (ctf_file_t *fp)
|
|||
/* Intern things in the dedup atoms table. */
|
||||
|
||||
static const char *
|
||||
intern (ctf_file_t *fp, char *atom)
|
||||
intern (ctf_dict_t *fp, char *atom)
|
||||
{
|
||||
const void *foo;
|
||||
|
||||
|
@ -414,7 +414,7 @@ intern (ctf_file_t *fp, char *atom)
|
|||
while allowing for the four C namespaces (normal, struct, union, enum).
|
||||
Return a new dynamically-allocated string. */
|
||||
static const char *
|
||||
ctf_decorate_type_name (ctf_file_t *fp, const char *name, int kind)
|
||||
ctf_decorate_type_name (ctf_dict_t *fp, const char *name, int kind)
|
||||
{
|
||||
ctf_dedup_t *d = &fp->ctf_dedup;
|
||||
const char *ret;
|
||||
|
@ -484,13 +484,13 @@ ctf_dedup_sha1_add (ctf_sha1_t *sha1, const void *buf, size_t len,
|
|||
}
|
||||
|
||||
static const char *
|
||||
ctf_dedup_hash_type (ctf_file_t *fp, ctf_file_t *input,
|
||||
ctf_file_t **inputs, uint32_t *parents,
|
||||
ctf_dedup_hash_type (ctf_dict_t *fp, ctf_dict_t *input,
|
||||
ctf_dict_t **inputs, uint32_t *parents,
|
||||
int input_num, ctf_id_t type, int flags,
|
||||
unsigned long depth,
|
||||
int (*populate_fun) (ctf_file_t *fp,
|
||||
ctf_file_t *input,
|
||||
ctf_file_t **inputs,
|
||||
int (*populate_fun) (ctf_dict_t *fp,
|
||||
ctf_dict_t *input,
|
||||
ctf_dict_t **inputs,
|
||||
int input_num,
|
||||
ctf_id_t type,
|
||||
void *id,
|
||||
|
@ -519,7 +519,7 @@ ctf_dedup_is_stub (const char *name, int kind, int fwdkind, int flags)
|
|||
Only called for forwards or forwardable types with names, when the link mode
|
||||
is CTF_LINK_SHARE_DUPLICATED. */
|
||||
static int
|
||||
ctf_dedup_record_origin (ctf_file_t *fp, int input_num, const char *decorated,
|
||||
ctf_dedup_record_origin (ctf_dict_t *fp, int input_num, const char *decorated,
|
||||
void *id)
|
||||
{
|
||||
ctf_dedup_t *d = &fp->ctf_dedup;
|
||||
|
@ -551,14 +551,14 @@ ctf_dedup_record_origin (ctf_file_t *fp, int input_num, const char *decorated,
|
|||
calls, recursively). */
|
||||
|
||||
static const char *
|
||||
ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
|
||||
ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs,
|
||||
uint32_t *parents, int input_num, ctf_id_t type,
|
||||
void *type_id, const ctf_type_t *tp, const char *name,
|
||||
const char *decorated, int kind, int flags,
|
||||
unsigned long depth,
|
||||
int (*populate_fun) (ctf_file_t *fp,
|
||||
ctf_file_t *input,
|
||||
ctf_file_t **inputs,
|
||||
int (*populate_fun) (ctf_dict_t *fp,
|
||||
ctf_dict_t *input,
|
||||
ctf_dict_t **inputs,
|
||||
int input_num,
|
||||
ctf_id_t type,
|
||||
void *id,
|
||||
|
@ -990,13 +990,13 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
|
|||
Returns a hash value (an atom), or NULL on error. */
|
||||
|
||||
static const char *
|
||||
ctf_dedup_hash_type (ctf_file_t *fp, ctf_file_t *input,
|
||||
ctf_file_t **inputs, uint32_t *parents,
|
||||
ctf_dedup_hash_type (ctf_dict_t *fp, ctf_dict_t *input,
|
||||
ctf_dict_t **inputs, uint32_t *parents,
|
||||
int input_num, ctf_id_t type, int flags,
|
||||
unsigned long depth,
|
||||
int (*populate_fun) (ctf_file_t *fp,
|
||||
ctf_file_t *input,
|
||||
ctf_file_t **inputs,
|
||||
int (*populate_fun) (ctf_dict_t *fp,
|
||||
ctf_dict_t *input,
|
||||
ctf_dict_t **inputs,
|
||||
int input_num,
|
||||
ctf_id_t type,
|
||||
void *id,
|
||||
|
@ -1139,8 +1139,8 @@ ctf_dedup_hash_type (ctf_file_t *fp, ctf_file_t *input,
|
|||
cd_output_first_tu mapping. */
|
||||
|
||||
static int
|
||||
ctf_dedup_populate_mappings (ctf_file_t *fp, ctf_file_t *input _libctf_unused_,
|
||||
ctf_file_t **inputs _libctf_unused_,
|
||||
ctf_dedup_populate_mappings (ctf_dict_t *fp, ctf_dict_t *input _libctf_unused_,
|
||||
ctf_dict_t **inputs _libctf_unused_,
|
||||
int input_num _libctf_unused_,
|
||||
ctf_id_t type _libctf_unused_, void *id,
|
||||
const char *decorated_name,
|
||||
|
@ -1212,7 +1212,7 @@ ctf_dedup_populate_mappings (ctf_file_t *fp, ctf_file_t *input _libctf_unused_,
|
|||
|
||||
while ((err = ctf_dynset_cnext (type_ids, &i, &one_id)) == 0)
|
||||
{
|
||||
ctf_file_t *foo = inputs[CTF_DEDUP_GID_TO_INPUT (one_id)];
|
||||
ctf_dict_t *foo = inputs[CTF_DEDUP_GID_TO_INPUT (one_id)];
|
||||
ctf_id_t bar = CTF_DEDUP_GID_TO_TYPE (one_id);
|
||||
if (ctf_type_kind_unsliced (foo, bar) != orig_kind)
|
||||
{
|
||||
|
@ -1285,7 +1285,7 @@ ctf_dedup_populate_mappings (ctf_file_t *fp, ctf_file_t *input _libctf_unused_,
|
|||
ctf_dedup_maybe_synthesize_forward.) */
|
||||
|
||||
static int
|
||||
ctf_dedup_mark_conflicting_hash (ctf_file_t *fp, const char *hval)
|
||||
ctf_dedup_mark_conflicting_hash (ctf_dict_t *fp, const char *hval)
|
||||
{
|
||||
ctf_dedup_t *d = &fp->ctf_dedup;
|
||||
ctf_next_t *i = NULL;
|
||||
|
@ -1331,7 +1331,7 @@ ctf_dedup_mark_conflicting_hash (ctf_file_t *fp, const char *hval)
|
|||
|
||||
/* Look up a type kind from the output mapping, given a type hash value. */
|
||||
static int
|
||||
ctf_dedup_hash_kind (ctf_file_t *fp, ctf_file_t **inputs, const char *hash)
|
||||
ctf_dedup_hash_kind (ctf_dict_t *fp, ctf_dict_t **inputs, const char *hash)
|
||||
{
|
||||
ctf_dedup_t *d = &fp->ctf_dedup;
|
||||
void *id;
|
||||
|
@ -1363,8 +1363,8 @@ ctf_dedup_hash_kind (ctf_file_t *fp, ctf_file_t **inputs, const char *hash)
|
|||
/* Used to keep a count of types: i.e. distinct type hash values. */
|
||||
typedef struct ctf_dedup_type_counter
|
||||
{
|
||||
ctf_file_t *fp;
|
||||
ctf_file_t **inputs;
|
||||
ctf_dict_t *fp;
|
||||
ctf_dict_t **inputs;
|
||||
int num_non_forwards;
|
||||
} ctf_dedup_type_counter_t;
|
||||
|
||||
|
@ -1401,7 +1401,7 @@ ctf_dedup_count_types (void *key_, void *value _libctf_unused_, void *arg_)
|
|||
/* Detect name ambiguity and mark ambiguous names as conflicting, other than the
|
||||
most common. */
|
||||
static int
|
||||
ctf_dedup_detect_name_ambiguity (ctf_file_t *fp, ctf_file_t **inputs)
|
||||
ctf_dedup_detect_name_ambiguity (ctf_dict_t *fp, ctf_dict_t **inputs)
|
||||
{
|
||||
ctf_dedup_t *d = &fp->ctf_dedup;
|
||||
ctf_next_t *i = NULL;
|
||||
|
@ -1560,7 +1560,7 @@ ctf_dedup_detect_name_ambiguity (ctf_file_t *fp, ctf_file_t **inputs)
|
|||
/* Initialize the deduplication machinery. */
|
||||
|
||||
static int
|
||||
ctf_dedup_init (ctf_file_t *fp)
|
||||
ctf_dedup_init (ctf_dict_t *fp)
|
||||
{
|
||||
ctf_dedup_t *d = &fp->ctf_dedup;
|
||||
size_t i;
|
||||
|
@ -1569,7 +1569,7 @@ ctf_dedup_init (ctf_file_t *fp)
|
|||
goto oom;
|
||||
|
||||
#if IDS_NEED_ALLOCATION
|
||||
if ((d->cd_id_to_file_t = ctf_dynhash_create (ctf_hash_type_id_key,
|
||||
if ((d->cd_id_to_dict_t = ctf_dynhash_create (ctf_hash_type_id_key,
|
||||
ctf_hash_eq_type_id_key,
|
||||
free, NULL)) == NULL)
|
||||
goto oom;
|
||||
|
@ -1646,14 +1646,14 @@ ctf_dedup_init (ctf_file_t *fp)
|
|||
}
|
||||
|
||||
void
|
||||
ctf_dedup_fini (ctf_file_t *fp, ctf_file_t **outputs, uint32_t noutputs)
|
||||
ctf_dedup_fini (ctf_dict_t *fp, ctf_dict_t **outputs, uint32_t noutputs)
|
||||
{
|
||||
ctf_dedup_t *d = &fp->ctf_dedup;
|
||||
size_t i;
|
||||
|
||||
/* ctf_dedup_atoms is kept across links. */
|
||||
#if IDS_NEED_ALLOCATION
|
||||
ctf_dynhash_destroy (d->cd_id_to_file_t);
|
||||
ctf_dynhash_destroy (d->cd_id_to_dict_t);
|
||||
#endif
|
||||
for (i = 0; i < 4; i++)
|
||||
ctf_dynhash_destroy (d->cd_decorated_names[i]);
|
||||
|
@ -1677,7 +1677,7 @@ ctf_dedup_fini (ctf_file_t *fp, ctf_file_t **outputs, uint32_t noutputs)
|
|||
ctf_dedup_t *od = &outputs[i]->ctf_dedup;
|
||||
ctf_dynhash_destroy (od->cd_output_emission_hashes);
|
||||
ctf_dynhash_destroy (od->cd_output_emission_conflicted_forwards);
|
||||
ctf_file_close (od->cd_output);
|
||||
ctf_dict_close (od->cd_output);
|
||||
}
|
||||
}
|
||||
memset (d, 0, sizeof (ctf_dedup_t));
|
||||
|
@ -1686,16 +1686,16 @@ ctf_dedup_fini (ctf_file_t *fp, ctf_file_t **outputs, uint32_t noutputs)
|
|||
/* Return 1 if this type is cited by multiple input dictionaries. */
|
||||
|
||||
static int
|
||||
ctf_dedup_multiple_input_dicts (ctf_file_t *output, ctf_file_t **inputs,
|
||||
ctf_dedup_multiple_input_dicts (ctf_dict_t *output, ctf_dict_t **inputs,
|
||||
const char *hval)
|
||||
{
|
||||
ctf_dedup_t *d = &output->ctf_dedup;
|
||||
ctf_dynset_t *type_ids;
|
||||
ctf_next_t *i = NULL;
|
||||
void *id;
|
||||
ctf_file_t *found = NULL, *relative_found = NULL;
|
||||
ctf_dict_t *found = NULL, *relative_found = NULL;
|
||||
const char *type_id;
|
||||
ctf_file_t *input_fp;
|
||||
ctf_dict_t *input_fp;
|
||||
ctf_id_t input_id;
|
||||
const char *name;
|
||||
const char *decorated;
|
||||
|
@ -1714,7 +1714,7 @@ ctf_dedup_multiple_input_dicts (ctf_file_t *output, ctf_file_t **inputs,
|
|||
|
||||
while ((err = ctf_dynset_next (type_ids, &i, &id)) == 0)
|
||||
{
|
||||
ctf_file_t *fp = inputs[CTF_DEDUP_GID_TO_INPUT (id)];
|
||||
ctf_dict_t *fp = inputs[CTF_DEDUP_GID_TO_INPUT (id)];
|
||||
|
||||
if (fp == found || fp == relative_found)
|
||||
continue;
|
||||
|
@ -1781,7 +1781,7 @@ ctf_dedup_multiple_input_dicts (ctf_file_t *output, ctf_file_t **inputs,
|
|||
types. Only used if the link mode is CTF_LINK_SHARE_DUPLICATED. */
|
||||
|
||||
static int
|
||||
ctf_dedup_conflictify_unshared (ctf_file_t *output, ctf_file_t **inputs)
|
||||
ctf_dedup_conflictify_unshared (ctf_dict_t *output, ctf_dict_t **inputs)
|
||||
{
|
||||
ctf_dedup_t *d = &output->ctf_dedup;
|
||||
ctf_next_t *i = NULL;
|
||||
|
@ -1853,7 +1853,7 @@ ctf_dedup_conflictify_unshared (ctf_file_t *output, ctf_file_t **inputs)
|
|||
ctf_dedup_emit afterwards to do that. */
|
||||
|
||||
int
|
||||
ctf_dedup (ctf_file_t *output, ctf_file_t **inputs, uint32_t ninputs,
|
||||
ctf_dedup (ctf_dict_t *output, ctf_dict_t **inputs, uint32_t ninputs,
|
||||
uint32_t *parents, int cu_mapped)
|
||||
{
|
||||
ctf_dedup_t *d = &output->ctf_dedup;
|
||||
|
@ -1924,17 +1924,17 @@ ctf_dedup (ctf_file_t *output, ctf_file_t **inputs, uint32_t ninputs,
|
|||
}
|
||||
|
||||
static int
|
||||
ctf_dedup_rwalk_output_mapping (ctf_file_t *output, ctf_file_t **inputs,
|
||||
ctf_dedup_rwalk_output_mapping (ctf_dict_t *output, ctf_dict_t **inputs,
|
||||
uint32_t ninputs, uint32_t *parents,
|
||||
ctf_dynset_t *already_visited,
|
||||
const char *hval,
|
||||
int (*visit_fun) (const char *hval,
|
||||
ctf_file_t *output,
|
||||
ctf_file_t **inputs,
|
||||
ctf_dict_t *output,
|
||||
ctf_dict_t **inputs,
|
||||
uint32_t ninputs,
|
||||
uint32_t *parents,
|
||||
int already_visited,
|
||||
ctf_file_t *input,
|
||||
ctf_dict_t *input,
|
||||
ctf_id_t type,
|
||||
void *id,
|
||||
int depth,
|
||||
|
@ -1944,19 +1944,19 @@ ctf_dedup_rwalk_output_mapping (ctf_file_t *output, ctf_file_t **inputs,
|
|||
/* Like ctf_dedup_rwalk_output_mapping (which see), only takes a single target
|
||||
type and visits it. */
|
||||
static int
|
||||
ctf_dedup_rwalk_one_output_mapping (ctf_file_t *output,
|
||||
ctf_file_t **inputs, uint32_t ninputs,
|
||||
ctf_dedup_rwalk_one_output_mapping (ctf_dict_t *output,
|
||||
ctf_dict_t **inputs, uint32_t ninputs,
|
||||
uint32_t *parents,
|
||||
ctf_dynset_t *already_visited,
|
||||
int visited, void *type_id,
|
||||
const char *hval,
|
||||
int (*visit_fun) (const char *hval,
|
||||
ctf_file_t *output,
|
||||
ctf_file_t **inputs,
|
||||
ctf_dict_t *output,
|
||||
ctf_dict_t **inputs,
|
||||
uint32_t ninputs,
|
||||
uint32_t *parents,
|
||||
int already_visited,
|
||||
ctf_file_t *input,
|
||||
ctf_dict_t *input,
|
||||
ctf_id_t type,
|
||||
void *id,
|
||||
int depth,
|
||||
|
@ -1964,7 +1964,7 @@ ctf_dedup_rwalk_one_output_mapping (ctf_file_t *output,
|
|||
void *arg, unsigned long depth)
|
||||
{
|
||||
ctf_dedup_t *d = &output->ctf_dedup;
|
||||
ctf_file_t *fp;
|
||||
ctf_dict_t *fp;
|
||||
int input_num;
|
||||
ctf_id_t type;
|
||||
int ret;
|
||||
|
@ -2128,17 +2128,17 @@ ctf_dedup_rwalk_one_output_mapping (ctf_file_t *output,
|
|||
once, but are not recursed through repeatedly: ALREADY_VISITED tracks whether
|
||||
types have already been visited. */
|
||||
static int
|
||||
ctf_dedup_rwalk_output_mapping (ctf_file_t *output, ctf_file_t **inputs,
|
||||
ctf_dedup_rwalk_output_mapping (ctf_dict_t *output, ctf_dict_t **inputs,
|
||||
uint32_t ninputs, uint32_t *parents,
|
||||
ctf_dynset_t *already_visited,
|
||||
const char *hval,
|
||||
int (*visit_fun) (const char *hval,
|
||||
ctf_file_t *output,
|
||||
ctf_file_t **inputs,
|
||||
ctf_dict_t *output,
|
||||
ctf_dict_t **inputs,
|
||||
uint32_t ninputs,
|
||||
uint32_t *parents,
|
||||
int already_visited,
|
||||
ctf_file_t *input,
|
||||
ctf_dict_t *input,
|
||||
ctf_id_t type,
|
||||
void *id,
|
||||
int depth,
|
||||
|
@ -2222,7 +2222,7 @@ ctf_dedup_rwalk_output_mapping (ctf_file_t *output, ctf_file_t **inputs,
|
|||
|
||||
typedef struct ctf_sort_om_cb_arg
|
||||
{
|
||||
ctf_file_t **inputs;
|
||||
ctf_dict_t **inputs;
|
||||
uint32_t ninputs;
|
||||
ctf_dedup_t *d;
|
||||
} ctf_sort_om_cb_arg_t;
|
||||
|
@ -2241,8 +2241,8 @@ sort_output_mapping (const ctf_next_hkv_t *one, const ctf_next_hkv_t *two,
|
|||
void *one_gid, *two_gid;
|
||||
uint32_t one_ninput;
|
||||
uint32_t two_ninput;
|
||||
ctf_file_t *one_fp;
|
||||
ctf_file_t *two_fp;
|
||||
ctf_dict_t *one_fp;
|
||||
ctf_dict_t *two_fp;
|
||||
ctf_id_t one_type;
|
||||
ctf_id_t two_type;
|
||||
|
||||
|
@ -2288,15 +2288,15 @@ sort_output_mapping (const ctf_next_hkv_t *one, const ctf_next_hkv_t *two,
|
|||
|
||||
/* The public entry point to ctf_dedup_rwalk_output_mapping, above. */
|
||||
static int
|
||||
ctf_dedup_walk_output_mapping (ctf_file_t *output, ctf_file_t **inputs,
|
||||
ctf_dedup_walk_output_mapping (ctf_dict_t *output, ctf_dict_t **inputs,
|
||||
uint32_t ninputs, uint32_t *parents,
|
||||
int (*visit_fun) (const char *hval,
|
||||
ctf_file_t *output,
|
||||
ctf_file_t **inputs,
|
||||
ctf_dict_t *output,
|
||||
ctf_dict_t **inputs,
|
||||
uint32_t ninputs,
|
||||
uint32_t *parents,
|
||||
int already_visited,
|
||||
ctf_file_t *input,
|
||||
ctf_dict_t *input,
|
||||
ctf_id_t type,
|
||||
void *id,
|
||||
int depth,
|
||||
|
@ -2351,8 +2351,8 @@ ctf_dedup_walk_output_mapping (ctf_file_t *output, ctf_file_t **inputs,
|
|||
conflicted per-TU type ID in INPUT with hash HVAL. Return its CTF ID, or 0
|
||||
if none was needed. */
|
||||
static ctf_id_t
|
||||
ctf_dedup_maybe_synthesize_forward (ctf_file_t *output, ctf_file_t *target,
|
||||
ctf_file_t *input, ctf_id_t id,
|
||||
ctf_dedup_maybe_synthesize_forward (ctf_dict_t *output, ctf_dict_t *target,
|
||||
ctf_dict_t *input, ctf_id_t id,
|
||||
const char *hval)
|
||||
{
|
||||
ctf_dedup_t *od = &output->ctf_dedup;
|
||||
|
@ -2430,14 +2430,14 @@ ctf_dedup_maybe_synthesize_forward (ctf_file_t *output, ctf_file_t *target,
|
|||
make usability a bit better. */
|
||||
|
||||
static ctf_id_t
|
||||
ctf_dedup_id_to_target (ctf_file_t *output, ctf_file_t *target,
|
||||
ctf_file_t **inputs, uint32_t ninputs,
|
||||
uint32_t *parents, ctf_file_t *input, int input_num,
|
||||
ctf_dedup_id_to_target (ctf_dict_t *output, ctf_dict_t *target,
|
||||
ctf_dict_t **inputs, uint32_t ninputs,
|
||||
uint32_t *parents, ctf_dict_t *input, int input_num,
|
||||
ctf_id_t id)
|
||||
{
|
||||
ctf_dedup_t *od = &output->ctf_dedup;
|
||||
ctf_dedup_t *td = &target->ctf_dedup;
|
||||
ctf_file_t *err_fp = input;
|
||||
ctf_dict_t *err_fp = input;
|
||||
const char *hval;
|
||||
void *target_id;
|
||||
ctf_id_t emitted_forward;
|
||||
|
@ -2535,7 +2535,7 @@ ctf_dedup_id_to_target (ctf_file_t *output, ctf_file_t *target,
|
|||
have already been emitted. (This type itself may also have been emitted.)
|
||||
|
||||
If the ARG is 1, this is a CU-mapped deduplication round mapping many
|
||||
ctf_file_t's into precisely one: conflicting types should be marked
|
||||
ctf_dict_t's into precisely one: conflicting types should be marked
|
||||
non-root-visible. If the ARG is 0, conflicting types go into per-CU
|
||||
dictionaries stored in the input's ctf_dedup.cd_output: otherwise, everything
|
||||
is emitted directly into the output. No struct/union members are emitted.
|
||||
|
@ -2546,16 +2546,16 @@ ctf_dedup_id_to_target (ctf_file_t *output, ctf_file_t *target,
|
|||
data object section, backtrace section etc). */
|
||||
|
||||
static int
|
||||
ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
|
||||
ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs,
|
||||
uint32_t ninputs, uint32_t *parents, int already_visited,
|
||||
ctf_file_t *input, ctf_id_t type, void *id, int depth,
|
||||
ctf_dict_t *input, ctf_id_t type, void *id, int depth,
|
||||
void *arg)
|
||||
{
|
||||
ctf_dedup_t *d = &output->ctf_dedup;
|
||||
int kind = ctf_type_kind_unsliced (input, type);
|
||||
const char *name;
|
||||
ctf_file_t *target = output;
|
||||
ctf_file_t *real_input;
|
||||
ctf_dict_t *target = output;
|
||||
ctf_dict_t *real_input;
|
||||
const ctf_type_t *tp;
|
||||
int input_num = CTF_DEDUP_GID_TO_INPUT (id);
|
||||
int output_num = (uint32_t) -1; /* 'shared' */
|
||||
|
@ -2896,14 +2896,14 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
|
|||
point. */
|
||||
|
||||
static int
|
||||
ctf_dedup_emit_struct_members (ctf_file_t *output, ctf_file_t **inputs,
|
||||
ctf_dedup_emit_struct_members (ctf_dict_t *output, ctf_dict_t **inputs,
|
||||
uint32_t ninputs, uint32_t *parents)
|
||||
{
|
||||
ctf_dedup_t *d = &output->ctf_dedup;
|
||||
ctf_next_t *i = NULL;
|
||||
void *input_id, *target_id;
|
||||
int err;
|
||||
ctf_file_t *err_fp, *input_fp;
|
||||
ctf_dict_t *err_fp, *input_fp;
|
||||
int input_num;
|
||||
ctf_id_t err_type;
|
||||
|
||||
|
@ -2911,7 +2911,7 @@ ctf_dedup_emit_struct_members (ctf_file_t *output, ctf_file_t **inputs,
|
|||
&input_id, &target_id)) == 0)
|
||||
{
|
||||
ctf_next_t *j = NULL;
|
||||
ctf_file_t *target;
|
||||
ctf_dict_t *target;
|
||||
uint32_t target_num;
|
||||
ctf_id_t input_type, target_type;
|
||||
ssize_t offset;
|
||||
|
@ -2992,11 +2992,11 @@ ctf_dedup_emit_struct_members (ctf_file_t *output, ctf_file_t **inputs,
|
|||
dict containing a non-null cd_output resulting from a ctf_dedup_emit_type
|
||||
walk). */
|
||||
static int
|
||||
ctf_dedup_populate_type_mapping (ctf_file_t *shared, ctf_file_t *fp,
|
||||
ctf_file_t **inputs)
|
||||
ctf_dedup_populate_type_mapping (ctf_dict_t *shared, ctf_dict_t *fp,
|
||||
ctf_dict_t **inputs)
|
||||
{
|
||||
ctf_dedup_t *d = &shared->ctf_dedup;
|
||||
ctf_file_t *output = fp->ctf_dedup.cd_output;
|
||||
ctf_dict_t *output = fp->ctf_dedup.cd_output;
|
||||
const void *k, *v;
|
||||
ctf_next_t *i = NULL;
|
||||
int err;
|
||||
|
@ -3029,7 +3029,7 @@ ctf_dedup_populate_type_mapping (ctf_file_t *shared, ctf_file_t *fp,
|
|||
|
||||
while ((err = ctf_dynset_cnext (type_ids, &j, &id)) == 0)
|
||||
{
|
||||
ctf_file_t *input = inputs[CTF_DEDUP_GID_TO_INPUT (id)];
|
||||
ctf_dict_t *input = inputs[CTF_DEDUP_GID_TO_INPUT (id)];
|
||||
ctf_id_t id_in = CTF_DEDUP_GID_TO_TYPE (id);
|
||||
|
||||
#ifdef ENABLE_LIBCTF_HASH_DEBUGGING
|
||||
|
@ -3057,7 +3057,7 @@ ctf_dedup_populate_type_mapping (ctf_file_t *shared, ctf_file_t *fp,
|
|||
/* Populate the type mapping machinery used by the rest of the linker,
|
||||
by ctf_add_type, etc. */
|
||||
static int
|
||||
ctf_dedup_populate_type_mappings (ctf_file_t *output, ctf_file_t **inputs,
|
||||
ctf_dedup_populate_type_mappings (ctf_dict_t *output, ctf_dict_t **inputs,
|
||||
uint32_t ninputs)
|
||||
{
|
||||
size_t i;
|
||||
|
@ -3094,13 +3094,13 @@ ctf_dedup_populate_type_mappings (ctf_file_t *output, ctf_file_t **inputs,
|
|||
If CU_MAPPED is set, this is a first pass for a link with a non-empty CU
|
||||
mapping: only one output will result. */
|
||||
|
||||
ctf_file_t **
|
||||
ctf_dedup_emit (ctf_file_t *output, ctf_file_t **inputs, uint32_t ninputs,
|
||||
ctf_dict_t **
|
||||
ctf_dedup_emit (ctf_dict_t *output, ctf_dict_t **inputs, uint32_t ninputs,
|
||||
uint32_t *parents, uint32_t *noutputs, int cu_mapped)
|
||||
{
|
||||
size_t num_outputs = 1; /* Always at least one output: us. */
|
||||
ctf_file_t **outputs;
|
||||
ctf_file_t **walk;
|
||||
ctf_dict_t **outputs;
|
||||
ctf_dict_t **walk;
|
||||
size_t i;
|
||||
|
||||
ctf_dprintf ("Triggering emission.\n");
|
||||
|
@ -3124,7 +3124,7 @@ ctf_dedup_emit (ctf_file_t *output, ctf_file_t **inputs, uint32_t ninputs,
|
|||
if (!ctf_assert (output, !cu_mapped || (cu_mapped && num_outputs == 1)))
|
||||
return NULL;
|
||||
|
||||
if ((outputs = calloc (num_outputs, sizeof (ctf_file_t *))) == NULL)
|
||||
if ((outputs = calloc (num_outputs, sizeof (ctf_dict_t *))) == NULL)
|
||||
{
|
||||
ctf_err_warn (output, 0, ENOMEM,
|
||||
_("out of memory allocating link outputs array"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue