[ipxe-devel] gcc defaults to pie ?

Joakim Tjernlund Joakim.Tjernlund at infinera.com
Wed Jan 31 17:12:46 UTC 2018


On Thu, 1970-01-01 at 00:00 +0000, Joakim Tjernlund wrote:
> On Thu, 1970-01-01 at 00:00 +0000, Michael Brown wrote:
> > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > 
> > 
> > On 31/01/18 16:35, Joakim Tjernlund wrote:
> > > On Gentoo gcc 6 defaults to PIE and that generates and ton of
> > >   error: code model kernel does not support PIC mode
> > > 
> > > Throwing in a general -fno-pie does not seem to be the right fix either.
> > > Maybe iPXE should start specifying -fno-pie where needed?
> > 
> > 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.
> 
> I don't see how these tests are applied though.

Moving 
ifeq ($(CCTYPE),gcc)
PIE_TEST = [ -z "`$(CC) -fno-PIE -no-pie -x c -c /dev/null -o /dev/null 2>&1`" ]
PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE -no-pie')
PIE_TEST2 = [ -z "`$(CC) -fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1`" ]
PIE_FLAGS2 := $(shell $(PIE_TEST2) && $(ECHO) '-fno-PIE -nopie')
WORKAROUND_CFLAGS += $(PIE_FLAGS) $(PIE_FLAGS2)
endif

from arch/i386/Makefile to Makefile.housekeeping makes iPXE build

 Jocke


More information about the ipxe-devel mailing list