aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libctf/ChangeLog7
-rw-r--r--libctf/ctf-create.c23
-rw-r--r--libctf/ctf-lookup.c24
-rw-r--r--libctf/ctf-open.c21
4 files changed, 14 insertions, 61 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index eaecb17..9b0dad9 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,5 +1,12 @@
2021-01-27 Nick Alcock <nick.alcock@oracle.com>
+ * ctf-open.c (init_types): Rip out code to check anonymous typedef
+ nodes.
+ * ctf-create.c (ctf_add_reftype): Likewise.
+ * ctf-lookup.c (refresh_pptrtab): Likewise.
+
+2021-01-27 Nick Alcock <nick.alcock@oracle.com>
+
* ctf-impl.c (_libctf_nonnull_): Add parameters.
(LCTF_LINKING): New flag.
(ctf_dict_t) <ctf_link_flags>: Mention it.
diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c
index c5f79d1..cf47384 100644
--- a/libctf/ctf-create.c
+++ b/libctf/ctf-create.c
@@ -1629,29 +1629,18 @@ ctf_add_reftype (ctf_dict_t *fp, uint32_t flag, ctf_id_t ref, uint32_t kind)
if (kind != CTF_K_POINTER)
return type;
- /* If we are adding a pointer, update the ptrtab, both the directly pointed-to
- type and (if an anonymous typedef node is being pointed at) the type that
- points at too. Note that ctf_typemax is at this point one higher than we
- want to check against, because it's just been incremented for the addition
- of this type. The pptrtab is lazily-updated as needed, so is not touched
- here. */
+ /* If we are adding a pointer, update the ptrtab, pointing at this type from
+ the type it points to. Note that ctf_typemax is at this point one higher
+ than we want to check against, because it's just been incremented for the
+ addition of this type. The pptrtab is lazily-updated as needed, so is not
+ touched here. */
uint32_t type_idx = LCTF_TYPE_TO_INDEX (fp, type);
uint32_t ref_idx = LCTF_TYPE_TO_INDEX (fp, ref);
if (LCTF_TYPE_ISCHILD (fp, ref) == child
&& ref_idx < fp->ctf_typemax)
- {
- fp->ctf_ptrtab[ref_idx] = type_idx;
-
- ctf_id_t refref_idx = LCTF_TYPE_TO_INDEX (fp, dtd->dtd_data.ctt_type);
-
- if (tmp == fp
- && (LCTF_INFO_KIND (fp, dtd->dtd_data.ctt_info) == CTF_K_TYPEDEF)
- && strcmp (ctf_strptr (fp, dtd->dtd_data.ctt_name), "") == 0
- && refref_idx < fp->ctf_typemax)
- fp->ctf_ptrtab[refref_idx] = type_idx;
- }
+ fp->ctf_ptrtab[ref_idx] = type_idx;
return type;
}
diff --git a/libctf/ctf-lookup.c b/libctf/ctf-lookup.c
index 6d4e085..72f6a2a 100644
--- a/libctf/ctf-lookup.c
+++ b/libctf/ctf-lookup.c
@@ -51,7 +51,6 @@ refresh_pptrtab (ctf_dict_t *fp, ctf_dict_t *pfp)
{
ctf_id_t type = LCTF_INDEX_TO_TYPE (fp, i, 1);
ctf_id_t reffed_type;
- int updated;
if (ctf_type_kind (fp, type) != CTF_K_POINTER)
continue;
@@ -72,29 +71,6 @@ refresh_pptrtab (ctf_dict_t *fp, ctf_dict_t *pfp)
return -1; /* errno is set for us. */
fp->ctf_pptrtab[idx] = i;
- updated = 1;
- }
- }
- if (!updated)
- continue;
-
- /* If we updated the ptrtab entry for this type's referent, and it's an
- anonymous typedef node, we also want to chase down its referent and
- change that as well. */
-
- if ((ctf_type_kind (fp, reffed_type) == CTF_K_TYPEDEF)
- && strcmp (ctf_type_name_raw (fp, reffed_type), "") == 0)
- {
- uint32_t idx;
- idx = LCTF_TYPE_TO_INDEX (pfp, ctf_type_reference (fp, reffed_type));
-
- if (idx <= pfp->ctf_typemax)
- {
- if (idx >= fp->ctf_pptrtab_len
- && grow_pptrtab (fp, pfp->ctf_ptrtab_len) < 0)
- return -1; /* errno is set for us. */
-
- fp->ctf_pptrtab[idx] = i;
}
}
}
diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c
index a92668f..67d9f84 100644
--- a/libctf/ctf-open.c
+++ b/libctf/ctf-open.c
@@ -683,7 +683,7 @@ init_types (ctf_dict_t *fp, ctf_header_t *cth)
unsigned long pop[CTF_K_MAX + 1] = { 0 };
const ctf_type_t *tp;
- uint32_t id, dst;
+ uint32_t id;
uint32_t *xp;
/* We determine whether the dict is a child or a parent based on the value of
@@ -953,25 +953,6 @@ init_types (ctf_dict_t *fp, ctf_header_t *cth)
ctf_dprintf ("%u base type names hashed\n",
ctf_hash_size (fp->ctf_names.ctn_readonly));
- /* Make an additional pass through the pointer table to find pointers that
- point to anonymous typedef nodes. If we find one, modify the pointer table
- so that the pointer is also known to point to the node that is referenced
- by the anonymous typedef node. */
-
- for (id = 1; id <= fp->ctf_typemax; id++)
- {
- if ((dst = fp->ctf_ptrtab[id]) != 0)
- {
- tp = LCTF_INDEX_TO_TYPEPTR (fp, id);
-
- if (LCTF_INFO_KIND (fp, tp->ctt_info) == CTF_K_TYPEDEF
- && strcmp (ctf_strptr (fp, tp->ctt_name), "") == 0
- && LCTF_TYPE_ISCHILD (fp, tp->ctt_type) == child
- && LCTF_TYPE_TO_INDEX (fp, tp->ctt_type) <= fp->ctf_typemax)
- fp->ctf_ptrtab[LCTF_TYPE_TO_INDEX (fp, tp->ctt_type)] = dst;
- }
- }
-
return 0;
}