From: Mark Harmstone Date: Sat, 13 Jul 2024 14:36:34 +0000 (+0100) Subject: ld/PDB: use correct hashing algorithm in add_globals_ref X-Git-Tag: gdb-16-branchpoint~1350 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11c9c34be6c361622ddef854257cf3885c2df963;p=thirdparty%2Fbinutils-gdb.git ld/PDB: use correct hashing algorithm in add_globals_ref add_globals_ref was hashing using CRC32 rather than the hashing algorithm used for symbols, which meant that windbg was unable to put breakpoints against unmangled names. --- diff --git a/ld/pdb.c b/ld/pdb.c index 88639d539b7..7a08ae35e79 100644 --- a/ld/pdb.c +++ b/ld/pdb.c @@ -872,7 +872,7 @@ add_globals_ref (struct globals *glob, bfd *sym_rec_stream, const char *name, *slot = xmalloc (offsetof (struct global, data) + len); - hash = crc32 ((const uint8_t *) name, name_len); + hash = calc_hash (name, name_len); hash %= NUM_GLOBALS_HASH_BUCKETS; g = *slot; diff --git a/ld/testsuite/ld-pe/pdb-syms1-globals.d b/ld/testsuite/ld-pe/pdb-syms1-globals.d index 356c5de22a3..450f3a2326c 100644 --- a/ld/testsuite/ld-pe/pdb-syms1-globals.d +++ b/ld/testsuite/ld-pe/pdb-syms1-globals.d @@ -2,20 +2,20 @@ *: file format binary Contents of section .data: - 0000 ffffffff 1a092ff1 d0000000 64020000 ....../.....d... - 0010 fd000000 01000000 35010000 01000000 ........5....... - 0020 15000000 01000000 19010000 01000000 ................ - 0030 c1000000 01000000 b9010000 01000000 ................ - 0040 d5000000 01000000 61010000 01000000 ........a....... - 0050 e9000000 01000000 11020000 01000000 ................ - 0060 e9010000 01000000 d5010000 01000000 ................ - 0070 49010000 01000000 a5010000 01000000 I............... - 0080 99010000 01000000 85000000 01000000 ................ - 0090 01000000 01000000 99000000 01000000 ................ - 00a0 7d010000 01000000 ad000000 01000000 }............... - 00b0 5d000000 01000000 49000000 01000000 ].......I....... - 00c0 21000000 02000000 35000000 01000000 !.......5....... - 00d0 fd010000 01000000 71000000 01000000 ........q....... + 0000 ffffffff 1a092ff1 d0000000 60020000 ....../.....`... + 0010 15000000 01000000 b9010000 01000000 ................ + 0020 a5010000 01000000 fd000000 01000000 ................ + 0030 11020000 01000000 71000000 01000000 ........q....... + 0040 fd010000 01000000 5d000000 01000000 ........]....... + 0050 d5010000 01000000 e9010000 01000000 ................ + 0060 21000000 02000000 35000000 01000000 !.......5....... + 0070 49000000 01000000 7d010000 01000000 I.......}....... + 0080 99010000 01000000 19010000 01000000 ................ + 0090 35010000 01000000 d5000000 01000000 5............... + 00a0 c1000000 01000000 e9000000 01000000 ................ + 00b0 85000000 01000000 ad000000 01000000 ................ + 00c0 49010000 01000000 01000000 01000000 I............... + 00d0 99000000 01000000 61010000 01000000 ........a....... 00e0 00000000 00000000 00000000 00000000 ................ 00f0 00000000 00000000 00000000 00000000 ................ 0100 00000000 00000000 00000000 00000000 ................ @@ -23,35 +23,34 @@ Contents of section .data: 0120 00000000 00000000 00000000 00000000 ................ 0130 00000000 00000000 00000000 00000000 ................ 0140 00000000 00000000 00000000 00000000 ................ - 0150 00000002 00000000 00000000 00000000 ................ + 0150 00000000 00000000 00000000 00000000 ................ 0160 00000000 00000000 00000000 00000000 ................ - 0170 00000000 00020000 00000000 00000000 ................ - 0180 00000000 00000000 00000000 00000000 ................ - 0190 00000000 00000001 00000000 00000000 ................ - 01a0 00000000 00000000 00000000 00000000 ................ + 0170 00000000 00000000 00000000 00000000 ................ + 0180 00000001 00100040 00000000 00000000 .......@........ + 0190 00000000 00000000 00000000 00000000 ................ + 01a0 00000004 00000000 00000000 00000000 ................ 01b0 00000000 00000000 00000000 00000000 ................ 01c0 00000000 00000000 00000000 00000000 ................ 01d0 00000000 00000000 00000000 00000000 ................ - 01e0 08001000 00000000 00000000 00000040 ...............@ - 01f0 04002000 00000000 00000000 00000000 .. ............. - 0200 00000000 00000001 00000000 00000000 ................ + 01e0 00000000 0000b499 00000000 00000000 ................ + 01f0 00000000 00000000 00000000 00000000 ................ + 0200 00000000 00000000 00000000 00000000 ................ 0210 00000000 00000000 00000000 00000000 ................ 0220 00000000 00000000 00000000 00000000 ................ - 0230 00000000 00000000 00080000 00004000 ..............@. - 0240 00000000 00000000 00100010 00000000 ................ - 0250 40000000 00000000 00000000 00000000 @............... - 0260 00000000 00000800 00000000 00000000 ................ - 0270 00000008 00000000 00000000 00000000 ................ - 0280 00000000 02004000 00000000 00000000 ......@......... - 0290 00000000 00008000 00000000 00000000 ................ - 02a0 00000000 00000000 10000000 00000000 ................ - 02b0 00000000 00000000 00000000 00800000 ................ - 02c0 00000000 00000000 00002000 00010000 .......... ..... - 02d0 00000000 00000000 00000000 00000040 ...............@ + 0230 00000001 00000000 00000000 00000000 ................ + 0240 01000000 00000000 00000000 00000000 ................ + 0250 00000000 00000000 00000000 00000000 ................ + 0260 00000000 00000000 00000000 00000000 ................ + 0270 00000001 00000000 00000000 10db0000 ................ + 0280 00000000 00000000 00000000 00000000 ................ + 0290 00000001 00000000 00000000 00000000 ................ + 02a0 00000000 00000000 00000000 00000000 ................ + 02b0 00000000 00000000 00000000 00000000 ................ + 02c0 00000000 00000000 00000000 00000000 ................ + 02d0 00000000 00000000 00000000 00000000 ................ 02e0 00000000 00000000 0c000000 18000000 ................ 02f0 24000000 30000000 3c000000 48000000 $...0...<...H... 0300 54000000 60000000 6c000000 78000000 T...`...l...x... - 0310 84000000 90000000 9c000000 a8000000 ................ - 0320 b4000000 c0000000 d8000000 e4000000 ................ - 0330 f0000000 fc000000 08010000 20010000 ............ ... - 0340 2c010000 ,... \ No newline at end of file + 0310 90000000 9c000000 a8000000 b4000000 ................ + 0320 c0000000 cc000000 d8000000 e4000000 ................ + 0330 f0000000 fc000000 14010000 2c010000 ............,... \ No newline at end of file