sort global symbols deterministically within GSI bucket

This commit is contained in:
Nikita Smith
2026-04-11 13:42:30 -07:00
parent 1839187a3c
commit 0299b6922f
2 changed files with 6 additions and 1 deletions
+1
View File
@@ -1839,6 +1839,7 @@ THREAD_POOL_TASK_FUNC(lnk_move_global_symbols_to_gsi)
CV_SymbolNode *n = &nodes[i]; CV_SymbolNode *n = &nodes[i];
n->prev = n->next = 0; n->prev = n->next = 0;
n->data = cv_symbol_from_ptr(symbol_arr[i]); n->data = cv_symbol_from_ptr(symbol_arr[i]);
n->data.offset = i;
gsi_push_(gsi, symbol_hashes[i], n); gsi_push_(gsi, symbol_hashes[i], n);
} }
} }
+5 -1
View File
@@ -1827,7 +1827,11 @@ gsi_symbol_is_before(void *raw_a, void *raw_b)
if (a_name.size != b_name.size) { if (a_name.size != b_name.size) {
is_before = a_name.size < b_name.size; is_before = a_name.size < b_name.size;
} else { } else {
is_before = str8_compar_ignore_case(&a_name, &b_name) < 0; int cmp = str8_compar_ignore_case(&a_name, &b_name);
if (cmp == 0) {
cmp = u64_compar(&a->offset, &b->offset);
}
is_before = cmp < 0;
} }
return is_before; return is_before;