From owner-freebsd-mips@freebsd.org Fri Feb 5 21:13:26 2016 Return-Path: Delivered-To: freebsd-mips@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C392A9E2B3 for ; Fri, 5 Feb 2016 21:13:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk0-x236.google.com (mail-qk0-x236.google.com [IPv6:2607:f8b0:400d:c09::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE81FC0D for ; Fri, 5 Feb 2016 21:13:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk0-x236.google.com with SMTP id s5so39306642qkd.0 for ; Fri, 05 Feb 2016 13:13:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Uq/gFIvSfzvYzXmDddMaZ3Px7N142GfEhDREnfqZNEg=; b=p555WW2c6YwYb89s05t43woF145BU1rprDlKbwzra3XcVtEMSK1xgeVCLQUhHbT5ha siDSH0rECIEbghNpc4cdPx2R7IY8nyXxhJdulSpGcwJe+2/AajqHXRvAvjDutQ76w5vZ MUo3mu+/R07pd4Ubgx8jbTj719TDxbZdpWeebPHh+A0MWVTcDPEXHLrxpRzYReK155Vh adGC7lymb1rmAI0nW9KBTKrYW54fu/imd0/UfYMTxqCMgBbUPaw4u62Zr0rlBtM0GGUT KFF8hzgqp7eMjetdOY/vIJ3GdkvRbkDszJzTExU5g3xoqAFtn9oVIJ3Tog0rMx38C1w0 x2NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Uq/gFIvSfzvYzXmDddMaZ3Px7N142GfEhDREnfqZNEg=; b=KgFiBHzcXUEDYY98eV86o+DsFEr4w3hSTqQlJG0AhQ4ObuTqJSXuOEQGxQelr1ygT1 +blHSvD+xYAUSGleiUG52lSgl4lw4nALBLMwlfulyf5KeMFTG/ZZM1DNJjGZ4amYoE5H 6EgfP8Qt3xFgpNCDYaU/HNAhsN04XxuxF2pGPDPOQ06KekcHmUdWL+LpSf4USmBWppRr +ZspAadjdHerV+CI/aBJIlvQ4KLiMljlDazqgAistcooAovilIYQR1sJP5sWqHGbbK5g aMScWqNgX+PcJ0NSMOvQ+UAulJFIbKYqM/ioz2rDVqFosBZ+kZXTGRnLba73MNKOymfQ wGDg== X-Gm-Message-State: AG10YOS7WrR/xngLJYTcUfQIuujCYg7YVO0fFo7xZ5baxBcv01f8pxnvnMrqgvZgkFImu7rT57NWZuRFoLYCJw== MIME-Version: 1.0 X-Received: by 10.55.80.68 with SMTP id e65mr19483231qkb.46.1454706804870; Fri, 05 Feb 2016 13:13:24 -0800 (PST) Sender: wlosh@bsdimp.com Received: by 10.140.30.166 with HTTP; Fri, 5 Feb 2016 13:13:24 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <20160205210351.GD93874@anubis.morrow.me.uk> References: <20160205143335.GC93874@anubis.morrow.me.uk> <20160205210351.GD93874@anubis.morrow.me.uk> Date: Fri, 5 Feb 2016 14:13:24 -0700 X-Google-Sender-Auth: NiFkcs_gkyIXpDCcr7e_k1nNnYc Message-ID: Subject: Re: Re: mips/qemu jails with native-xtools From: Warner Losh To: Ben Morrow Cc: "freebsd-mips@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2016 21:13:26 -0000 On Fri, Feb 5, 2016 at 2:03 PM, Ben Morrow wrote: > Warner Losh wrote: > > On Fri, Feb 5, 2016 at 7:33 AM, Ben Morrow wrote: > > > Warner Losh wrote: > > > > On Thu, Feb 4, 2016 at 5:26 PM, Ben Morrow wrote: > > > > > > > > > I've finally got a mips/qemu poudriere jail working properly with a > > > > > native toolchain, but it took a bit of fiddling to make it work, > so I > > > > > thought I'd report on what I did. > > > [...] > > > > > Having put the proper libraries back, the next problem was that ld > was > > > > > failing to find shared libraries that were implicitly linked > > > (DT_NEEDED) > > > > > by other shared libraries. The specific port I was building was > > > > > net/tshark, which links glib, which implicitly pulls in libpcre and > > > > > libiconv. The configure step was failing because ld couldn't find > > > > > libpcre.so.3. > > > > > > > > > > It turns out that ld finds the path to search for DT_NEEDED > libraries > > > by > > > > > reading ld-elf.so.hints. That file (in the jail) is BE, because > this is > > > > > a mips world with a mips ldconfig, but the ld binary is LE, so it > can't > > > > > read the file. With the patch below, it can; since endianness is > the > > > > > only difference between architectures, I think it should be safe > for > > > > > general use, but I don't really know > > > > > > > > I'd think it would be better to generate the ld.so in the proper > binary > > > > format. How hard is that? > > > > > > ld.so has to be a mips binary, otherwise we can't run any other > > > (non-static) mips binaries. So ld.so.hints has to be in BE format, > > > otherwise ld.so can't read it. The problem is that ld and ld.so have > > > different endiannesses, and ld is assuming it can read ld.so's files to > > > find the search path. > > > > > > Of course, it would always be possible to simply use a mips binary for > > > ld, as well, and just let it be emulated. > > > > I guess I'm misunderstanding something. When / how is ld have a different > > endianness? Is it the amd64 ld that produces binaries for big-endian mips > > that introduces the cross-threading? > > Yes, exactly. > Then I see little alternative than your patch. And a similar patch to llvm... Warner