[llvm-bugs] [Bug 33635] New: --wrap foo produces dynamic reloc against __real_foo instead of foo
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jun 28 14:59:05 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=33635
Bug ID: 33635
Summary: --wrap foo produces dynamic reloc against __real_foo
instead of foo
Product: lld
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: roland at hack.frob.com
CC: llvm-bugs at lists.llvm.org
r306566
frobland 1119 % head foo.c
#include <unistd.h>
ssize_t __wrap_write(int fd, void *buf, size_t len) {
return __real_write(fd, buf+1, len-1);
}
int main(void) {
write(1, "hello world\n", 12);
return 0;
}
frobland 1120 % gcc -c foo.c
frobland 1121 % gcc -o foo.good foo.o -Wl,--wrap,write
frobland 1122 % hack/bin/ld.lld --sysroot=/ --build-id --eh-frame-hdr
-m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -z relro -o foo.lld --wrap write
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o
-L/usr/lib/gcc/x86_64-linux-gnu/4.8
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/x86_64-linux-gnu
-L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. foo.o -lgcc --as-needed -lgcc_s
--no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
frobland 1123 % nm -D foo.good foo.lld
foo.good:
w __gmon_start__
U __libc_start_main
U write
foo.lld:
U __libc_start_main
U __real_write
00000000002010ed T write
frobland 1124 %
--
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/20170628/3b8d5cfd/attachment.html>
More information about the llvm-bugs
mailing list