From patchwork Tue Jul 11 21:18:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 107419 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp5401349qge; Tue, 11 Jul 2017 14:18:49 -0700 (PDT) X-Received: by 10.55.154.5 with SMTP id c5mr2311080qke.231.1499807929170; Tue, 11 Jul 2017 14:18:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499807929; cv=none; d=google.com; s=arc-20160816; b=OWWfagW5e4prtXMsL+toz79myoiHIfzidSATAebOURuinEHOZFYTyVMCQ2VGcOxBSP fVth0prR4hS1Osz8kwM9Jyc/YW6fMMQEjISIeGEdnDeIKliM1p/6rd99PrqXga7BphT/ znXRABOU5K8o7HTozz8BGiDcwxYyz0PvhcYOF+bpQ3NDesnyhN3hfbTwgykxIzGbJ5vr L0xRNZ7AModLOYxr6l9QSlvFjnrmoXmkhARlIjw0AKK/7RuDPHToWaD4yhzfNWKFdAA7 p8mcc99NtG1vjI8koKXwoMcmEzw5gmXnBxbVZ3QHbZpfP6m6zABwALFH56wL+KsXTuWk Js7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:to:from :delivered-to:arc-authentication-results; bh=CYRL97lYhmnn8CqkrVPA8+IpMpuHel1HKxHFWhp25PQ=; b=j5GhwOy++NYHJpSlj26SamjoNt4n8MpslpMcH9HRm+CaRx35qHid7FZaAldxbr/SYJ VcM+cMkQFtIm+WMK8jDpgbOGejr+NE/co6AKhhaFVhFPz0Y+Y/Qs+eGr7oWn7wjZesoU prPVAVokcDWMs90sV3Oyt3pTOMGheV0eNfFF4JFO33k2n+ea4GDIPsMjvmiUIAVL79F+ XL2aQqla9FAU8mUYgx7k7U/HUgAKO2hgk1TIYCuwcG5hy3iJkePpZ0V4mWbEazVILliE aEz88kg3mGH2G7ZAlDlbqUSY4UmpSSZgaCPv8Q+nPXI8M0fV1TvAy6g/IyYWzXAn6Rqa y0DQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id d51si397833qtb.292.2017.07.11.14.18.48; Tue, 11 Jul 2017 14:18:49 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id D793464488; Tue, 11 Jul 2017 21:18:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 868A16448C; Tue, 11 Jul 2017 21:18:22 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 7CA4A64486; Tue, 11 Jul 2017 21:18:19 +0000 (UTC) Received: from mail-oi0-f42.google.com (mail-oi0-f42.google.com [209.85.218.42]) by lists.linaro.org (Postfix) with ESMTPS id 7425E60D89 for ; Tue, 11 Jul 2017 21:18:16 +0000 (UTC) Received: by mail-oi0-f42.google.com with SMTP id 191so4101676oii.2 for ; Tue, 11 Jul 2017 14:18:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CYRL97lYhmnn8CqkrVPA8+IpMpuHel1HKxHFWhp25PQ=; b=EMJOuKDydArigX6Fm/TYw/AOKleYV/bnevLzbPMRbyXbojVcdPWYN09cKAkbh5K4ie AD6omdng2ZH1ZUD9ulYpjqJHopA1spNssm5g5S20nmktMvMWv/jft+UlTQwawLUuNcJS Qb7MAStt0o91ymaczl4DD7wgkglx8a8SQnOfPAjks/EQVVK7MdtHs0jbGO+e9YDJJro/ gyAGNNxEsXpPH+eZF4tPMEK+h/HZkViWW+pZ1OOE/rDPgv9HabtV60vQriDCGXN0/EdY Esu8EhMz6zY+6u2bBbyEqZyZwe+AAZBP1z1bvqw70pxEQy5KoQ5X91f0006ndQ9KVgg2 6K8g== X-Gm-Message-State: AIVw113+QsPyOXmkTRxP4VEdsEvSJGa/ObkbXNy+xaXV1iQKcHaGWBg0 D8mTjK7k3uoanPZ+vszYhipB X-Received: by 10.202.192.11 with SMTP id q11mr1701516oif.228.1499807895640; Tue, 11 Jul 2017 14:18:15 -0700 (PDT) Received: from localhost.localdomain (cpe-70-121-83-241.austin.res.rr.com. [70.121.83.241]) by smtp.gmail.com with ESMTPSA id x74sm720063oia.23.2017.07.11.14.18.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jul 2017 14:18:14 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 11 Jul 2017 16:18:11 -0500 Message-Id: <20170711211812.9348-1-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [lng-odp] [MONARCH_LTS PATCH 1/2] build: GCC 7 fixes X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Brian Brooks The GCC 7 series introduces changes that expose ODP compilation issues. These include case statement fall through warnings, and stricter checks on potential string overflows and other semantic analysis. Fixes: https://bugs.linaro.org/show_bug.cgi?id=3027 Signed-off-by: Brian Brooks Reviewed-by: Ola Liljedahl Reviewed-by: Honnappa Nagarahalli Signed-off-by: Bill Fischofer --- DEPENDENCIES | 5 ++-- configure.ac | 13 ++++++++++ platform/linux-generic/m4/configure.m4 | 44 ++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/DEPENDENCIES b/DEPENDENCIES index a5266c9e..e344826e 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -8,13 +8,14 @@ Prerequisites for building the OpenDataPlane (ODP) API automake autoconf + autoconf-archive libtool On Debian/Ubuntu systems: - $ sudo apt-get install automake autoconf libtool + $ sudo apt-get install automake autoconf autoconf-archive libtool On CentOS/RedHat/Fedora systems: - $ sudo yum install automake autoconf libtool + $ sudo yum install automake autoconf autoconf-archive libtool 3. Required libraries diff --git a/configure.ac b/configure.ac index 5c7ddd04..08cc375d 100644 --- a/configure.ac +++ b/configure.ac @@ -224,6 +224,19 @@ ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations -Wold-style-definition -Wpointer- ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral" ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings" ODP_CFLAGS="$ODP_CFLAGS -std=c99" + +dnl Use -Werror in the checks below since Clang emits a warning instead of +dnl an error when it encounters an unknown warning option. +AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=0], + [ODP_CFLAGS="$ODP_CFLAGS -Wimplicit-fallthrough=0"], + [], [-Werror]) +AX_CHECK_COMPILE_FLAG([-Wformat-truncation=0], + [ODP_CFLAGS="$ODP_CFLAGS -Wformat-truncation=0"], + [], [-Werror]) +AX_CHECK_COMPILE_FLAG([-Wformat-overflow=0], + [ODP_CFLAGS="$ODP_CFLAGS -Wformat-overflow=0"], + [], [-Werror]) + # Extra flags for example to suppress certain warning types ODP_CFLAGS="$ODP_CFLAGS $ODP_CFLAGS_EXTRA" diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4 index 1b1b883d..98885f5f 100644 --- a/platform/linux-generic/m4/configure.m4 +++ b/platform/linux-generic/m4/configure.m4 @@ -28,6 +28,50 @@ AC_LINK_IFELSE( echo "Use newer version. For gcc > 4.7.0" exit -1) +dnl Check whether -latomic is needed +use_libatomic=no + +AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins) +AC_LINK_IFELSE( + [AC_LANG_SOURCE([[ + static int loc; + int main(void) + { + int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED); + return 0; + } + ]])], + [AC_MSG_RESULT(no)], + [AC_MSG_RESULT(yes) + AC_CHECK_LIB( + [atomic], [__atomic_exchange_8], + [use_libatomic=yes], + [AC_MSG_FAILURE([__atomic_exchange_8 is not available])]) + ]) + +AC_MSG_CHECKING(whether -latomic is needed for 128-bit atomic built-ins) +AC_LINK_IFELSE( + [AC_LANG_SOURCE([[ + static __int128 loc; + int main(void) + { + __int128 prev; + prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED); + return 0; + } + ]])], + [AC_MSG_RESULT(no)], + [AC_MSG_RESULT(yes) + AC_CHECK_LIB( + [atomic], [__atomic_exchange_16], + [use_libatomic=yes], + [AC_MSG_FAILURE([cannot detect support for 128-bit atomics])]) + ]) + +if test "x$use_libatomic" = "xyes"; then + AM_LDFLAGS="$AM_LDFLAGS -latomic" +fi + m4_include([platform/linux-generic/m4/odp_pthread.m4]) m4_include([platform/linux-generic/m4/odp_openssl.m4]) m4_include([platform/linux-generic/m4/odp_pcap.m4])