From owner-freebsd-mips@FreeBSD.ORG Thu Apr 14 19:18:40 2011 Return-Path: Delivered-To: mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6837A106566B for ; Thu, 14 Apr 2011 19:18:40 +0000 (UTC) (envelope-from aduane@juniper.net) Received: from exprod7og120.obsmtp.com (exprod7og120.obsmtp.com [64.18.2.18]) by mx1.freebsd.org (Postfix) with ESMTP id 93B518FC16 for ; Thu, 14 Apr 2011 19:18:39 +0000 (UTC) Received: from P-EMHUB03-HQ.jnpr.net ([66.129.224.36]) (using TLSv1) by exprod7ob120.postini.com ([64.18.6.12]) with SMTP ID DSNKTadIjozCqCLw5AmU4XIYZ2mzuONZ3nQg@postini.com; Thu, 14 Apr 2011 12:18:40 PDT Received: from p-emfe02-wf.jnpr.net (172.28.145.25) by P-EMHUB03-HQ.jnpr.net (172.24.192.37) with Microsoft SMTP Server (TLS) id 8.2.254.0; Thu, 14 Apr 2011 12:15:27 -0700 Received: from EMBX01-WF.jnpr.net ([fe80::1914:3299:33d9:e43b]) by p-emfe02-wf.jnpr.net ([fe80::c126:c633:d2dc:8090%11]) with mapi; Thu, 14 Apr 2011 15:17:24 -0400 From: Andrew Duane To: bhanuprakash bodireddy Date: Thu, 14 Apr 2011 15:17:23 -0400 Thread-Topic: Trouble with dynamic executables Thread-Index: Acv6170Ywwx7iLTwQuyRMcNL1ZtJagAABBQg Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "mips@freebsd.org" Subject: RE: Trouble with dynamic executables X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2011 19:18:40 -0000 I've figured out what the problem is. The elf header of a sample dynamic ex= ecutable shows: =20 Elf file type is EXEC (Executable file) Entry point 0x1200028f0 There are 7 program headers, starting at offset 64 =20 Program Headers: Type Offset VirtAddr PhysAddr F= ileSiz MemSiz Flags Align PHDR 0x0000000000000040 0x0000000120000040 0x0000000120000040 0= x0000000000000188 0x0000000000000188 R E 8 INTERP 0x0000000000012788 0x0000000120012788 0x0000000120012788 0= x0000000000000015 0x0000000000000015 R 1 [Requesting program interpreter: /libexec/ld-elf.so.1] LOAD 0x0000000000000000 0x0000000120000000 0x0000000120000000 0= x00000000000127bc 0x00000000000127bc R E 10000 LOAD 0x0000000000013000 0x0000000120023000 0x0000000120023000 0= x00000000000017d8 0x0000000000003c28 RW 10000 DYNAMIC 0x0000000000000808 0x0000000120000808 0x0000000120000808 0= x00000000000001e0 0x00000000000001e0 RWE 8 NOTE 0x00000000000127a4 0x00000001200127a4 0x00000001200127a4 0= x0000000000000018 0x0000000000000018 R 4 NULL 0x0000000000000000 0x0000000000000000 0x0000000000000000 0= x0000000000000000 0x0000000000000000 8 Note section 1 the INTERP header: the offset is 0x12788. There's a check in= the ELF64 image activator to see if the offset is outside the first page a= nd returns ENOEXEC. The exec path reads in the first page first, and tries = to figure out what to do with the rest. So if the interpreter name isn't in= the first page, it can't decode it. This is a toolchain issue, or some setup issue. =20 /Andrew =20 =20 ________________________________ From: bhanuprakash bodireddy [mailto:bhanuprakashbodireddy@gmail.com]=20 Sent: Thursday, April 14, 2011 3:11 PM To: Andrew Duane Cc: mips@freebsd.org Subject: Re: Trouble with dynamic executables I had a similar issue the other day when i did a fresh build world. I tried= it to reproduce the issue you reported and its pretty much there in the tr= unk. But the last buildworld has no such issues and am still using the same old = fs image to boot on to the octeon boards.=20 I believe, some recent fixes should have caused this.=20 Thanks, Bhanu Prakash. On Thu, Apr 14, 2011 at 11:01 AM, Andrew Duane wrote: I've pretty much completed my board bringup of an OCTEON based board, but = am still battling one *major* issue. Dynamically linked executables do not = work at all. Any time I try to run one, I get "Exec format error" (ENOEXEC)= . Sample output from file is: =09 Statically linked /bin/cat: =09 bin/cat: ELF 64-bit MSB executable, MIPS, MIPS64 rel2 version 1 (Free= BSD), for FreeBSD 9.0 (900035), statically linked, FreeBSD-style, not strip= ped =09 Dynamically linked /usr/bin/size: =09 usr/bin/size: ELF 64-bit MSB executable, MIPS, MIPS64 rel2 version 1 (Free= BSD), for FreeBSD 9.0 (900035), dynamically linked (uses shared libs), Free= BSD-style, not stripped =09 For now, I've sort of worked around this by editing close to 1000 Makefile= s and making almost everything static. There must be a reason for this thou= gh. I've done a fresh update and rebuilt everything including the toolchain= . Is there something missing from my system? The loader itself? Libraries? = An ldscript file? =09 -- =09 Andrew Duane Juniper Networks 978-589-0551 10 Technology Park Dr aduane@juniper.net Westford, MA 01886-3418 =09 _______________________________________________ freebsd-mips@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-mips To unsubscribe, send any mail to "freebsd-mips-unsubscribe@freebsd.org" =09