summaryrefslogtreecommitdiff
path: root/usr/src/lib/libctf/common
diff options
context:
space:
mode:
authorJohn Levon <john.levon@joyent.com>2019-04-23 08:53:40 +0000
committerJohn Levon <john.levon@joyent.com>2019-05-03 02:15:58 -0700
commit5215e75068b0ff78c8961f6cb4607c3659403cda (patch)
tree6b02bb31b1910243efa51ea49bb50eac7cc6c6a3 /usr/src/lib/libctf/common
parent6ef284f1d464c08bc420048a0b211080cb9fe009 (diff)
downloadillumos-joyent-5215e75068b0ff78c8961f6cb4607c3659403cda.tar.gz
10827 some symbols have the wrong CTF type
Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com> Approved by: Gordon Ross <gwr@nexenta.com>
Diffstat (limited to 'usr/src/lib/libctf/common')
-rw-r--r--usr/src/lib/libctf/common/ctf_merge.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/usr/src/lib/libctf/common/ctf_merge.c b/usr/src/lib/libctf/common/ctf_merge.c
index 755c6ebc9e..578e667079 100644
--- a/usr/src/lib/libctf/common/ctf_merge.c
+++ b/usr/src/lib/libctf/common/ctf_merge.c
@@ -10,7 +10,7 @@
*/
/*
- * Copyright (c) 2019 Joyent, Inc.
+ * Copyright 2019, Joyent, Inc.
*/
/*
@@ -615,25 +615,34 @@ ctf_merge_fixup_type(ctf_merge_types_t *cmp, ctf_id_t id)
}
/*
- * Now that we've successfully merged everything, we're going to clean
- * up the merge type table. Traditionally if we had just two different
- * files that we were working between, the types would be fully
- * resolved. However, because we were comparing with ourself every step
- * of the way and not our reduced self, we need to go through and update
- * every mapped entry to what it now points to in the deduped file.
+ * Now that we've successfully merged everything, we're going to remap the type
+ * table.
+ *
+ * Remember we have two containers: ->cm_src is what we're working from, and
+ * ->cm_out is where we are building the de-duplicated CTF.
+ *
+ * The index of this table is always the type IDs in ->cm_src.
+ *
+ * When we built this table originally in ctf_diff_self(), if we found a novel
+ * type, we marked it as .cmt_missing to indicate it needs adding to ->cm_out.
+ * Otherwise, .cmt_map indicated the ->cm_src type ID that this type duplicates.
+ *
+ * Then, in ctf_merge_common(), we walked through and added all "cmt_missing"
+ * types to ->cm_out with ctf_merge_add_type(). These routines update cmt_map
+ * to be the *new* type ID in ->cm_out. In this function, you can read
+ * "cmt_missing" as meaning "added to ->cm_out, and cmt_map updated".
+ *
+ * So at this point, we need to mop up all types where .cmt_missing == B_FALSE,
+ * making sure *their* .cmt_map values also point to the ->cm_out container.
*/
static void
-ctf_merge_fixup_dedup_map(ctf_merge_types_t *cmp)
+ctf_merge_dedup_remap(ctf_merge_types_t *cmp)
{
int i;
for (i = 1; i < cmp->cm_src->ctf_typemax + 1; i++) {
ctf_id_t tid;
- /*
- * Missing types always have their id updated to exactly what it
- * should be.
- */
if (cmp->cm_tmap[i].cmt_missing == B_TRUE) {
VERIFY(cmp->cm_tmap[i].cmt_map != 0);
continue;
@@ -701,7 +710,7 @@ ctf_merge_common(ctf_merge_types_t *cmp)
return (ret);
if (cmp->cm_dedup == B_TRUE) {
- ctf_merge_fixup_dedup_map(cmp);
+ ctf_merge_dedup_remap(cmp);
}
ctf_dprintf("Beginning merge pass 3\n");
@@ -714,10 +723,6 @@ ctf_merge_common(ctf_merge_types_t *cmp)
}
}
- if (cmp->cm_dedup == B_TRUE) {
- ctf_merge_fixup_dedup_map(cmp);
- }
-
return (0);
}