Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20171221020342.GX1627@brightrain.aerifal.cx>
Date: Wed, 20 Dec 2017 21:03:42 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: musl-cross-make: how to build target libraries with -fpic

On Thu, Dec 21, 2017 at 09:51:21AM +1100, Patrick Oppenlander wrote:
> Hi,
> 
> what is the the right way to build a toolchain with PIC libraries?
> 
> The best I've come up with is to add
> 
> GCC_CONFIG_FOR_TARGET = CFLAGS_FOR_TARGET="-g -O2 -fpic"
> MUSL_CONFIG = CFLAGS="-fpic"
> 
> to my config. But that seems a little over complicated.
> 
> Is there a recommended/better way?

Are you specifically trying to get -fpic instead of -fPIC? As far as I
know, -fPIC is the default for all of the gcc target libraries anyway;
if not all, at least for libgcc (parts of which normally get linked
into most shared libraries and thus need to be pic). If you build gcc
with --enable-default-pie, musl libc.a will also end up as PIC by
default.

Aside from that, the above should work, but you should probably be
using GCC_CONFIG, not GCC_CONFIG_FOR_TARGET. The latter is intended
for the makefiles and your config.mak to automatically build based on
$(TARGET) to meet the ABI requirements of the target you specified,
and replacing it will definitely break some targets.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.