Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Oct 2008 21:48:47 -0400
From:      "Alexander Sack" <pisymbol@gmail.com>
To:        "=?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?=" <des@des.no>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>, freebsd-questions@freebsd.org
Subject:   Re: Why does adding /usr/lib32 to LD_LIBRARY_PATH break 64-bit binaries?
Message-ID:  <3c0b01820810231848r3e3e297cl3dc9bf1d0edcd588@mail.gmail.com>
In-Reply-To: <86d4hqwzur.fsf@ds4.des.no>
References:  <3c0b01820810231731s1b4d4659j7d1df8bf4abb229c@mail.gmail.com> <86hc72x0nx.fsf@ds4.des.no> <86d4hqwzur.fsf@ds4.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Oct 23, 2008 at 9:23 PM, Dag-Erling Sm=F8rgrav <des@des.no> wrote:
> Dag-Erling Sm=F8rgrav <des@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=3D-DDEBUG
> % make install
> % echo $LD_LIBRARY_PATH
> /home/des/lib:/opt/varnish/lib:/usr/local/lib
> % LD_DEBUG=3D1 /usr/bin/true
> /libexec/ld-elf.so.1 is initialized, base address =3D 0x800500000
> RTLD dynamic =3D 0x8006305b0
> RTLD pltgot  =3D 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 =3D 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" =3D=3D> 0x80071ae00 in "libc.so.7"
> reloc_jmpslot: *0x800845c78 =3D 0x80071ae00
> transferring control to program entry point =3D 0x400420
> "atexit" in "true" =3D=3D> 0x8006fac3e in "libc.so.7"
> reloc_jmpslot: *0x500868 =3D 0x8006fac3e
> "exit" in "true" =3D=3D> 0x8006af118 in "libc.so.7"
> reloc_jmpslot: *0x500860 =3D 0x8006af118
> "__cxa_finalize" in "libc.so.7" =3D=3D> 0x8006fa940 in "libc.so.7"
> reloc_jmpslot: *0x800846140 =3D 0x8006fa940
> rtld_exit()
> calling fini function for /lib/libc.so.7 at 0x80071ae60
> "_exit" in "libc.so.7" =3D=3D> 0x8006cfff0 in "libc.so.7"
> reloc_jmpslot: *0x8008471d8 =3D 0x8006cfff0
>
> DES
> --
> Dag-Erling Sm=F8rgrav - des@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3c0b01820810231848r3e3e297cl3dc9bf1d0edcd588>