[dpdk-dev,v2] net/octeontx: use stub for building in old compilers

Message ID 20180126064016.9966-1-pbhagavatula@caviumnetworks.com (mailing list archive)
State Rejected, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Pavan Nikhilesh Jan. 26, 2018, 6:40 a.m. UTC
  Use stub for building clang < 4.0 as it doesn't support the following
arm machine directives:

.cpu

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---

 v2 Changes:
 - use stub for older clang compilers instead of disabling PMD

 drivers/net/octeontx/Makefile           | 8 ++++++++
 drivers/net/octeontx/base/octeontx_io.h | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

--
2.16.0
  

Comments

Jerin Jacob Jan. 26, 2018, 7:20 a.m. UTC | #1
-----Original Message-----
> Date: Fri, 26 Jan 2018 12:10:16 +0530
> From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com,
>  ferruh.yigit@intel.com
> Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH v2] net/octeontx: use stub for building in old
>  compilers
> X-Mailer: git-send-email 2.14.1
> 
> Use stub for building clang < 4.0 as it doesn't support the following
> arm machine directives:
> 
> .cpu
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
> 
>  v2 Changes:
>  - use stub for older clang compilers instead of disabling PMD
> 
>  drivers/net/octeontx/Makefile           | 8 ++++++++
>  drivers/net/octeontx/base/octeontx_io.h | 2 +-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/octeontx/Makefile b/drivers/net/octeontx/Makefile
> index b47bf7a40..5244eedd3 100644
> --- a/drivers/net/octeontx/Makefile
> +++ b/drivers/net/octeontx/Makefile
> @@ -30,6 +30,14 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx_pkivf.c
>  SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx_bgx.c
>  SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx_ethdev.c
> 
> +ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
> +
> +ifeq ($(shell test $(CLANG_MAJOR_VERSION)$(CLANG_MINOR_VERSION) -lt 40 && echo 1), 1)
> +CFLAGS += -D CLANG_BUILD_BUG
> +endif
> +
> +endif
> +
>  ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
>  CFLAGS_octeontx_rxtx.o += -fno-prefetch-loop-arrays
> 
> diff --git a/drivers/net/octeontx/base/octeontx_io.h b/drivers/net/octeontx/base/octeontx_io.h
> index d51ded236..1c0a941a5 100644
> --- a/drivers/net/octeontx/base/octeontx_io.h
> +++ b/drivers/net/octeontx/base/octeontx_io.h
> @@ -51,7 +51,7 @@ do {							\
>  } while (0)
>  #endif
> 
> -#if defined(RTE_ARCH_ARM64)
> +#if defined(RTE_ARCH_ARM64) && !defined(CLANG_BUILD_BUG)

It will build silently and break while running the PMD.

I think, We should disable building the PMD if dependencies are not meet.
Instead of building something that known to not work.


>  /**
>   * Perform an atomic fetch-and-add operation.
>   */
> --
> 2.16.0
>
  

Patch

diff --git a/drivers/net/octeontx/Makefile b/drivers/net/octeontx/Makefile
index b47bf7a40..5244eedd3 100644
--- a/drivers/net/octeontx/Makefile
+++ b/drivers/net/octeontx/Makefile
@@ -30,6 +30,14 @@  SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx_pkivf.c
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx_bgx.c
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx_ethdev.c

+ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y)
+
+ifeq ($(shell test $(CLANG_MAJOR_VERSION)$(CLANG_MINOR_VERSION) -lt 40 && echo 1), 1)
+CFLAGS += -D CLANG_BUILD_BUG
+endif
+
+endif
+
 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
 CFLAGS_octeontx_rxtx.o += -fno-prefetch-loop-arrays

diff --git a/drivers/net/octeontx/base/octeontx_io.h b/drivers/net/octeontx/base/octeontx_io.h
index d51ded236..1c0a941a5 100644
--- a/drivers/net/octeontx/base/octeontx_io.h
+++ b/drivers/net/octeontx/base/octeontx_io.h
@@ -51,7 +51,7 @@  do {							\
 } while (0)
 #endif

-#if defined(RTE_ARCH_ARM64)
+#if defined(RTE_ARCH_ARM64) && !defined(CLANG_BUILD_BUG)
 /**
  * Perform an atomic fetch-and-add operation.
  */