ld/pdb: Make globals hash ordering deterministic
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
Commit Message
global_compare_hash treated entries with colliding hashes as equal,
leaving their relative order to the host qsort implementation. Sort
collisions by symbol-record offset so PDB output is reproducible across
hosts.
ld/
* pdb.c (global_compare_hash): Compare offsets when hashes are equal.
---
ld/pdb.c | 5 +++++
1 file changed, 5 insertions(+)
@@ -4473,6 +4473,11 @@ global_compare_hash (const void *s1, const void *s2)
if (g1->hash > g2->hash)
return 1;
+ if (g1->offset < g2->offset)
+ return -1;
+ if (g1->offset > g2->offset)
+ return 1;
+
return 0;
}