armv7, building p7zip and -fPIC

Mark Millard markmi at dsl-only.net
Sun Oct 8 00:27:46 UTC 2017


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



More information about the freebsd-arm mailing list