[PATCH REVIEW 0/5] symtypetab bugfixes and likely-dead code removal

Nick Alcock nick.alcock@oracle.com
Fri Jan 29 19:29:08 GMT 2021


This is a bit of a grab-bag of commits that just happened all to be
written at once.

Only one tiny part of one commit needs review: two lines in the ld -r
patch that use a new ctf_link flag to tell libctf when we are doing a
relocatable link rather than trying to guess (and sometimes getting it
wrong in obscure cases such as, uh, linking an ordinary executable
without -Bdynamic).

Everything else is smaller stuff in libctf only: removal of Solaris-era
dead code and prohibition of obviously-illegal-in-C stuff like attempts
to add base types, typedefs, or forwards with no name (adding forwards
with no name would cause the deduplicator to fail anyway, so let's
explicitly prohibit it).

Doing this showed up a bug that was actually *causing* the deduplicator
to do just that when doing CU-mapped links of the sort ld never does, so
we fix that too: no need to put this on the release branch since it only
affects third-party non-ld programs doing links of CTF sections, which
are still rare.

Finally we have a fix for an uninitialized variable spotted by clang:
this bug is on the 2.36 release branch too, but since its only effect is
the emission or non-emission of a string to the debug stream in an error
case, this fix is not needed on the branch unless we're being really hot
about valgrind-correctness.

(This was the first of my patch series tested using the new GCC 11-based
compiler that generates CTF by way of DWARF rather than using the debug
hooks! Hats off to Indu Bhagat and Jose Marchesi for their fine work.
My next patch series will adjust the testsuite for the changed test results
and CTF-enabling flags needed when using that compiler.)

Nick Alcock (5):
  libctf, ld: fix symtypetab and var section population under ld -r
  libctf: rip out dead code handling typedefs with no name
  libctf: prohibit nameless ints, floats, typedefs and forwards
  libctf: fix uninitialized variable in symbol serialization error
    handling
  libctf: always name nameless types "", never NULL

 include/ctf-api.h                             |  14 +-
 ld/ldlang.c                                   |   2 +
 libctf/ctf-create.c                           | 187 +++++++++------
 libctf/ctf-dedup.c                            |   7 +-
 libctf/ctf-impl.h                             |   8 +-
 libctf/ctf-link.c                             |  34 ++-
 libctf/ctf-lookup.c                           |  24 --
 libctf/ctf-open.c                             |  21 +-
 libctf/ctf-string.c                           |   9 +-
 libctf/ctf-types.c                            |   8 +-
 libctf/testsuite/lib/ctf-lib.exp              |  11 +-
 .../nonstatic-var-section-ld-executable.lk    |   9 +
 .../nonstatic-var-section-ld-r-ctf.c          |   9 +
 .../nonstatic-var-section-ld-r.c              |  73 ++++++
 .../nonstatic-var-section-ld-r.lk             |   6 +
 .../nonstatic-var-section-ld.c                |  76 ++++++
 .../nonstatic-var-section-ld.lk               |   6 +
 .../symtypetab-nonlinker-writeout.c           | 218 ++++++++++++++++++
 .../symtypetab-nonlinker-writeout.lk          |  12 +
 19 files changed, 603 insertions(+), 131 deletions(-)
 create mode 100644 libctf/testsuite/libctf-regression/nonstatic-var-section-ld-executable.lk
 create mode 100644 libctf/testsuite/libctf-regression/nonstatic-var-section-ld-r-ctf.c
 create mode 100644 libctf/testsuite/libctf-regression/nonstatic-var-section-ld-r.c
 create mode 100644 libctf/testsuite/libctf-regression/nonstatic-var-section-ld-r.lk
 create mode 100644 libctf/testsuite/libctf-regression/nonstatic-var-section-ld.c
 create mode 100644 libctf/testsuite/libctf-regression/nonstatic-var-section-ld.lk
 create mode 100644 libctf/testsuite/libctf-writable/symtypetab-nonlinker-writeout.c
 create mode 100644 libctf/testsuite/libctf-writable/symtypetab-nonlinker-writeout.lk

-- 
2.30.0.252.gc27e85e57d



More information about the Binutils mailing list