Sync reproducible builds patches with 17.05.x
[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/27512/
12 Forwarded: yes
13 Author: Luca Boccassi <luca.boccassi@gmail.com>
14 Last-Update: 2017-08-10
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_eal/linuxapp/eal/Makefile |  8 +++++++-
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, 173 insertions(+), 32 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_eal/linuxapp/eal/Makefile
97 +++ b/lib/librte_eal/linuxapp/eal/Makefile
98 @@ -41,7 +41,13 @@ LIBABIVER := 3
99  
100  VPATH += $(RTE_SDK)/lib/librte_eal/common
101  
102 -CFLAGS += -I$(SRCDIR)/include
103 +# Include the source dir first, so that headers paths are always picked
104 +# from there. By including it last race conditions might happen during paralle
105 +# builds, and headers might be already installed in RTE_OUT/include when the
106 +# variable is recursively expanded, thus causing GCC to sometimes use the
107 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
108 +# reproducible.
109 +CFLAGS := -I$(SRCDIR)/include $(CFLAGS)
110  CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
111  CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include
112  CFLAGS += $(WERROR_FLAGS) -O3
113 --- a/lib/librte_hash/Makefile
114 +++ b/lib/librte_hash/Makefile
115 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
116  # library name
117  LIB = librte_hash.a
118  
119 -CFLAGS += -O3
120 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
121 +# Include the source dir first, so that headers paths are always picked
122 +# from there. By including it last race conditions might happen during paralle
123 +# builds, and headers might be already installed in RTE_OUT/include when the
124 +# variable is recursively expanded, thus causing GCC to sometimes use the
125 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
126 +# reproducible.
127 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
128 +CFLAGS += $(WERROR_FLAGS) -O3
129  
130  EXPORT_MAP := rte_hash_version.map
131  
132 --- a/lib/librte_ip_frag/Makefile
133 +++ b/lib/librte_ip_frag/Makefile
134 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
135  # library name
136  LIB = librte_ip_frag.a
137  
138 -CFLAGS += -O3
139 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
140 +# Include the source dir first, so that headers paths are always picked
141 +# from there. By including it last race conditions might happen during paralle
142 +# builds, and headers might be already installed in RTE_OUT/include when the
143 +# variable is recursively expanded, thus causing GCC to sometimes use the
144 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
145 +# reproducible.
146 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
147 +CFLAGS += $(WERROR_FLAGS) -O3
148  
149  EXPORT_MAP := rte_ipfrag_version.map
150  
151 --- a/lib/librte_jobstats/Makefile
152 +++ b/lib/librte_jobstats/Makefile
153 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
154  # library name
155  LIB = librte_jobstats.a
156  
157 -CFLAGS += -O3
158 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
159 +# Include the source dir first, so that headers paths are always picked
160 +# from there. By including it last race conditions might happen during paralle
161 +# builds, and headers might be already installed in RTE_OUT/include when the
162 +# variable is recursively expanded, thus causing GCC to sometimes use the
163 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
164 +# reproducible.
165 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
166 +CFLAGS += $(WERROR_FLAGS) -O3
167  
168  EXPORT_MAP := rte_jobstats_version.map
169  
170 --- a/lib/librte_kni/Makefile
171 +++ b/lib/librte_kni/Makefile
172 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
173  # library name
174  LIB = librte_kni.a
175  
176 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
177 +# Include the source dir first, so that headers paths are always picked
178 +# from there. By including it last race conditions might happen during paralle
179 +# builds, and headers might be already installed in RTE_OUT/include when the
180 +# variable is recursively expanded, thus causing GCC to sometimes use the
181 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
182 +# reproducible.
183 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
184 +CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
185  
186  EXPORT_MAP := rte_kni_version.map
187  
188 --- a/lib/librte_kvargs/Makefile
189 +++ b/lib/librte_kvargs/Makefile
190 @@ -36,7 +36,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
191  # library name
192  LIB = librte_kvargs.a
193  
194 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
195 +# Include the source dir first, so that headers paths are always picked
196 +# from there. By including it last race conditions might happen during paralle
197 +# builds, and headers might be already installed in RTE_OUT/include when the
198 +# variable is recursively expanded, thus causing GCC to sometimes use the
199 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
200 +# reproducible.
201 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
202 +CFLAGS += $(WERROR_FLAGS) -O3
203  
204  EXPORT_MAP := rte_kvargs_version.map
205  
206 --- a/lib/librte_lpm/Makefile
207 +++ b/lib/librte_lpm/Makefile
208 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
209  # library name
210  LIB = librte_lpm.a
211  
212 -CFLAGS += -O3
213 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
214 +# Include the source dir first, so that headers paths are always picked
215 +# from there. By including it last race conditions might happen during paralle
216 +# builds, and headers might be already installed in RTE_OUT/include when the
217 +# variable is recursively expanded, thus causing GCC to sometimes use the
218 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
219 +# reproducible.
220 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
221 +CFLAGS += $(WERROR_FLAGS) -O3
222  
223  EXPORT_MAP := rte_lpm_version.map
224  
225 --- a/lib/librte_mbuf/Makefile
226 +++ b/lib/librte_mbuf/Makefile
227 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
228  # library name
229  LIB = librte_mbuf.a
230  
231 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
232 +# Include the source dir first, so that headers paths are always picked
233 +# from there. By including it last race conditions might happen during paralle
234 +# builds, and headers might be already installed in RTE_OUT/include when the
235 +# variable is recursively expanded, thus causing GCC to sometimes use the
236 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
237 +# reproducible.
238 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
239 +CFLAGS += $(WERROR_FLAGS) -O3
240  
241  EXPORT_MAP := rte_mbuf_version.map
242  
243 --- a/lib/librte_mempool/Makefile
244 +++ b/lib/librte_mempool/Makefile
245 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
246  # library name
247  LIB = librte_mempool.a
248  
249 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
250 +# Include the source dir first, so that headers paths are always picked
251 +# from there. By including it last race conditions might happen during paralle
252 +# builds, and headers might be already installed in RTE_OUT/include when the
253 +# variable is recursively expanded, thus causing GCC to sometimes use the
254 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
255 +# reproducible.
256 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
257 +CFLAGS += $(WERROR_FLAGS) -O3
258  
259  EXPORT_MAP := rte_mempool_version.map
260  
261 --- a/lib/librte_net/Makefile
262 +++ b/lib/librte_net/Makefile
263 @@ -33,7 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
264  
265  LIB = librte_net.a
266  
267 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
268 +# Include the source dir first, so that headers paths are always picked
269 +# from there. By including it last race conditions might happen during paralle
270 +# builds, and headers might be already installed in RTE_OUT/include when the
271 +# variable is recursively expanded, thus causing GCC to sometimes use the
272 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
273 +# reproducible.
274 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
275 +CFLAGS += $(WERROR_FLAGS) -O3
276  
277  EXPORT_MAP := rte_net_version.map
278  LIBABIVER := 1
279 --- a/lib/librte_pdump/Makefile
280 +++ b/lib/librte_pdump/Makefile
281 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
282  # library name
283  LIB = librte_pdump.a
284  
285 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
286 -CFLAGS += -D_GNU_SOURCE
287 +# Include the source dir first, so that headers paths are always picked
288 +# from there. By including it last race conditions might happen during paralle
289 +# builds, and headers might be already installed in RTE_OUT/include when the
290 +# variable is recursively expanded, thus causing GCC to sometimes use the
291 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
292 +# reproducible.
293 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
294 +CFLAGS += $(WERROR_FLAGS) -O3 -D_GNU_SOURCE
295  LDLIBS += -lpthread
296  
297  EXPORT_MAP := rte_pdump_version.map
298 --- a/lib/librte_power/Makefile
299 +++ b/lib/librte_power/Makefile
300 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
301  # library name
302  LIB = librte_power.a
303  
304 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
305 +# Include the source dir first, so that headers paths are always picked
306 +# from there. By including it last race conditions might happen during paralle
307 +# builds, and headers might be already installed in RTE_OUT/include when the
308 +# variable is recursively expanded, thus causing GCC to sometimes use the
309 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
310 +# reproducible.
311 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
312 +CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
313  
314  EXPORT_MAP := rte_power_version.map
315  
316 --- a/lib/librte_reorder/Makefile
317 +++ b/lib/librte_reorder/Makefile
318 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
319  # library name
320  LIB = librte_reorder.a
321  
322 -CFLAGS += -O3
323 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
324 +# Include the source dir first, so that headers paths are always picked
325 +# from there. By including it last race conditions might happen during paralle
326 +# builds, and headers might be already installed in RTE_OUT/include when the
327 +# variable is recursively expanded, thus causing GCC to sometimes use the
328 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
329 +# reproducible.
330 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
331 +CFLAGS += $(WERROR_FLAGS) -O3
332  
333  EXPORT_MAP := rte_reorder_version.map
334  
335 --- a/lib/librte_ring/Makefile
336 +++ b/lib/librte_ring/Makefile
337 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
338  # library name
339  LIB = librte_ring.a
340  
341 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
342 +# Include the source dir first, so that headers paths are always picked
343 +# from there. By including it last race conditions might happen during paralle
344 +# builds, and headers might be already installed in RTE_OUT/include when the
345 +# variable is recursively expanded, thus causing GCC to sometimes use the
346 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
347 +# reproducible.
348 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
349 +CFLAGS += $(WERROR_FLAGS) -O3
350  
351  EXPORT_MAP := rte_ring_version.map
352  
353 --- a/lib/librte_timer/Makefile
354 +++ b/lib/librte_timer/Makefile
355 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
356  # library name
357  LIB = librte_timer.a
358  
359 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
360 +# Include the source dir first, so that headers paths are always picked
361 +# from there. By including it last race conditions might happen during parallel
362 +# builds, and headers might be already installed in RTE_OUT/include when the
363 +# variable is recursively expanded, thus causing GCC to sometimes use the
364 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
365 +# reproducible.
366 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
367 +CFLAGS += $(WERROR_FLAGS) -O3
368  
369  EXPORT_MAP := rte_timer_version.map
370  
371 --- a/lib/librte_vhost/Makefile
372 +++ b/lib/librte_vhost/Makefile
373 @@ -38,7 +38,14 @@ EXPORT_MAP := rte_vhost_version.map
374  
375  LIBABIVER := 3
376  
377 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
378 +# Include the source dir first, so that headers paths are always picked
379 +# from there. By including it last race conditions might happen during parallel
380 +# builds, and headers might be already installed in RTE_OUT/include when the
381 +# variable is recursively expanded, thus causing GCC to sometimes use the
382 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
383 +# reproducible.
384 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
385 +CFLAGS += $(WERROR_FLAGS) -O3 -D_FILE_OFFSET_BITS=64
386  CFLAGS += -I vhost_user
387  LDLIBS += -lpthread
388