Gilles Espinasse
2011-Mar-29 12:12 UTC
[syslinux] [PATCH] Fix gpxe compilation when gcc is patched to compile by default with -fPIE -Wl, -pie
Signed-off-by: Gilles Espinasse <g.esp at free.fr> --- gpxe/src/Makefile.housekeeping | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/gpxe/src/Makefile.housekeeping b/gpxe/src/Makefile.housekeeping index 1f5e115..d49416e 100644 --- a/gpxe/src/Makefile.housekeeping +++ b/gpxe/src/Makefile.housekeeping @@ -134,6 +134,16 @@ SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector') CFLAGS += $(SP_FLAGS) endif +# Some widespread patched versions of gcc include -fPIE -Wl,-pie by +# default. gpxe does not support pie code in get_cpuinfo. +# +ifeq ($(CCTYPE),gcc) +PIE_TEST = $(CC) -fno-PIE -nopie -x c -c /dev/null \ + -o /dev/null >/dev/null 2>&1 +PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE -nopie') +CFLAGS += $(PIE_FLAGS) +endif + # gcc 4.4 generates .eh_frame sections by default, which distort the # output of "size". Inhibit this. # -- 1.7.3.4
Michael Brown
2011-Mar-29 14:40 UTC
[syslinux] [PATCH] Fix gpxe compilation when gcc is patched to compile by default with -fPIE -Wl, -pie
On Tuesday 29 Mar 2011 13:12:31 Gilles Espinasse wrote:> +# Some widespread patched versions of gcc include -fPIE -Wl,-pie by > +# default. gpxe does not support pie code in get_cpuinfo. > +# > +ifeq ($(CCTYPE),gcc) > +PIE_TEST = $(CC) -fno-PIE -nopie -x c -c /dev/null \ > + -o /dev/null >/dev/null 2>&1 > +PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE -nopie') > +CFLAGS += $(PIE_FLAGS) > +endif > +Applied to upstream iPXE, with modifications to fix building on unaffected systems: http://git.ipxe.org/ipxe.git/commitdiff/fe61f6d Many thanks! Michael
Seemingly Similar Threads
- [PATCH] Fix compilation when gcc is patched to default to -fPIE -Wl, -pie
- Last call for 4.05
- [LLVMdev] Clang predefined macros with -fPIC and -fPIE
- [LLVMdev] Unable to call a function in GDB when build with -fPIE
- How does -fPIE get passed from clang to llc when run on a .ll file?