Skip to content
Commit 7c74ce3c authored by Fangrui Song's avatar Fangrui Song
Browse files

[ELF] --wrap: don't clear sym->isUsedInRegularObj if real->isUsedInRegularObj;...

[ELF] --wrap: don't clear sym->isUsedInRegularObj if real->isUsedInRegularObj; set wrap's initial binding to sym's

Fix PR49897: if `__real_foo` has the isUsedInRegularObj bit set, we need to
retain `foo` in .symtab, even if `foo` is undefined. The new behavior will match
GNU ld.

Before the patch, we produced an R_X86_64_JUMP_SLOT relocation referencing the
index 0 undefined symbol, which would be erroed by glibc
(see f96ff3c0).

While here, fix another bug: if `__wrap_foo` does not exist, its initial binding
should be `foo`'s.
parent d6de1e1a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment