From owner-freebsd-current@FreeBSD.ORG Mon Sep 16 08:01:47 2013 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8E242D0D; Mon, 16 Sep 2013 08:01:47 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 43242251E; Mon, 16 Sep 2013 08:01:46 +0000 (UTC) Received: from [192.168.0.2] (cpc27-cmbg15-2-0-cust235.5-4.cable.virginmedia.com [86.27.188.236]) (authenticated bits=0) by theravensnest.org (8.14.5/8.14.5) with ESMTP id r8G81aw0057028 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 16 Sep 2013 08:01:39 GMT (envelope-from theraven@FreeBSD.org) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: how do i cross build world/kernel with clang? From: David Chisnall In-Reply-To: <024001ceb262$e87f9ea0$b97edbe0$@rewt.org.uk> Date: Mon, 16 Sep 2013 09:01:32 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <024001ceb262$e87f9ea0$b97edbe0$@rewt.org.uk> To: "Joe Holden" X-Mailer: Apple Mail (2.1508) Cc: 'Adrian Chadd' , 'freebsd-current' , freebsd-mips@FreeBSD.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Sep 2013 08:01:47 -0000 On 15 Sep 2013, at 23:28, "Joe Holden" wrote: > Are you still playing with this? Reason I ask is that I tried to = build > world with clang for the crack and it bails with: >=20 > /usr/obj/mips.mips64/pseudosrc/tmp/usr/bin/ld: > /usr/obj/mips.mips64/pseudosrc/tmp/usr/lib/crtn.o: warning: linking = PIC > files with non-PIC files This is an old bug in LLVM, where it didn't set the cpic bit in the = e_flags field of the ELF header. We fixed it a little while ago, but it = hasn't been imported into head yet. > exect.So: In function `exect': > (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against = `__cerror' > setjmp.So: In function `botch': > (.text+0x124): relocation truncated to fit: R_MIPS_PC16 against = `abort' > _setjmp.So: In function `botch': > (.text+0xac): relocation truncated to fit: R_MIPS_PC16 against `abort' > _sigwait.So: In function `err': > (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against = `__cerror' > _getlogin.So: In function `err': > (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against = `__cerror' > aio_mlock.So: In function `err': > (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against = `__cerror' > pipe2.So: In function `err': > (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against = `__cerror' > accept4.So: In function `err': > (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against = `__cerror' > chflagsat.So: In function `err': > (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against = `__cerror' > connectat.So: In function `err': > (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against = `__cerror' > bindat.So: In function `err': > (.text+0x18): additional relocation overflows omitted from the output Most of these are due to our linker not being able to correctly insert = PLT entries on MIPS (recent GNU binutils doesn't have this problem, but = unfortunately also can't target FreeBSD. I believe Warner is working on = forward-porting our patches to a new binutils). We might be able to = hack LLVM to always emit 24-bit relocations, but that seems a bit of a = hack. I'm inclined to wait until we import MCLinker, which now has = MIPS32/64 support, and should be much easier to fix if it has this kind = of issue. David