mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 22:08:41 +00:00
update weak vs undefined replacement rule
This commit is contained in:
committed by
Ryan Fleury
parent
d7cdaa98b5
commit
e1b7168605
@@ -1521,6 +1521,9 @@ lnk_build_link_context(TP_Context *tp, TP_Arena *tp_arena, LNK_Config *config)
|
|||||||
if (symbol_ht) {
|
if (symbol_ht) {
|
||||||
COFF_SymbolValueInterpType interp = lnk_interp_from_symbol(symbol_ht->symbol);
|
COFF_SymbolValueInterpType interp = lnk_interp_from_symbol(symbol_ht->symbol);
|
||||||
if (interp == COFF_SymbolValueInterp_Undefined) {
|
if (interp == COFF_SymbolValueInterp_Undefined) {
|
||||||
|
// clear out slot so weak symbol can replace undefined symbol
|
||||||
|
symbol_ht->symbol = 0;
|
||||||
|
|
||||||
// make obj with alternamte name symbol
|
// make obj with alternamte name symbol
|
||||||
String8 alt_name_obj;
|
String8 alt_name_obj;
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -141,7 +141,11 @@ lnk_can_replace_symbol(LNK_Symbol *dst, LNK_Symbol *src)
|
|||||||
|
|
||||||
COFF_SymbolWeakExt *weak_ext = coff_parse_weak_tag(weak_parsed, weak->defined.obj->header.is_big_obj);
|
COFF_SymbolWeakExt *weak_ext = coff_parse_weak_tag(weak_parsed, weak->defined.obj->header.is_big_obj);
|
||||||
if (weak_ext->characteristics == COFF_WeakExt_SearchLibrary) {
|
if (weak_ext->characteristics == COFF_WeakExt_SearchLibrary) {
|
||||||
can_replace = lnk_symbol_defined_is_before(dst, src);
|
// NOTE: MSVC does not let a weak symbol to replace an undefined one,
|
||||||
|
// but LLD links without errors or warnings, meaning undefined symbols
|
||||||
|
// are resolved to the weak, which can potentially change behaviour of
|
||||||
|
// the linked image
|
||||||
|
can_replace = dst_interp == COFF_SymbolValueInterp_Weak;
|
||||||
} else if (weak_ext->characteristics == COFF_WeakExt_NoLibrary) {
|
} else if (weak_ext->characteristics == COFF_WeakExt_NoLibrary) {
|
||||||
can_replace = dst_interp == COFF_SymbolValueInterp_Weak;
|
can_replace = dst_interp == COFF_SymbolValueInterp_Weak;
|
||||||
} else if (weak_ext->characteristics == COFF_WeakExt_SearchAlias) {
|
} else if (weak_ext->characteristics == COFF_WeakExt_SearchAlias) {
|
||||||
|
|||||||
Reference in New Issue
Block a user