On Thursday 2015-10-29 20:07, Mike Frysinger wrote: >Neutron Soutmun wrote: >> * libmnl using an export map (-Wl,--version-script=), >> hence, no need to explicitly use the EXPORT_SYMBOL() tags. > >this isn't entirely accurate. the use of hidden visibility allows for >optimizations (e.g. bypassing the PLT). export maps merely control the >final visibility of the symbols at link time ... gcc is forced to assume >every function call otherwise is still globally visible (exported). Though your argument makes sense, I find that `gcc -c` does not really care about the visibility. It always emits, on x86_64, a 0xE8 __ __ __ __ opcode for a function call with C external linkage, whether that function has hidden or default visibility. The linker fills in the four bytes because only it knows how far to jump, after combining the .o files. And it appears to be smart enough not to issue a "callq <st_intern@plt>": $ cat x.c extern void st_exported(void); extern void st_intern(void); void st_exported(void) { st_intern(); } $ cat y.c extern void st_intern(void); void st_intern(void) {} $ cat xy.sym XY { global: st_exported; local: *; }; $ gcc x.c y.c -fPIC -Wall -shared -o xy.so -Wl,--version-script=xy.sym $ objdump -d xy.so 0000000000000655 <st_exported>: 655: 55 push %rbp 656: 48 89 e5 mov %rsp,%rbp 659: e8 02 00 00 00 callq 660 <st_intern> 65e: 5d pop %rbp 65f: c3 retq -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html