ld, ctf: new and adjusted CTF tests due to func info / object data sections

The flags word is nonzero now (so all the tests have been adjusted to
not depend on its content): some of them have data objects and functions
in the data object and function info sections now, rather than in the
variable section or recorded nowhere.  There is a new test for
parent/child relationships and index section emission.

ld/ChangeLog
2020-11-20  Nick Alcock  <nick.alcock@oracle.com>

	* testsuite/ld-ctf/array.d: Adjust for nonzero flags word and
	public symbols in the data section rather than variables: use
	sysv hash style to keep test results the same on non-GNU targets.
	* testsuite/ld-ctf/diag-cttname-null.d: Likewise.
	* testsuite/ld-ctf/diag-cuname.d: Likewise.
	* testsuite/ld-ctf/diag-parlabel.d: Likewise.
	* testsuite/ld-ctf/slice.d: Likewise.
	* testsuite/ld-ctf/function.d: Likewise, but in the function section.
	* testsuite/ld-ctf/conflicting-cycle-1.B-1.d:  Adjust for nonzero
	flags word.
	* testsuite/ld-ctf/conflicting-cycle-1.B-2.d: Likewise.
	* testsuite/ld-ctf/conflicting-cycle-1.parent.d: Likewise.
	* testsuite/ld-ctf/conflicting-cycle-2.A-1.d: Likewise.
	* testsuite/ld-ctf/conflicting-cycle-2.A-2.d: Likewise.
	* testsuite/ld-ctf/conflicting-cycle-2.parent.d: Likewise.
	* testsuite/ld-ctf/conflicting-cycle-3.C-1.d: Likewise.
	* testsuite/ld-ctf/conflicting-cycle-3.C-2.d: Likewise.
	* testsuite/ld-ctf/conflicting-cycle-3.parent.d: Likewise.
	* testsuite/ld-ctf/cross-tu-noncyclic.d: Likewise.
	* testsuite/ld-ctf/cycle-1.d: Likewise.
	* testsuite/ld-ctf/cycle-2.A.d: Likewise.
	* testsuite/ld-ctf/cycle-2.B.d: Likewise.
	* testsuite/ld-ctf/cycle-2.C.d: Likewise.
	* testsuite/ld-ctf/diag-wrong-magic-number-mixed.d:  Likewise.
	* testsuite/ld-ctf/super-sub-cycles.d:  Likewise.
	* testsuite/ld-ctf/data-func-1.c: New test.
	* testsuite/ld-ctf/data-func-2.c: Likewise.
	* testsuite/ld-ctf/data-func-conflicted.d: Likewise.
This commit is contained in:
Nick Alcock 2020-11-20 13:34:04 +00:00
parent 4665e895c3
commit 0ad70c536a
26 changed files with 1191 additions and 45 deletions

View File

@ -1,3 +1,34 @@
2020-11-20 Nick Alcock <nick.alcock@oracle.com>
* testsuite/ld-ctf/array.d: Adjust for nonzero flags word and
public symbols in the data section rather than variables: use
sysv hash style to keep test results the same on non-GNU targets.
* testsuite/ld-ctf/diag-cttname-null.d: Likewise.
* testsuite/ld-ctf/diag-cuname.d: Likewise.
* testsuite/ld-ctf/diag-parlabel.d: Likewise.
* testsuite/ld-ctf/slice.d: Likewise.
* testsuite/ld-ctf/function.d: Likewise, but in the function section.
* testsuite/ld-ctf/conflicting-cycle-1.B-1.d: Adjust for nonzero
flags word.
* testsuite/ld-ctf/conflicting-cycle-1.B-2.d: Likewise.
* testsuite/ld-ctf/conflicting-cycle-1.parent.d: Likewise.
* testsuite/ld-ctf/conflicting-cycle-2.A-1.d: Likewise.
* testsuite/ld-ctf/conflicting-cycle-2.A-2.d: Likewise.
* testsuite/ld-ctf/conflicting-cycle-2.parent.d: Likewise.
* testsuite/ld-ctf/conflicting-cycle-3.C-1.d: Likewise.
* testsuite/ld-ctf/conflicting-cycle-3.C-2.d: Likewise.
* testsuite/ld-ctf/conflicting-cycle-3.parent.d: Likewise.
* testsuite/ld-ctf/cross-tu-noncyclic.d: Likewise.
* testsuite/ld-ctf/cycle-1.d: Likewise.
* testsuite/ld-ctf/cycle-2.A.d: Likewise.
* testsuite/ld-ctf/cycle-2.B.d: Likewise.
* testsuite/ld-ctf/cycle-2.C.d: Likewise.
* testsuite/ld-ctf/diag-wrong-magic-number-mixed.d: Likewise.
* testsuite/ld-ctf/super-sub-cycles.d: Likewise.
* testsuite/ld-ctf/data-func-1.c: New test.
* testsuite/ld-ctf/data-func-2.c: Likewise.
* testsuite/ld-ctf/data-func-conflicted.d: Likewise.
2020-11-20 Nick Alcock <nick.alcock@oracle.com>
* ldelfgen.c (struct ctf_strsym_iter_cb_arg): Rename to...

