Hi All,
This flag is needed to support proper ordering in libctf, binutils
already has the change
(https://sourceware.org/pipermail/binutils/2025-September/144453.html).
---
Add flag to signal that array nelems must be reversed in ctf dumping.
gcc/
* ctfc.cc (init_ctf_container): Adding new flag for array dumping.
include/
* ctf.h (CTF_F_ARRNELEMS): Define new flag.
(CTF_F_MAX): Update accordingly.
---
gcc/ctfc.cc | 2 +-
include/ctf.h | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/ctfc.cc b/gcc/ctfc.cc
index 51511d69baa..59f0986bf82 100644
--- a/gcc/ctfc.cc
+++ b/gcc/ctfc.cc
@@ -961,7 +961,7 @@ init_ctf_container (void)
tu_ctfc->ctfc_magic = CTF_MAGIC;
tu_ctfc->ctfc_version = CTF_VERSION;
- tu_ctfc->ctfc_flags = CTF_F_NEWFUNCINFO;
+ tu_ctfc->ctfc_flags = CTF_F_NEWFUNCINFO | CTF_F_ARRNELEMS;
tu_ctfc->ctfc_nextid = CTF_INIT_TYPEID;
init_ctf_string_table (tu_ctfc);
diff --git a/include/ctf.h b/include/ctf.h
index 72a639ac9b4..64d035d0759 100644
--- a/include/ctf.h
+++ b/include/ctf.h
@@ -213,8 +213,9 @@ typedef struct ctf_header
#define CTF_F_NEWFUNCINFO 0x2 /* New v3 func info section format. */
#define CTF_F_IDXSORTED 0x4 /* Index sections already sorted. */
#define CTF_F_DYNSTR 0x8 /* Strings come from .dynstr. */
+#define CTF_F_ARRNELEMS 0x10 /* Array nelems are reported backwards. */
#define CTF_F_MAX (CTF_F_COMPRESS | CTF_F_NEWFUNCINFO | CTF_F_IDXSORTED
\
- | CTF_F_DYNSTR)
+ | CTF_F_DYNSTR | CTF_F_ARRNELEMS)
typedef struct ctf_lblent
{
--
2.47.3