Why does adding /usr/lib32 to LD_LIBRARY_PATH break 64-bit binaries?

Alexander Sack pisymbol at gmail.com
Thu Oct 23 18:48:48 PDT 2008


On Thu, Oct 23, 2008 at 9:23 PM, Dag-Erling Smørgrav <des at des.no> wrote:
> Dag-Erling Smørgrav <des at des.no> writes:
>> If you look at the rtld(1) man page, there are a number of environment
>> variables you can set to debug the loader.  I'm not sure how helpful
>> they are, though.
>
> You can rebuild rtld(1) with debugging enabled:
>
> % cd /usr/src/libexec/rtld-elf
> % make clean
> % make DEBUG_FLAGS=-DDEBUG
> % make install
> % echo $LD_LIBRARY_PATH
> /home/des/lib:/opt/varnish/lib:/usr/local/lib
> % LD_DEBUG=1 /usr/bin/true
> /libexec/ld-elf.so.1 is initialized, base address = 0x800500000
> RTLD dynamic = 0x8006305b0
> RTLD pltgot  = 0x0
> processing main program's program header
> Filling in DT_DEBUG entry
> lm_init("(null)")
> loading LD_PRELOAD libraries
> loading needed objects
>  Searching for "libc.so.7"
>  Trying "/home/des/lib/libc.so.7"
>  Trying "/opt/varnish/lib/libc.so.7"
>  Trying "/usr/local/lib/libc.so.7"
>  Trying "/lib/libc.so.7"
> loading "/lib/libc.so.7"
> Ignoring d_tag 1879048185 = 0x6ffffff9
>  0x80063b000 .. 0x80085efff: /lib/libc.so.7
> checking for required versions
> initializing initial thread local storage
> relocating "/usr/bin/true"
> relocating "/lib/libc.so.7"
> doing copy relocations
> initializing key program variables
> "__progname": *0x5005e8 <-- 0x7fffffffebc1
> "environ": *0x500878 <-- 0x7fffffffe9a8
> initializing thread locks
> calling init function for /lib/libc.so.7 at 0x800664da8
> "__sysctl" in "libc.so.7" ==> 0x80071ae00 in "libc.so.7"
> reloc_jmpslot: *0x800845c78 = 0x80071ae00
> transferring control to program entry point = 0x400420
> "atexit" in "true" ==> 0x8006fac3e in "libc.so.7"
> reloc_jmpslot: *0x500868 = 0x8006fac3e
> "exit" in "true" ==> 0x8006af118 in "libc.so.7"
> reloc_jmpslot: *0x500860 = 0x8006af118
> "__cxa_finalize" in "libc.so.7" ==> 0x8006fa940 in "libc.so.7"
> reloc_jmpslot: *0x800846140 = 0x8006fa940
> rtld_exit()
> calling fini function for /lib/libc.so.7 at 0x80071ae60
> "_exit" in "libc.so.7" ==> 0x8006cfff0 in "libc.so.7"
> reloc_jmpslot: *0x8008471d8 = 0x8006cfff0
>
> DES
> --
> Dag-Erling Smørgrav - des at des.no

Thanks, comments most appreciated.  Damn, I was looking for someone to
go "a ha, you can't do this because...."  Alright, let me see why rtld
on 6.1-amd64 is picking up /usr/lib32 stuff for a native 64-bit binary
via debugging techniques. This seems very very wrong to me.  I mean if
/usr/lib is in my LD_LIBRARY_PATH and it comes before /usr/lib the
/usr/lib32 *should* be innocuous, right?

Feel free to use that last statement on my epitaph!  :D

-aps


More information about the freebsd-questions mailing list