On Wed, Apr 10, 2019 at 7:49 AM Andy Lutomirski <l...@kernel.org> wrote: > And build it like this, it fails: > > $ gcc -o ingo -g ingo.c -pie > /usr/bin/ld: /tmp/ccofYU9N.o: relocation R_X86_64_32 against `.rodata' > can not be used when making a PIE object; recompile with -fPIC > /usr/bin/ld: final link failed: nonrepresentable section on output > collect2: error: ld returned 1 exit status > > Which I assume means that -pie requires -fPIC, and your toolchain is > screwed up and is defaulting to useless options. I'm guessing you > should file a bug against your distro gcc package. For me, it works > if I remove -pie.
I think you need both -fPIE (object creation) and -pie (linking). -- Kees Cook