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