https://sourceware.org/bugzilla/show_bug.cgi?id=22628
Bug ID: 22628 Summary: gold ignores version of --wrap symbols Product: binutils Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: gold Assignee: ccoutant at gmail dot com Reporter: benjamin at benjamin dot pe CC: ian at airs dot com Target Milestone: --- gold drops symbol version information from symbols being wrapped with the --wraps command line option. (A comment source code says this is for the convenience of wrappers.) Unfortunately, that breaks excessively clever code like this: [wrapper.c] #include <string.h> __asm__(".symver memcpy,memcpy@GLIBC_2.2.5"); void* __wrap_memcpy(void* dest, const void* src, size_t n) { return memcpy(dest, src, n); } In the hands of gold, __wrap_memcpy() is linked into an infinite loop: $ gcc -O3 -fuse-ld=gold -shared -o wrapped.so wrapper.c -Wl,--wrap=memcpy $ objdump -d wrapped.so | grep -A1 __wrap_memcpy\> 0000000000000670 <__wrap_memcpy>: 670: e9 0b ff ff ff jmpq 580 <__wrap_memcpy@plt> whereas ld.bfd resolves the memcpy call to memcpy@GLIBC_2.2.5 as the code intends: $ gcc -O3 -fuse-ld=bfd -shared -o wrapped.so wrapper.c -Wl,--wrap=memcpy $ objdump -d wrapped.so | grep -A1 __wrap_memcpy\> 0000000000000610 <__wrap_memcpy>: 610: e9 fb fe ff ff jmpq 510 <memcpy@plt> -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils