mailing list of musl libc
 help / color / mirror / code / Atom feed
* musl-cross-make: how to build target libraries with -fpic
@ 2017-12-20 22:51 Patrick Oppenlander
  2017-12-21  2:03 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Oppenlander @ 2017-12-20 22:51 UTC (permalink / raw)
  To: musl

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?

Patrick


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: musl-cross-make: how to build target libraries with -fpic
  2017-12-20 22:51 musl-cross-make: how to build target libraries with -fpic Patrick Oppenlander
@ 2017-12-21  2:03 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2017-12-21  2:03 UTC (permalink / raw)
  To: musl

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-21  2:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-20 22:51 musl-cross-make: how to build target libraries with -fpic Patrick Oppenlander
2017-12-21  2:03 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).