diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2021-01-27 19:41:49 +0000 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2021-02-04 16:01:53 +0000 |
commit | 78f28b89e8c7a2c9e262e2819f0da5629f226efc (patch) | |
tree | e900c4a1676fdcb53141054e68160a844b58ad7d /libctf/ctf-open.c | |
parent | 35a01a045442f6860abba7246f215adefc9dfa5b (diff) | |
download | gdb-78f28b89e8c7a2c9e262e2819f0da5629f226efc.zip gdb-78f28b89e8c7a2c9e262e2819f0da5629f226efc.tar.gz gdb-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-open.c')
-rw-r--r-- | libctf/ctf-open.c | 21 |
1 files changed, 1 insertions, 20 deletions
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; } |