Add patch to fix order of CFLAGS and drop dropped patch
[deb_dpdk.git] / debian / patches / mk-order-CFLAGS-so-that-ISCDIR-comes-before-IRTE_OUT.patch
1 Description: mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS
2
3 A race condition can happen during parallel builds, where a header
4 might be installed in RTE_OUT/include before CFLAGS is recursively
5 expanded. This causes GCC to sometimes pick the header path as
6 SRCDIR/... and sometimes as RTE_OUT/include/... making the build
7 unreproducible, as the full path is used for the expansion of
8 __FILE__ and in the DWARF directory listing.
9 Always pass -ISRCDIR first to CFLAGS so that it's deterministic.
10
11 Origin: http://dpdk.org/dev/patchwork/patch/25866/
12 Forwarded: yes
13 Author: Luca Boccassi <luca.boccassi@gmail.com>
14 Last-Update: 2017-06-28
15 ---
16  lib/librte_acl/Makefile          | 10 ++++++++--
17  lib/librte_bitratestats/Makefile |  9 ++++++++-
18  lib/librte_cmdline/Makefile      |  9 ++++++++-
19  lib/librte_distributor/Makefile  | 10 ++++++++--
20  lib/librte_efd/Makefile          | 10 ++++++++--
21  lib/librte_hash/Makefile         | 10 ++++++++--
22  lib/librte_ip_frag/Makefile      | 10 ++++++++--
23  lib/librte_jobstats/Makefile     | 10 ++++++++--
24  lib/librte_kni/Makefile          |  9 ++++++++-
25  lib/librte_kvargs/Makefile       |  9 ++++++++-
26  lib/librte_latencystats/Makefile |  9 ++++++++-
27  lib/librte_lpm/Makefile          | 10 ++++++++--
28  lib/librte_mbuf/Makefile         |  9 ++++++++-
29  lib/librte_mempool/Makefile      |  9 ++++++++-
30  lib/librte_metrics/Makefile      |  9 ++++++++-
31  lib/librte_net/Makefile          |  9 ++++++++-
32  lib/librte_pdump/Makefile        | 10 ++++++++--
33  lib/librte_power/Makefile        |  9 ++++++++-
34  lib/librte_reorder/Makefile      | 10 ++++++++--
35  lib/librte_ring/Makefile         |  9 ++++++++-
36  lib/librte_timer/Makefile        |  9 ++++++++-
37  lib/librte_vhost/Makefile        |  9 ++++++++-
38  22 files changed, 176 insertions(+), 31 deletions(-)
39
40 --- a/lib/librte_acl/Makefile
41 +++ b/lib/librte_acl/Makefile
42 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
43  # library name
44  LIB = librte_acl.a
45  
46 -CFLAGS += -O3
47 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
48 +# Include the source dir first, so that headers paths are always picked
49 +# from there. By including it last race conditions might happen during paralle
50 +# builds, and headers might be already installed in RTE_OUT/include when the
51 +# variable is recursively expanded, thus causing GCC to sometimes use the
52 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
53 +# reproducible.
54 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
55 +CFLAGS += $(WERROR_FLAGS) -O3
56  
57  EXPORT_MAP := rte_acl_version.map
58  
59 --- a/lib/librte_cmdline/Makefile
60 +++ b/lib/librte_cmdline/Makefile
61 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
62  # library name
63  LIB = librte_cmdline.a
64  
65 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
66 +# Include the source dir first, so that headers paths are always picked
67 +# from there. By including it last race conditions might happen during paralle
68 +# builds, and headers might be already installed in RTE_OUT/include when the
69 +# variable is recursively expanded, thus causing GCC to sometimes use the
70 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
71 +# reproducible.
72 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
73 +CFLAGS += $(WERROR_FLAGS) -O3
74  
75  EXPORT_MAP := rte_cmdline_version.map
76  
77 --- a/lib/librte_distributor/Makefile
78 +++ b/lib/librte_distributor/Makefile
79 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
80  # library name
81  LIB = librte_distributor.a
82  
83 -CFLAGS += -O3
84 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
85 +# Include the source dir first, so that headers paths are always picked
86 +# from there. By including it last race conditions might happen during paralle
87 +# builds, and headers might be already installed in RTE_OUT/include when the
88 +# variable is recursively expanded, thus causing GCC to sometimes use the
89 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
90 +# reproducible.
91 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
92 +CFLAGS += $(WERROR_FLAGS) -O3
93  
94  EXPORT_MAP := rte_distributor_version.map
95  
96 --- a/lib/librte_hash/Makefile
97 +++ b/lib/librte_hash/Makefile
98 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
99  # library name
100  LIB = librte_hash.a
101  
102 -CFLAGS += -O3
103 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
104 +# Include the source dir first, so that headers paths are always picked
105 +# from there. By including it last race conditions might happen during paralle
106 +# builds, and headers might be already installed in RTE_OUT/include when the
107 +# variable is recursively expanded, thus causing GCC to sometimes use the
108 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
109 +# reproducible.
110 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
111 +CFLAGS += $(WERROR_FLAGS) -O3
112  
113  EXPORT_MAP := rte_hash_version.map
114  
115 --- a/lib/librte_ip_frag/Makefile
116 +++ b/lib/librte_ip_frag/Makefile
117 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
118  # library name
119  LIB = librte_ip_frag.a
120  
121 -CFLAGS += -O3
122 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
123 +# Include the source dir first, so that headers paths are always picked
124 +# from there. By including it last race conditions might happen during paralle
125 +# builds, and headers might be already installed in RTE_OUT/include when the
126 +# variable is recursively expanded, thus causing GCC to sometimes use the
127 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
128 +# reproducible.
129 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
130 +CFLAGS += $(WERROR_FLAGS) -O3
131  
132  EXPORT_MAP := rte_ipfrag_version.map
133  
134 --- a/lib/librte_jobstats/Makefile
135 +++ b/lib/librte_jobstats/Makefile
136 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
137  # library name
138  LIB = librte_jobstats.a
139  
140 -CFLAGS += -O3
141 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
142 +# Include the source dir first, so that headers paths are always picked
143 +# from there. By including it last race conditions might happen during paralle
144 +# builds, and headers might be already installed in RTE_OUT/include when the
145 +# variable is recursively expanded, thus causing GCC to sometimes use the
146 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
147 +# reproducible.
148 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
149 +CFLAGS += $(WERROR_FLAGS) -O3
150  
151  EXPORT_MAP := rte_jobstats_version.map
152  
153 --- a/lib/librte_kni/Makefile
154 +++ b/lib/librte_kni/Makefile
155 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
156  # library name
157  LIB = librte_kni.a
158  
159 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
160 +# Include the source dir first, so that headers paths are always picked
161 +# from there. By including it last race conditions might happen during paralle
162 +# builds, and headers might be already installed in RTE_OUT/include when the
163 +# variable is recursively expanded, thus causing GCC to sometimes use the
164 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
165 +# reproducible.
166 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
167 +CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
168  
169  EXPORT_MAP := rte_kni_version.map
170  
171 --- a/lib/librte_kvargs/Makefile
172 +++ b/lib/librte_kvargs/Makefile
173 @@ -36,7 +36,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
174  # library name
175  LIB = librte_kvargs.a
176  
177 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
178 +# Include the source dir first, so that headers paths are always picked
179 +# from there. By including it last race conditions might happen during paralle
180 +# builds, and headers might be already installed in RTE_OUT/include when the
181 +# variable is recursively expanded, thus causing GCC to sometimes use the
182 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
183 +# reproducible.
184 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
185 +CFLAGS += $(WERROR_FLAGS) -O3
186  
187  EXPORT_MAP := rte_kvargs_version.map
188  
189 --- a/lib/librte_lpm/Makefile
190 +++ b/lib/librte_lpm/Makefile
191 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
192  # library name
193  LIB = librte_lpm.a
194  
195 -CFLAGS += -O3
196 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
197 +# Include the source dir first, so that headers paths are always picked
198 +# from there. By including it last race conditions might happen during paralle
199 +# builds, and headers might be already installed in RTE_OUT/include when the
200 +# variable is recursively expanded, thus causing GCC to sometimes use the
201 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
202 +# reproducible.
203 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
204 +CFLAGS += $(WERROR_FLAGS) -O3
205  
206  EXPORT_MAP := rte_lpm_version.map
207  
208 --- a/lib/librte_mbuf/Makefile
209 +++ b/lib/librte_mbuf/Makefile
210 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
211  # library name
212  LIB = librte_mbuf.a
213  
214 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
215 +# Include the source dir first, so that headers paths are always picked
216 +# from there. By including it last race conditions might happen during paralle
217 +# builds, and headers might be already installed in RTE_OUT/include when the
218 +# variable is recursively expanded, thus causing GCC to sometimes use the
219 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
220 +# reproducible.
221 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
222 +CFLAGS += $(WERROR_FLAGS) -O3
223  
224  EXPORT_MAP := rte_mbuf_version.map
225  
226 --- a/lib/librte_mempool/Makefile
227 +++ b/lib/librte_mempool/Makefile
228 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
229  # library name
230  LIB = librte_mempool.a
231  
232 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
233 +# Include the source dir first, so that headers paths are always picked
234 +# from there. By including it last race conditions might happen during paralle
235 +# builds, and headers might be already installed in RTE_OUT/include when the
236 +# variable is recursively expanded, thus causing GCC to sometimes use the
237 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
238 +# reproducible.
239 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
240 +CFLAGS += $(WERROR_FLAGS) -O3
241  
242  EXPORT_MAP := rte_mempool_version.map
243  
244 --- a/lib/librte_net/Makefile
245 +++ b/lib/librte_net/Makefile
246 @@ -33,7 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
247  
248  LIB = librte_net.a
249  
250 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
251 +# Include the source dir first, so that headers paths are always picked
252 +# from there. By including it last race conditions might happen during paralle
253 +# builds, and headers might be already installed in RTE_OUT/include when the
254 +# variable is recursively expanded, thus causing GCC to sometimes use the
255 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
256 +# reproducible.
257 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
258 +CFLAGS += $(WERROR_FLAGS) -O3
259  
260  EXPORT_MAP := rte_net_version.map
261  LIBABIVER := 1
262 --- a/lib/librte_pdump/Makefile
263 +++ b/lib/librte_pdump/Makefile
264 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
265  # library name
266  LIB = librte_pdump.a
267  
268 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
269 -CFLAGS += -D_GNU_SOURCE
270 +# Include the source dir first, so that headers paths are always picked
271 +# from there. By including it last race conditions might happen during paralle
272 +# builds, and headers might be already installed in RTE_OUT/include when the
273 +# variable is recursively expanded, thus causing GCC to sometimes use the
274 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
275 +# reproducible.
276 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
277 +CFLAGS += $(WERROR_FLAGS) -O3 -D_GNU_SOURCE
278  LDLIBS += -lpthread
279  
280  EXPORT_MAP := rte_pdump_version.map
281 --- a/lib/librte_power/Makefile
282 +++ b/lib/librte_power/Makefile
283 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
284  # library name
285  LIB = librte_power.a
286  
287 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
288 +# Include the source dir first, so that headers paths are always picked
289 +# from there. By including it last race conditions might happen during paralle
290 +# builds, and headers might be already installed in RTE_OUT/include when the
291 +# variable is recursively expanded, thus causing GCC to sometimes use the
292 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
293 +# reproducible.
294 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
295 +CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
296  
297  EXPORT_MAP := rte_power_version.map
298  
299 --- a/lib/librte_reorder/Makefile
300 +++ b/lib/librte_reorder/Makefile
301 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
302  # library name
303  LIB = librte_reorder.a
304  
305 -CFLAGS += -O3
306 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
307 +# Include the source dir first, so that headers paths are always picked
308 +# from there. By including it last race conditions might happen during paralle
309 +# builds, and headers might be already installed in RTE_OUT/include when the
310 +# variable is recursively expanded, thus causing GCC to sometimes use the
311 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
312 +# reproducible.
313 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
314 +CFLAGS += $(WERROR_FLAGS) -O3
315  
316  EXPORT_MAP := rte_reorder_version.map
317  
318 --- a/lib/librte_ring/Makefile
319 +++ b/lib/librte_ring/Makefile
320 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
321  # library name
322  LIB = librte_ring.a
323  
324 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
325 +# Include the source dir first, so that headers paths are always picked
326 +# from there. By including it last race conditions might happen during paralle
327 +# builds, and headers might be already installed in RTE_OUT/include when the
328 +# variable is recursively expanded, thus causing GCC to sometimes use the
329 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
330 +# reproducible.
331 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
332 +CFLAGS += $(WERROR_FLAGS) -O3
333  
334  EXPORT_MAP := rte_ring_version.map
335  
336 --- a/lib/librte_timer/Makefile
337 +++ b/lib/librte_timer/Makefile
338 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
339  # library name
340  LIB = librte_timer.a
341  
342 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
343 +# Include the source dir first, so that headers paths are always picked
344 +# from there. By including it last race conditions might happen during parallel
345 +# builds, and headers might be already installed in RTE_OUT/include when the
346 +# variable is recursively expanded, thus causing GCC to sometimes use the
347 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
348 +# reproducible.
349 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
350 +CFLAGS += $(WERROR_FLAGS) -O3
351  
352  EXPORT_MAP := rte_timer_version.map
353  
354 --- a/lib/librte_vhost/Makefile
355 +++ b/lib/librte_vhost/Makefile
356 @@ -38,7 +38,14 @@ EXPORT_MAP := rte_vhost_version.map
357  
358  LIBABIVER := 3
359  
360 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
361 +# Include the source dir first, so that headers paths are always picked
362 +# from there. By including it last race conditions might happen during parallel
363 +# builds, and headers might be already installed in RTE_OUT/include when the
364 +# variable is recursively expanded, thus causing GCC to sometimes use the
365 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
366 +# reproducible.
367 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
368 +CFLAGS += $(WERROR_FLAGS) -O3 -D_FILE_OFFSET_BITS=64
369  CFLAGS += -I vhost_user
370  LDLIBS += -lpthread
371