[PATCH] libctf: remove CTF_F_ARRNELEMS flag
Alan Modra
amodra@gmail.com
Sat Feb 28 01:37:40 GMT 2026
On Fri, Feb 27, 2026 at 03:07:15PM +0000, Nick Alcock via Binutils wrote:
> On 27 Feb 2026, Nick Alcock via Binutils verbalised:
>
> > From: Bruce McCulloch <bruce.mcculloch@oracle.com>
> >
> > This patch removes the constraint that a CTF_F_ARRNELEMS flag has to be
> > present in order to reverse the elements of an array when dumping. The
> > flag was never added to GCC, and having this requirement causes more
> > problems than it solves. A quick recap of the issue:
> >
> > Given an array int foo[1][2][3], the expected graph is:
> > int foo[1][2][3] -> int foo[2][3] -> int foo[3] -> int foo
> >
> > Prior to GCC PR114186, the emitted graph would be:
> > int foo[1][2][3] -> int foo[1][2] -> int foo[1] -> int foo
> >
> > Following GCC PR114186, before the libctf fix, the output was:
> > int foo[3][2][1] -> int foo[3][2] -> int foo[3] -> int foo
> > So the underlying type graph was correct, but the ordering of elements
> > was incorrect.
> >
> > With this fix, we emit correct ordering of the type graph, with no
> > requirements for the compiler to signal that it has GCC PR114186.
> >
> > include/
> > * ctf.h (CTF_F_ARRNELEMS): Delete.
> > (CTF_F_MAX): Adjust.
> >
> > libctf/
> > * ctf-decl.c (ctf_decl_push): Act as if CTF_F_ARRNELEMS is
> > always set.
> > * ctf-dump.c (ctf_dump_header): No longer dump its value.
> > * testsuite/libctf-lookup/multidim-array.c: No longer detect
> > compilers not emitting this flag (none do).
> > ---
> > include/ctf.h | 3 +-
> > libctf/ctf-decl.c | 3 +-
> > libctf/ctf-dump.c | 8 +-
> > .../testsuite/libctf-lookup/multidim-array.c | 82 +------------------
> > 4 files changed, 7 insertions(+), 89 deletions(-)
>
> All tests passed: pushed to master.
>
> --
> NULL && (void)
aarch64-linux-gnu +FAIL: libctf-lookup/multidim-array
alpha-linux-gnu +FAIL: libctf-lookup/multidim-array
arm-linux-gnueabi +FAIL: libctf-lookup/multidim-array
hppa-linux-gnu +FAIL: libctf-lookup/multidim-array
ia64-linux-gnu +FAIL: libctf-lookup/multidim-array
m68k-linux-gnu +FAIL: libctf-lookup/multidim-array
microblaze-linux-gnu +FAIL: libctf-lookup/multidim-array
mips64-linux-gnuabi64 +FAIL: libctf-lookup/multidim-array
mips-linux-gnu +FAIL: libctf-lookup/multidim-array
powerpc-linux-gnu +FAIL: libctf-lookup/multidim-array
riscv64-linux-gnu +FAIL: libctf-lookup/multidim-array
s390-linux-gnu +FAIL: libctf-lookup/multidim-array
s390x-linux-gnu +FAIL: libctf-lookup/multidim-array
sh4-linux-gnu +FAIL: libctf-lookup/multidim-array
sparc64-linux-gnu +FAIL: libctf-lookup/multidim-array
So does this mean I need to rebuild all my cross compilers? Well, not
all, these are (GCC) 13.0.0 20220910 (experimental). I do have some
later cross compilers that pass the test. powerpc64le-linux-gnu and
powerpc64-linux-gnu are both (GCC) 15.0.1 20250311 (experimental).
--
Alan Modra
More information about the Binutils
mailing list