[llvm-bugs] [Bug 49897] Missing dyn symbol for a weak wrapped function when using --wrap

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Apr 17 00:41:10 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49897

Fangrui Song <i at maskray.me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
                 CC|                            |i at maskray.me
           Assignee|unassignedbugs at nondot.org   |i at maskray.me

--- Comment #1 from Fangrui Song <i at maskray.me> ---
I'll consider this a bug because ld.lld produced an R_X86_64_JUMP_SLOT
relocation referencing the index 0 undefined symbol, which would be errored by
glibc (see commit 7c74ce3c686938e95a08a05ea1e2a714eac43167).

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

I fixed another bug: if `__wrap_foo` does not exist, its initial binding should
be `foo`'s.

I can still observe a difference with GNU ld which probably does not matter in
practice: if foo does not exist, --wrap=foo is a no-op in ld.lld. However, GNU
ld can still redirect __real_foo to foo.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210417/85510187/attachment.html>


More information about the llvm-bugs mailing list