+2021-01-05 Nick Alcock <nick.alcock@oracle.com>
+
+ * testsuite/ld-ctf/enum-forward.c: New test.
+ * testsuite/ld-ctf/enum-forward.c: New results.
+
2021-01-05 Nick Alcock <nick.alcock@oracle.com>
* testsuite/ld-ctf/array.d: Adjust for dumper changes.
--- /dev/null
+enum vibgyor;
+char * (*get_color_name) (enum vibgyor);
--- /dev/null
+#as:
+#source: enum-forward.c
+#objdump: --ctf=.ctf
+#ld: -shared
+#name: Forwards to enums
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: 0xdff2
+ Version: 4 \(CTF_VERSION_3\)
+#...
+ Type section: .* \(0x48 bytes\)
+#...
+ Data objects:
+ get_color_name -> 0x[0-9a-f]*: \(kind 3\) char \*\*\(\*\) \(enum vibgyor\) \(size 0x[0-9a-f]*\) \(aligned at 0x[0-9a-f]*\) -> 0x[0-9a-f]*: \(kind 5\) char \*\(\*\) \(enum vibgyor\) \(aligned at 0x[0-9a-f]*\)
+
+#...
+2021-01-05 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-types.c (ctf_type_aname): Print forwards to unions and enums
+ properly.
+
2021-01-05 Nick Alcock <nick.alcock@oracle.com>
* ctf-impl.h (ctf_dict_t) <ctf_pptrtab>: New.
}
break;
case CTF_K_STRUCT:
- case CTF_K_FORWARD:
ctf_decl_sprintf (&cd, "struct %s", name);
break;
case CTF_K_UNION:
case CTF_K_ENUM:
ctf_decl_sprintf (&cd, "enum %s", name);
break;
+ case CTF_K_FORWARD:
+ {
+ switch (ctf_type_kind_forwarded (fp, cdp->cd_type))
+ {
+ case CTF_K_STRUCT:
+ ctf_decl_sprintf (&cd, "struct %s", name);
+ break;
+ case CTF_K_UNION:
+ ctf_decl_sprintf (&cd, "union %s", name);
+ break;
+ case CTF_K_ENUM:
+ ctf_decl_sprintf (&cd, "enum %s", name);
+ break;
+ default:
+ ctf_set_errno (fp, ECTF_CORRUPT);
+ ctf_decl_fini (&cd);
+ return NULL;
+ }
+ break;
+ }
case CTF_K_VOLATILE:
ctf_decl_sprintf (&cd, "volatile");
break;