mirror of https://github.com/mkerrisk/man-pages
ld.so.8: LD_BIND_NOT has effect only for function symbols
As far as I can tell from testing and a short read of the glibc source code, LD_BIND_NOT has an effect only for function symbols. This is consistent also with the Solaris documentation, which says: When the runtime linker performs a function relocation, it rewrites data associated with the functions .plt so that any subsequent calls will go directly to the function. The environment variable LD_BIND_NOT can be set to any value to prevent this data update. By using this variable together with the debugging request for detailed bindings, you can get a complete runtime account of all function binding. Test case: $ cat prog.c int main(int argc, char *argv[]) { for (;;) { sleep(1); optind = 0; } exit(EXIT_SUCCESS); } $ cc prog.c And then in the run below, in each loop, we see repeated resolutions only for the function symbol, sleep() (and not for optind). $ LD_BIND_NOT=1 LD_DEBUG=symbols,bindings ./a.out ... 30481: transferring control: ./t 30481: 30481: symbol=sleep; lookup in file=./t [0] 30481: symbol=sleep; lookup in file=/lib64/libc.so.6 [0] 30481: binding file ./t [0] to /lib64/libc.so.6 [0]: normal symbol `sleep' [GLIBC_2.2.5] 30481: symbol=sleep; lookup in file=./t [0] 30481: symbol=sleep; lookup in file=/lib64/libc.so.6 [0] 30481: binding file ./t [0] to /lib64/libc.so.6 [0]: normal symbol `sleep' [GLIBC_2.2.5] 30481: symbol=sleep; lookup in file=./t [0] 30481: symbol=sleep; lookup in file=/lib64/libc.so.6 [0] 30481: binding file ./t [0] to /lib64/libc.so.6 [0]: normal symbol `sleep' [GLIBC_2.2.5] 30481: symbol=sleep; lookup in file=./t [0] 30481: symbol=sleep; lookup in file=/lib64/libc.so.6 [0] 30481: binding file ./t [0] to /lib64/libc.so.6 [0]: normal symbol `sleep' [GLIBC_2.2.5] 30481: symbol=sleep; lookup in file=./t [0] 30481: symbol=sleep; lookup in file=/lib64/libc.so.6 [0] 30481: binding file ./t [0] to /lib64/libc.so.6 [0]: normal symbol `sleep' [GLIBC_2.2.5] 30481: symbol=sleep; lookup in file=./t [0] 30481: symbol=sleep; lookup in file=/lib64/libc.so.6 [0] 30481: binding file ./t [0] to /lib64/libc.so.6 [0]: normal symbol `sleep' [GLIBC_2.2.5] Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
534267c408
commit
a3a72ad210
|
@ -354,7 +354,7 @@ in the chapter
|
|||
.BR LD_BIND_NOT " (since glibc 2.1.95)"
|
||||
If this environment variable is set to a nonempty string,
|
||||
do not update the GOT (global offset table) and PLT (procedure linkage table)
|
||||
after resolving a symbol.
|
||||
after resolving a function symbol.
|
||||
.TP
|
||||
.BR LD_DEBUG " (since glibc 2.1)"
|
||||
Output verbose debugging information about the dynamic linker.
|
||||
|
|
Loading…
Reference in New Issue