[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: static pie: confusion between _DYNAMIC, crt1.o, Scrt1.o



* Samuel Thibault:

> Florian Weimer, le lun. 24 oct. 2022 12:11:03 +0200, a ecrit:
>> * Samuel Thibault:
>> 
>> > Is it not possible to make -static -pie get the same behavior? That'd be
>> > way more orthogonal for people to understand.
>> 
>> I think you want -static to mean -static-pie if GCC defaults to PIE,
>> right?
>
> That would actually provide the pie benefit automatically for all
> static executable, yes. Otherwise static pie will be a nice thing, but
> not actually largely used in practice. And most people won't actually
> realize it.

That's true.

Fedora uses a specs file fragment that turns -static into -static-pie
under certain conditions.

>> That will break a few things that use gcc -static to build binaries for
>> quasi-bare-metal targets using the GNU ELF toolchain (where glibc's
>> startup code is not use).
>
> But then the piece which is saying that glibc's startup code is not in
> use can be fixed into not using static-pie, can't it?

In theory, yes.  How hard it will be depends on the specs file change
for --enable-default-pie.

Thanks,
Florian


Reply to: