summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2015-12-10 08:02:32 +0000
committerRobert Mustacchi <rm@joyent.com>2015-12-15 23:45:37 +0000
commit3ec23a4ba7b4c7b7c3af40f9357d781349b03c44 (patch)
tree1878114085a30b462ba14cbaa03860ebb70ddab6
parentd0702bed07529b68e296ae261377ca44f1f84943 (diff)
downloadillumos-joyent-3ec23a4ba7b4c7b7c3af40f9357d781349b03c44.tar.gz
OS-5037 struct struct machcpu is not a type
OS-5038 ctfmerge doesn't properly uniquify forwards Reviewed by: Patrick Mooney <patrick.mooney@joyent.com> Reviewed by: Cody Mello <cody.mello@joyent.com>
-rw-r--r--usr/src/cmd/ctfconvert/ctfconvert.c2
-rw-r--r--usr/src/lib/libctf/common/ctf_merge.c21
2 files changed, 22 insertions, 1 deletions
diff --git a/usr/src/cmd/ctfconvert/ctfconvert.c b/usr/src/cmd/ctfconvert/ctfconvert.c
index dd3d40c6cc..a4394c3ec8 100644
--- a/usr/src/cmd/ctfconvert/ctfconvert.c
+++ b/usr/src/cmd/ctfconvert/ctfconvert.c
@@ -184,7 +184,7 @@ ctfconvert_fixup_genunix(ctf_file_t *fp)
*/
mcpu = ctf_lookup_by_name(fp, "struct machcpu");
if (mcpu == CTF_ERR) {
- mcpu = ctf_add_forward(fp, CTF_ADD_NONROOT, "struct machcpu",
+ mcpu = ctf_add_forward(fp, CTF_ADD_NONROOT, "machcpu",
CTF_K_STRUCT);
if (mcpu == CTF_ERR) {
ctfconvert_fatal("failed to add 'struct machcpu' "
diff --git a/usr/src/lib/libctf/common/ctf_merge.c b/usr/src/lib/libctf/common/ctf_merge.c
index 9611c50acc..f23dbc232d 100644
--- a/usr/src/lib/libctf/common/ctf_merge.c
+++ b/usr/src/lib/libctf/common/ctf_merge.c
@@ -56,6 +56,7 @@ typedef struct ctf_merge_types {
ctf_file_t *cm_src; /* Input CTF file */
ctf_merge_tinfo_t *cm_tmap; /* Type state information */
boolean_t cm_dedup; /* Are we doing a dedup? */
+ boolean_t cm_unique; /* are we doing a uniquify? */
} ctf_merge_types_t;
typedef struct ctf_merge_objmap {
@@ -124,6 +125,23 @@ ctf_merge_diffcb(ctf_file_t *ifp, ctf_id_t iid, boolean_t same, ctf_file_t *ofp,
if (ctf_type_kind(ifp, iid) == CTF_K_FORWARD &&
ctf_type_kind(ofp, oid) != CTF_K_FORWARD) {
VERIFY(cmt[oid].cmt_map == 0);
+
+ /*
+ * If we're uniquifying types, it's possible for the
+ * container that we're uniquifying against to have a
+ * forward which exists in the container being reduced.
+ * For example, genunix has the machcpu structure as a
+ * forward which is actually in unix and we uniquify
+ * unix against genunix. In such cases, we explicitly do
+ * not do any mapping of the forward information, lest
+ * we risk losing the real definition. Instead, mark
+ * that it's missing.
+ */
+ if (cmp->cm_unique == B_TRUE) {
+ cmt[oid].cmt_missing = B_TRUE;
+ return;
+ }
+
cmt[oid].cmt_map = iid;
cmt[oid].cmt_forward = B_TRUE;
ctf_dprintf("merge diff forward mapped %d->%d\n", oid,
@@ -779,6 +797,7 @@ ctf_merge_types(void *arg, void *arg2, void **outp, void *unsued)
cm.cm_out = out;
cm.cm_src = source;
cm.cm_dedup = B_FALSE;
+ cm.cm_unique = B_FALSE;
ret = ctf_merge_types_init(&cm);
if (ret != 0) {
ctf_diff_fini(cdp);
@@ -874,6 +893,7 @@ ctf_uniquify_types(ctf_merge_t *cmh, ctf_file_t *src, ctf_file_t **outp)
cm.cm_out = parent;
cm.cm_src = src;
cm.cm_dedup = B_FALSE;
+ cm.cm_unique = B_TRUE;
ret = ctf_merge_types_init(&cm);
if (ret != 0) {
ctf_close(out);
@@ -1462,6 +1482,7 @@ ctf_merge_dedup(ctf_merge_t *cmp, ctf_file_t **outp)
cm.cm_src = ifp;
cm.cm_out = ofp;
cm.cm_dedup = B_TRUE;
+ cm.cm_unique = B_FALSE;
if ((ret = ctf_merge_types_init(&cm)) != 0) {
return (ret);