summaryrefslogtreecommitdiffstats
path: root/main/xen/fix_ipxe_no_pie_default.patch
blob: 3ffb5388c40a87936763ea605f82385f1b29c20b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# HG changeset patch
# Parent b60667a56ae085ee2bcea896887d0907fb86af41
ipxe: fix compilation issues with some gcc versions

Backported some changes from current ipxe, to fix a issue with some 
new versions of gcc that add -fPIC by default, and compilation fails 
with the following error:

arch/i386/core/cpu.c: In function 'get_cpuinfo':
arch/i386/include/bits/cpu.h:79:2: error: inconsistent operand 
constraints in an 'asm'
arch/i386/include/bits/cpu.h:79:2: error: inconsistent operand 
constraints in an 'asm'
arch/i386/include/bits/cpu.h:79:2: error: inconsistent operand 
constraints in an 'asm'
arch/i386/include/bits/cpu.h:79:2: error: inconsistent operand 
constraints in an 'asm'

Two patches from ipxe git have been added. The problem is reproducible 
with at least this version of gcc:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-alpine-linux-uclibc/4.6.2/lto-wrapper
Target: x86_64-alpine-linux-uclibc
Configured with: 
/home/buildozer/aports/main/gcc/src/gcc-4.6.2/configure --prefix=/usr 
--mandir=/usr/share/man --infodir=/usr/share/info 
--build=x86_64-alpine-linux-uclibc --host=x86_64-alpine-linux-uclibc 
--target=x86_64-alpine-linux-uclibc --with-pkgversion='Alpine 
4.6.2-r1' --disable-altivec --disable-checking --disable-fixed-point 
--disable-libssp --disable-libstdcxx-pch --disable-multilib 
--disable-nls --disable-werror --enable-__cxa_atexit --enable-cld 
--enable-esp --enable-cloog-backend 
--enable-languages=c,c++,objc,java,go --enable-shared 
--enable-target-optspace --enable-tls --enable-threads 
--with-dynamic-linker=ld64-uClibc.so.0.9.32 
--with-dynamic-linker-prefix=/lib --with-system-zlib 
--without-system-libunwind
Thread model: posix
gcc version 4.6.2 (Alpine 4.6.2-r1) 

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>

