[ipxe-devel] [PATCH 1/1] [build] Fix no-PIE workaround for i386 builds

Christian Hesse list at eworm.de
Wed Feb 24 08:29:21 UTC 2016


Christian Hesse <list at eworm.de> on Fri, 2015/04/24 19:23:
> Michael Brown <mcb30 at ipxe.org> on Fri, 2015/04/24 17:41:
> > On 08/04/15 09:13, Christian Hesse wrote:  
> > > diff --git a/src/arch/i386/Makefile b/src/arch/i386/Makefile
> > > index 99f8753..897081b 100644
> > > --- a/src/arch/i386/Makefile
> > > +++ b/src/arch/i386/Makefile
> > > @@ -75,8 +75,8 @@ CFLAGS			+= -Ui386
> > >   # output on stderr instead of checking the exit status.
> > >   #
> > >   ifeq ($(CCTYPE),gcc)
> > > -PIE_TEST = [ -z "`$(CC) -fno-PIE -nopie -x c -c /dev/null
> > > -o /dev/null  
> > > 2>&1`" ] -PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE
> > > 2>-nopie')  
> > > +PIE_TEST = $(CC) -dM -E - < /dev/null | grep -q '__PIE__'
> > > +PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE')
> > >   WORKAROUND_CFLAGS += $(PIE_FLAGS)
> > >   endif  
> > 
> > The original fix (in http://git.ipxe.org/ipxe.git/commitdiff/fe61f6d) 
> > added both -fno-PIE and -nopie if it detected that the workaround was 
> > necessary: the -fno-PIE is for compilation and the -nopie is to instruct 
> > gcc to not pass "-pie" to the linker (i.e. not to default to -Wl,-pie).
> > 
> > Since we (I think) always invoke the linker directly via $(LD), it's 
> > plausible that the -nopie was never needed.  Is this the case?  (I don't 
> > have any systems on which the workaround is necessary, so can't test 
> > this for myself.)  
> 
> The problem is that gcc does not know the command option -nopie here:
> 
> % gcc -fno-PIE -nopie -x c -c /dev/null -o /dev/null
> gcc: error: unrecognized command line option ‘-nopie’
> % echo $?
> 1
> 
> So the check always fails and the workaround is never applied.

Any news about this one? Still having trouble with the PIE stuff.
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20160224/b231043c/attachment.sig>


More information about the ipxe-devel mailing list