Skip to content

Commit ede903e

Browse files
committed
One day i'll propertly implement this
1 parent 0245583 commit ede903e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Source/Relocs.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ static u32 ctrdl_resolveSymbol(const RelContext* ctx, Elf32_Word index, bool* is
3434
u32 symBase = 0;
3535
const Elf32_Sym* symEntry = &ctx->elf->symEntries[index];
3636
const char* name = &ctx->elf->stringTable[symEntry->st_name];
37-
*isWeak = ELF32_ST_BIND(symEntry->st_info) == STB_WEAK;
37+
const bool weak = ELF32_ST_BIND(symEntry->st_info) == STB_WEAK;
38+
*isWeak = weak;
3839

3940
// If we were given a resolver, use it first.
4041
if (ctx->resolver) {
@@ -73,7 +74,9 @@ static u32 ctrdl_resolveSymbol(const RelContext* ctx, Elf32_Word index, bool* is
7374

7475
while (chainIndex != STN_UNDEF) {
7576
const Elf32_Sym* candidate = &ctx->elf->symEntries[chainIndex];
76-
if (candidate != symEntry && !strcmp(&ctx->elf->stringTable[candidate->st_name], name)) {
77+
const bool skipSelf = candidate == symEntry && weak;
78+
79+
if (!skipSelf && !strcmp(&ctx->elf->stringTable[candidate->st_name], name)) {
7780
sym = candidate;
7881
symBase = ctx->handle->base;
7982
break;

0 commit comments

Comments
 (0)