libctf, ld: fix test results for upstream GCC
authorNick Alcock <nick.alcock@oracle.com>
Thu, 6 May 2021 08:30:58 +0000 (09:30 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Thu, 6 May 2021 08:31:31 +0000 (09:31 +0100)
commitae064303efe5830e6b9901ce2e4ed241a3cda8e7
tree11dc2fe833c1460029e4c5d1bd727d99f838d359
parent49da556c658684db1b8bdba956e541bc99628f02
libctf, ld: fix test results for upstream GCC

The tests currently in binutils are aimed at the original GCC-based
implementation of CTF, which emitted CTF directly from GCC's internal
representation.  The approach now under review emits CTF from DWARF,
with an eye to eventually doing this for all non-DWARF debuginfo-like
formats GCC supports.  It also uses a different flag to enable
CTF emission (-gctf rather than -gt).

Adjust the testsuite accordingly.

Given that the ld testsuite results are dependent on type ordering,
which we do not guarantee at all, it's amazing how little changes. We
see a few type ordering differences, slices change because the old GCC
was buggy (slices were emitted "backwards", from the wrong end of the
machine word) and its expected results were wrong, and GCC now emits the
underlying integral type for enumerated types, though CTF has no way to
record this yet (coming in v4).

GCC also now emits even hidden symbols into the symtab (and thus
symtypetab), so one symtypetab test changes its expected results
slightly to compensate.

Also add tests for the CTF_K_UNKNOWN nonrepresentable type: this
couldn't be done before now since the only GCC that emits CTF_K_UNKNOWN
for nonrepresentable types is the new one.

ld/ChangeLog
2021-05-06  Nick Alcock  <nick.alcock@oracle.com>

* testsuite/ld-ctf/ctf.exp: Use -gctf, not -gt.
* testsuite/lib/ld-lib.exp: Likewise.
* testsuite/ld-ctf/nonrepresentable-1.c: New test for nonrepresentable types.
* testsuite/ld-ctf/nonrepresentable-2.c: Likewise.
* testsuite/ld-ctf/nonrepresentable.d: Likewise.
* testsuite/ld-ctf/array.d: Larger type section.
* testsuite/ld-ctf/data-func-conflicted.d: Likewise.
* testsuite/ld-ctf/enums.d: Likewise.
* testsuite/ld-ctf/conflicting-enums.d: Don't compare types.
* testsuite/ld-ctf/cross-tu-cyclic-conflicting.d: Changed type order.
* testsuite/ld-ctf/cross-tu-noncyclic.d: Likewise.
* testsuite/ld-ctf/slice.d: Adjust for improved slice emission.

libctf/ChangeLog
2021-05-06  Nick Alcock  <nick.alcock@oracle.com>

* testsuite/lib/ctf-lib.exp: Use -gctf, not -gt.
* testsuite/libctf-regression/nonstatic-var-section-ld-r.lk:
Hidden symbols now get into the symtypetab anyway.
16 files changed:
ld/ChangeLog
ld/testsuite/ld-ctf/array.d
ld/testsuite/ld-ctf/conflicting-enums.d
ld/testsuite/ld-ctf/cross-tu-cyclic-conflicting.d
ld/testsuite/ld-ctf/cross-tu-noncyclic.d
ld/testsuite/ld-ctf/ctf.exp
ld/testsuite/ld-ctf/data-func-conflicted.d
ld/testsuite/ld-ctf/enums.d
ld/testsuite/ld-ctf/nonrepresentable-1.c [new file with mode: 0644]
ld/testsuite/ld-ctf/nonrepresentable-2.c [new file with mode: 0644]
ld/testsuite/ld-ctf/nonrepresentable.d [new file with mode: 0644]
ld/testsuite/ld-ctf/slice.d
ld/testsuite/lib/ld-lib.exp
libctf/ChangeLog
libctf/testsuite/lib/ctf-lib.exp
libctf/testsuite/libctf-regression/nonstatic-var-section-ld-r.lk