From owner-freebsd-amd64@FreeBSD.ORG Tue May 4 16:07:06 2010 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AE3D8106564A for ; Tue, 4 May 2010 16:07:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 4AA338FC0C for ; Tue, 4 May 2010 16:07:05 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o44G72md037609 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 4 May 2010 19:07:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o44G724S050005; Tue, 4 May 2010 19:07:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o44G6xXk050004; Tue, 4 May 2010 19:06:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 4 May 2010 19:06:59 +0300 From: Kostik Belousov To: Shuichi KITAGUCHI Message-ID: <20100504160659.GO23646@deviant.kiev.zoral.com.ua> References: <201005040400.o44409pW050045@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JfVplkuTfB13Rsg5" Content-Disposition: inline In-Reply-To: <201005040400.o44409pW050045@freefall.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-amd64@freebsd.org Subject: Re: amd64/127276: ldd invokes linux yes X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 16:07:06 -0000 --JfVplkuTfB13Rsg5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 04, 2010 at 04:00:09AM +0000, Shuichi KITAGUCHI wrote: > The following reply was made to PR amd64/127276; it has been noted by GNA= TS. >=20 > From: Shuichi KITAGUCHI > To: bug-followup@FreeBSD.org, kamikaze@bsdforen.de > Cc: =20 > Subject: Re: amd64/127276: ldd invokes linux yes > Date: Tue, 04 May 2010 12:21:45 +0900 (JST) >=20 > ----Next_Part(Tue_May_04_12_21_45_2010_795)-- > Content-Type: Text/Plain; charset=3Dus-ascii > Content-Transfer-Encoding: 7bit > =20 > Hello, > =20 > I investigate this problem today and found that Linux's ld.so > accepts "LD_TRACE_LOADED_OBJECTS". > =20 > % env LD_TRACE_LOADED_OBJECTS=3Dyes /compat/linux/bin/ls > librt.so.1 =3D> /lib/librt.so.1 (0x28087000) > libselinux.so.1 =3D> /lib/libselinux.so.1 (0x28092000) > libcap.so.2 =3D> /lib/libcap.so.2 (0x280af000) > libacl.so.1 =3D> /lib/libacl.so.1 (0x280b4000) > libc.so.6 =3D> /lib/libc.so.6 (0x280bc000) > libpthread.so.0 =3D> /lib/libpthread.so.0 (0x28234000) > /lib/ld-linux.so.2 (0x28063000) > libdl.so.2 =3D> /lib/libdl.so.2 (0x2824e000) > libattr.so.1 =3D> /lib/libattr.so.1 (0x28254000) > =20 > I think environment variable "LD_32_TRACE_LOADED_OBJECTS" is > FreeBSD specific, and "LD_TRACE_LOADED_OBJECTS" should be passed > to other binaries. > =20 > Attached patch is reasonable? No, what you test for is the old branding method. Relatively modern FreeBSD kernels deduce the ABI of the binary from the .note section. Also please note that there are hybrid systems like Debian/kFreeBSD, that also use .note to brand the binary. > =20 > =20 > -- > Shuichi KITAGUCHI // kit@ysnb.net / ki@hh.iij4u.or.jp > =20 > ----Next_Part(Tue_May_04_12_21_45_2010_795)-- > Content-Type: Text/X-Patch; charset=3Dus-ascii > Content-Transfer-Encoding: 7bit > Content-Disposition: inline; filename=3D"ldd.c.patch" > =20 > --- ldd.c.old 2009-09-19 21:45:17.000000000 +0900 > +++ ldd.c 2010-05-04 11:48:42.000000000 +0900 > @@ -65,7 +65,7 @@ > #endif > =20 > static int is_executable(const char *fname, int fd, int *is_shlib, > - int *type); > + int *osabi, int *type); > static void usage(void); > =20 > #define TYPE_UNKNOWN 0 > @@ -177,14 +177,14 @@ > =20 > rval =3D 0; > for (; argc > 0; argc--, argv++) { > - int fd, status, is_shlib, rv, type; > + int fd, status, is_shlib, rv, type, osabi; > =20 > if ((fd =3D open(*argv, O_RDONLY, 0)) < 0) { > warn("%s", *argv); > rval |=3D 1; > continue; > } > - rv =3D is_executable(*argv, fd, &is_shlib, &type); > + rv =3D is_executable(*argv, fd, &is_shlib, &osabi, &type); > close(fd); > if (rv =3D=3D 0) { > rval |=3D 1; > @@ -197,6 +197,8 @@ > break; > #if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) > case TYPE_ELF32: > + if (osabi !=3D ELFOSABI_FREEBSD) > + break; > rval |=3D execldd32(*argv, fmt1, fmt2, aflag, vflag); > continue; > #endif > @@ -267,7 +269,7 @@ > } > =20 > static int > -is_executable(const char *fname, int fd, int *is_shlib, int *type) > +is_executable(const char *fname, int fd, int *is_shlib, int *osabi, int= *type) > { > union { > struct exec aout; > @@ -300,6 +302,8 @@ > return (1); > } > =20 > + *osabi =3D hdr.elf.e_ident[EI_OSABI]; > + > #if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) > if ((size_t)n >=3D sizeof(hdr.elf32) && IS_ELF(hdr.elf32) && > hdr.elf32.e_ident[EI_CLASS] =3D=3D ELFCLASS32) { > =20 > ----Next_Part(Tue_May_04_12_21_45_2010_795)---- > _______________________________________________ > freebsd-amd64@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-amd64 > To unsubscribe, send any mail to "freebsd-amd64-unsubscribe@freebsd.org" --JfVplkuTfB13Rsg5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkvgRiIACgkQC3+MBN1Mb4hmFwCfbUscw0p2YAO3+RDAmqQGStVb r2wAoICIrmgP455BAFlvA694+pw87TZy =PKxD -----END PGP SIGNATURE----- --JfVplkuTfB13Rsg5--