mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
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.
This commit is contained in:
@ -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;
|
||||
@ -65,29 +64,6 @@ refresh_pptrtab (ctf_dict_t *fp, ctf_dict_t *pfp)
|
||||
/* Guard against references to invalid types. No need to consider
|
||||
the CTF dict corrupt in this case: this pointer just can't be a
|
||||
pointer to any type we know about. */
|
||||
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;
|
||||
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
|
||||
|
Reference in New Issue
Block a user