From owner-freebsd-arm@freebsd.org Sun Oct 8 00:27:46 2017 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 41E1BE45E68 for ; Sun, 8 Oct 2017 00:27:46 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-18.reflexion.net [208.70.210.18]) (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 89ACB1C49 for ; Sun, 8 Oct 2017 00:27:44 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 31093 invoked from network); 8 Oct 2017 00:27:43 -0000 Received: from unknown (HELO mail-cs-02.app.dca.reflexion.local) (10.81.19.2) by 0 (rfx-qmail) with SMTP; 8 Oct 2017 00:27:43 -0000 Received: by mail-cs-02.app.dca.reflexion.local (Reflexion email security v8.40.3) with SMTP; Sat, 07 Oct 2017 20:27:43 -0400 (EDT) Received: (qmail 15106 invoked from network); 8 Oct 2017 00:27:43 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 8 Oct 2017 00:27:43 -0000 Received: from [192.168.1.26] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id C1A9CEC8936; Sat, 7 Oct 2017 17:27:42 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: armv7, building p7zip and -fPIC From: Mark Millard In-Reply-To: <20171007214849.GB22150@lonesome.com> Date: Sat, 7 Oct 2017 17:27:42 -0700 Cc: Ian Lepore , freebsd-arm Content-Transfer-Encoding: 7bit Message-Id: <29DA467B-BD24-4E1A-B3CC-E1F4BD107DA4@dsl-only.net> References: <1507403387.86205.286.camel@freebsd.org> <20171007214849.GB22150@lonesome.com> To: Mark Linimon X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Oct 2017 00:27:46 -0000 On 2017-Oct-7, at 2:48 PM, Mark Linimon wrote: > On Sat, Oct 07, 2017 at 01:09:47PM -0600, Ian Lepore wrote: >> This is really not just an armv7-only thing, the -fPIC flag should >> always be used. > > OK, I'm going to admit some ignorance and prepare to take my beating. > > The last time I tried to pepper some -fPIC flags around without knowing > what I was doing, I was told (in no uncertain terms) that I didn't know > what I was doing. While this was true I wasn't happy with the way I was > told :-) > > So can you please provide a "-fPIC for dummies" summary? I'll add it to > the wiki. > > (In my old embedded systems days, we didn't need all this fancy stuff; > you just stuffed your statically-linked result in the 64KB EPROM and you > were done.) Here is my understanding of a recent exchange for this subject area: If any architecture needs -fPIC then then target all of them doing so. In order of priority: A) If the original materials have a defined way to cause -fPIC use that instead of explicitly using CFLAGS+= -fPIC style. B) Otherwise use CFLAGS+= -fPIC style. An example of (A) was audio/liba52 that uses (an internal?) libtool and had used libtool's -prefer-non-pic . Such is now removed via: post-patch: @${REINPLACE_CMD} '/-prefer-non-pic/d' ${WRKSRC}/configure instead of separately using CFLAGS+= -fPIC . (There was the possibility of using -prefer-pic instead. I'm unsure of the tradeoffs/distinctions vs. what was done.) The above wording does not deal with -fpic vs. -fPIC or possibly other distinctions that might sometimes be involved. === Mark Millard markmi at dsl-only.net