aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-create.c
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2021-01-27 19:41:49 +0000
committerNick Alcock <nick.alcock@oracle.com>2021-02-04 16:01:53 +0000
commit78f28b89e8c7a2c9e262e2819f0da5629f226efc (patch)
treee900c4a1676fdcb53141054e68160a844b58ad7d /libctf/ctf-create.c
parent35a01a045442f6860abba7246f215adefc9dfa5b (diff)
downloadbinutils-78f28b89e8c7a2c9e262e2819f0da5629f226efc.zip
binutils-78f28b89e8c7a2c9e262e2819f0da5629f226efc.tar.gz
binutils-78f28b89e8c7a2c9e262e2819f0da5629f226efc.tar.bz2
libctf: rip out dead code handling typedefs with no name
There is special code in libctf to handle typedefs with no name, which the code calls "anonymous typedef nodes". These monsters are obviously not something C programs can include: the whole point of a ttypedef is to introduce a new name. Looking back at the history of DWARF in GCC, the only thing (outside C++ anonymous namespaces) which can generate a DW_TAG_typedef without a DW_AT_name is obsolete code to handle the long-removed -feliminate-dwarf2-dups option. Looking at OpenSolaris, typedef nodes with no name couldn't be generated by the DWARF->CTF converter at all (and its deduplicator barfed on them): the only reason for the existence of this code is a special case working around a peculiarity of stabs whereby types could sometimes be referenced before they were introduced. We don't need to carry code in libctf to handle special cases in an obsolete OpenSolaris converter (that yields a format that isn't readable by libctf anyway). So drop it. libctf/ChangeLog 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.
Diffstat (limited to 'libctf/ctf-create.c')
-rw-r--r--libctf/ctf-create.c23
1 files changed, 6 insertions, 17 deletions
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;
}