diff -r b60667a56ae0 tools/firmware/etherboot/patches/gpxe-git-b8924c1aed51
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/etherboot/patches/gpxe-git-b8924c1aed51	Fri Dec 16 13:48:49 2011 +0100
@@ -0,0 +1,72 @@
+commit b8924c1aed512aa40cf28a43635df383880f771d
+Author: Michael Brown <mcb30@ipxe.org>
+Date:   Wed Mar 16 19:30:42 2011 +0000
+
+    [build] Allow workaround-specific flags to override default flags
+    
+    Signed-off-by: Michael Brown <mcb30@ipxe.org>
+
+diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
+index 709f8de..78e78c9 100644
+--- a/src/Makefile.housekeeping
++++ b/src/Makefile.housekeeping
+@@ -109,6 +109,10 @@ VERYCLEANUP	+= .toolcheck
+ # Check for various tool workarounds
+ #
+ 
++WORKAROUND_CFLAGS :=
++WORKAROUND_ASFLAGS :=
++WORKAROUND_LDFLAGS :=
++
+ # Make syntax does not allow use of comma or space in certain places.
+ # This ugly workaround is suggested in the manual.
+ #
+@@ -119,7 +123,7 @@ SPACE	:= $(EMPTY) $(EMPTY)
+ # Check for an old version of gas (binutils 2.9.1)
+ #
+ OLDGAS	:= $(shell $(AS) --version | grep -q '2\.9\.1' && $(ECHO) -DGAS291)
+-CFLAGS	+= $(OLDGAS)
++WORKAROUND_CFLAGS += $(OLDGAS)
+ oldgas :
+ 	@$(ECHO) $(oldgas)
+ 
+@@ -131,7 +135,7 @@ ifeq ($(CCTYPE),gcc)
+ SP_TEST = $(CC) -fno-stack-protector -x c -c /dev/null \
+ 		-o /dev/null >/dev/null 2>&1
+ SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector')
+-CFLAGS	+= $(SP_FLAGS)
++WORKAROUND_CFLAGS += $(SP_FLAGS)
+ endif
+ 
+ # gcc 4.4 generates .eh_frame sections by default, which distort the
+@@ -141,7 +145,7 @@ ifeq ($(CCTYPE),gcc)
+ CFI_TEST = $(CC) -fno-dwarf2-cfi-asm -x c -c /dev/null \
+ 		 -o /dev/null >/dev/null 2>&1
+ CFI_FLAGS := $(shell $(CFI_TEST) && $(ECHO) '-fno-dwarf2-cfi-asm')
+-CFLAGS	+= $(CFI_FLAGS)
++WORKAROUND_CFLAGS += $(CFI_FLAGS)
+ endif
+ 
+ # Some versions of gas choke on division operators, treating them as
+@@ -150,7 +154,7 @@ endif
+ #
+ DIVIDE_TEST = $(AS) --divide /dev/null -o /dev/null 2>/dev/null
+ DIVIDE_FLAGS := $(shell $(DIVIDE_TEST) && $(ECHO) '--divide')
+-ASFLAGS	+= $(DIVIDE_FLAGS)
++WORKAROUND_ASFLAGS += $(DIVIDE_FLAGS)
+ 
+ ###############################################################################
+ #
+@@ -375,9 +379,9 @@ CFLAGS		+= -diag-disable 1419 # Missing prototypes
+ CFLAGS		+= -diag-disable 1599 # Hidden variables
+ CFLAGS		+= -Wall -Wmissing-declarations
+ endif
+-CFLAGS		+= $(EXTRA_CFLAGS)
+-ASFLAGS		+= $(EXTRA_ASFLAGS)
+-LDFLAGS		+= $(EXTRA_LDFLAGS)
++CFLAGS		+= $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)
++ASFLAGS		+= $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS)
++LDFLAGS		+= $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS)
+ 
+ # Inhibit -Werror if NO_WERROR is specified on make command line
+ #
diff -r b60667a56ae0 tools/firmware/etherboot/patches/gpxe-git-fe61f6de0dd5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/etherboot/patches/gpxe-git-fe61f6de0dd5	Fri Dec 16 13:48:49 2011 +0100
@@ -0,0 +1,32 @@
+commit fe61f6de0dd5d39ac3de5e8e18742f9bd0aafad7
+Author: Gilles Espinasse <g.esp@free.fr>
+Date:   Tue Mar 29 15:30:11 2011 +0100
+
+    [build] Fix compilation when gcc is patched to default to -fPIE -Wl,-pie
+    
+    Signed-off-by: Gilles Espinasse <g.esp@free.fr>
+    Modified-by: Michael Brown <mcb30@ipxe.org>
+    Signed-off-by: Michael Brown <mcb30@ipxe.org>
+
+diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
+index 57e52c0..c184351 100644
+--- a/src/Makefile.housekeeping
++++ b/src/Makefile.housekeeping
+@@ -138,6 +138,17 @@ SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector')
+ WORKAROUND_CFLAGS += $(SP_FLAGS)
+ endif
+ 
++# Some widespread patched versions of gcc include -fPIE -Wl,-pie by
++# default.  Note that gcc will exit *successfully* if it fails to
++# recognise an option that starts with "no", so we have to test for
++# 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')
++WORKAROUND_CFLAGS += $(PIE_FLAGS)
++endif
++
+ # gcc 4.4 generates .eh_frame sections by default, which distort the
+ # output of "size".  Inhibit this.
+ #
diff -r b60667a56ae0 tools/firmware/etherboot/patches/series
--- a/tools/firmware/etherboot/patches/series	Fri Dec 16 10:47:18 2011 +0100
+++ b/tools/firmware/etherboot/patches/series	Fri Dec 16 13:48:49 2011 +0100
@@ -1,3 +1,5 @@
 boot_prompt_option.patch
 gpxe-git-0edf2405b457
 gpxe-git-a803ef3dfeac
+gpxe-git-b8924c1aed51
+gpxe-git-fe61f6de0dd5