mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-07 14:28:40 +00:00
update link symbol set logic to replace import address symbols with jump
thunk symbols
This commit is contained in:
committed by
Ryan Fleury
parent
c7c86cd360
commit
c47b35f635
+11
-2
@@ -228,13 +228,22 @@ lnk_lib_set_link_symbol(LNK_Lib *lib, U32 member_idx, LNK_Symbol *link_symbol)
|
|||||||
{
|
{
|
||||||
local_persist LNK_Symbol null_symbol;
|
local_persist LNK_Symbol null_symbol;
|
||||||
|
|
||||||
|
B32 is_first_set;
|
||||||
|
|
||||||
LNK_Symbol *slot = ins_atomic_ptr_eval_assign(&lib->was_member_linked[member_idx], &null_symbol);
|
LNK_Symbol *slot = ins_atomic_ptr_eval_assign(&lib->was_member_linked[member_idx], &null_symbol);
|
||||||
B32 is_first_set = (slot == 0);
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
is_first_set = (slot == 0);
|
||||||
|
|
||||||
// update slot symbol if it is empty or link symbol comes before symbol in the slot
|
// update slot symbol if it is empty or link symbol comes before symbol in the slot
|
||||||
if (slot && slot != &null_symbol) {
|
if (slot && slot != &null_symbol) {
|
||||||
if (lnk_symbol_is_before(slot, link_symbol)) {
|
if (!str8_starts_with(link_symbol->name, str8_lit("__imp_")) && str8_starts_with(slot->name, str8_lit("__imp_"))) {
|
||||||
|
// replace import address symbol with jump thunk symbol
|
||||||
|
slot = link_symbol;
|
||||||
|
is_first_set = 1;
|
||||||
|
} else if (str8_starts_with(link_symbol->name, str8_lit("__imp_")) && !str8_starts_with(slot->name, str8_lit("__imp_"))) {
|
||||||
|
// no need to replace
|
||||||
|
} else if (lnk_symbol_is_before(slot, link_symbol)) {
|
||||||
slot = link_symbol;
|
slot = link_symbol;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user