[root@monitor ~]# LD_DEBUG=help ls
Valid options for the LD_DEBUG environment variable are:
libs display library search paths
reloc display relocation processing
files display progress for input file
symbols display symbol table processing
bindings display information about symbol binding
versions display version dependencies
all all previous options combined
statistics display relocation statistics
unused determined unused DSOs
help display this help message and exit
To direct the debugging output into a file instead of standard output
a filename can be specified using the LD_DEBUG_OUTPUT environment variable.
[root@monitor ~]# LD_DEBUG=bindings /root/test
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_res' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_IO_file_close' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `rpc_createerr' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__key_gendes_LOCAL' [GLIBC_2.1]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__ctype32_tolower' [GLIBC_2.2]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `loc1' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `svc_pollfd' [GLIBC_2.2]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_IO_funlockfile' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__malloc_initialize_hook' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `argp_program_version' [GLIBC_2.1]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__tzname' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__after_morecore_hook' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__progname' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `obstack_exit_failure' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__check_rhosts_file' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `program_invocation_short_name' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_IO_stdout_' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `optopt' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `malloc' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_environ' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_IO_stderr_' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__key_encryptsession_pk_LOCAL' [GLIBC_2.1]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__ctype_tolower' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__malloc_hook' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /root/test [0]: normal symbol `_IO_stdin_used'
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__progname_full' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `obstack_alloc_failed_handler' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__fpu_control' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `mallwatch' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `loc2' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__realloc_hook' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/ld-linux.so.2 [0]: normal symbol `__libc_stack_end' [GLIBC_2.1]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `program_invocation_name' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `argp_program_version_hook' [GLIBC_2.1]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__curbrk' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `stdout' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `svc_max_pollfd' [GLIBC_2.2]
21569: binding file /lib/libc.so.6 [0] to /lib/ld-linux.so.2 [0]: normal symbol `_rtld_global_ro' [GLIBC_PRIVATE]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_nl_domain_bindings' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `stderr' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__ctype32_b' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/ld-linux.so.2 [0]: normal symbol `__libc_enable_secure' [GLIBC_PRIVATE]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_res_hconf' [GLIBC_2.2]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `argp_program_bug_address' [GLIBC_2.1]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `h_errlist' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `optind' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/ld-linux.so.2 [0]: normal symbol `_dl_argv' [GLIBC_PRIVATE]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `svc_fdset' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_IO_stdin_' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `re_syntax_options' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__rcmd_errstr' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__daylight' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `error_print_progname' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__ctype32_toupper' [GLIBC_2.2]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__ctype_b' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__ctype_toupper' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__morecore' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `getdate_err' [GLIBC_2.1]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_nl_msg_cat_cntr' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `stdin' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__environ' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `svcauthdes_stats' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__memalign_hook' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__free_hook' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `error_message_count' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `free' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/ld-linux.so.2 [0]: normal symbol `_rtld_global' [GLIBC_PRIVATE]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__timezone' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `__key_decryptsession_pk_LOCAL' [GLIBC_2.1]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `error_one_per_line' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `opterr' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `optarg' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `argp_err_exit_status' [GLIBC_2.1]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_IO_2_1_stdin_' [GLIBC_2.1]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_IO_2_1_stdout_' [GLIBC_2.1]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_IO_2_1_stderr_' [GLIBC_2.1]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `calloc' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `realloc' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `malloc' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/ld-linux.so.2 [0]: normal symbol `___tls_get_addr' [GLIBC_2.3]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `memalign' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `free' [GLIBC_2.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `_Unwind_Find_FDE' [GCC_3.0]
21569: binding file /lib/libc.so.6 [0] to /lib/libc.so.6 [0]: normal symbol `memmem' [GLIBC_2.0]
21569: binding file /lib/ld-linux.so.2 [0] to /lib/ld-linux.so.2 [0]: normal symbol `_r_debug' [GLIBC_2.0]
21569: binding file /lib/ld-linux.so.2 [0] to /lib/libc.so.6 [0]: normal symbol `free' [GLIBC_2.0]
21569: binding file /lib/ld-linux.so.2 [0] to /lib/libc.so.6 [0]: normal symbol `__libc_memalign' [GLIBC_2.0]
21569: binding file /lib/ld-linux.so.2 [0] to /lib/libc.so.6 [0]: normal symbol `malloc' [GLIBC_2.0]
21569: binding file /lib/ld-linux.so.2 [0] to /lib/libc.so.6 [0]: normal symbol `calloc' [GLIBC_2.0]
21569: binding file /lib/ld-linux.so.2 [0] to /lib/libc.so.6 [0]: normal symbol `realloc' [GLIBC_2.0]
21569: binding file /lib/ld-linux.so.2 [0] to /lib/ld-linux.so.2 [0]: normal symbol `___tls_get_addr' [GLIBC_2.3]
21569: binding file /lib/ld-linux.so.2 [0] to /lib/libc.so.6 [0]: normal symbol `free' [GLIBC_2.0]
21569:
21569: calling init: /lib/libc.so.6
21569:
21569: binding file /root/test [0] to /lib/libc.so.6 [0]: normal symbol `__libc_start_main' [GLIBC_2.0]
21569:
21569: initialize program: /root/test
21569:
21569:
21569: transferring control: /root/test
21569:
21569: binding file /root/test [0] to /lib/libc.so.6 [0]: normal symbol `sbrk' [GLIBC_2.0]
21569: binding file /root/test [0] to /lib/libc.so.6 [0]: normal symbol `brk' [GLIBC_2.0]
21569: binding file /root/test [0] to /lib/libc.so.6 [0]: normal symbol `printf' [GLIBC_2.0]
0x9c22000
0x9c22004
(nil)
0x9c22004
0x9c22004
Segmentation fault
[root@monitor ~]# LD_DEBUG=libs /root/test //显示库如何加载的
21570: find library=libc.so.6 [0]; searching
21570: search cache=/etc/ld.so.cache
21570: trying file=/lib/libc.so.6
21570:
21570:
21570: calling init: /lib/libc.so.6
21570:
21570:
21570: initialize program: /root/test
21570:
21570:
21570: transferring control: /root/test
21570:
0x9a88000
0x9a88004
(nil)
0x9a88004
0x9a88004
Segmentation fault