aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-pe
diff options
context:
space:
mode:
authorMark Harmstone <mark@harmstone.com>2024-07-29 22:19:36 +0100
committerMark Harmstone <mark@harmstone.com>2024-08-01 01:33:34 +0100
commite859b93a8cfbe506f8cce1398dd585bab07499fe (patch)
treeb9204330e83f1b92f918d18c2e0fa80f544fcb17 /ld/testsuite/ld-pe
parentc2e15bf51978bb020c2e4e142f60896a29e05617 (diff)
downloadgdb-e859b93a8cfbe506f8cce1398dd585bab07499fe.zip
gdb-e859b93a8cfbe506f8cce1398dd585bab07499fe.tar.gz
gdb-e859b93a8cfbe506f8cce1398dd585bab07499fe.tar.bz2
ld/PDB: handle empty LF_FIELDLIST types
Empty structs in C++ lead to empty LF_FIELDLIST types in the .debug$T section, but we were mistakenly rejecting these as invalid. Allow CodeView types of two bytes, and add a test for this.
Diffstat (limited to 'ld/testsuite/ld-pe')
-rw-r--r--ld/testsuite/ld-pe/pdb-types1-typelist.d5
-rw-r--r--ld/testsuite/ld-pe/pdb-types1b.s20
-rw-r--r--ld/testsuite/ld-pe/pdb.exp2
3 files changed, 24 insertions, 3 deletions
diff --git a/ld/testsuite/ld-pe/pdb-types1-typelist.d b/ld/testsuite/ld-pe/pdb-types1-typelist.d
index db08b52..1caa074 100644
--- a/ld/testsuite/ld-pe/pdb-types1-typelist.d
+++ b/ld/testsuite/ld-pe/pdb-types1-typelist.d
@@ -77,4 +77,7 @@ Contents of section .data:
0480 3a001d15 2a100000 00000000 00000000 :...*...........
0490 27000000 49556e6b 6e6f776e 00517565 '...IUnknown.Que
04a0 7279496e 74657266 61636500 41646452 ryInterface.AddR
- 04b0 65660052 656c6561 736500f1 ef.Release..
+ 04b0 65660052 656c6561 736500f1 02000312 ef.Release......
+ 04c0 22000515 00000000 2c100000 00000000 ".......,.......
+ 04d0 00000000 0100656d 7074795f 73747275 ......empty_stru
+ 04e0 637400f1 ct..
diff --git a/ld/testsuite/ld-pe/pdb-types1b.s b/ld/testsuite/ld-pe/pdb-types1b.s
index e26b190..8bfc973 100644
--- a/ld/testsuite/ld-pe/pdb-types1b.s
+++ b/ld/testsuite/ld-pe/pdb-types1b.s
@@ -593,7 +593,7 @@
/* Type 102a, virtual function table */
.vftable1:
-.short .types_end - .vftable1 - 2
+.short .fieldlist12 - .vftable1 - 2
.short LF_VFTABLE
.long 0x1029 /* type */
.long 0 /* base vftable */
@@ -607,4 +607,22 @@
.vftable1_names_end:
.byte 0xf1 /* padding */
+/* Type 102b, empty LF_FIELDLIST */
+.fieldlist12:
+.short .struct7 - .fieldlist12 - 2
+.short LF_FIELDLIST
+
+/* Type 102c, empty struct */
+.struct7:
+.short .types_end - .struct7 - 2
+.short LF_STRUCTURE
+.short 0 /* no. members */
+.short 0 /* property */
+.long 0x102b /* field list */
+.long 0 /* type derived from */
+.long 0 /* type of vshape table */
+.short 1 /* size */
+.asciz "empty_struct" /* name */
+.byte 0xf1 /* padding */
+
.types_end:
diff --git a/ld/testsuite/ld-pe/pdb.exp b/ld/testsuite/ld-pe/pdb.exp
index 1247651..b583e87 100644
--- a/ld/testsuite/ld-pe/pdb.exp
+++ b/ld/testsuite/ld-pe/pdb.exp
@@ -1036,7 +1036,7 @@ proc test5 { } {
binary scan $data i end_type
# end_type is one greater than the last type in the stream
- if { $end_type != 0x102c } {
+ if { $end_type != 0x102e } {
fail "Incorrect end type value in TPI stream."
} else {
pass "Correct end type value in TPI stream."