aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2021-01-05 13:25:56 +0000
committerNick Alcock <nick.alcock@oracle.com>2021-01-05 14:53:40 +0000
commitb4b6ea46807ec9c01ed4f4f18a50840358d16c28 (patch)
tree538a4618b793ecaa88896e1a66ba9b28ba601734 /ld
parent608a333d7d1ce111a4f69acea0ea6c7a2e81a766 (diff)
downloadgdb-b4b6ea46807ec9c01ed4f4f18a50840358d16c28.zip
gdb-b4b6ea46807ec9c01ed4f4f18a50840358d16c28.tar.gz
gdb-b4b6ea46807ec9c01ed4f4f18a50840358d16c28.tar.bz2
libctf, ld: fix formatting of forwards to unions and enums
The type printer was unconditionally printing these as if they were forwards to structs, even if they were forwards to unions or enums. ld/ChangeLog 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. libctf/ChangeLog 2021-01-05 Nick Alcock <nick.alcock@oracle.com> * ctf-types.c (ctf_type_aname): Print forwards to unions and enums properly.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/testsuite/ld-ctf/enum-forward.c2
-rw-r--r--ld/testsuite/ld-ctf/enum-forward.d20
3 files changed, 27 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 213aed0..b939f61 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,10 @@
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.
* testsuite/ld-ctf/conflicting-cycle-1.B-1.d: Likewise.
* testsuite/ld-ctf/conflicting-cycle-1.B-2.d: Likewise.
diff --git a/ld/testsuite/ld-ctf/enum-forward.c b/ld/testsuite/ld-ctf/enum-forward.c
new file mode 100644
index 0000000..e0a64b8
--- /dev/null
+++ b/ld/testsuite/ld-ctf/enum-forward.c
@@ -0,0 +1,2 @@
+enum vibgyor;
+char * (*get_color_name) (enum vibgyor);
diff --git a/ld/testsuite/ld-ctf/enum-forward.d b/ld/testsuite/ld-ctf/enum-forward.d
new file mode 100644
index 0000000..a83651e
--- /dev/null
+++ b/ld/testsuite/ld-ctf/enum-forward.d
@@ -0,0 +1,20 @@
+#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]*\)
+
+#...