https://sourceware.org/bugzilla/show_bug.cgi?id=16467
--- Comment #7 from Zbigniew Jędrzejewski-Szmek <zbyszek at in dot waw .pl> --- > Can you double check if gold generates the working output? It seemed to be working for me before, in the sense that at least linking worked without any error report, and the binary linking the symbols in the equivalent of libb in the example above was running successfully. I didn't actually test whether the functions can be correctly called. Updated recipe that I paste below does that. I use versioned symbols for libb.so too. With out that, resulting binary segfaults when it is run. Also, I had to added -fPIC to the compilation of liba.so. Previously I test ed with both gcc-4.7 and gcc-4.8, and the old gcc did not complain about missi ng -fPIC, the newer one does. The guess the newer one is right. -------------------------------------------------- ==> liba.c <== const char* sd_get_seats(void) {return "bla bla";} ==> liba.sym <== LIBSYSTEMD_209 { global: sd_get_seats; }; ==> libb.c <== void new_sd_get_seats(void); __asm__(".symver new_sd_get_seats,sd_get_seats@LIBSYSTEMD_209"); static void (*resolve_sd_get_seats(void)) (void) { return new_sd_get_seats; } void sd_get_seats(void) __attribute__((ifunc("resolve_sd_get_seats"))); ==> libb.sym <== LIBSYSTEMD_208 { global: sd_get_seats; }; ==> test1.c <== #include <stdio.h> const char* sd_get_seats(void); int main(int argc, char **argv) { printf("%s\n", sd_get_seats()); return 0; } $ gcc -shared -o liba.so liba.c -Wl,--version-script=liba.sym -Wl,-fuse-l d=gold -fPIC $ gcc -shared -fPIC libb.c -o libb.so -L. -la -Wl,-fuse-ld=gold -Wl,--version-script=libb.sym $ gcc -L. -lb -Wl,-fuse-ld=gold test1.c -o test1 $ LD_LIBRARY_PATH=. ./test1 bla bla $ LD_LIBRARY_PATH=. ldd ./test1 linux-vdso.so.1 (0x00007fff81963000) libb.so => ./libb.so (0x00007faf96c52000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007faf96872000) liba.so => ./liba.so (0x00007faf9686f000) /lib64/ld-linux-x86-64.so.2 (0x00007faf96c56000) -- 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