[PATCH] libctf: remove CTF_F_ARRNELEMS flag
Nick Alcock
nick.alcock@oracle.com
Fri Feb 27 15:07:15 GMT 2026
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)
More information about the Binutils
mailing list