View File

@ -2,7 +2,7 @@
#source: array-char.c
#source: array-int.c
#objdump: --ctf=.ctf
#ld: -shared --ctf-variables
#ld: -shared --ctf-variables --hash-style=sysv
#name: Arrays
.*: +file format .*
@ -12,19 +12,20 @@ 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\)
#...
Data object section: .* \(0x8 bytes\)
Type section: .* \(0x5c bytes\)
String section: .*
Labels:
Data objects:
digits -> int \[10\]
digits_names -> char \*\[10\]
Function objects:
Variables:
digits.*\[10] .*
digits.*\[10] .*
Types:
#...

View File

@ -16,10 +16,11 @@ 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\)
#...
Type section: .* \(0x18 bytes\)
String section: .*
Labels:

View File

@ -16,10 +16,11 @@ 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\)
#...
Type section: .* \(0x24 bytes\)
String section: .*
Labels:

View File

@ -15,8 +15,8 @@ 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\)
#...
Type section: .* \(0xac bytes\)
String section: .*
Labels:

View File

@ -18,6 +18,7 @@ CTF archive member: .*/A.c:
Header:
Magic number: dff2
Version: 4 \(CTF_VERSION_3\)
#...
Parent name: .*
Compilation unit name: .*/A.c
#...

View File

@ -18,6 +18,7 @@ CTF archive member: .*/A-2.c:
Header:
Magic number: dff2
Version: 4 \(CTF_VERSION_3\)
#...
Parent name: .*
Compilation unit name: .*/A-2.c
#...

View File

@ -17,9 +17,9 @@ 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\)
#...
Type section: .* \(0x94 bytes\)
String section: .* \(0x1d bytes\)
Labels:

View File

@ -17,6 +17,7 @@ CTF archive member: .*/C.c:
Header:
Magic number: dff2
Version: 4 \(CTF_VERSION_3\)
#...
Parent name: .*
Compilation unit name: .*/C.c
#...

View File

@ -17,6 +17,7 @@ CTF archive member: .*/C-2.c:
Header:
Magic number: dff2
Version: 4 \(CTF_VERSION_3\)
#...
Parent name: .*
Compilation unit name: .*/C-2.c
#...

View File

@ -16,6 +16,7 @@ Contents of CTF section .ctf:
Header:
Magic number: dff2
Version: 4 \(CTF_VERSION_3\)
#...
Type section: 0x0 -- 0x57 \(0x58 bytes\)
String section: .*

View File

@ -14,8 +14,8 @@ 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\)
#...
Type section: .* \(0x74 bytes\)
String section: .*
Labels:

View File

@ -14,8 +14,8 @@ 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\)
#...
Type section: .* \(0xa8 bytes\)
String section: .*
Labels:

View File

@ -13,8 +13,8 @@ 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\)
#...
Type section: .* \(0x6c bytes\)
String section: .*
Labels:

View File

@ -13,8 +13,8 @@ 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\)
#...
Type section: .* \(0x6c bytes\)
String section: .*
Labels:

