Message ID | 20170711211812.9348-1-bill.fischofer@linaro.org |
---|---|
State | New |
Headers | show |
Series | [MONARCH_LTS,1/2] build: GCC 7 fixes | expand |
On 07/12/17 00:18, Bill Fischofer wrote: > From: Brian Brooks <brian.brooks@arm.com> > > 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 <brian.brooks@arm.com> > Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com> > Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > DEPENDENCIES | 5 ++-- > configure.ac | 13 ++++++++++ > platform/linux-generic/m4/configure.m4 | 44 ++++++++++++++++++++++++++++++++++ > 3 files changed, 60 insertions(+), 2 deletions(-) > > 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 there was follow up patch to remove autoconf-archive dependency. Please take it also. Maxim. > > 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]) >
I just ported and posted the patch to fix breakage when compiling with clang 4.0. :) On Tue, Jul 11, 2017 at 4:37 PM, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > On 07/12/17 00:18, Bill Fischofer wrote: >> From: Brian Brooks <brian.brooks@arm.com> >> >> 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 <brian.brooks@arm.com> >> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com> >> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> >> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> >> --- >> DEPENDENCIES | 5 ++-- >> configure.ac | 13 ++++++++++ >> platform/linux-generic/m4/configure.m4 | 44 ++++++++++++++++++++++++++++++++++ >> 3 files changed, 60 insertions(+), 2 deletions(-) >> >> 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 > > > there was follow up patch to remove autoconf-archive dependency. Please > take it also. > > Maxim. > >> >> 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]) >> >
Wasn't that dependency introduced after Monarch_LTS? If so, then there'd be nothing to remove. The patch makes reference to travis files, which certainly was post-Monarch. On Tue, Jul 11, 2017 at 4:37 PM, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > On 07/12/17 00:18, Bill Fischofer wrote: >> From: Brian Brooks <brian.brooks@arm.com> >> >> 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 <brian.brooks@arm.com> >> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com> >> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> >> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> >> --- >> DEPENDENCIES | 5 ++-- >> configure.ac | 13 ++++++++++ >> platform/linux-generic/m4/configure.m4 | 44 ++++++++++++++++++++++++++++++++++ >> 3 files changed, 60 insertions(+), 2 deletions(-) >> >> 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 > > > there was follow up patch to remove autoconf-archive dependency. Please > take it also. > > Maxim. > >> >> 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]) >> >
Strange. m4/ax_check_compile_flag.m4 already exists in monarch_lts. I posted the ported patch, but it's just a doc update to the DEPENDENCIES file sine travis.yaml doesn't exist in Monarch. On Tue, Jul 11, 2017 at 4:53 PM, Bill Fischofer <bill.fischofer@linaro.org> wrote: > Wasn't that dependency introduced after Monarch_LTS? If so, then > there'd be nothing to remove. The patch makes reference to travis > files, which certainly was post-Monarch. > > On Tue, Jul 11, 2017 at 4:37 PM, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: >> On 07/12/17 00:18, Bill Fischofer wrote: >>> From: Brian Brooks <brian.brooks@arm.com> >>> >>> 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 <brian.brooks@arm.com> >>> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com> >>> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> >>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> >>> --- >>> DEPENDENCIES | 5 ++-- >>> configure.ac | 13 ++++++++++ >>> platform/linux-generic/m4/configure.m4 | 44 ++++++++++++++++++++++++++++++++++ >>> 3 files changed, 60 insertions(+), 2 deletions(-) >>> >>> 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 >> >> >> there was follow up patch to remove autoconf-archive dependency. Please >> take it also. >> >> Maxim. >> >>> >>> 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]) >>> >>
Well, it's like pulling on a thread :) I also ported and filled-in the fixes to the doxygen errors caused by the newer levels of Doxygen. So v1.11.0.1 should be clean there as well as compile properly under current levels of both clang and gcc. We can sync on this tomorrow. On Tue, Jul 11, 2017 at 5:49 PM, Bill Fischofer <bill.fischofer@linaro.org> wrote: > Strange. m4/ax_check_compile_flag.m4 already exists in monarch_lts. I > posted the ported patch, but it's just a doc update to the > DEPENDENCIES file sine travis.yaml doesn't exist in Monarch. > > On Tue, Jul 11, 2017 at 4:53 PM, Bill Fischofer > <bill.fischofer@linaro.org> wrote: >> Wasn't that dependency introduced after Monarch_LTS? If so, then >> there'd be nothing to remove. The patch makes reference to travis >> files, which certainly was post-Monarch. >> >> On Tue, Jul 11, 2017 at 4:37 PM, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: >>> On 07/12/17 00:18, Bill Fischofer wrote: >>>> From: Brian Brooks <brian.brooks@arm.com> >>>> >>>> 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 <brian.brooks@arm.com> >>>> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com> >>>> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> >>>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> >>>> --- >>>> DEPENDENCIES | 5 ++-- >>>> configure.ac | 13 ++++++++++ >>>> platform/linux-generic/m4/configure.m4 | 44 ++++++++++++++++++++++++++++++++++ >>>> 3 files changed, 60 insertions(+), 2 deletions(-) >>>> >>>> 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 >>> >>> >>> there was follow up patch to remove autoconf-archive dependency. Please >>> take it also. >>> >>> Maxim. >>> >>>> >>>> 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]) >>>> >>>
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])