aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorMark Harmstone <mark@harmstone.com>2022-11-11 03:30:40 +0000
committerMark Harmstone <mark@harmstone.com>2022-11-23 01:13:35 +0000
commite2a1b0a0d1bf0e9282e4902b2a2b2e75400104b4 (patch)
tree36840a4f7b24b27762344fe244a341b2c49b8453 /ld/testsuite
parentc392c0e0ae1b654c3fafc42e2a9ed7cbfcee0769 (diff)
downloadbinutils-e2a1b0a0d1bf0e9282e4902b2a2b2e75400104b4.zip
binutils-e2a1b0a0d1bf0e9282e4902b2a2b2e75400104b4.tar.gz
binutils-e2a1b0a0d1bf0e9282e4902b2a2b2e75400104b4.tar.bz2
ld: Add section contributions substream to PDB files
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-pe/pdb.exp29
-rw-r--r--ld/testsuite/ld-pe/pdb2-section-contrib.d12
-rw-r--r--ld/testsuite/ld-pe/pdb2a.s9
-rw-r--r--ld/testsuite/ld-pe/pdb2b.s3
4 files changed, 51 insertions, 2 deletions
diff --git a/ld/testsuite/ld-pe/pdb.exp b/ld/testsuite/ld-pe/pdb.exp
index ab22506..0be65e2 100644
--- a/ld/testsuite/ld-pe/pdb.exp
+++ b/ld/testsuite/ld-pe/pdb.exp
@@ -626,6 +626,26 @@ proc test_mod_info { mod_info } {
}
}
+proc test_section_contrib { section_contrib } {
+ global objdump
+ global srcdir
+ global subdir
+
+ set fi [open tmpdir/pdb2-sc w]
+ fconfigure $fi -translation binary
+ puts -nonewline $fi $section_contrib
+ close $fi
+
+ set exp [file_contents "$srcdir/$subdir/pdb2-section-contrib.d"]
+ set got [run_host_cmd "$objdump" "-s --target=binary tmpdir/pdb2-sc"]
+
+ if [string equal $exp $got] {
+ pass "Correct section contribution substream"
+ } else {
+ fail "Incorrect section contribution substream"
+ }
+}
+
proc test2 { } {
global as
global ar
@@ -650,7 +670,7 @@ proc test2 { } {
return
}
- if ![ld_link $ld "tmpdir/pdb2.exe" "--pdb=tmpdir/pdb2.pdb -e foo tmpdir/pdb2a.o tmpdir/pdb2b.a"] {
+ if ![ld_link $ld "tmpdir/pdb2.exe" "--pdb=tmpdir/pdb2.pdb --gc-sections -e foo tmpdir/pdb2a.o tmpdir/pdb2b.a"] {
unsupported "Create PE image with PDB file"
return
}
@@ -669,13 +689,18 @@ proc test2 { } {
set data [read $fi 4]
binary scan $data i mod_info_size
- seek $fi 36 current
+ set data [read $fi 4]
+ binary scan $data i section_contrib_size
+
+ seek $fi 32 current
set mod_info [read $fi $mod_info_size]
+ set section_contrib [read $fi $section_contrib_size]
close $fi
test_mod_info $mod_info
+ test_section_contrib $section_contrib
}
test1
diff --git a/ld/testsuite/ld-pe/pdb2-section-contrib.d b/ld/testsuite/ld-pe/pdb2-section-contrib.d
new file mode 100644
index 0000000..3afeb14
--- /dev/null
+++ b/ld/testsuite/ld-pe/pdb2-section-contrib.d
@@ -0,0 +1,12 @@
+
+tmpdir/pdb2-sc: file format binary
+
+Contents of section .data:
+ 0000 2dba2ef1 01000000 00000000 10000000 -...............
+ 0010 20000060 00000000 00000000 00000000 ..`............
+ 0020 02000000 00000000 44000000 40000040 ........D...@..@
+ 0030 00000000 00000000 00000000 01000000 ................
+ 0040 10000000 10000000 20000060 01000000 ........ ..`....
+ 0050 00000000 00000000 04000000 00000000 ................
+ 0060 0c000000 40000042 02000000 00000000 ....@..B........
+ 0070 00000000 .... \ No newline at end of file
diff --git a/ld/testsuite/ld-pe/pdb2a.s b/ld/testsuite/ld-pe/pdb2a.s
index 414edeb..beeea8b 100644
--- a/ld/testsuite/ld-pe/pdb2a.s
+++ b/ld/testsuite/ld-pe/pdb2a.s
@@ -3,3 +3,12 @@
.global foo
foo:
.secrel32 bar
+ .long 0
+ .long 0
+ .long 0
+
+.section "gcsect"
+
+.global baz
+baz:
+ .long 0x12345678
diff --git a/ld/testsuite/ld-pe/pdb2b.s b/ld/testsuite/ld-pe/pdb2b.s
index 6401023..3a63386 100644
--- a/ld/testsuite/ld-pe/pdb2b.s
+++ b/ld/testsuite/ld-pe/pdb2b.s
@@ -3,3 +3,6 @@
.global bar
bar:
.long 0x12345678
+ .long 0
+ .long 0
+ .long 0