View File

@ -13,8 +13,8 @@ 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\)
#...
Type section: .* \(0x6c bytes\)
String section: .*
Labels:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
typedef char foo_t;
/* Conflicting, and indexed. */
extern foo_t var_1;
extern foo_t *var_666;

View File

@ -0,0 +1,63 @@
#as:
#source: data-func-1.c
#source: data-func-2.c
#objdump: --ctf=.ctf
#ld: -shared -s
#name: Conflicted data syms, partially indexed, stripped
.*: +file format .*
Contents of CTF section \.ctf:
Header:
Magic number: dff2
Version: 4 \(CTF_VERSION_3\)
#...
Data object section: .* \(0xc bytes\)
Function info section: .* \(0x40 bytes\)
Object index section: .* \(0xc bytes\)
Type section: .* \(0x228 bytes\)
String section: .*
#...
Data objects:
bar -> struct var_3
var_1 -> foo_t
var_666 -> foo_t \*
Function objects:
func_[0-9]* -> void \*\(\*\) \(const char \*restrict, int \(\*\)\(\*\) \(const char \*\)\)
#...
Types:
#...
.*: struct var_3 .*
#...
CTF archive member: .*/data-func-1\.c:
Header:
Magic number: dff2
Version: 4 \(CTF_VERSION_3\)
#...
Parent name: \.ctf
Compilation unit name: .*/data-func-1\.c
Data object section: .* \(0xfa4 bytes\)
Type section: .* \(0xc bytes\)
String section: .*
Labels:
Data objects:
var_[0-9]* -> foo_t
var_[0-9]* -> foo_t
var_[0-9]* -> foo_t
var_[0-9]* -> foo_t
var_[0-9]* -> foo_t
var_[0-9]* -> foo_t
var_[0-9]* -> foo_t
#...
Function objects:
Variables:
Types:
80000001: foo_t .* -> .* int .*
#...

View File

@ -12,9 +12,8 @@ Contents of CTF section .ctf:
Magic number: dff2
Version: 4 \(CTF_VERSION_3\)
#...
Variables:
#...
a -> [0-9a-f]*: struct \(.*
Data objects:
a -> struct
#...
Types:
#...

View File

@ -11,21 +11,22 @@ Contents of CTF section .ctf:
Header:
Magic number: dff2
Version: 4 \(CTF_VERSION_3\)
#...
Compilation unit name: \(\?\)
Variable section: .*
#...
Data object section: .*
Type section: .*
String section: .*
Labels:
Data objects:
a -> struct A
#...
Function objects:
Variables:
#...
a -> [0-9a-f]*: struct A \(.*
#...
Types:
#...
[0-9a-f]*: struct A \(.*

View File

@ -11,21 +11,21 @@ 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\)
Data object section: 0x0 -- 0x3 \(0x4 bytes\)
Type section: 0x4 -- 0x33 \(0x30 bytes\)
String section: .*
Labels:
Data objects:
a -> struct A
#...
Function objects:
Variables:
#...
a -> [0-9a-f]*: struct A \(.*
#...
Types:
#...
[0-9a-f]*: struct A \(.*

View File

@ -12,6 +12,7 @@ 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: .*

View File

@ -11,10 +11,14 @@ 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\)
Compilation unit name: .*function.c
Function info section: .* \(0x4 bytes\)
Type section: .* \(0x90 bytes\)
String section: .*
#...
Function objects:
foo -> int \(\*\) \(char, int, float, void \*, void \(\*\)\(\*\) \(int\)\)
#...
Types:
#...

View File

@ -11,14 +11,16 @@ 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\)
#...
Data object section: .* \(0x4 bytes\)
Type section: .* \(0x9c bytes\)
String section: .*
#...
Variables:
slices -> [0-9a-f]*: struct slices \(size 0x4\)
Data objects:
slices -> struct slices
#...
Types:
#...
[0-9a-f]*: struct slices \(size 0x[0-9a-f]*\)

View File

@ -11,6 +11,7 @@ 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\)