]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/dpdk/mk/toolchain/gcc/rte.toolchain-compat.mk
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / dpdk / mk / toolchain / gcc / rte.toolchain-compat.mk
CommitLineData
11fdf7f2
TL
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2010-2014 Intel Corporation
7c673cae
FG
3
4#
5# CPUID-related options
6#
7# This was added to support compiler versions which might not support all the
8# flags we need
9#
10
11#find out GCC version
12
13GCC_MAJOR = $(shell echo __GNUC__ | $(CC) -E -x c - | tail -n 1)
14GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
11fdf7f2 15GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(CC) -E -x c - | tail -n 1)
7c673cae
FG
16GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR)
17
11fdf7f2
TL
18HOST_GCC_MAJOR = $(shell echo __GNUC__ | $(HOSTCC) -E -x c - | tail -n 1)
19HOST_GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(HOSTCC) -E -x c - | tail -n 1)
20HOST_GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(HOSTCC) -E -x c - | tail -n 1)
21HOST_GCC_VERSION = $(HOST_GCC_MAJOR)$(HOST_GCC_MINOR)
22
9f95a23c
TL
23LD_VERSION = $(shell $(LD) -v)
24# disable AVX512F support for GCC & binutils 2.30 as a workaround for Bug 97
25ifeq ($(CONFIG_RTE_ARCH_X86), y)
26ifneq ($(filter 2.30%,$(LD_VERSION)),)
27FORCE_DISABLE_AVX512 := y
28# print warning only once for librte_eal
29ifneq ($(filter %librte_eal,$(CURDIR)),)
30$(warning AVX512 support disabled because of binutils 2.30. See Bug 97)
31endif
32endif
33ifneq ($(filter 2.31%,$(LD_VERSION)),)
34FORCE_DISABLE_AVX512 := y
35# print warning only once for librte_eal
36ifneq ($(filter %librte_eal,$(CURDIR)),)
37$(warning AVX512 support disabled because of binutils 2.31. See Bug 249)
38endif
39endif
40endif
41
7c673cae
FG
42# if GCC is older than 4.x
43ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1)
44 MACHINE_CFLAGS =
45$(warning You are using GCC < 4.x. This is neither supported, nor tested.)
46
47
48else
49# GCC graceful degradation
50# GCC 4.2.x - added support for generic target
51# GCC 4.3.x - added support for core2, ssse3, sse4.1, sse4.2
52# GCC 4.4.x - added support for avx, aes, pclmul
53# GCC 4.5.x - added support for atom
54# GCC 4.6.x - added support for corei7, corei7-avx
55# GCC 4.7.x - added support for fsgsbase, rdrnd, f16c, core-avx-i, core-avx2
56# GCC 4.9.x - added support for armv8-a+crc
57#
58 ifeq ($(shell test $(GCC_VERSION) -le 49 && echo 1), 1)
59 MACHINE_CFLAGS := $(patsubst -march=armv8-a+crc,-march=armv8-a+crc -D__ARM_FEATURE_CRC32=1,$(MACHINE_CFLAGS))
11fdf7f2 60 MACHINE_CFLAGS := $(patsubst -march=armv8-a+crc+crypto,-march=armv8-a+crc+crypto -D__ARM_FEATURE_CRC32=1,$(MACHINE_CFLAGS))
7c673cae
FG
61 endif
62 ifeq ($(shell test $(GCC_VERSION) -le 47 && echo 1), 1)
63 MACHINE_CFLAGS := $(patsubst -march=core-avx-i,-march=corei7-avx,$(MACHINE_CFLAGS))
64 MACHINE_CFLAGS := $(patsubst -march=core-avx2,-march=core-avx2,$(MACHINE_CFLAGS))
65 endif
66 ifeq ($(shell test $(GCC_VERSION) -lt 46 && echo 1), 1)
67 MACHINE_CFLAGS := $(patsubst -march=corei7-avx,-march=core2 -maes -mpclmul -mavx,$(MACHINE_CFLAGS))
68 MACHINE_CFLAGS := $(patsubst -march=corei7,-march=core2 -maes -mpclmul,$(MACHINE_CFLAGS))
69 endif
70 ifeq ($(shell test $(GCC_VERSION) -lt 45 && echo 1), 1)
71 MACHINE_CFLAGS := $(patsubst -march=atom,-march=core2 -mssse3,$(MACHINE_CFLAGS))
72 endif
73 ifeq ($(shell test $(GCC_VERSION) -lt 44 && echo 1), 1)
74 MACHINE_CFLAGS := $(filter-out -mavx -mpclmul -maes,$(MACHINE_CFLAGS))
75 ifneq ($(findstring SSE4_2, $(CPUFLAGS)),)
76 MACHINE_CFLAGS += -msse4.2
77 endif
78 ifneq ($(findstring SSE4_1, $(CPUFLAGS)),)
79 MACHINE_CFLAGS += -msse4.1
80 endif
81 endif
82 ifeq ($(shell test $(GCC_VERSION) -lt 43 && echo 1), 1)
83 MACHINE_CFLAGS := $(filter-out -msse% -mssse%,$(MACHINE_CFLAGS))
84 MACHINE_CFLAGS := $(patsubst -march=core2,-march=generic,$(MACHINE_CFLAGS))
85 MACHINE_CFLAGS += -msse3
86 endif
87 ifeq ($(shell test $(GCC_VERSION) -lt 42 && echo 1), 1)
88 MACHINE_CFLAGS := $(filter-out -march% -mtune% -msse%,$(MACHINE_CFLAGS))
89 endif
11fdf7f2
TL
90
91 # Disable thunderx PMD for gcc < 4.7
92 ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
93 CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=d
94 endif
95
96 # Disable OPDL PMD for gcc < 4.7
97 ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
98 CONFIG_RTE_LIBRTE_PMD_OPDL_EVENTDEV=d
99 endif
100
9f95a23c
TL
101 # Disable octeontx event PMD for gcc < 4.8.6 & ARCH=arm64
102 ifeq ($(CONFIG_RTE_ARCH), arm64)
11fdf7f2
TL
103 ifeq ($(shell test $(GCC_VERSION)$(GCC_PATCHLEVEL) -lt 486 && echo 1), 1)
104 CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF=d
105 CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL=d
106 CONFIG_RTE_LIBRTE_OCTEONTX_PMD=d
107 endif
9f95a23c 108 endif
11fdf7f2 109
7c673cae 110endif