From owner-freebsd-amd64@FreeBSD.ORG Fri May 23 23:28:36 2014 Return-Path: Delivered-To: freebsd-amd64@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 ESMTPS id 2E544A47 for ; Fri, 23 May 2014 23:28:36 +0000 (UTC) Received: from smtp2.wemm.org (smtp2.wemm.org [192.203.228.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 140D020F8 for ; Fri, 23 May 2014 23:28:35 +0000 (UTC) Received: from [172.16.21.76] (50-204-120-225-static.hfc.comcastbusiness.net [50.204.120.225]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) (Authenticated sender: peter) by smtp2.wemm.org (Postfix) with ESMTPSA id B69DE2CA for ; Fri, 23 May 2014 16:28:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1400887715; bh=sscm9zBD5lyVUk6mY1luPAJCrnxxbIha6HJj+S0wOhQ=; h=Date:From:To:Subject:References:In-Reply-To; b=EFL+Te7WtHjL7j3S+RkmQ5ag9OIrZv4dpnqWEsDOK0CRcK9Q9tOnaPMI37aEUZ9U1 HbuZv7vmJ62LbReBS8lYK5GrJZAHHPjK464A60lO5HSr+E1Nr966aLBO18ODyAz5km 7VzlUOJKj0FSx2aNETbqI7TOLYgSMzXhy+91v9EM= Message-ID: <537FD9A2.2010607@wemm.org> Date: Fri, 23 May 2014 16:28:34 -0700 From: Peter Wemm User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: freebsd-amd64@freebsd.org Subject: Re: i386 Go programs crash on amd64 References: <20140523225300.GA14433@server.rulingia.com> <537FD853.3000505@wemm.org> In-Reply-To: <537FD853.3000505@wemm.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 May 2014 23:28:36 -0000 On 5/23/14, 4:22 PM, Peter Wemm wrote: > On 5/23/14, 3:53 PM, Peter Jeremy wrote: >> I've been playing with Go (lang/go) and found that i386 Go binaries >> segfault when run on amd64 (9.x, 10.x or HEAD). I've narrowed it down >> to the LDT handling but am not sure whether it's on the FreeBSD or Go >> side. >> >> As far as I can see, the i386 binary is correctly calling i386_set_ldt() >> and the i386_set_ldt() emulation in the amd64 kernel matches the i386 >> kernel - but the net result doesn't work. >> >> Can anyone offer any suggestions as to how to resolve this? >> > We don't emulate i386_set_ldt(). > > The 32 bit version of libc on amd64 has a different implementation > that calls sysarch(I386_SET_FSBASE, ..) and friends. Normally this is > handled transparently by static linking, but obviously that's an issue > for Go. Actually, that's an even more interesting question. WHY are they using i386_set_ldt()? Where is it coming from? As near as I can tell, libc, libthr etc call I386_SET_GSBASE for tls. -Peter