diff --git a/ld/pdb.c b/ld/pdb.c
index 9988fd94f51..36b600e34bd 100644
--- a/ld/pdb.c
+++ b/ld/pdb.c
@@ -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;
 }
 
