This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: -static-pie support in 8.1
- From: Alexander Monakov <amonakov at ispras dot ru>
- To: Dmitry Vyukov <dvyukov at google dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sun, 13 May 2018 19:34:33 +0300 (MSK)
- Subject: Re: -static-pie support in 8.1
- References: <CACT4Y+a3r=5vPdas0+UnT_QpROmicVkywZSwKBQ6tNaqauuFyg@mail.gmail.com>
On Sun, 13 May 2018, Dmitry Vyukov via gcc-help wrote:
> Hello,
>
> I want to build statically-lined pie binaries, a-la -static + -pie, no
> dependency on dynamic libraries + loading at random addresses. I see
> that this does not work per se as -static overrides -pie. I see that
> gcc 8.1 has -static-pie which looks like what I want. But it fails for
> me with:
>
> $ gcc-8.1.0/bin/gcc test.c -fPIE -static-pie
> /usr/bin/ld: cannot find rcrt1.o: No such file or directory
> collect2: error: ld returned 1 exit status
>
> Is there some magic configure flag? Or anything else I am missing?
> There are no files rcrt1.o in gcc-8.1.0 installation. For configure I used:
rcrt1.o needs to be provided by the libc, not the compiler; on Linux, musl
provides it since a few releases, and the latest release of Glibc (2.27) does too.
Alexander