[ipxe-devel] gcc defaults to pie ?

Michael Brown mcb30 at ipxe.org
Wed Jan 31 17:17:40 UTC 2018


On 31/01/18 17:05, Joakim Tjernlund wrote:
> On Thu, 1970-01-01 at 00:00 +0000, Michael Brown wrote:
>> There's logic within arch/i386/Makefile which is supposed to autodetect
>> compilers that do this and specify the appropriate combination of "do
>> not use PIE" options.  We may need to expand this to handle whatever
>> Gentoo has done.
> 
> Does that apply to every file that is built? arch/i386/Makefile feel specific for
> i386.

It applies to every file built for the (standard) i386 BIOS build.

To hit an error relating to "code model kernel" I think you must be 
trying to build for the x86_64-pcbios platform, since that's the only 
place I can find that we use an explicit -mcmodel=kernel.

The x86_64-pcbios platform is fairly obscure: it produces code that runs 
in 64-bit long mode but using 16-bit BIOS calls for console I/O and 
providing 16-bit real-mode entry points for PXE NBPs.  You only really 
need this platform if you are going to end up with your PCI BARs 
allocated above 4GB.

>> There's similar logic in Makefile.housekeeping to disable
>> -fstack-protector if needed.
> 
> I see that, should Makefile.housekeeping include -U_FORTIFY_SOURCE then?

I don't think so.  The FORTIFY_SOURCE macro will be completely ignored 
by all of the iPXE source files, and there are no external libraries 
linked in anyway.

> Also, ATM one cannot pass flags into ipxe due to:
> CFLAGS		:=
> can it be changed to
> CFLAGS		?=

You can use EXTRA_CFLAGS to insert additional flags.  These will be 
placed after CFLAGS, which makes it possible to use EXTRA_CFLAGS to 
override Makefile-generated flags.

Michael



More information about the ipxe-devel mailing list