From owner-cvs-all@FreeBSD.ORG Tue Nov 3 21:37:30 2009 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 666231065741; Tue, 3 Nov 2009 21:37:30 +0000 (UTC) (envelope-from nox@jelal.kn-bremen.de) Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id DF2608FC0A; Tue, 3 Nov 2009 21:37:28 +0000 (UTC) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id 4295D1E00710; Tue, 3 Nov 2009 22:37:27 +0100 (CET) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.3/8.14.3) with ESMTP id nA3LZdYh062651; Tue, 3 Nov 2009 22:35:39 +0100 (CET) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.3/8.14.3/Submit) id nA3LZcKA062650; Tue, 3 Nov 2009 22:35:38 +0100 (CET) (envelope-from nox) From: Juergen Lock Date: Tue, 3 Nov 2009 22:35:38 +0100 To: Dirk Meyer Message-ID: <20091103213538.GA61624@triton8.kn-bremen.de> References: <200909211911.n8LJBlUK002650@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200909211911.n8LJBlUK002650@repoman.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: cvs-ports@FreeBSD.org, Ian Lance Taylor , sprewell@jaggeri.com, cvs-all@FreeBSD.org, ports-committers@FreeBSD.org Subject: Re: cvs commit: ports/devel/gold Makefile X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2009 21:37:30 -0000 On Mon, Sep 21, 2009 at 07:11:47PM +0000, Dirk Meyer wrote: > dinoex 2009-09-21 19:11:47 UTC > > FreeBSD ports repository > > Modified files: > devel/gold Makefile > Log: > - mark BROKEN for FreeBSD 6.x > Feature safe: yes Is this about `exec format error' (ENOEXEC)? We discussed this yesterday on irc (hi Sprewell! :) and found out that gold can produce executables that won't run on FreeBSD 7 and 8 too (for him it was chromium and some test executables on 7.2/i386, for me it was test executables on 8/amd64, I couldnt reproduce it here on 8 and 7 i386) - and after some debugging using qemu's gdbstub and a FreeBSD 8/amd64 livefs guest that I scp'd a problem executable into I found out that its this condition in sys/kern/imgact_elf.c that fails: http://fxr.watson.org/fxr/source/kern/imgact_elf.c#L721 719 if (phdr[i].p_type == PT_INTERP) { 720 /* Path to interpreter */ 721 if (phdr[i].p_filesz > MAXPATHLEN || 722 phdr[i].p_offset + phdr[i].p_filesz > PAGE_SIZE) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 723 return (ENOEXEC); 724 interp = imgp->image_header + phdr[i].p_offset; 725 break; 726 } 727 } (gdb) p/x phdr[1].p_offset $11 = 0x1174 (gdb) p/x phdr[1].p_filesz $12 = 0x15 (gdb) So it seems our kernel expects this data (path of the `image activator' aka shared linker aka /libexec/ld-elf.so.1) to be in the first page of the executable... There is code to print this header in jkoshy's libelf article, http://people.freebsd.org/~jkoshy/download/libelf/article.html#SEC.ELF-PHDR (4.1 Reading a Program Header Table using gelf(3), Figure 13. Printing the Program Header Table), running that on the above executable gives: PHDR 2: p_type 0x6 "PHDR" p_offset 0x40 p_vaddr 0x400040 p_paddr 0x400040 p_filesz 0x150 p_memsz 0x150 p_flags 0x4 [ read ] p_align 0x8 PHDR 2: p_type 0x3 "INTERP" p_offset 0x1174 ^^^^^^ here is the problem p_vaddr 0x401174 p_paddr 0x401174 p_filesz 0x15 p_memsz 0x15 p_flags 0x4 [ read ] p_align 0x1 PHDR 2: p_type 0x1 "LOAD" p_offset 0x0 p_vaddr 0x400000 p_paddr 0x400000 p_filesz 0x11f8 p_memsz 0x11f8 p_flags 0x5 [ execute read ] p_align 0x1000 PHDR 2: p_type 0x1 "LOAD" p_offset 0x11f8 p_vaddr 0x4021f8 p_paddr 0x4021f8 p_filesz 0x220 p_memsz 0x230 p_flags 0x6 [ read write ] p_align 0x1000 PHDR 2: p_type 0x2 "DYNAMIC" p_offset 0x1238 p_vaddr 0x402238 p_paddr 0x402238 p_filesz 0x140 p_memsz 0x140 p_flags 0x6 [ read write ] p_align 0x8 PHDR 2: p_type 0x6474e550 "unknown" p_offset 0xae8 p_vaddr 0x400ae8 p_paddr 0x400ae8 p_filesz 0x8 p_memsz 0x8 p_flags 0x4 [ read ] p_align 0x4 HTH, Juergen PS: I added the gold author, Ian Lance Taylor, to the Cc, hope thats ok...