Clang compilation support on FreeBSD and Linux
cover Clang compilation support on FreeBSD and Linux
This patch set enables clang compilation on FreeBSD and Linux. It includes patches to fix a number of compilation errors thrown up by clang, and then adds in the appropriate toolchain makefiles and compile-time configurations.
This set has been tested with clang v3.3 on FreeBSD 10 and clang v3.4 on Fedora linux 20. The example apps folder has not been tested at this time, this patch set only focuses on the core libraries and apps.
Bruce Richardson (6):
pmd_bond: add missing variable initialization
Makefiles: add clang to compiler if/else block
mk: Ensure correct detection of SSE4.2 on FreeBSD
acl: add nmmintrin.h header to allow clang compilation
mk: add toolchain for clang and linuxapp target
config: add compile target for clang on BSD
config/defconfig_x86_64-native-bsdapp-clang | 71 ++++++++++++++++++++++++ config/defconfig_x86_64-native-linuxapp-clang | 63 ++++++++++++++++++++++ lib/librte_acl/acl_bld.c | 1 + lib/librte_pmd_bond/rte_eth_bond_pmd.c | 2 +- lib/librte_pmd_i40e/Makefile | 9 ++++ lib/librte_pmd_ixgbe/Makefile | 7 +++ lib/librte_pmd_vmxnet3/Makefile | 7 +++ mk/machine/native/rte.vars.mk | 12 +++++ mk/toolchain/clang/rte.toolchain-compat.mk | 43 +++++++++++++++ mk/toolchain/clang/rte.vars.mk | 77 +++++++++++++++++++++++++++ 10 files changed, 291 insertions(+), 1 deletion(-) create mode 100644 config/defconfig_x86_64-native-bsdapp-clang create mode 100644 config/defconfig_x86_64-native-linuxapp-clang create mode 100644 mk/toolchain/clang/rte.toolchain-compat.mk create mode 100644 mk/toolchain/clang/rte.vars.mk
Signature · 1 line
1.9.3
A message that is not in the archive (sent off-list or not yet received): 1404776219-6130-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
PATCH 1/6 pmd_bond: add missing variable initialization
Variable "valid_slave" wasn't getting properly zero-initialized. This error is flagged by clang on compile.
--- lib/librte_pmd_bond/rte_eth_bond_pmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_pmd_bond/rte_eth_bond_pmd.c +1 -1
@@ -920,7 +920,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,struct bond_dev_private *internals;struct rte_eth_link link; -int i, bonded_port_id, valid_slave, active_pos =-1 ; +int i, bonded_port_id, valid_slave =0 , active_pos =-1 ;if (type !=RTE_ETH_EVENT_INTR_LSC )return ;
Signature · 1 line
1.9.3
PATCH 2/6 Makefiles: add clang to compiler if/else block
In reply to a message not in the archiveThe makefiles for a number of drivers conditionally disable certain warnings depending on the compiler and version used. Add in clang to the list of compiler options.
--- lib/librte_pmd_i40e/Makefile | 9 +++++++++ lib/librte_pmd_ixgbe/Makefile | 7 +++++++ lib/librte_pmd_vmxnet3/Makefile | 7 +++++++ 3 files changed, 23 insertions(+)
lib/librte_pmd_i40e/Makefile +9 -0
@@ -45,6 +45,15 @@ CFLAGS += $(WERROR_FLAGS) # ifeq ($(CC), icc) CFLAGS_BASE_DRIVER = -wd593 +else ifeq ($(CC), clang) +CFLAGS_BASE_DRIVER += -Wno-sign-compare +CFLAGS_BASE_DRIVER += -Wno-unused-value +CFLAGS_BASE_DRIVER += -Wno-unused-parameter +CFLAGS_BASE_DRIVER += -Wno-strict-aliasing +CFLAGS_BASE_DRIVER += -Wno-format +CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers +CFLAGS_BASE_DRIVER += -Wno-pointer-to-int-cast +CFLAGS_BASE_DRIVER += -Wno-format-nonliteral else CFLAGS_BASE_DRIVER = -Wno-unused-but-set-variable CFLAGS_BASE_DRIVER += -Wno-sign-compare
lib/librte_pmd_ixgbe/Makefile +7 -0
@@ -44,6 +44,13 @@ ifeq ($(CC), icc) # CFLAGS for icc # CFLAGS_BASE_DRIVER = -wd174 -wd593 -wd869 -wd981 -wd2259 +else ifeq ($(CC), clang) +# +# CFLAGS for clang +# +CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value +CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args + else # # CFLAGS for gcc
lib/librte_pmd_vmxnet3/Makefile +7 -0
@@ -44,6 +44,13 @@ ifeq ($(CC), icc) # CFLAGS for icc # CFLAGS_BASE_DRIVER = -wd174 -wd593 -wd869 -wd981 -wd2259 +else ifeq ($(CC), clang) +# +# CFLAGS for clang +# +CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value +CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args + else # # CFLAGS for gcc
Signature · 1 line
1.9.3
PATCH 3/6 mk: Ensure correct detection of SSE4.2 on FreeBSD
In reply to a message not in the archiveAdd a special case to the native target makefile, where we check if -march=native shows SSE4.2 support. If it does not, then not everything may build, so we check if the hardware supports SSE4.2, and use a corei7 target explicitly to get the SSE4.2 support.
--- mk/machine/native/rte.vars.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+)
mk/machine/native/rte.vars.mk +12 -0
@@ -56,3 +56,15 @@ # CPU_ASFLAGS = MACHINE_CFLAGS = -march=native + +# on FreeBSD systems, sometimes the correct cputype is not picked up. +# To get everything to compile, we need SSE4.2 support, so check if that is +# reported by compiler. If not, check if the CPU actually supports it, and if +# so, set the compilation target to be a corei7, minimum target with SSE4.2 +SSE42_SUPPORT=$(shell $(CC) -march=native -dM -E - < /dev/null | grep SSE4_2) +ifeq ($(SSE42_SUPPORT),) + CPU_SSE42_SUPPORT=$(shell if [ -f /var/run/dmesg.boot ] ; then grep SSE4\.2 /var/run/dmesg.boot ; fi) + ifneq ($(CPU_SSE42_SUPPORT),) + MACHINE_CFLAGS= -march=corei7 + endif +endif
Signature · 1 line
1.9.3
A message that is not in the archive (sent off-list or not yet received): 1404776219-6130-4-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH 3/6] mk: Ensure correct detection of SSE4.2 on FreeBSD
Hi Bruce,
2014-07-08 00:36, Bruce Richardson:
Quoted 4 lines
Add a special case to the native target makefile, where we check if -march=native shows SSE4.2 support. If it does not, then not everything may build, so we check if the hardware supports SSE4.2, and use a corei7 target explicitly to get the SSE4.2 support.
[...]
mk/machine/native/rte.vars.mk line 70
Quoted 13 lines
MACHINE_CFLAGS= -march=nativemk/machine/native/rte.vars.mk +12
-0+ +# on FreeBSD systems, sometimes the correct cputype is not picked up. +# To get everything to compile, we need SSE4.2 support, so check if that is +# reported by compiler. If not, check if the CPU actually supports it, and if +# so, set the compilation target to be a corei7, minimum target with SSE4.2 +SSE42_SUPPORT=$(shell $(CC) -march=native -dM -E - < /dev/null | grep SSE4_2) +ifeq ($(SSE42_SUPPORT),) + CPU_SSE42_SUPPORT=$(shell if [ -f /var/run/dmesg.boot ] ; then grep SSE4\.2 /var/run/dmesg.boot ; fi) + ifneq ($(CPU_SSE42_SUPPORT),) + MACHINE_CFLAGS= -march=corei7 + endif +endif
What do you think of this change?
- CPU_SSE42_SUPPORT=$(shell if [ -f /var/run/dmesg.boot ] ; then grep SSE4\.2 /var/run/dmesg.boot ; fi)
+ CPU_SSE42_SUPPORT = $(shell grep SSE4\.2 /var/run/dmesg.boot 2>/dev/null)
It's simpler and should produce the same result.
If you agree, I'll change it before applying.
Thanks
Signature · 1 line
Thomas
Re: [PATCH 3/6] mk: Ensure correct detection of SSE4.2 on FreeBSD
Quoted 26 lines · Thomas Monjalon
Hi Bruce,
2014-07-08 00:36, Bruce Richardson:
Quoted 4 lines
Add a special case to the native target makefile, where we check if -march=native shows SSE4.2 support. If it does not, then not everything may build, so we check if the hardware supports SSE4.2, and use a corei7 target explicitly to get the SSE4.2 support.
[...]
mk/machine/native/rte.vars.mk line 70
Quoted 13 lines
MACHINE_CFLAGS= -march=nativemk/machine/native/rte.vars.mk +12
-0+ +# on FreeBSD systems, sometimes the correct cputype is not picked up. +# To get everything to compile, we need SSE4.2 support, so check if that is +# reported by compiler. If not, check if the CPU actually supports it, and if +# so, set the compilation target to be a corei7, minimum target with SSE4.2 +SSE42_SUPPORT=$(shell $(CC) -march=native -dM -E - < /dev/null | grep SSE4_2) +ifeq ($(SSE42_SUPPORT),) + CPU_SSE42_SUPPORT=$(shell if [ -f /var/run/dmesg.boot ] ; then grep SSE4\.2 /var/run/dmesg.boot ; fi) + ifneq ($(CPU_SSE42_SUPPORT),) + MACHINE_CFLAGS= -march=corei7 + endif +endifWhat do you think of this change?
(quoted diff) +1
-1- CPU_SSE42_SUPPORT=$(shell if [ -f /var/run/dmesg.boot ] ; then grep SSE4\.2 /var/run/dmesg.boot ; fi) + CPU_SSE42_SUPPORT = $(shell grep SSE4\.2 /var/run/dmesg.boot 2>/dev/null)
Quoted 3 lines
It's simpler and should produce the same result.
If you agree, I'll change it before applying.
I'm going to do up a second version of this patch to also re-enable the ACL compile on BSD - as you pointed out in your other mail, so I'll include this change in a rev 2. That ok?
/Bruce
Re: [PATCH 3/6] mk: Ensure correct detection of SSE4.2 on FreeBSD
In reply to a message not in the archive2014-07-08 00:36, Bruce Richardson:
Quoted 4 lines
Add a special case to the native target makefile, where we check if -march=native shows SSE4.2 support. If it does not, then not everything may build, so we check if the hardware supports SSE4.2, and use a corei7 target explicitly to get the SSE4.2 support.
Now that SSE4.2 support is better detected, can we remove these lines from defconfig_x86_64-native-bsdapp-gcc?
-#
-# GCC doesn't detect SSE4.x support correctly on BSD, so disable ACL lib -#
-CONFIG_RTE_LIBRTE_ACL=n
Signature · 1 line
Thomas
Re: [PATCH 3/6] mk: Ensure correct detection of SSE4.2 on FreeBSD
Quoted 17 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Thursday, July 17, 2014 3:26 AM
To: Richardson, Bruce
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH 3/6] mk: Ensure correct detection of SSE4.2 on FreeBSD2014-07-08 00:36, Bruce Richardson:
Quoted 4 lines
Add a special case to the native target makefile, where we check if -march=native shows SSE4.2 support. If it does not, then not everything may build, so we check if the hardware supports SSE4.2, and use a corei7 target explicitly to get the SSE4.2 support.
Now that SSE4.2 support is better detected, can we remove these lines from defconfig_x86_64-native-bsdapp-gcc?
Review
Quoted 6 lines
(quoted diff) +0
-5-# -# GCC doesn't detect SSE4.x support correctly on BSD, so disable ACL lib -# -CONFIG_RTE_LIBRTE_ACL=n --
Good point, I'll check that out.
/Bruce
PATCH v2 3/6 mk: Ensure correct detection of SSE4.2 on FreeBSD
In reply to a message not in the archiveAdd a special case to the native target makefile, where we check if -march=native shows SSE4.2 support. If it does not, then not everything may build, so we check if the hardware supports SSE4.2, and use a corei7 target explicitly to get the SSE4.2 support.
New in V2:
* Re-enable ACL library for FreeBSD using gcc, which requires SSE4.2
* Adjust SSE42 detection command based on feedback from Thomas Monjalon
--- config/defconfig_x86_64-native-bsdapp-gcc | 5 ----- mk/machine/native/rte.vars.mk | 12 ++++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-)
config/defconfig_x86_64-native-bsdapp-gcc +0 -5
@@ -69,8 +69,3 @@ CONFIG_RTE_ARCH_X86_64=y # CONFIG_RTE_TOOLCHAIN="gcc" CONFIG_RTE_TOOLCHAIN_GCC=y - -# -# GCC doesn't detect SSE4.x support correctly on BSD, so disable ACL lib -# -CONFIG_RTE_LIBRTE_ACL=n
mk/machine/native/rte.vars.mk +12 -0
@@ -56,3 +56,15 @@ # CPU_ASFLAGS = MACHINE_CFLAGS = -march=native + +# on FreeBSD systems, sometimes the correct cputype is not picked up. +# To get everything to compile, we need SSE4.2 support, so check if that is +# reported by compiler. If not, check if the CPU actually supports it, and if +# so, set the compilation target to be a corei7, minimum target with SSE4.2 +SSE42_SUPPORT=$(shell $(CC) -march=native -dM -E - < /dev/null | grep SSE4_2) +ifeq ($(SSE42_SUPPORT),) + CPU_SSE42_SUPPORT=$(shell grep SSE4\.2 /var/run/dmesg.boot 2>/dev/null) + ifneq ($(CPU_SSE42_SUPPORT),) + MACHINE_CFLAGS= -march=corei7 + endif +endif
Signature · 1 line
2.0.0
PATCH 4/6 acl: add nmmintrin.h header to allow clang compilation
In reply to a message not in the archiveClang compile fails without nmmintrin.h being explicitly included.
--- lib/librte_acl/acl_bld.c | 1 + 1 file changed, 1 insertion(+)
lib/librte_acl/acl_bld.c +1 -0
@@ -31,6 +31,7 @@* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <nmmintrin.h> #include <rte_acl.h> #include "tb_mem.h" #include "acl.h"
Signature · 1 line
1.9.3
PATCH 5/6 mk: add toolchain for clang and linuxapp target
In reply to a message not in the archiveAdd support for clang by adding a toolchain folder for it with the appropriate files.
Add compilation support for clang on linux by adding a new target.
--- config/defconfig_x86_64-native-linuxapp-clang | 63 ++++++++++++++++++++++ mk/toolchain/clang/rte.toolchain-compat.mk | 43 +++++++++++++++ mk/toolchain/clang/rte.vars.mk | 77 +++++++++++++++++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 config/defconfig_x86_64-native-linuxapp-clang create mode 100644 mk/toolchain/clang/rte.toolchain-compat.mk create mode 100644 mk/toolchain/clang/rte.vars.mk
config/defconfig_x86_64-native-linuxapp-clang new file +63 -0
@@ -0,0 +1,63 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +#include "common_linuxapp" + +# +# machine can define specific variables or action for a specific board +# RTE_MACHINE can be: +# default nothing specific +# native current machine +# atm Intel® Atom™ microarchitecture +# nhm Intel® microarchitecture code name Nehalem +# wsm Intel® microarchitecture code name Westmere +# snb Intel® microarchitecture code name Sandy Bridge +# ivb Intel® microarchitecture code name Ivy Bridge +# +# Note: if your compiler does not support the relevant -march options, +# it will be compiled with whatever latest processor the compiler supports! +# +CONFIG_RTE_MACHINE="native" + +# +# define the architecture we compile for. +# CONFIG_RTE_ARCH can be i686, x86_64, x86_64_32 +# +CONFIG_RTE_ARCH="x86_64" +CONFIG_RTE_ARCH_X86_64=y + +# +# The compiler we use. +# Can be gcc or icc. +# +CONFIG_RTE_TOOLCHAIN="clang" +CONFIG_RTE_TOOLCHAIN_CLANG=y
mk/toolchain/clang/rte.toolchain-compat.mk new file +43 -0
43 lines not on this page · raw message
mk/toolchain/clang/rte.vars.mk new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
1.9.3
A message that is not in the archive (sent off-list or not yet received): 1404776219-6130-6-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH 5/6] mk: add toolchain for clang and linuxapp target
2014-07-08 00:36, Bruce Richardson:
Quoted 2 lines
mk/toolchain/clang/rte.vars.mk new file +0
-0
[...]
mk/toolchain/clang/rte.vars.mk line 47
Quoted 5 lines
mk/toolchain/clang/rte.vars.mk new file +5
-0+ifeq ($(KERNELRELEASE),) +CC = $(CROSS)clang +else +CC = $(CROSS)gcc +endif
Why not use clang for FreeBSD modules?
This page seems to encourage clang:
https://wiki.freebsd.org/BuildingFreeBSDWithClang
Signature · 1 line
Thomas
Re: [PATCH 5/6] mk: add toolchain for clang and linuxapp target
Quoted 22 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Thursday, July 17, 2014 3:23 AM
To: Richardson, Bruce
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH 5/6] mk: add toolchain for clang and linuxapp target2014-07-08 00:36, Bruce Richardson:
Quoted 2 lines
mk/toolchain/clang/rte.vars.mk new file +0
-0[...]
mk/toolchain/clang/rte.vars.mk line 47
Quoted 5 lines
mk/toolchain/clang/rte.vars.mk new file +5
-0+ifeq ($(KERNELRELEASE),) +CC = $(CROSS)clang +else +CC = $(CROSS)gcc +endifWhy not use clang for FreeBSD modules?
This page seems to encourage clang:
https://wiki.freebsd.org/BuildingFreeBSDWithClang
Quoted 1 line
--
That is an interesting one.
That branch is only really applicable for Linux. In the BSD modules makefile we explicitly unexport CC to allow the build system to use its own default. BSD 9 defaults to using gcc 4.2, and BSD 10 to clang, so this is probably the best approach, leaving the result in the hands of the user. Obviously this won't work with cross-compiling to BSD, but I don't think that is a scenario we support right now anyway.
/Bruce
PATCH 6/6 config: add compile target for clang on BSD
In reply to a message not in the archiveAdd option to compile on FreeBSD using the clang compiler, now the default compiler on FreeBSD 10.
--- config/defconfig_x86_64-native-bsdapp-clang | 71 +++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 config/defconfig_x86_64-native-bsdapp-clang
config/defconfig_x86_64-native-bsdapp-clang new file +71 -0
@@ -0,0 +1,71 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +#include "common_bsdapp" + +# +# define executive environment +# +# CONFIG_RTE_EXEC_ENV can be linuxapp, baremetal, bsdapp +# +CONFIG_RTE_EXEC_ENV="bsdapp" +CONFIG_RTE_EXEC_ENV_BSDAPP=y + +# +# machine can define specific variables or action for a specific board +# RTE_MACHINE can be: +# default nothing specific +# native current machine +# atm Intel® Atom™ microarchitecture +# nhm Intel® microarchitecture code name Nehalem +# wsm Intel® microarchitecture code name Westmere +# snb Intel® microarchitecture code name Sandy Bridge +# ivb Intel® microarchitecture code name Ivy Bridge +# +# Note: if your compiler does not support the relevant -march options, +# it will be compiled with whatever latest processor the compiler supports! +# +CONFIG_RTE_MACHINE="native" + +# +# define the architecture we compile for. +# CONFIG_RTE_ARCH can be i686, x86_64, x86_64_32 +# +CONFIG_RTE_ARCH="x86_64" +CONFIG_RTE_ARCH_X86_64=y + +# +# The compiler we use. +# Can be gcc or icc. +# +CONFIG_RTE_TOOLCHAIN="clang" +CONFIG_RTE_TOOLCHAIN_CLANG=y
Signature · 1 line
1.9.3
Tested by Zhan, Zhaochen <[email protected]>
Applying these patches on the dpdk-1.7.0, we verified the compilation on FreeBSD10.0 with Clang 3.3 and Fedora20 with Clang 3.4. We also verified some simple test case (pmd, cmdline, hello_world and timer) on FreeBSD with Clang 3.3.
Quoted 45 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Tuesday, July 08, 2014 7:37 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH 0/6] Clang compilation support on FreeBSD and LinuxThis patch set enables clang compilation on FreeBSD and Linux. It includes patches to fix a number of compilation errors thrown up by clang, and then adds in the appropriate toolchain makefiles and compile-time configurations.
This set has been tested with clang v3.3 on FreeBSD 10 and clang v3.4 on Fedora linux 20. The example apps folder has not been tested at this time, this
patch set only focuses on the core libraries and apps.Bruce Richardson (6):
pmd_bond: add missing variable initialization
Makefiles: add clang to compiler if/else block
mk: Ensure correct detection of SSE4.2 on FreeBSD
acl: addnmmintrin.hheader to allow clang compilation
mk: add toolchain for clang and linuxapp target
config: add compile target for clang on BSDconfig/defconfig_x86_64-native-bsdapp-clang | 71 ++++++++++++++++++++++++ config/defconfig_x86_64-native-linuxapp-clang | 63 ++++++++++++++++++++++ lib/librte_acl/acl_bld.c | 1 + lib/librte_pmd_bond/rte_eth_bond_pmd.c | 2 +- lib/librte_pmd_i40e/Makefile | 9 ++++ lib/librte_pmd_ixgbe/Makefile | 7 +++ lib/librte_pmd_vmxnet3/Makefile | 7 +++ mk/machine/native/rte.vars.mk | 12 +++++ mk/toolchain/clang/rte.toolchain-compat.mk | 43 +++++++++++++++ mk/toolchain/clang/rte.vars.mk | 77 +++++++++++++++++++++++++++ 10 files changed, 291 insertions(+), 1 deletion(-) create mode 100644 config/defconfig_x86_64-native-bsdapp-clang create mode 100644 config/defconfig_x86_64-native-linuxapp-clang create mode 100644 mk/toolchain/clang/rte.toolchain-compat.mk create mode 100644 mk/toolchain/clang/rte.vars.mk--
1.9.3
Zhan, Zhaochen
Acked-by Zhaochen ZhanQuoted 17 lines
Quoted 9 lines
This patch set enables clang compilation on FreeBSD and Linux. It includes patches to fix a number of compilation errors thrown up by clang, and then adds in the appropriate toolchain makefiles and compile-time configurations.
This set has been tested with clang v3.3 on FreeBSD 10 and clang v3.4 on Fedora linux 20. The example apps folder has not been tested at this time, this patch set only focuses on the core libraries and apps.
Quoted 7 lines
Bruce Richardson (6):
pmd_bond: add missing variable initialization
Makefiles: add clang to compiler if/else block
mk: Ensure correct detection of SSE4.2 on FreeBSD
acl: addnmmintrin.hheader to allow clang compilation
mk: add toolchain for clang and linuxapp target
config: add compile target for clang on BSD
Quoted 6 lines
We verified the compilation on FreeBSD 10.0 with Clang 3.3 and Fedora 20 with Clang 3.4.
We also verified some simple test cases (pmd, cmdline,hello_worldand timer) on FreeBSD with Clang 3.3.
2014-07-08 00:36, Bruce Richardson:
Quoted 8 lines
This patch set enables clang compilation on FreeBSD and Linux. It includes patches to fix a number of compilation errors thrown up by clang, and then adds in the appropriate toolchain makefiles and compile-time configurations.
This set has been tested with clang v3.3 on FreeBSD 10 and clang v3.4 on Fedora linux 20. The example apps folder has not been tested at this time, this patch set only focuses on the core libraries and apps.
Quoted 7 lines
Bruce Richardson (6):
pmd_bond: add missing variable initialization
Makefiles: add clang to compiler if/else block
mk: Ensure correct detection of SSE4.2 on FreeBSD
acl: addnmmintrin.hheader to allow clang compilation
mk: add toolchain for clang and linuxapp target
config: add compile target for clang on BSD
Applied with some cleanups for version 1.7.1
Thanks
Signature · 1 line
Thomas