blob: 9824b61e91cfd592efe78cb283e42a1783ec5332 [file] [log] [blame]
Brad Bishop2eeb5252018-09-10 18:40:16 +00001From aee098f1bf0511c6b5544de3170a9e8b51673b60 Mon Sep 17 00:00:00 2001
2From: Pierre Le Magourou <plemagourou@softbankrobotics.com>
3Date: Tue, 23 Jan 2018 15:25:50 +0100
4Subject: [PATCH] linux.gcc: Fix cross compilation error.
5
6When cross compiling on linux with gcc, the host gcc was used instead of
7the cross gcc to set compilation flags according to gcc version.
8
9When the cross gcc was in version 5.X and the host gcc in version 7.X,
10tbb was compiled with the -flifetime-dse=1 flag that does not exist on
11gcc 5.X.
12---
13 build/linux.gcc.inc | 10 +++++-----
14 1 file changed, 5 insertions(+), 5 deletions(-)
15
16diff --git a/build/linux.gcc.inc b/build/linux.gcc.inc
17index 5c1889c..a4d6698 100644
18--- a/build/linux.gcc.inc
19+++ b/build/linux.gcc.inc
20@@ -41,29 +41,29 @@ LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
21 C_FLAGS = $(CPLUS_FLAGS)
22
23 # gcc 4.2 and higher support OpenMP
24-ifneq (,$(shell gcc -dumpversion | egrep "^(4\.[2-9]|[5-9])"))
25+ifneq (,$(shell $(CC) -dumpversion | egrep "^(4\.[2-9]|[5-9])"))
26 OPENMP_FLAG = -fopenmp
27 endif
28
29 # gcc 4.8 and later support RTM intrinsics, but require command line switch to enable them
30-ifneq (,$(shell gcc -dumpversion | egrep "^(4\.[8-9]|[5-9])"))
31+ifneq (,$(shell $(CC) -dumpversion | egrep "^(4\.[8-9]|[5-9])"))
32 RTM_KEY = -mrtm
33 endif
34
35 # gcc 4.0 and later have -Wextra that is used by some our customers.
36-ifneq (,$(shell gcc -dumpversion | egrep "^([4-9])"))
37+ifneq (,$(shell $(CC) -dumpversion | egrep "^([4-9])"))
38 TEST_WARNING_KEY += -Wextra
39 endif
40
41 # gcc 5.0 and later have -Wsuggest-override option
42 # enable it via a pre-included header in order to limit to C++11 and above
43-ifneq (,$(shell gcc -dumpversion | egrep "^([5-9])"))
44+ifneq (,$(shell $(CC) -dumpversion | egrep "^([5-9])"))
45 INCLUDE_TEST_HEADERS = -include $(tbb_root)/src/test/harness_preload.h
46 endif
47
48 # gcc 6.0 and later have -flifetime-dse option that controls
49 # elimination of stores done outside the object lifetime
50-ifneq (,$(shell gcc -dumpversion | egrep "^([6-9])"))
51+ifneq (,$(shell $(CC) -dumpversion | egrep "^([6-9])"))
52 # keep pre-contruction stores for zero initialization
53 DSE_KEY = -flifetime-dse=1
54 endif
55--
562.15.1
57