Message ID | 1464208623-29531-2-git-send-email-bill.fischofer@linaro.org |
---|---|
State | New |
Headers | show |
On 05/25/16 23:37, Bill Fischofer wrote: > GCC support for cmpxchng16 is buggy for older versions of GCC, so add > a check for GCC version and don't enable this unless the GCC major version > is 5 or higher. > > Note: The use of the AX_COMPILER_VERSION macro creates a dependency on > the autoconf-archive package. > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > DEPENDENCIES | 5 +++-- > configure.ac | 33 ++++++++++++++++++++++++--------- > 2 files changed, 27 insertions(+), 11 deletions(-) > > diff --git a/DEPENDENCIES b/DEPENDENCIES > index a5266c9..e344826 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 5857893..842dc97 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -50,6 +50,17 @@ AC_TYPE_INT32_T > AC_TYPE_UINT32_T > AC_TYPE_UINT64_T > > +######################################################################### > +# Get GCC version > +######################################################################### > + > +AX_COMPILER_VERSION > +GCC_VERSION=$ax_cv_c_compiler_version > + > +GCC_VERSION_MAJOR=$(echo $GCC_VERSION | cut -d'.' -f1) > +GCC_VERSION_MINOR=$(echo $GCC_VERSION | cut -d'.' -f2) > +GCC_VERSION_PATCH=$(echo $GCC_VERSION | cut -d'.' -f3) > + > ########################################################################## > # Allow valgrind suite to run against the defined tests > ########################################################################## > @@ -212,15 +223,18 @@ ODP_CFLAGS="$ODP_CFLAGS $ODP_CFLAGS_EXTRA" > ######################################################################### > # Check if compiler supports cmpxchng16 > ########################################################################## > -my_save_cflags="$CFLAGS" > -CFLAGS=-mcx16 > -AC_MSG_CHECKING([whether CC supports -mcx16]) > -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], > - [AC_MSG_RESULT([yes])] > - [ODP_CFLAGS="$ODP_CFLAGS -mcx16"], > - [AC_MSG_RESULT([no])] > -) > -CFLAGS="$my_save_cflags" > +if $GCC_VERSION_MAJOR >= 5; then will -mcx16 be enabled in clang? I think check has to be: +if $GCC_VERSION_MAJOR >= 5 || CLANG; then Maxim. > + my_save_cflags="$CFLAGS" > + > + CFLAGS=-mcx16 > + AC_MSG_CHECKING([whether CC supports -mcx16]) > + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], > + [AC_MSG_RESULT([yes])] > + [ODP_CFLAGS="$ODP_CFLAGS $CFLAGS"], > + [AC_MSG_RESULT([no])] > + ) > + CFLAGS="$my_save_cflags" > +fi > > ########################################################################## > # Default include setup > @@ -266,6 +280,7 @@ AC_MSG_RESULT([ > WITH_ARCH: ${WITH_ARCH} > > cc: ${CC} > + gcc version: ${GCC_VERSION} > cppflags: ${CPPFLAGS} > am_cppflags: ${AM_CPPFLAGS} > am_cxxflags: ${AM_CXXFLAGS}
tested this patch, it fixes issue. Maxim. On 05/25/16 23:37, Bill Fischofer wrote: > GCC support for cmpxchng16 is buggy for older versions of GCC, so add > a check for GCC version and don't enable this unless the GCC major version > is 5 or higher. > > Note: The use of the AX_COMPILER_VERSION macro creates a dependency on > the autoconf-archive package. > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > DEPENDENCIES | 5 +++-- > configure.ac | 33 ++++++++++++++++++++++++--------- > 2 files changed, 27 insertions(+), 11 deletions(-) > > diff --git a/DEPENDENCIES b/DEPENDENCIES > index a5266c9..e344826 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 5857893..842dc97 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -50,6 +50,17 @@ AC_TYPE_INT32_T > AC_TYPE_UINT32_T > AC_TYPE_UINT64_T > > +######################################################################### > +# Get GCC version > +######################################################################### > + > +AX_COMPILER_VERSION > +GCC_VERSION=$ax_cv_c_compiler_version > + > +GCC_VERSION_MAJOR=$(echo $GCC_VERSION | cut -d'.' -f1) > +GCC_VERSION_MINOR=$(echo $GCC_VERSION | cut -d'.' -f2) > +GCC_VERSION_PATCH=$(echo $GCC_VERSION | cut -d'.' -f3) > + > ########################################################################## > # Allow valgrind suite to run against the defined tests > ########################################################################## > @@ -212,15 +223,18 @@ ODP_CFLAGS="$ODP_CFLAGS $ODP_CFLAGS_EXTRA" > ######################################################################### > # Check if compiler supports cmpxchng16 > ########################################################################## > -my_save_cflags="$CFLAGS" > -CFLAGS=-mcx16 > -AC_MSG_CHECKING([whether CC supports -mcx16]) > -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], > - [AC_MSG_RESULT([yes])] > - [ODP_CFLAGS="$ODP_CFLAGS -mcx16"], > - [AC_MSG_RESULT([no])] > -) > -CFLAGS="$my_save_cflags" > +if $GCC_VERSION_MAJOR >= 5; then > + my_save_cflags="$CFLAGS" > + > + CFLAGS=-mcx16 > + AC_MSG_CHECKING([whether CC supports -mcx16]) > + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], > + [AC_MSG_RESULT([yes])] > + [ODP_CFLAGS="$ODP_CFLAGS $CFLAGS"], > + [AC_MSG_RESULT([no])] > + ) > + CFLAGS="$my_save_cflags" > +fi > > ########################################################################## > # Default include setup > @@ -266,6 +280,7 @@ AC_MSG_RESULT([ > WITH_ARCH: ${WITH_ARCH} > > cc: ${CC} > + gcc version: ${GCC_VERSION} > cppflags: ${CPPFLAGS} > am_cppflags: ${AM_CPPFLAGS} > am_cxxflags: ${AM_CXXFLAGS}
OK, I'll submit a v2 with the changes we discussed. Thanks. On Thu, May 26, 2016 at 8:14 AM, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > tested this patch, it fixes issue. > > Maxim. > > On 05/25/16 23:37, Bill Fischofer wrote: > >> GCC support for cmpxchng16 is buggy for older versions of GCC, so add >> a check for GCC version and don't enable this unless the GCC major version >> is 5 or higher. >> >> Note: The use of the AX_COMPILER_VERSION macro creates a dependency on >> the autoconf-archive package. >> >> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> >> --- >> DEPENDENCIES | 5 +++-- >> configure.ac | 33 ++++++++++++++++++++++++--------- >> 2 files changed, 27 insertions(+), 11 deletions(-) >> >> diff --git a/DEPENDENCIES b/DEPENDENCIES >> index a5266c9..e344826 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 5857893..842dc97 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -50,6 +50,17 @@ AC_TYPE_INT32_T >> AC_TYPE_UINT32_T >> AC_TYPE_UINT64_T >> >> +######################################################################### >> +# Get GCC version >> +######################################################################### >> + >> +AX_COMPILER_VERSION >> +GCC_VERSION=$ax_cv_c_compiler_version >> + >> +GCC_VERSION_MAJOR=$(echo $GCC_VERSION | cut -d'.' -f1) >> +GCC_VERSION_MINOR=$(echo $GCC_VERSION | cut -d'.' -f2) >> +GCC_VERSION_PATCH=$(echo $GCC_VERSION | cut -d'.' -f3) >> + >> >> ########################################################################## >> # Allow valgrind suite to run against the defined tests >> >> ########################################################################## >> @@ -212,15 +223,18 @@ ODP_CFLAGS="$ODP_CFLAGS $ODP_CFLAGS_EXTRA" >> >> ######################################################################### >> # Check if compiler supports cmpxchng16 >> >> ########################################################################## >> -my_save_cflags="$CFLAGS" >> -CFLAGS=-mcx16 >> -AC_MSG_CHECKING([whether CC supports -mcx16]) >> -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], >> - [AC_MSG_RESULT([yes])] >> - [ODP_CFLAGS="$ODP_CFLAGS -mcx16"], >> - [AC_MSG_RESULT([no])] >> -) >> -CFLAGS="$my_save_cflags" >> +if $GCC_VERSION_MAJOR >= 5; then >> + my_save_cflags="$CFLAGS" >> + >> + CFLAGS=-mcx16 >> + AC_MSG_CHECKING([whether CC supports -mcx16]) >> + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], >> + [AC_MSG_RESULT([yes])] >> + [ODP_CFLAGS="$ODP_CFLAGS $CFLAGS"], >> + [AC_MSG_RESULT([no])] >> + ) >> + CFLAGS="$my_save_cflags" >> +fi >> >> ########################################################################## >> # Default include setup >> @@ -266,6 +280,7 @@ AC_MSG_RESULT([ >> WITH_ARCH: ${WITH_ARCH} >> cc: ${CC} >> + gcc version: ${GCC_VERSION} >> cppflags: ${CPPFLAGS} >> am_cppflags: ${AM_CPPFLAGS} >> am_cxxflags: ${AM_CXXFLAGS} >> > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
diff --git a/DEPENDENCIES b/DEPENDENCIES index a5266c9..e344826 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 5857893..842dc97 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,17 @@ AC_TYPE_INT32_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T +######################################################################### +# Get GCC version +######################################################################### + +AX_COMPILER_VERSION +GCC_VERSION=$ax_cv_c_compiler_version + +GCC_VERSION_MAJOR=$(echo $GCC_VERSION | cut -d'.' -f1) +GCC_VERSION_MINOR=$(echo $GCC_VERSION | cut -d'.' -f2) +GCC_VERSION_PATCH=$(echo $GCC_VERSION | cut -d'.' -f3) + ########################################################################## # Allow valgrind suite to run against the defined tests ########################################################################## @@ -212,15 +223,18 @@ ODP_CFLAGS="$ODP_CFLAGS $ODP_CFLAGS_EXTRA" ######################################################################### # Check if compiler supports cmpxchng16 ########################################################################## -my_save_cflags="$CFLAGS" -CFLAGS=-mcx16 -AC_MSG_CHECKING([whether CC supports -mcx16]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], - [AC_MSG_RESULT([yes])] - [ODP_CFLAGS="$ODP_CFLAGS -mcx16"], - [AC_MSG_RESULT([no])] -) -CFLAGS="$my_save_cflags" +if $GCC_VERSION_MAJOR >= 5; then + my_save_cflags="$CFLAGS" + + CFLAGS=-mcx16 + AC_MSG_CHECKING([whether CC supports -mcx16]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes])] + [ODP_CFLAGS="$ODP_CFLAGS $CFLAGS"], + [AC_MSG_RESULT([no])] + ) + CFLAGS="$my_save_cflags" +fi ########################################################################## # Default include setup @@ -266,6 +280,7 @@ AC_MSG_RESULT([ WITH_ARCH: ${WITH_ARCH} cc: ${CC} + gcc version: ${GCC_VERSION} cppflags: ${CPPFLAGS} am_cppflags: ${AM_CPPFLAGS} am_cxxflags: ${AM_CXXFLAGS}
GCC support for cmpxchng16 is buggy for older versions of GCC, so add a check for GCC version and don't enable this unless the GCC major version is 5 or higher. Note: The use of the AX_COMPILER_VERSION macro creates a dependency on the autoconf-archive package. Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> --- DEPENDENCIES | 5 +++-- configure.ac | 33 ++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 11 deletions(-)