From owner-svn-src-head@freebsd.org Tue Jun 20 07:36:25 2017 Return-Path: Delivered-To: svn-src-head@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 51446D91C74; Tue, 20 Jun 2017 07:36:25 +0000 (UTC) (envelope-from jasone@canonware.com) Received: from canonware.com (canonware.com [204.109.63.53]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 28AF577601; Tue, 20 Jun 2017 07:36:24 +0000 (UTC) (envelope-from jasone@canonware.com) Received: from maple (unknown [208.67.62.115]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by canonware.com (Postfix) with ESMTPSA id 170FC28A2C; Tue, 20 Jun 2017 00:36:18 -0700 (PDT) Date: Tue, 20 Jun 2017 00:36:16 -0700 From: Jason Evans To: Jason Evans Cc: Shawn Webb , Jason Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r319971 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src include lib/libc/stdlib/jemalloc Message-Id: <20170620003616.d85c2fd028d40f2961282222@canonware.com> In-Reply-To: <20170616171544.9b4a398cac3328f9bd6cd747@canonware.com> References: <201706150715.v5F7F6aT031218@repo.freebsd.org> <20170616224517.td7yiahzv2oxcpts@mutt-hbsd> <20170616171544.9b4a398cac3328f9bd6cd747@canonware.com> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jun 2017 07:36:25 -0000 On Fri, 16 Jun 2017 17:15:44 -0700 Jason Evans wrote: > On Fri, 16 Jun 2017 18:45:17 -0400 > Shawn Webb wrote: > > On Thu, Jun 15, 2017 at 07:15:06AM +0000, Jason Evans wrote: > > > Author: jasone > > > Date: Thu Jun 15 07:15:05 2017 > > > New Revision: 319971 > > > URL: https://svnweb.freebsd.org/changeset/base/319971 > > > > > > Log: > > > Update jemalloc to 5.0.0. > > > > This breaks buildworld for arm64: > > > > /usr/obj/arm64.aarch64/scratch/fbsd/tmp/usr/bin/ld: error: sigsetjmp.pico:(function sigsetjmp): relocation R_AARCH64_CONDBR19 out of range > > /usr/obj/arm64.aarch64/scratch/fbsd/tmp/usr/bin/ld: error: sigsetjmp.pico:(function siglongjmp): relocation R_AARCH64_CONDBR19 out of range > > cc: error: linker command failed with exit code 1 (use -v to see invocation) > > --- libc.so.7.full --- > > *** [libc.so.7.full] Error code 1 > > > > make[4]: stopped in /scratch/fbsd/lib/libc > > Indeed, this happens for me too with TARGET=arm64 TARGET_ARCH=aarch64. I haven't found anything specifically about this error message, but it looks vaguely like the amd64-specific messages that happen when trying to link non-PIC object files into a shared library. In src/lib/libc/aarch64/gen/sigsetjmp.S, we have two conditional jumps > > b.eq C_LABEL(_setjmp) > [...] > b.eq C_LABEL(_longjmp) > > Maybe there's a simple macro change that can make these relocatable jumps. Alternatively, we could probably simplify the code by merging setjmp.S and sigsetjmp.S, so that PC-relative jumps could be used. Given how arm handles similar branches, it seems like the correct fix would be to change these (and probably other branches) from e.g. b.eq _C_LABEL(_setjmp) to b.eq PIC_SYM(_C_LABEL(_setjmp), PLT) However, doing so triggers a clang crash. PIC_SYM is explicitly defined for aarch64, but is otherwise unused. It appears that we don't actually generate relocations, at least during initial linking. As a side effect, we have an implicit dependency on all of libc's dependent symbols serendipitously being within some limited range of each other. When using conditional branches, that range is +-1 MiB; for unconditional branches it is +-128 MiB. The jemalloc update changed libc's layout, and the conditional branches exceeded the +-1 MiB range. This latent bug is worked around in r320136, though it seems likely we have broader problems with how we build PIC libraries for arm64. Jason