[binutils-gdb] ld/pdb: Read inlinee-lines signature at correct offset

Jan Beulich jbeulich@sourceware.org
Fri Nov 6 07:18:56 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aff26e1d6724c890aa27cde74c983f931069de21

commit aff26e1d6724c890aa27cde74c983f931069de21
Author: Oleg Tolmatcev <oleg.tolmatcev@gmail.com>
Date:   Fri Nov 6 08:17:02 2026 +0100

    ld/pdb: Read inlinee-lines signature at correct offset
    
    parse_inlinee_lines receives a pointer to the subsection payload, so
    read its signature from the start rather than from the first entry file
    ID.
    
    Give the first test entry a nonzero file ID so the incorrect read is
    observable, and report the resulting link failure as a test failure.
    
    ld/
            * pdb.c (parse_inlinee_lines): Read the signature at the start of the
            payload.
            * testsuite/ld-pe/pdb-inlineelines1b.s: Give the first inlinee a
            nonzero file ID.
            * testsuite/ld-pe/pdb-inlineelines1-c13-info2.d: Update expected
            output.
            * testsuite/ld-pe/pdb.exp (test10): Update expected file ID and treat
            a linker failure as a test failure.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32942

Diff:
---
 ld/pdb.c                                         | 2 +-
 ld/testsuite/ld-pe/pdb-inlineelines1-c13-info2.d | 2 +-
 ld/testsuite/ld-pe/pdb-inlineelines1b.s          | 4 ++--
 ld/testsuite/ld-pe/pdb.exp                       | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ld/pdb.c b/ld/pdb.c
index 5b39d3c11e0..19799929c3a 100644
--- a/ld/pdb.c
+++ b/ld/pdb.c
@@ -1879,7 +1879,7 @@ parse_inlinee_lines (uint8_t *data, uint32_t size, uint8_t **bufptr,
       return false;
     }
 
-  version = bfd_getl32 (data + sizeof (uint32_t) + sizeof (uint32_t));
+  version = bfd_getl32 (data);
   if (version != CV_INLINEE_SOURCE_LINE_SIGNATURE)
     {
       einfo (_("%P: warning: unexpected DEBUG_S_INLINEELINES version %u\n"),
diff --git a/ld/testsuite/ld-pe/pdb-inlineelines1-c13-info2.d b/ld/testsuite/ld-pe/pdb-inlineelines1-c13-info2.d
index ac4e49bbe46..662ecb26669 100644
--- a/ld/testsuite/ld-pe/pdb-inlineelines1-c13-info2.d
+++ b/ld/testsuite/ld-pe/pdb-inlineelines1-c13-info2.d
@@ -6,5 +6,5 @@ Contents of section .data:
  0010 2301efcd ab8998ba dcfe1023 45670000  #..........#Eg..
  0020 08000000 100198ba dcfe1023 45676745  ...........#EggE
  0030 2301efcd ab890000 f6000000 1c000000  #...............
- 0040 00000000 02100000 00000000 2a000000  ............*...
+ 0040 00000000 02100000 18000000 2a000000  ............*...
  0050 03100000 18000000 1c000000           ............    
diff --git a/ld/testsuite/ld-pe/pdb-inlineelines1b.s b/ld/testsuite/ld-pe/pdb-inlineelines1b.s
index d8d917068f3..23340280d78 100644
--- a/ld/testsuite/ld-pe/pdb-inlineelines1b.s
+++ b/ld/testsuite/ld-pe/pdb-inlineelines1b.s
@@ -138,7 +138,7 @@
   *** INLINEE LINES
 
   InlineeId  FileId  StaringLine
-       1003       0           42
+       1003      18           42
        1004      18           28
 */
 
@@ -150,7 +150,7 @@
 .long CV_INLINEE_SOURCE_LINE_SIGNATURE
 
 .long 0x1003
-.long .file1 - .chksms_start
+.long .file2 - .chksms_start
 .long 42
 
 .long 0x1004
diff --git a/ld/testsuite/ld-pe/pdb.exp b/ld/testsuite/ld-pe/pdb.exp
index 49a16454c67..48b0f517ec7 100644
--- a/ld/testsuite/ld-pe/pdb.exp
+++ b/ld/testsuite/ld-pe/pdb.exp
@@ -1763,7 +1763,7 @@ proc test10 { } {
     }
 
     if ![ld_link $ld "tmpdir/pdb-inlineelines1.exe" "--pdb=tmpdir/pdb-inlineelines1.pdb tmpdir/pdb-inlineelines1a.o tmpdir/pdb-inlineelines1b.o"] {
-	unsupported "Create PE image with PDB file"
+	fail "Create PE image with PDB file"
 	return
     }
 
@@ -1805,7 +1805,7 @@ proc test10 { } {
     # *** INLINEE LINES
     #
     # InlineeId  FileId  StaringLine
-    #      1002       0           42
+    #      1002       1           42
     #      1003       1           28
 
     # For some reason it numbers file IDs in bytes for object files but as an


More information about the Binutils-cvs mailing list