https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116642

--- Comment #19 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Joshua from comment #18)
> I stand corrected. I removed -pie.
> 
> The resulting output binary is still relocatable in memory. I don't think
> the Kernel is willing to load an ELF binary at address 0, and that's the
> only other option with this header. (I ran hexdump on the binary to verify)

Because they've configured --enable-default-pie so -pie is the default.  Taking
it out or not shouldn't make a difference.  With a GCC 14 configured
--enable-default-pie (also --enable-default-ssp so I had to add
-fno-stack-protector):

$ gcc -o nutty1 -Wall -Wl,-T,minipie.ld -Wl,--no-dynamic-linker  -nostdlib
-nostartfiles -O3 -s -fpic -fno-asynchronous-unwind-tables -ffreestanding
package.s nutty.i  -fno-stack-protector -fpie
$ gcc -o nutty0 -Wall -Wl,-T,minipie.ld -Wl,--no-dynamic-linker  -nostdlib
-nostartfiles -O3 -s -fpic -fno-asynchronous-unwind-tables -ffreestanding
package.s nutty.i  -fno-stack-protector
$ diff nutty0 nutty1 && echo same
same

So if something's changed just by taking out -pie, it really seems a Debian bug
(they are doing A LOT OF strange things to their GCC build).

Reply via email to