+2020-07-22 Egeyar Bagcioglu <egeyar.bagcioglu@oracle.com>
+
+ * testsuite/ld-ctf/ctf.exp: New file.
+ * testsuite/ld-ctf/A-2.c: New file.
+ * testsuite/ld-ctf/A.c: New file.
+ * testsuite/ld-ctf/B-2.c: New file.
+ * testsuite/ld-ctf/B.c: New file.
+ * testsuite/ld-ctf/C-2.c: New file.
+ * testsuite/ld-ctf/C.c: New file.
+ * testsuite/ld-ctf/array-char.c: New file.
+ * testsuite/ld-ctf/array-int.c: New file.
+ * testsuite/ld-ctf/array.d: New file.
+ * testsuite/ld-ctf/child-float.c: New file.
+ * testsuite/ld-ctf/child-int.c: New file.
+ * testsuite/ld-ctf/conflicting-cycle-1.B-1.d: New file.
+ * testsuite/ld-ctf/conflicting-cycle-1.B-2.d: New file.
+ * testsuite/ld-ctf/conflicting-cycle-1.parent.d: New file.
+ * testsuite/ld-ctf/conflicting-cycle-2.A-1.d: New file.
+ * testsuite/ld-ctf/conflicting-cycle-2.A-2.d: New file.
+ * testsuite/ld-ctf/conflicting-cycle-2.parent.d: New file.
+ * testsuite/ld-ctf/conflicting-cycle-3.C-1.d: New file.
+ * testsuite/ld-ctf/conflicting-cycle-3.C-2.d: New file.
+ * testsuite/ld-ctf/conflicting-cycle-3.parent.d: New file.
+ * testsuite/ld-ctf/conflicting-enums.d: New file.
+ * testsuite/ld-ctf/conflicting-typedefs.d: New file.
+ * testsuite/ld-ctf/cross-tu-1.c: New file.
+ * testsuite/ld-ctf/cross-tu-2.c: New file.
+ * testsuite/ld-ctf/cross-tu-conflicting-2.c: New file.
+ * testsuite/ld-ctf/cross-tu-cyclic-1.c: New file.
+ * testsuite/ld-ctf/cross-tu-cyclic-2.c: New file.
+ * testsuite/ld-ctf/cross-tu-cyclic-3.c: New file.
+ * testsuite/ld-ctf/cross-tu-cyclic-4.c: New file.
+ * testsuite/ld-ctf/cross-tu-cyclic-conflicting.d: New file.
+ * testsuite/ld-ctf/cross-tu-cyclic-nonconflicting.d: New file.
+ * testsuite/ld-ctf/cross-tu-into-cycle.d: New file.
+ * testsuite/ld-ctf/cross-tu-noncyclic.d: New file.
+ * testsuite/ld-ctf/cycle-1.c: New file.
+ * testsuite/ld-ctf/cycle-1.d: New file.
+ * testsuite/ld-ctf/cycle-2.A.d: New file.
+ * testsuite/ld-ctf/cycle-2.B.d: New file.
+ * testsuite/ld-ctf/cycle-2.C.d: New file.
+ * testsuite/ld-ctf/diag-ctf-version-0.d: New file.
+ * testsuite/ld-ctf/diag-ctf-version-0.s: New file.
+ * testsuite/ld-ctf/diag-ctf-version-2-unsupported-feature.d: New file.
+ * testsuite/ld-ctf/diag-ctf-version-2-unsupported-feature.s: New file.
+ * testsuite/ld-ctf/diag-ctf-version-f.d: New file.
+ * testsuite/ld-ctf/diag-ctf-version-f.s: New file.
+ * testsuite/ld-ctf/diag-cttname-invalid.d: New file.
+ * testsuite/ld-ctf/diag-cttname-invalid.s: New file.
+ * testsuite/ld-ctf/diag-cttname-null.d: New file.
+ * testsuite/ld-ctf/diag-cttname-null.s: New file.
+ * testsuite/ld-ctf/diag-cuname.d: New file.
+ * testsuite/ld-ctf/diag-cuname.s: New file.
+ * testsuite/ld-ctf/diag-decompression-failure.d: New file.
+ * testsuite/ld-ctf/diag-decompression-failure.s: New file.
+ * testsuite/ld-ctf/diag-parlabel.d: New file.
+ * testsuite/ld-ctf/diag-parlabel.s: New file.
+ * testsuite/ld-ctf/diag-parname.d: New file.
+ * testsuite/ld-ctf/diag-parname.s: New file.
+ * testsuite/ld-ctf/diag-unsupported-flag.d: New file.
+ * testsuite/ld-ctf/diag-unsupported-flag.s: New file.
+ * testsuite/ld-ctf/diag-wrong-magic-number-mixed.d: New file.
+ * testsuite/ld-ctf/diag-wrong-magic-number.d: New file.
+ * testsuite/ld-ctf/diag-wrong-magic-number.s: New file.
+ * testsuite/ld-ctf/enum-2.c: New file.
+ * testsuite/ld-ctf/enum.c: New file.
+ * testsuite/ld-ctf/function.c: New file.
+ * testsuite/ld-ctf/function.d: New file.
+ * testsuite/ld-ctf/slice.c: New file.
+ * testsuite/ld-ctf/slice.d: New file.
+ * testsuite/ld-ctf/super-sub-cycles.c: New file.
+ * testsuite/ld-ctf/super-sub-cycles.d: New file.
+ * testsuite/ld-ctf/typedef-int.c: New file.
+ * testsuite/ld-ctf/typedef-long.c: New file.
+ * testsuite/ld-ctf/union-1.c: New file.
+
2020-07-22 Nick Alcock <nick.alcock@oracle.com>
* ldlex.h (option_values) <OPTION_CTF_VARIABLES,
--- /dev/null
+struct A {
+ struct B *b;
+ int wombat;
+};
+
+static struct A a __attribute__((used));
--- /dev/null
+struct A {
+ struct B *b;
+};
+
+static struct A a __attribute__((used));
--- /dev/null
+struct B {
+ struct C *c;
+ int wombat;
+};
+static struct B b __attribute__((used));
--- /dev/null
+struct B {
+ struct C *c;
+};
+static struct B b __attribute__((used));
--- /dev/null
+struct C {
+ struct A *a;
+ int wombat;
+};
+static struct C c __attribute__((used));
--- /dev/null
+struct C {
+ struct A *a;
+};
+static struct C c __attribute__((used));
+
--- /dev/null
+char * digits_names[10] = {"zero", "one", "two", "three", "four",
+ "five", "six", "seven", "eight", "nine"};
--- /dev/null
+int digits[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, };
--- /dev/null
+#as:
+#source: array-char.c
+#source: array-int.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Arrays
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Variable section: 0x0 -- 0xf \(0x10 bytes\)
+ Type section: 0x10 -- 0x6b \(0x5c bytes\)
+ String section: .*
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+ digits.*\[10] .*
+ digits.*\[10] .*
+
+ Types:
+#...
+ [0-9a-f]*: .*\[10\] .*
+#...
+ [0-9a-f]*: .*\[10\] .*
+#...
--- /dev/null
+struct child_float {
+ float d;
+};
+static struct child_float *a_child_float __attribute__((used));
--- /dev/null
+struct child_int {
+ int i;
+};
+static struct child_int *a_child_int __attribute__((used));
--- /dev/null
+#as:
+#source: cycle-1.c
+#source: A.c
+#source: B.c
+#source: B-2.c
+#source: C.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Conflicting cycle 1.B-1
+
+.*: +file format .*
+
+#...
+CTF archive member: .*/B.c:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Parent name: .ctf
+ Compilation unit name: .*/B.c
+ Variable section: 0x0 -- 0x7 \(0x8 bytes\)
+ Type section: 0x8 -- 0x1f \(0x18 bytes\)
+ String section: .*
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+ b -> 80000001: struct B \(size 0x[0-9]*\)
+
+ Types:
+ 8[0-9a-f]*: struct B .*
+ \[0x0\] \(ID 0x8[0-9a-f]*\) \(kind 6\) struct B \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct C \* c \(.*
+
+ Strings:
+#...
--- /dev/null
+#as:
+#source: cycle-1.c
+#source: A.c
+#source: B.c
+#source: B-2.c
+#source: C.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Conflicting cycle 1.B-2
+
+.*: +file format .*
+
+#...
+CTF archive member: .*/B-2.c:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Parent name: .ctf
+ Compilation unit name: .*/B-2.c
+ Variable section: 0x0 -- 0x7 \(0x8 bytes\)
+ Type section: 0x8 -- 0x2b \(0x24 bytes\)
+ String section: .*
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+ b -> 80000001: struct B \(.*
+
+ Types:
+ 8[0-9a-f]*: struct B \(.*
+ \[0x0\] \(ID 0x8[0-9a-f]*\) \(kind 6\) struct B \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct C \* c \(.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 1\) int wombat:32 \(aligned at 0x[0-9a-f]*, format 0x1, offset:bits 0x0:0x[0-9a-f]*\)
+
+ Strings:
+#...
--- /dev/null
+#as:
+#source: cycle-1.c
+#source: A.c
+#source: B.c
+#source: B-2.c
+#source: C.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Conflicting cycle 1.parent
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Variable section: 0x0 -- 0x17 \(0x18 bytes\)
+ Type section: 0x18 -- 0xc3 \(0xac bytes\)
+ String section: .*
+
+ Labels:
+
+ Data objects:
+#...
+ Function objects:
+
+ Variables:
+#...
+ Types:
+#...
+ [0-9a-f]*: struct B \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 9\) struct B \(.*
+#...
+CTF archive member: .*:
+#...
+CTF archive member: .*:
+#...
--- /dev/null
+#as:
+#source: cycle-1.c
+#source: A.c
+#source: A-2.c
+#source: B.c
+#source: B-2.c
+#source: C.c
+#source: C-2.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Conflicting cycle 2.A-1
+
+.*: +file format .*
+
+#...
+CTF archive member: .*/A.c:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Parent name: .*
+ Compilation unit name: .*/A.c
+#...
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+ a -> 80000001: struct A \(size 0x[0-9a-f]*\)
+
+ Types:
+ 8[0-9a-f]*: struct A \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x8[0-9a-f]*\) \(kind 6\) struct A \(aligned at 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* b \(aligned at 0x[0-9a-f]*\)
+
+ Strings:
+ 0:
+#...
--- /dev/null
+#as:
+#source: cycle-1.c
+#source: A.c
+#source: A-2.c
+#source: B.c
+#source: B-2.c
+#source: C.c
+#source: C-2.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Conflicting cycle 2.A-2
+
+.*: +file format .*
+
+#...
+CTF archive member: .*/A-2.c:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Parent name: .*
+ Compilation unit name: .*/A-2.c
+#...
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+ a -> 80000001: struct A \(size 0x[0-9a-f]*\)
+
+ Types:
+ 8[0-9a-f]*: struct A \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x8[0-9a-f]*\) \(kind 6\) struct A \(aligned at 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* b \(aligned at 0x[0-9a-f]*\)
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 1\) int wombat:32 \(aligned at 0x[0-9a-f]*, format 0x1, offset:bits 0x0:0x[0-9a-f]*\)
+
+ Strings:
+ 0:
+#...
--- /dev/null
+#as:
+#source: cycle-1.c
+#source: A.c
+#source: A-2.c
+#source: B.c
+#source: B-2.c
+#source: C.c
+#source: C-2.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Conflicting cycle 2.parent
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Variable section: 0x0 -- 0x7 \(0x8 bytes\)
+ Type section: 0x8 -- 0x9b \(0x94 bytes\)
+ String section: 0x9c -- 0xac \(0x11 bytes\)
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+ cycle_1 -> [0-9a-f]*: struct cycle_1 \* \(size 0x[0-9a-f]*\) -> [0-9a-f]*: struct cycle_1 \(size 0x[0-9a-f]*\)
+
+ Types:
+#...
+ [0-9a-f]*: struct cycle_1 \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct cycle_1 \(aligned at 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct A \* a \(aligned at 0x[0-9a-f]*\)
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* b \(aligned at 0x[0-9a-f]*\)
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct cycle_1 \* next \(aligned at 0x[0-9a-f]*\)
+#...
--- /dev/null
+#as:
+#source: A.c
+#source: A-2.c
+#source: B.c
+#source: B-2.c
+#source: C.c
+#source: C-2.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Conflicting cycle 3.C-1
+
+.*: +file format .*
+
+#...
+CTF archive member: .*/C.c:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Parent name: .*
+ Compilation unit name: .*/C.c
+#...
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+ c -> 80000001: struct C \(size 0x[0-9a-f]*\)
+
+ Types:
+ 8[0-9a-f]*: struct C \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x8[0-9a-f]*\) \(kind 6\) struct C \(aligned at 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct A \* a \(aligned at 0x[0-9a-f]*\)
+
+ Strings:
+ 0:
+#...
--- /dev/null
+#as:
+#source: A.c
+#source: A-2.c
+#source: B.c
+#source: B-2.c
+#source: C.c
+#source: C-2.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Conflicting cycle 3.C-2
+
+.*: +file format .*
+
+#...
+CTF archive member: .*/C-2.c:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Parent name: .*
+ Compilation unit name: .*/C-2.c
+#...
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+ c -> 80000001: struct C \(size 0x[0-9a-f]*\)
+
+ Types:
+ 8[0-9a-f]*: struct C \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x8[0-9a-f]*\) \(kind 6\) struct C \(aligned at 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct A \* a \(aligned at 0x[0-9a-f]*\)
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 1\) int wombat:[0-9]* \(aligned at 0x[0-9a-f]*, format 0x1, offset:bits 0x0:0x[0-9a-f]*\)
+
+ Strings:
+ 0:
+#...
--- /dev/null
+#as:
+#source: A.c
+#source: A-2.c
+#source: B.c
+#source: B-2.c
+#source: C.c
+#source: C-2.c
+#objdump: --ctf=.ctf
+#ld: -shared
+#name: Conflicting cycle 3
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Type section: 0x0 -- 0x57 \(0x58 bytes\)
+ String section: .*
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+
+ Types:
+#...
+ [0-9a-f]*: int \[0x0:0x[0-9a-f]*\] \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 1\) int:[0-9]* \(aligned at 0x[0-9a-f]*, format 0x1, offset:bits 0x0:0x[0-9a-f]*\)
+#...
+ Strings:
+ 0:
+#...
--- /dev/null
+#as:
+#source: enum.c
+#source: enum-2.c
+#objdump: --ctf=.ctf
+#ld: -shared
+#name: Conflicting Enums
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+#...
+ Types:
+
+ Strings:
+#...
+CTF archive member: .*enum.*\.c:
+#...
+ Types:
+ 8[0-9a-f]*: enum day_of_the_week \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x8[0-9a-f]*\) \(kind 8\) enum day_of_the_week \(aligned at 0x[0-9a-f]*\)
+
+ Strings:
+#...
+CTF archive member: .*enum.*\.c:
+#...
+ Types:
+ 8[0-9a-f]*: enum day_of_the_week \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x8[0-9a-f]*\) \(kind 8\) enum day_of_the_week \(aligned at 0x[0-9a-f]*\)
+
+ Strings:
+#...
--- /dev/null
+#as:
+#source: typedef-int.c
+#source: typedef-long.c
+#objdump: --ctf=.ctf
+#ld: -shared
+#name: Conflicting Typedefs
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+#...
+ Types:
+ 1: .*int .*
+ .*
+ [0-9]:.*int .*
+ .*
+ [0-9]: word .*
+ \[0x0\] \(ID 0x[0-9]\) \(kind 10\) word \(aligned at 0x[48]\)
+
+ Strings:
+#...
+CTF archive member: .*typedef.*\.c:
+#...
+ Types:
+ 80000001: word .*
+ \[0x0\] \(ID 0x80000001\) \(kind 10\) word \(aligned at 0x[48]\)
+
+ Strings:
+#...
--- /dev/null
+struct B
+{
+ int foo;
+};
+
+struct A
+{
+ long a;
+ struct B *foo;
+};
+
+static struct A *foo __attribute__((used));
--- /dev/null
+struct B;
+struct A
+{
+ long a;
+ struct B *foo;
+};
+
+static struct A *foo __attribute__((used));
--- /dev/null
+struct B;
+struct A
+{
+ int a;
+ struct B *foo;
+};
+
+static struct A *foo __attribute__((used));
--- /dev/null
+struct A;
+struct B
+{
+ int foo;
+ struct A *bar;
+};
+
+struct A
+{
+ long a;
+ struct B *foo;
+};
+
+static struct A *foo __attribute__((used));
--- /dev/null
+struct B;
+struct A
+{
+ long a;
+ struct B *foo;
+ struct C *bar;
+};
+
+struct C
+{
+ struct B *foo;
+ int b;
+};
+
+static struct C *foo __attribute__((used));
+static struct A *bar __attribute__((used));
--- /dev/null
+struct A { struct B *foo; };
+static struct A *a __attribute__((__used__));
+static struct A *conflicty __attribute__((__used__));
--- /dev/null
+struct A { struct B *foo; };
+struct B { struct B *next; };
+static struct A *a __attribute__((__used__));
+static struct B *conflicty __attribute__((__used__));
--- /dev/null
+# Check that types with the same names in distinct TUs show up as
+# conflicting.
+#as:
+#source: cross-tu-cyclic-1.c
+#source: cross-tu-cyclic-2.c
+#objdump: --ctf=.ctf
+#ld: -shared
+#name: cross-TU-cyclic-conflicting
+
+.*: file format .*
+
+Contents of CTF section \.ctf:
+
+#...
+ Types:
+#...
+ [0-9a-f]*: long int \[0x0:0x[0-9a-f]*\] \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 1\) long int:[0-9]* \(aligned at 0x[0-9a-f]*, format 0x1, offset:bits 0x0:0x[0-9a-f]*\)
+#...
+ [0-9a-f]*: struct B .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct B .*
+#...
+ [0-9a-f]*: int \[0x0:0x[0-9a-f]*\] \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 1\) int:[0-9]* \(aligned at 0x[0-9a-f]*, format 0x1, offset:bits 0x0:0x[0-9a-f]*\)
+#...
+ [0-9a-f]*: struct A .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 9\) struct A .*
+#...
+ [0-9a-f]*: struct C .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct C .*
+#...
+
+ Strings:
+#...
+
+CTF archive member: .*/ld/testsuite/ld-ctf/cross-tu-cyclic-1\.c:
+#...
+ Types:
+ 80.*[0-9a-f]*: struct A .*
+ \[0x0\] \(ID 0x80.*\) \(kind 6\) struct A .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 1\) long int a:.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* foo .*
+
+ Strings:
+#...
+
+CTF archive member: .*/ld/testsuite/ld-ctf/cross-tu-cyclic-2\.c:
+#...
+ Types:
+ 80.*[0-9a-f]*: struct A .*
+ \[0x0\] \(ID 0x80.*\) \(kind 6\) struct A .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 1\) long int a:.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* foo .*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct C \* bar .*
+
+ Strings:
+#...
--- /dev/null
+# Check that cross-TU chasing to a type in a cycle works.
+# In particular, there should be only one copy of 'struct A *'.
+# (Not entirely reliable: only fails if the two are emitted adjacently.
+# Needs a proper objdump-CTF parser.)
+#as:
+#source: cross-tu-2.c
+#source: cross-tu-cyclic-1.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: cross-TU-cyclic-nonconflicting
+
+.*: file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+#...
+
+ Labels:
+
+ Data objects:
+#...
+ Function objects:
+
+ Variables:
+#...
+
+ Types:
+#...
+ [0-9a-f]*: struct A \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]\) \(kind 6\) struct A \(aligned at 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 1\) long int a:[0-9]* \(aligned at 0x[0-9a-f]*, format 0x1, offset:bits 0x0:0x[0-9a-f]*\)
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* foo \(aligned at 0x[0-9a-f]*\)
+ [0-9a-f]*: long int .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 1\) long int:[0-9].*
+ [0-9a-f]*: struct B \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct B \(aligned at 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 1\) int foo:[0-9]* \(aligned at 0x[0-9a-f]*, format 0x1, offset:bits 0x0:0x[0-9a-f]*\)
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct A \* bar \(aligned at 0x[0-9a-f]*\)
+ [0-9a-f]*: struct B \* \(size 0x[0-9a-f]*\) -> [0-9a-f]*: struct B \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* \(aligned at 0x[0-9a-f]*\)
+ [0-9a-f]*: struct A \* \(size 0x[0-9a-f]*\) -> [0-9a-f]*: struct A \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct A \* \(aligned at 0x[0-9a-f]*\)
+ [0-9a-f]*: int .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 1\) int:.*
+
+ Strings:
+#...
--- /dev/null
+# Check that a type outside a cycle pointing into a cycle
+# in another TU does not cause the whole cycle to show up
+# as conflicted. (Here, we do that by forcing conflicts
+# in the variable section alone, so that we can assert that
+# the type section of any conflicted dicts is empty.)
+# Minimized from libbfd itself.
+#as:
+#source: cross-tu-cyclic-3.c
+#source: cross-tu-cyclic-4.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: cross-TU-into-cycle
+
+.*: file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+#...
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+ a -> .*
+ conflicty -> .*
+
+ Types:
+ [0-9a-f]*: struct A .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct A .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* foo .*
+ [0-9a-f]*: struct B .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct B .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* next .*
+ [0-9a-f]*: struct B \* .*
+ \[0x0\] .*
+ [0-9a-f]*: struct A \* .*
+ \[0x0\] .*
+
+ Strings:
+#...
+
+CTF archive member: .*/ld/testsuite/ld-ctf/cross-tu-cyclic-[34].c:
+
+ Header:
+#...
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+ conflicty -> .*
+
+ Types:
+
+ Strings:
+#...
--- /dev/null
+# Check that noncyclic cross-TU matching-up works.
+# We can guarantee the order of emitted structures, too.
+#as:
+#source: cross-tu-1.c
+#source: cross-tu-2.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: cross-TU-noncyclic
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Variable section: 0x0 -- 0x7 \(0x8 bytes\)
+ Type section: 0x8 -- 0x7b \(0x74 bytes\)
+ String section: .*
+
+ Labels:
+
+ Data objects:
+#...
+ Function objects:
+
+ Variables:
+#...
+
+ Types:
+#...
+ [0-9a-f]*: struct A .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct A .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 1\) long int a:[0-9]* .*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* foo .*
+#...
+ [0-9a-f]*: struct B .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct B .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 1\) int foo:[0-9]* .*
+#...
+ [0-9a-f]*: struct B \* \(size 0x[0-9a-f]*\) -\> [0-9a-f]*: struct B .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* .*
+#...
+ [0-9a-f]*: struct A \* \(size 0x[0-9a-f]*\) -> [0-9a-f]*: struct A .*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct A \* .*
+#...
--- /dev/null
+# Copyright (C) 2020 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+set ctf_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+
+foreach ctf_test $ctf_test_list {
+ verbose [file rootname $ctf_test]
+ run_dump_test [file rootname $ctf_test] { { cc "-gt -fPIC" } }
+}
--- /dev/null
+struct cycle_1 {
+ struct A *a;
+ struct B *b;
+ struct cycle_1 *next;
+};
+
+static struct cycle_1 *cycle_1 __attribute__((used));
--- /dev/null
+#as:
+#source: cycle-1.c
+#source: A.c
+#source: B.c
+#source: C.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Cycle 1
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Variable section: 0x0 -- 0x1f \(0x20 bytes\)
+ Type section: 0x20 -- 0xc7 \(0xa8 bytes\)
+ String section: .*
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+#...
+ Types:
+#...
+ [0-9a-f]*: struct cycle_1 \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct cycle_1 \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct A \* a \(.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* b \(.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct cycle_1 \* next \(.*
+#...
--- /dev/null
+#as:
+#source: A.c
+#source: B.c
+#source: C.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Cycle 2.A
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Variable section: 0x0 -- 0x17 \(0x18 bytes\)
+ Type section: 0x18 -- 0x83 \(0x6c bytes\)
+ String section: .*
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+#...
+ a -> [0-9a-f]*: struct A \(.*
+#...
+ Types:
+#...
+ [0-9a-f]*: struct A \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct A \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* b \(.*
+#...
+ Strings:
+ 0:
+#...
+ [0-9a-f]*: A
+#...
--- /dev/null
+#as:
+#source: A.c
+#source: B.c
+#source: C.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Cycle 2.B
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Variable section: 0x0 -- 0x17 \(0x18 bytes\)
+ Type section: 0x18 -- 0x83 \(0x6c bytes\)
+ String section: .*
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+#...
+ b -> [0-9a-f]*: struct B \(.*
+#...
+ Types:
+#...
+ [0-9a-f]*: struct B \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct B \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct C \* c \(.*
+#...
+ Strings:
+ 0:
+#...
+ [0-9a-f]*: B
+#...
--- /dev/null
+#as:
+#source: A.c
+#source: B.c
+#source: C.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Cycle 2.C
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Variable section: 0x0 -- 0x17 \(0x18 bytes\)
+ Type section: 0x18 -- 0x83 \(0x6c bytes\)
+ String section: .*
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+#...
+ c -> [0-9a-f]*: struct C \(.*
+#...
+ Types:
+#...
+ [0-9a-f]*: struct C \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct C \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct A \* a \(.*
+#...
+ Strings:
+ 0:
+#...
+ [0-9a-f]*: C
+#...
--- /dev/null
+#as:
+#source: diag-ctf-version-0.s
+#ld: -shared
+#name: Diagnostics - CTF version 0
+#warning: CTF section .* not loaded; its types will be discarded: .*
--- /dev/null
+ .file "A.c"
+ .section .ctf,"",@progbits
+.Lctf0:
+ .2byte 0xdff2
+ .byte 0x0
+ .byte 0
+ .long 0
+ .long 0
+ .long 0x9
+ .long 0
+ .long 0
+ .long 0x4
+ .long 0x4
+ .long 0x8
+ .long 0x8
+ .long 0x10
+ .long 0x40
+ .long 0x42
+ .long 0x1
+ .long 0x7
+ .long 0x7
+ .long 0x1
+ .long 0x1
+ .long 0x1a000001
+ .long 0x8
+ .long 0x5
+ .long 0
+ .long 0x3
+ .long 0x3
+ .long 0x26000000
+ .long 0x6
+ .long 0
+ .long 0xe000000
+ .long 0x2
+ .ascii "\0"
+ .ascii "A\0"
+ .ascii "B\0"
+ .ascii "b\0"
+ .ascii "a\0"
+ .ascii "/usr/src/binutils-gdb/ld/testsuite/ld-ctf/A.c\0"
+ .text
+ .comm a,8,8
+ .ident "GCC: (GNU) 8.3.1 20191121 (Red Hat 8.3.1-5.0.1)"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#as:
+#source: diag-ctf-version-2-unsupported-feature.s
+#ld: -shared
+#name: Diagnostics - CTF version 2 with unsupported feature
+#warning: CTF section .* not loaded; its types will be discarded: .*
--- /dev/null
+ .file "A.c"
+ .section .ctf,"",@progbits
+.Lctf0:
+ .2byte 0xdff2
+ .byte 0x2
+ .byte 0
+ .long 0
+ .long 0
+ .long 0x9
+ .long 0
+ .long 0
+ .long 0x4
+ .long 0x4
+ .long 0x8
+ .long 0x8
+ .long 0x10
+ .long 0x40
+ .long 0x42
+ .long 0x1
+ .long 0x7
+ .long 0x7
+ .long 0x1
+ .long 0x1
+ .long 0x1a000001
+ .long 0x8
+ .long 0x5
+ .long 0
+ .long 0x3
+ .long 0x3
+ .long 0x26000000
+ .long 0x6
+ .long 0
+ .long 0xe000000
+ .long 0x2
+ .ascii "\0"
+ .ascii "A\0"
+ .ascii "B\0"
+ .ascii "b\0"
+ .ascii "a\0"
+ .ascii "/usr/src/binutils-gdb/ld/testsuite/ld-ctf/A.c\0"
+ .text
+ .comm a,8,8
+ .ident "GCC: (GNU) 8.3.1 20191121 (Red Hat 8.3.1-5.0.1)"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#as:
+#source: diag-ctf-version-f.s
+#ld: -shared
+#name: Diagnostics - Unsupported CTF version
+#warning: CTF section .* not loaded; its types will be discarded: .CTF dict version is too new for libctf.
--- /dev/null
+ .file "A.c"
+ .section .ctf,"",@progbits
+.Lctf0:
+ .2byte 0xdff2
+ .byte 0xf
+ .byte 0
+ .long 0
+ .long 0
+ .long 0x9
+ .long 0
+ .long 0
+ .long 0x4
+ .long 0x4
+ .long 0x8
+ .long 0x8
+ .long 0x10
+ .long 0x40
+ .long 0x42
+ .long 0x1
+ .long 0x7
+ .long 0x7
+ .long 0x1
+ .long 0x1
+ .long 0x1a000001
+ .long 0x8
+ .long 0x5
+ .long 0
+ .long 0x3
+ .long 0x3
+ .long 0x26000000
+ .long 0x6
+ .long 0
+ .long 0xe000000
+ .long 0x2
+ .ascii "\0"
+ .ascii "A\0"
+ .ascii "B\0"
+ .ascii "b\0"
+ .ascii "a\0"
+ .ascii "/usr/src/binutils-gdb/ld/testsuite/ld-ctf/A.c\0"
+ .text
+ .comm a,8,8
+ .ident "GCC: (GNU) 8.3.1 20191121 (Red Hat 8.3.1-5.0.1)"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#as:
+#source: diag-cttname-invalid.s
+#ld: -shared
+#name: Diagnostics - Invalid type name.
+#warning: CTF section in .*not loaded; its types will be discarded: .String name offset is corrupt.
--- /dev/null
+ .file "A.c"
+ .section .ctf,"",@progbits
+.Lctf0:
+ .2byte 0xdff2
+ .byte 0x4
+ .byte 0
+ .long 0
+ .long 0
+ .long 0x9
+ .long 0
+ .long 0
+ .long 0x4
+ .long 0x4
+ .long 0x8
+ .long 0x8
+ .long 0x10
+ .long 0x40
+ .long 0x42
+ .long 0x1
+ .long 0x7
+ .long 0x7
+ .long 0x1
+ .long 0xff00
+ .long 0x1a000001
+ .long 0x8
+ .long 0x5
+ .long 0
+ .long 0x3
+ .long 0x3
+ .long 0x26000000
+ .long 0x6
+ .long 0
+ .long 0xe000000
+ .long 0x2
+ .ascii "\0"
+ .ascii "A\0"
+ .ascii "B\0"
+ .ascii "b\0"
+ .ascii "a\0"
+ .ascii "/usr/src/binutils-gdb/ld/testsuite/ld-ctf/A.c\0"
+ .text
+ .comm a,8,8
+ .ident "GCC: (GNU) 8.3.1 20191121 (Red Hat 8.3.1-5.0.1)"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#as:
+#source: diag-cttname-null.s
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Diagnostics - Null type name
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+#...
+ Variables:
+#...
+ a -> [0-9a-f]*: struct \(.*
+#...
+ Types:
+#...
+ [0-9a-f]*: struct \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* b \(.*
+#...
--- /dev/null
+ .file "A.c"
+ .section .ctf,"",@progbits
+.Lctf0:
+ .2byte 0xdff2
+ .byte 0x4
+ .byte 0
+ .long 0
+ .long 0
+ .long 0x9
+ .long 0
+ .long 0
+ .long 0x4
+ .long 0x4
+ .long 0x8
+ .long 0x8
+ .long 0x10
+ .long 0x40
+ .long 0x42
+ .long 0x1
+ .long 0x7
+ .long 0x7
+ .long 0x1
+ .long 0
+ .long 0x1a000001
+ .long 0x8
+ .long 0x5
+ .long 0
+ .long 0x3
+ .long 0x3
+ .long 0x26000000
+ .long 0x6
+ .long 0
+ .long 0xe000000
+ .long 0x2
+ .ascii "\0"
+ .ascii "A\0"
+ .ascii "B\0"
+ .ascii "b\0"
+ .ascii "a\0"
+ .ascii "/usr/src/binutils-gdb/ld/testsuite/ld-ctf/A.c\0"
+ .text
+ .comm a,8,8
+ .ident "GCC: (GNU) 8.3.1 20191121 (Red Hat 8.3.1-5.0.1)"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#as:
+#source: diag-cuname.s
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Diagnostics - Invalid CU name offset
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Compilation unit name: \(\?\)
+ Variable section: .*
+ Type section: .*
+ String section: .*
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+#...
+ a -> [0-9a-f]*: struct A \(.*
+#...
+ Types:
+#...
+ [0-9a-f]*: struct A \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct A \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* b \(.*
+#...
+ Strings:
+ 0:
+#...
+ [0-9a-f]*: \(\?\)
+#...
--- /dev/null
+ .file "A.c"
+ .section .ctf,"",@progbits
+.Lctf0:
+ .2byte 0xdff2
+ .byte 0x4
+ .byte 0
+ .long 0
+ .long 0
+ .long 0xffffffff
+ .long 0
+ .long 0
+ .long 0x4
+ .long 0x4
+ .long 0x8
+ .long 0x8
+ .long 0x10
+ .long 0x40
+ .long 0x42
+ .long 0x1
+ .long 0x7
+ .long 0x7
+ .long 0x1
+ .long 0x1
+ .long 0x1a000001
+ .long 0x8
+ .long 0x5
+ .long 0
+ .long 0x3
+ .long 0x3
+ .long 0x26000000
+ .long 0x6
+ .long 0
+ .long 0xe000000
+ .long 0x2
+ .ascii "\0"
+ .ascii "A\0"
+ .ascii "B\0"
+ .ascii "b\0"
+ .ascii "a\0"
+ .ascii "/usr/src/binutils-gdb/ld/testsuite/ld-ctf/A.c\0"
+ .text
+ .comm a,8,8
+ .ident "GCC: (GNU) 8.3.1 20191121 (Red Hat 8.3.1-5.0.1)"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#as:
+#source: diag-decompression-failure.s
+#ld: -shared
+#name: Diagnostics - Decompression failure
+#warning: CTF section.* not loaded; its types will be discarded: .Failed to decompress CTF data.
--- /dev/null
+ .file "A.c"
+ .section .ctf,"",@progbits
+.Lctf0:
+ .2byte 0xdff2
+ .byte 0x4
+ .byte 0x1
+ .long 0
+ .long 0
+ .long 0x9
+ .long 0
+ .long 0
+ .long 0x4
+ .long 0x4
+ .long 0x8
+ .long 0x8
+ .long 0x10
+ .long 0x40
+ .long 0x42
+ .long 0x1
+ .long 0x7
+ .long 0x7
+ .long 0x1
+ .long 0x1
+ .long 0x1a000001
+ .long 0x8
+ .long 0x5
+ .long 0
+ .long 0x3
+ .long 0x3
+ .long 0x26000000
+ .long 0x6
+ .long 0
+ .long 0xe000000
+ .long 0x2
+ .ascii "\0"
+ .ascii "A\0"
+ .ascii "B\0"
+ .ascii "b\0"
+ .ascii "a\0"
+ .ascii "/usr/src/binutils-gdb/ld/testsuite/ld-ctf/A.c\0"
+ .text
+ .comm a,8,8
+ .ident "GCC: (GNU) 8.3.1 20191121 (Red Hat 8.3.1-5.0.1)"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#as:
+#source: diag-parlabel.s
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Diagnostics - Non-zero parlabel in parent
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Compilation unit name: .*A.c
+ Variable section: 0x0 -- 0x7 \(0x8 bytes\)
+ Type section: 0x8 -- 0x37 \(0x30 bytes\)
+ String section: .*
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+#...
+ a -> [0-9a-f]*: struct A \(.*
+#...
+ Types:
+#...
+ [0-9a-f]*: struct A \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct A \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* b \(.*
+#...
+ Strings:
+ 0:
+#...
+ [0-9a-f]*: A
+#...
--- /dev/null
+ .file "A.c"
+ .section .ctf,"",@progbits
+.Lctf0:
+ .2byte 0xdff2
+ .byte 0x4
+ .byte 0
+ .long 0x2
+ .long 0
+ .long 0x9
+ .long 0
+ .long 0
+ .long 0x4
+ .long 0x4
+ .long 0x8
+ .long 0x8
+ .long 0x10
+ .long 0x40
+ .long 0x42
+ .long 0x1
+ .long 0x7
+ .long 0x7
+ .long 0x1
+ .long 0x1
+ .long 0x1a000001
+ .long 0x8
+ .long 0x5
+ .long 0
+ .long 0x3
+ .long 0x3
+ .long 0x26000000
+ .long 0x6
+ .long 0
+ .long 0xe000000
+ .long 0x2
+ .ascii "\0"
+ .ascii "A\0"
+ .ascii "B\0"
+ .ascii "b\0"
+ .ascii "a\0"
+ .ascii "/usr/src/binutils-gdb/ld/testsuite/ld-ctf/A.c\0"
+ .text
+ .comm a,8,8
+ .ident "GCC: (GNU) 8.3.1 20191121 (Red Hat 8.3.1-5.0.1)"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#as:
+#source: diag-parname.s
+#ld: -shared --ctf-variables
+#name: Diagnostics - No parent dictionary
+#warning: CTF linking failed; output will have no CTF section: .The parent CTF dictionary is unavailable.
--- /dev/null
+ .file "A.c"
+ .section .ctf,"",@progbits
+.Lctf0:
+ .2byte 0xdff2
+ .byte 0x4
+ .byte 0
+ .long 0
+ .long 0xffffffff
+ .long 0x9
+ .long 0
+ .long 0
+ .long 0x4
+ .long 0x4
+ .long 0x8
+ .long 0x8
+ .long 0x10
+ .long 0x40
+ .long 0x42
+ .long 0x1
+ .long 0x7
+ .long 0x7
+ .long 0x1
+ .long 0x1
+ .long 0x1a000001
+ .long 0x8
+ .long 0x5
+ .long 0
+ .long 0x3
+ .long 0x3
+ .long 0x26000000
+ .long 0x6
+ .long 0
+ .long 0xe000000
+ .long 0x2
+ .ascii "\0"
+ .ascii "A\0"
+ .ascii "B\0"
+ .ascii "b\0"
+ .ascii "a\0"
+ .ascii "/usr/src/binutils-gdb/ld/testsuite/ld-ctf/A.c\0"
+ .text
+ .comm a,8,8
+ .ident "GCC: (GNU) 8.3.1 20191121 (Red Hat 8.3.1-5.0.1)"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#as:
+#source: diag-unsupported-flag.s
+#ld: -shared
+#name: Diagnostics - Unsupported flag
+#warning: CTF section.* not loaded; its types will be discarded: .CTF header contains flags unknown to libctf.
--- /dev/null
+ .file "A.c"
+ .section .ctf,"",@progbits
+.Lctf0:
+ .2byte 0xdff2
+ .byte 0x4
+ .byte 0x80
+ .long 0
+ .long 0
+ .long 0x9
+ .long 0
+ .long 0
+ .long 0x4
+ .long 0x4
+ .long 0x8
+ .long 0x8
+ .long 0x10
+ .long 0x40
+ .long 0x42
+ .long 0x1
+ .long 0x7
+ .long 0x7
+ .long 0x1
+ .long 0x1
+ .long 0x1a000001
+ .long 0x8
+ .long 0x5
+ .long 0
+ .long 0x3
+ .long 0x3
+ .long 0x26000000
+ .long 0x6
+ .long 0
+ .long 0xe000000
+ .long 0x2
+ .ascii "\0"
+ .ascii "A\0"
+ .ascii "B\0"
+ .ascii "b\0"
+ .ascii "a\0"
+ .ascii "/usr/src/binutils-gdb/ld/testsuite/ld-ctf/A.c\0"
+ .text
+ .comm a,8,8
+ .ident "GCC: (GNU) 8.3.1 20191121 (Red Hat 8.3.1-5.0.1)"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#as:
+#source: diag-wrong-magic-number.s
+#source: B.c
+#ld: -shared --ctf-variables
+#name: Diagnostics - Wrong magic number mixed with valid CTF sections
+#warning: CTF section in .* not loaded; its types will be discarded: .Buffer does not contain CTF data.
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Variable section: 0x0 -- 0x17 \(0x18 bytes\)
+ Type section: 0x18 -- 0x83 \(0x6c bytes\)
+ String section: .*
+
+ Labels:
+
+ Data objects:
+
+ Function objects:
+
+ Variables:
+#...
+ b -> [0-9a-f]*: struct B \(.*
+#...
+ Types:
+#...
+ [0-9a-f]*: struct B \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct B \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct C \* c \(.*
+#...
+ Strings:
+ 0:
+#...
+ [0-9a-f]*: B
+#...
--- /dev/null
+#as:
+#source: diag-wrong-magic-number.s
+#ld: -shared
+#name: Diagnostics - Wrong magic number
+#warning: CTF section in .* not loaded; its types will be discarded: .Buffer does not contain CTF data.
--- /dev/null
+ .file "A.c"
+ .section .ctf,"",@progbits
+.Lctf0:
+ .2byte 0xdff3
+ .byte 0x4
+ .byte 0
+ .long 0
+ .long 0
+ .long 0x9
+ .long 0
+ .long 0
+ .long 0x4
+ .long 0x4
+ .long 0x8
+ .long 0x8
+ .long 0x10
+ .long 0x40
+ .long 0x42
+ .long 0x1
+ .long 0x7
+ .long 0x7
+ .long 0x1
+ .long 0x1
+ .long 0x1a000001
+ .long 0x8
+ .long 0x5
+ .long 0
+ .long 0x3
+ .long 0x3
+ .long 0x26000000
+ .long 0x6
+ .long 0
+ .long 0xe000000
+ .long 0x2
+ .ascii "\0"
+ .ascii "A\0"
+ .ascii "B\0"
+ .ascii "b\0"
+ .ascii "a\0"
+ .ascii "/usr/src/binutils-gdb/ld/testsuite/ld-ctf/A.c\0"
+ .text
+ .comm a,8,8
+ .ident "GCC: (GNU) 8.3.1 20191121 (Red Hat 8.3.1-5.0.1)"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+enum day_of_the_week {Sunday = 0, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday};
+
+static enum day_of_the_week day __attribute__((used));
--- /dev/null
+enum day_of_the_week {Monday = 0, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};
+
+static enum day_of_the_week day __attribute__((used));
--- /dev/null
+int foo (char ch, int i, float f, void * p, void (*bar_ptr)(int)) {
+ return 0;
+}
--- /dev/null
+#as:
+#source: function.c
+#objdump: --ctf=.ctf
+#ld: -shared
+#name: Function
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Compilation unit name: .*function.c
+#...
+ Type section: 0x0 -- 0x8f \(0x90 bytes\)
+ String section: .*
+#...
+ Types:
+#...
+ [0-9a-f]*: int \(\*\) \(char, int, float, void \*, void \(\*\)\(\*\) \(int\)\) \(size 0x0\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 5\) int \(\*\) \(char, int[0-9]*, float, void \*, void \(\*\)\(\*\) \(int\)\) \(aligned at 0x[0-9a-f]*\)
+#...
--- /dev/null
+struct slices {
+ int one : 1;
+ int two : 2;
+ int six : 6;
+ int ten :10;
+} slices;
--- /dev/null
+#as:
+#source: slice.c
+#objdump: --ctf=.ctf
+#ld: -shared --ctf-variables
+#name: Slice
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Compilation unit name: .*slice.c
+ Variable section: 0x0 -- 0x7 \(0x8 bytes\)
+ Type section: 0x8 -- 0xa3 \(0x9c bytes\)
+ String section: .*
+#...
+ Variables:
+ slices -> [0-9a-f]*: struct slices \(size 0x4\)
+
+ Types:
+#...
+ [0-9a-f]*: struct slices \(size 0x[0-9a-f]*\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct slices \(aligned at 0x1\)
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 1\) int one:1 \(aligned at 0x1, format 0x1, offset:bits 0x0:0x1\)
+ \[0x1\] \(ID 0x[0-9a-f]*\) \(kind 1\) int two:2 \(aligned at 0x1, format 0x1, offset:bits 0x1:0x2\)
+ \[0x3\] \(ID 0x[0-9a-f]*\) \(kind 1\) int six:6 \(aligned at 0x1, format 0x1, offset:bits 0x3:0x6\)
+ \[0x9\] \(ID 0x[0-9a-f]*\) \(kind 1\) int ten:10 \(aligned at 0x2, format 0x1, offset:bits 0x9:0xa\)
+#...
--- /dev/null
+struct A;
+struct B;
+struct D { struct B *b; };
+struct Y;
+struct Z { struct Y *y; struct D *d; };
+struct Y { struct Z z; };
+struct X { struct Y y; };
+struct C { struct A *a; struct D d; };
+struct B { struct C c; struct D d; };
+struct A { struct B b; struct X x; } a;
--- /dev/null
+#as:
+#source: super-sub-cycles.c
+#objdump: --ctf=.ctf
+#ld: -shared
+#name: Super- and sub-cycles
+
+.*: +file format .*
+
+Contents of CTF section .ctf:
+
+ Header:
+ Magic number: dff2
+ Version: 4 \(CTF_VERSION_3\)
+ Compilation unit name: .*super-sub-cycles.c
+#...
+ Type section: .*\(0x108 bytes\)
+#...
+ Types:
+#...
+ [0-9a-f]*: struct A \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct A \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct B b \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct C c \(.*
+ \[0x0\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct A \* a \(.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct D d \(.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* b \(.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct D d \(.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct B \* b \(.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct X x \(.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct Y y \(.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 6\) struct Z z \(.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct Y \* y \(.*
+ \[0x[0-9a-f]*\] \(ID 0x[0-9a-f]*\) \(kind 3\) struct D \* d \(.*
+#...
--- /dev/null
+typedef int word;
+
+static word w;
--- /dev/null
+typedef long word;
+
+static word w;
--- /dev/null
+union int_or_float {
+ struct child_int * a_child_int;
+ struct child_float * a_child_float;
+} an_int_or_float;