From owner-freebsd-arm@freebsd.org Tue Jan 5 18:56:31 2016 Return-Path: Delivered-To: freebsd-arm@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 D327EA62619 for ; Tue, 5 Jan 2016 18:56:31 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9ECD2199F for ; Tue, 5 Jan 2016 18:56:31 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Tue, 5 Jan 2016 18:56:54 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id u05IuO3r001660; Tue, 5 Jan 2016 11:56:24 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1452020184.1320.24.camel@freebsd.org> Subject: Re: 11.0-CURRENT Bug 205904 "unresolvable R_ARM_MOVW_ABS_NC relocation" vs. forced -fPIC use From: Ian Lepore To: Mark Millard , freebsd-arm , FreeBSD Toolchain Date: Tue, 05 Jan 2016 11:56:24 -0700 In-Reply-To: <8079E6B2-DC53-4BFA-9129-8A88A1A1F044@dsl-only.net> References: <8079E6B2-DC53-4BFA-9129-8A88A1A1F044@dsl-only.net> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2016 18:56:31 -0000 On Mon, 2016-01-04 at 20:36 -0800, Mark Millard wrote: > I had in Bug 205904 reported that trying "portmaster -DK > textproc/expat2" in a -march=armv7-a -mcpu=cortex-a7 context (on an > rpi2b) gets (for -r293129 and its /usr/bin/ tools): > > > unresolvable R_ARM_MOVW_ABS_NC relocation against symbol > > `malloc@@FBSD_1.0' > > in an attempted link operation. > > I've now added a comment saying in part: > > > Investigating the issue I had the portmaster activity use the > > /usr/local/arm-gnueabi-freebsd/bin/ tools instead (via > > /etc/make.conf changes) and in that context the message is > > different but it was still an error: > > > > > relocation R_ARM_MOVW_ABS_NC against `malloc' can not be used > > > when making a shared object; recompile with -fPIC > > > > > > Trying again with -fPIC does let the portmaster command complete in > > this /usr/local/arm-gnueabi-freebsd/bin/ based tool context. > > > > > > Going back and trying -fPIC in the /usr/bin/ based tools context > > also lets the portmaster command complete. (That context without > > -fPIC did not directly indicate to try -fPIC in its messages.) > > > > > > So maybe part of the issue is having compiler arguments like -fPIC > > show up in commands for contexts like -march=armv7-a -mcpu=cortex > > -a7 without manual intervention in each case. For ports: some parts > > of a more complicated port might need[] such and other parts might > > not. > > I used /etc/make.conf to force -fPIC being present. > > I started this investigation to try some things after Ian Lepore's > -r292964 for the /usr/bin/ binutils. I picked on textproc/expat2 > initially as something fairly simple and limited to C. (clang++ has > problems under SCTLR bit[1]==1 [alignment required] on arm that make > clang++ Bus Error during most C++ compiles). > > === > Mark Millard > markmi at dsl-only.net All of this is a complex way of saying "there is a bug in the expat2 port" (that being that it tries to build a shared library from object files that were compiled without -fpic). Adding -fpic via make.conf is absolutely not a fix or even a marginally viable workaround. -- Ian