[ipxe-devel] [PATCH 1/1] [build] Fix no-PIE workaround for i386 builds
Michael Brown
mcb30 at ipxe.org
Fri Apr 24 16:41:11 UTC 2015
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 -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.)
Michael
More information about the ipxe-devel
mailing list