diff options
author | Mark Harmstone <mark@harmstone.com> | 2022-10-17 00:24:18 +0100 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-10-20 15:22:37 +1030 |
commit | f6f30f347bb97898a74e59a841982170e42bb265 (patch) | |
tree | 966ab495055389361fb61cc34836818bc7890bc1 /ld/testsuite/ld-pe | |
parent | 97df7412a183b73a1bfaeed55a4d951c2aede7d4 (diff) | |
download | gdb-f6f30f347bb97898a74e59a841982170e42bb265.zip gdb-f6f30f347bb97898a74e59a841982170e42bb265.tar.gz gdb-f6f30f347bb97898a74e59a841982170e42bb265.tar.bz2 |
ld: Add --pdb option
Second patch incorporates fixes for endian and UB issues in calc_hash, as per
https://sourceware.org/pipermail/binutils/2022-October/123514.html.
Diffstat (limited to 'ld/testsuite/ld-pe')
-rw-r--r-- | ld/testsuite/ld-pe/pdb.exp | 53 | ||||
-rw-r--r-- | ld/testsuite/ld-pe/pdb1.s | 5 |
2 files changed, 58 insertions, 0 deletions
diff --git a/ld/testsuite/ld-pe/pdb.exp b/ld/testsuite/ld-pe/pdb.exp new file mode 100644 index 0000000..1560241 --- /dev/null +++ b/ld/testsuite/ld-pe/pdb.exp @@ -0,0 +1,53 @@ +# Expect script for creating PDB files when linking. +# Copyright (C) 2022 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. + +if {![istarget i*86-*-mingw*] + && ![istarget x86_64-*-mingw*]} { + return +} + +proc get_pdb_name { pe } { + global OBJDUMP + + set exec_output [run_host_cmd "$OBJDUMP" "-p $pe"] + + if ![regexp -line "^\\(format RSDS signature (\[0-9a-fA-F\]{32}) age 1 pdb (.*)\\)$" $exec_output full sig pdb] { + return "" + } + + return $pdb +} + +if ![ld_assemble $as $srcdir/$subdir/pdb1.s tmpdir/pdb1.o] { + unsupported "Build pdb1.o" + return +} + +if ![ld_link $ld "tmpdir/pdb1.exe" "--pdb=tmpdir/pdb1.pdb tmpdir/pdb1.o"] { + fail "Could not create a PE image with a PDB file" + return +} + +if ![string equal [get_pdb_name "tmpdir/pdb1.exe"] "pdb1.pdb"] { + fail "PDB filename not found in CodeView debug info" + return +} + +pass "PDB filename present in CodeView debug info" diff --git a/ld/testsuite/ld-pe/pdb1.s b/ld/testsuite/ld-pe/pdb1.s new file mode 100644 index 0000000..30a8cfc --- /dev/null +++ b/ld/testsuite/ld-pe/pdb1.s @@ -0,0 +1,5 @@ +.text + +.global foo +foo: + .long 0x12345678 |