From owner-freebsd-questions@FreeBSD.ORG Fri Oct 24 01:48:47 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F17FC106569D for ; Fri, 24 Oct 2008 01:48:47 +0000 (UTC) (envelope-from pisymbol@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.225]) by mx1.freebsd.org (Postfix) with ESMTP id C1CE48FC08 for ; Fri, 24 Oct 2008 01:48:47 +0000 (UTC) (envelope-from pisymbol@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so583095rvf.43 for ; Thu, 23 Oct 2008 18:48:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=SMMVLKEc+XRyEOupMmcta1KpSbjw85U+8lO/Vov6WwM=; b=f5QyguVF14hJdAmYuOG1sQ1m2UGFIRggGMXJdk5ydOoxVRXQNhKlTXLFRAbxNKpmZ+ 8dMMmlT4hhiAQTsVVjKCRD72BbvOq1aE1s/dLqMChOvcyypGXx7kDG1MTyY52OfVyDz1 QOElnnpWWbE/Dw0noJHxdCkDLX+AkEC28fY6w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=FrFQCX8UQvlWAIx2vfGM/iLzWtugLoTLo678YuboCgGBh3MtsN51v+Rlc8t4FUI9Iy nt9GdnQ4LSo3b8QVPvIwsHOfNbpdasMRKXiPlmh2rZSkyoxaDb7fu6GPUCmGcaN+SpNu kppbhY105LrSROIdyKRmZVHyM1ny6S0ETluYs= Received: by 10.141.88.3 with SMTP id q3mr814602rvl.46.1224812927543; Thu, 23 Oct 2008 18:48:47 -0700 (PDT) Received: by 10.141.43.14 with HTTP; Thu, 23 Oct 2008 18:48:47 -0700 (PDT) Message-ID: <3c0b01820810231848r3e3e297cl3dc9bf1d0edcd588@mail.gmail.com> Date: Thu, 23 Oct 2008 21:48:47 -0400 From: "Alexander Sack" To: "=?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?=" In-Reply-To: <86d4hqwzur.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <3c0b01820810231731s1b4d4659j7d1df8bf4abb229c@mail.gmail.com> <86hc72x0nx.fsf@ds4.des.no> <86d4hqwzur.fsf@ds4.des.no> Cc: FreeBSD Hackers , freebsd-questions@freebsd.org Subject: Re: Why does adding /usr/lib32 to LD_LIBRARY_PATH break 64-bit binaries? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2008 01:48:48 -0000 On Thu, Oct 23, 2008 at 9:23 PM, Dag-Erling Sm=F8rgrav wrote: > Dag-Erling Sm=F8rgrav 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