[00/16] libctf: mostly cleanups and refactoring

Message ID 20210306004023.164154-1-nick.alcock@oracle.com
Headers show
Series
  • libctf: mostly cleanups and refactoring
Related show

Message

Nick Clifton via Binutils March 6, 2021, 12:40 a.m.
This series is mostly cleanups and refactoring in preparation for the
changes that will go into CTFv4, splitting serialization and dict writeout
into its own file and refactoring the representation of types in writable
dicts to use the same representation as used in written-out CTF dicts, and
to expand all CTF representations into their largest form for in-memory
processing, and to shrink them down to their smallest possible form only at
serialization time, so that code creating and querying types only needs to
handle one representation (the largest form used in written-out CTF dicts)
rather than three (the large form, the small form, and a form used only by
writable dicts).  This will make it practical to add more compact
representations in v4.

There are also a couple of bugfixes, highly unlikely to be visible in any
current use case, since they mostly relate either to error-handling or to
writing out a dict and then doing something else with it, something the
linker does not do and neither will users who merely consume .ctf sections
produced by the linker.

Jammed in the middle is one top-level possible fix for bug 27482, which
might need review as it is top-level. (The reporter has not yet confirmed
that this fixes his bug, either, but it might!)

The usual great big pile of tests passed (including, now, just over a
thousand Gentoo packages successfully built with nary a CTF-related linker
warning).

Nick Alcock (16):
  libctf: fix some tabdamage and move some code around
  libctf: split serialization and file writeout into its own file
  libctf: fix comment above ctf_dict_t
  libctf: split up ctf_serialize
  libctf: fix GNU style for do {} while
  libctf: eliminate dtd_u, part 1: int/float/slice
  libctf: eliminate dtd_u, part 2: arrays
  libctf: eliminate dtd_u, part 3: functions
  Add install dependencies for ld -> bfd and libctf -> bfd
  libctf: don't lose track of all valid types upon serialization
  libctf: do not corrupt strings across ctf_serialize
  libctf: eliminate dtd_u, part 4: enums
  libctf: eliminate dtd_u, part 5: structs / unions
  libctf: types: unify code dealing with small-vs-large struct members
  libctf: a couple of small error-handling fixes
  libctf: support encodings for enums

 Makefile.def                                  |    6 +-
 Makefile.in                                   |    4 +-
 ld/testsuite/ld-ctf/slice.c                   |    3 +
 ld/testsuite/ld-ctf/slice.d                   |    4 +-
 libctf/Makefile.am                            |    4 +-
 libctf/Makefile.in                            |   44 +-
 libctf/ctf-archive.c                          |    3 +-
 libctf/ctf-create.c                           | 1893 +++--------------
 libctf/ctf-dedup.c                            |   90 +-
 libctf/ctf-dump.c                             |    8 +-
 libctf/ctf-hash.c                             |    6 +
 libctf/ctf-impl.h                             |   42 +-
 libctf/ctf-link.c                             |   92 +-
 libctf/ctf-lookup.c                           |   15 +-
 libctf/ctf-open.c                             |    7 +-
 libctf/ctf-serialize.c                        | 1419 ++++++++++++
 libctf/ctf-string.c                           |   78 +-
 libctf/ctf-types.c                            |  540 ++---
 libctf/swap.h                                 |   24 +-
 .../testsuite/libctf-lookup/enum-many-ctf.c   |   10 +
 libctf/testsuite/libctf-lookup/enum-many.lk   |  101 +
 .../libctf-lookup/struct-iteration.c          |    6 +-
 .../type-add-unnamed-struct-ctf.c             |    1 +
 .../type-add-unnamed-struct.c                 |    4 +-
 .../type-add-unnamed-struct.lk                |    1 +
 .../reserialize-strtab-corruption.c           |   91 +
 .../reserialize-strtab-corruption.lk          |    5 +
 28 files changed, 2414 insertions(+), 2095 deletions(-)
 create mode 100644 libctf/ctf-serialize.c
 create mode 100644 libctf/testsuite/libctf-lookup/enum-many-ctf.c
 create mode 100644 libctf/testsuite/libctf-lookup/enum-many.lk
 create mode 100644 libctf/testsuite/libctf-writable/reserialize-strtab-corruption.c
 create mode 100644 libctf/testsuite/libctf-writable/reserialize-strtab-corruption.lk

-- 
2.30.0.252.gc27e85e57d