llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

--wrap with a wrapper function from a DSO fails

Open nga888 opened this issue 6 years ago • 3 comments

Bugzilla Link 47017
Resolution FIXED
Resolved on Aug 10, 2020 02:31
Version unspecified
OS All
Attachments Test to reproduce issue.
CC @MaskRay,@smithp35

Extended Description

Since the commit "[ELF] --wrap: set isUsedInRegularObj of _wrap only if it is defined" (https://github.com/llvm/llvm-project/commit/e281376e996e37fb6411363510e917b5b2c53c89), which fixed llvm/llvm-project#45514 , --wrap with a wrapper function from a DSO no longer works.

I have attached the test 'wrap-shared.s' to reproduce the issue.

nga888 avatar Aug 06 '20 15:08 nga888

Thanks for fixing this.

nga888 avatar Aug 10 '20 09:08 nga888

I noticed another problem: in the new test in wrap-shlib-undefined.s, GNU ld does not add an undefined bar in .dynsym

Fixed by 0334578edc60ad8a7455e7b76e41901376245b56


I spent more time studying --wrap. We still have behavior differences with GNU ld and gold, but I think our approach is superior. Filed https://sourceware.org/bugzilla/show_bug.cgi?id=26358 --wrap: the special rule for "undefined symbol" is incompatible with -flto or relocatable links

MaskRay avatar Aug 09 '20 01:08 MaskRay

Thanks, fixed by 99cd56906a4dd00db25b045eccddcb6802d39f8d [ELF] --wrap: set isUsedInRegularObj of _wrap if it is defined or shared

I noticed another problem: in the new test in wrap-shlib-undefined.s, GNU ld does not add an undefined bar in .dynsym

MaskRay avatar Aug 08 '20 16:08 MaskRay