This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: how to compile glibc with -fPIC?
- From: Ian Lance Taylor <iant at google dot com>
- To: CNZhangQuan <cnzhangquan at gmail dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 7 Oct 2013 10:20:31 -0700
- Subject: Re: how to compile glibc with -fPIC?
- Authentication-results: sourceware.org; auth=none
- References: <CACdxSLkW0bf+7x-XRFyaf0RT+OSeOHEqfpXapgrWrYsqpDLucg at mail dot gmail dot com>
On Sun, Oct 6, 2013 at 11:50 PM, CNZhangQuan <cnzhangquan@gmail.com> wrote:
>
> i want to build a 'static toolchain', with option --disable-shared,
> for no shared library include/depend in the toolchain-self
>
> cause i don't want the target binary runs depend on the toolchain,
> such as libc.so, ld-xxx.so.
>
>
> but when the target binary need the function dlopen, it give a build
> error that libc.a need to recompile with -fPIC
>
>
> so, how to compile glibc with -fPIC?
You will need to ask the glibc developers. This is the GCC help list,
not the glibc list, and different people work on the different
projects. When writing to the glibc list you should explain how you
managed to compile glibc *without* -fPIC.
> or maybe i should ask is it possible to gen a shared library with
> static toolchain?
Yes, it is. To say a "static toolchain" effectively just means using
different defaults. In fact you could probably do what you want with
just a minor edit of gcc/gcc.c to add -static to LINK_COMMAND_SPEC.
Although you would only want to add it if some option (perhaps
--no-static?) where not present.
Ian