Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Oct 2017 17:27:42 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        Mark Linimon <linimon@lonesome.com>
Cc:        Ian Lepore <ian@freebsd.org>, freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: armv7, building p7zip and -fPIC
Message-ID:  <29DA467B-BD24-4E1A-B3CC-E1F4BD107DA4@dsl-only.net>
In-Reply-To: <20171007214849.GB22150@lonesome.com>
References:  <CAC67Hz8kctZyTEW%2B0qQRVYLzPEK7cG9JXhw90fwHx84fnuwO0w@mail.gmail.com> <CANCZdfo-1ngKQSkkW5zjZwMWj0QnVnrf2WaJ68=bh_oNPKZ3hw@mail.gmail.com> <CAC67Hz8RxH%2BNd0dPbn4qstpFJEkoFWkKpTQ81sX6K3NUuYPDtA@mail.gmail.com> <1507403387.86205.286.camel@freebsd.org> <20171007214849.GB22150@lonesome.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 2017-Oct-7, at 2:48 PM, Mark Linimon <linimon@lonesome.com> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?29DA467B-BD24-4E1A-B3CC-E1F4BD107DA4>