Hi Jakub! On 2021-03-04T09:52:41+0100, Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > On Thu, Jan 14, 2021 at 07:18:13PM +0100, Thomas Schwinge wrote: >> libgomp/ >> PR libgomp/65099 >> * plugin/configfrag.ac (PLUGIN_NVPTX): Restrict to supported >> configurations.
(I had copied for the nvptx offloading plugin the approach as had before been established for the GCN offloading plugin.) > Some gcc configurations default to -m32 but support -m64 too. This patch > just makes the ILP32 tests more reliable by following what e.g. libsanitizer > configury does. ACK, thanks! > Perhaps we should incrementally also handle there > | i?86-*-* Yes, I suppose we should. > Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. Shouldn't this also go onto the release branches? Grüße Thomas > 2021-03-04 Jakub Jelinek <ja...@redhat.com> > > * configure.ac: Add AC_CHECK_SIZEOF([void *]). > * plugin/configfrag.ac: Check $ac_cv_sizeof_void_p value instead of > checking of -m32 or -mx32 options on the command line. > * config.h.in: Regenerated. > * configure: Regenerated. > > --- libgomp/configure.ac.jj 2020-07-28 15:39:10.148754303 +0200 > +++ libgomp/configure.ac 2021-03-03 14:41:21.964355951 +0100 > @@ -221,6 +221,8 @@ if test x$libgomp_offloaded_only = xyes; > [Define to 1 if building libgomp for an accelerator-only > target.]) > fi > > +AC_CHECK_SIZEOF([void *]) > + > m4_include([plugin/configfrag.ac]) > > # Check for functions needed. > --- libgomp/plugin/configfrag.ac.jj 2021-01-14 19:34:06.164423884 +0100 > +++ libgomp/plugin/configfrag.ac 2021-03-03 14:45:45.374070228 +0100 > @@ -160,8 +160,8 @@ if test x"$enable_offload_targets" != x; > nvptx*) > case "${target}" in > aarch64*-*-* | powerpc64le-*-* | x86_64-*-*) > - case " ${CC} ${CFLAGS} " in > - *" -m32 "* | *" -mx32 "*) > + case "$ac_cv_sizeof_void_p" in > + 4) > # PR libgomp/65099: Currently, we only support offloading in > # 64-bit configurations. > PLUGIN_NVPTX=0 > @@ -218,8 +218,8 @@ if test x"$enable_offload_targets" != x; > amdgcn*) > case "${target}" in > x86_64-*-*) > - case " ${CC} ${CFLAGS} " in > - *" -m32 "*|*" -mx32 "*) > + case "$ac_cv_sizeof_void_p" in > + 4) > PLUGIN_GCN=0 > ;; > *) > --- libgomp/config.h.in.jj 2020-08-03 22:54:51.483530741 +0200 > +++ libgomp/config.h.in 2021-03-03 14:46:07.965788364 +0100 > @@ -183,6 +183,9 @@ > /* Define if all infrastructure, needed for plugins, is supported. */ > #undef PLUGIN_SUPPORT > > +/* The size of `void *', as computed by sizeof. */ > +#undef SIZEOF_VOID_P > + > /* Define to 1 if you have the ANSI C header files. */ > #undef STDC_HEADERS > > --- libgomp/configure.jj 2021-01-14 19:34:06.140424158 +0100 > +++ libgomp/configure 2021-03-03 14:46:05.317821453 +0100 > @@ -2058,60 +2058,6 @@ fi > > } # ac_fn_c_check_header_mongrel > > -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES > -# ------------------------------------------- > -# Tests whether TYPE exists after having included INCLUDES, setting cache > -# variable VAR accordingly. > -ac_fn_c_check_type () > -{ > - as_lineno=${as_lineno-"$1"} > as_lineno_stack=as_lineno_stack=$as_lineno_stack > - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 > -$as_echo_n "checking for $2... " >&6; } > -if eval \${$3+:} false; then : > - $as_echo_n "(cached) " >&6 > -else > - eval "$3=no" > - cat confdefs.h - <<_ACEOF >conftest.$ac_ext > -/* end confdefs.h. */ > -$4 > -int > -main () > -{ > -if (sizeof ($2)) > - return 0; > - ; > - return 0; > -} > -_ACEOF > -if ac_fn_c_try_compile "$LINENO"; then : > - cat confdefs.h - <<_ACEOF >conftest.$ac_ext > -/* end confdefs.h. */ > -$4 > -int > -main () > -{ > -if (sizeof (($2))) > - return 0; > - ; > - return 0; > -} > -_ACEOF > -if ac_fn_c_try_compile "$LINENO"; then : > - > -else > - eval "$3=yes" > -fi > -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext > -fi > -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext > -fi > -eval ac_res=\$$3 > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 > -$as_echo "$ac_res" >&6; } > - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno > - > -} # ac_fn_c_check_type > - > # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES > # -------------------------------------------- > # Tries to find the compile-time value of EXPR in a program that includes > @@ -2294,6 +2240,60 @@ rm -f conftest.val > as_fn_set_status $ac_retval > > } # ac_fn_c_compute_int > + > +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES > +# ------------------------------------------- > +# Tests whether TYPE exists after having included INCLUDES, setting cache > +# variable VAR accordingly. > +ac_fn_c_check_type () > +{ > + as_lineno=${as_lineno-"$1"} > as_lineno_stack=as_lineno_stack=$as_lineno_stack > + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 > +$as_echo_n "checking for $2... " >&6; } > +if eval \${$3+:} false; then : > + $as_echo_n "(cached) " >&6 > +else > + eval "$3=no" > + cat confdefs.h - <<_ACEOF >conftest.$ac_ext > +/* end confdefs.h. */ > +$4 > +int > +main () > +{ > +if (sizeof ($2)) > + return 0; > + ; > + return 0; > +} > +_ACEOF > +if ac_fn_c_try_compile "$LINENO"; then : > + cat confdefs.h - <<_ACEOF >conftest.$ac_ext > +/* end confdefs.h. */ > +$4 > +int > +main () > +{ > +if (sizeof (($2))) > + return 0; > + ; > + return 0; > +} > +_ACEOF > +if ac_fn_c_try_compile "$LINENO"; then : > + > +else > + eval "$3=yes" > +fi > +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext > +fi > +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext > +fi > +eval ac_res=\$$3 > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 > +$as_echo "$ac_res" >&6; } > + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno > + > +} # ac_fn_c_check_type > cat >config.log <<_ACEOF > This file contains any messages produced by compilers while > running configure, to aid debugging if configure makes a mistake. > @@ -11421,7 +11421,7 @@ else > lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 > lt_status=$lt_dlunknown > cat > conftest.$ac_ext <<_LT_EOF > -#line 11434 "configure" > +#line 11424 "configure" > #include "confdefs.h" > > #if HAVE_DLFCN_H > @@ -11527,7 +11527,7 @@ else > lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 > lt_status=$lt_dlunknown > cat > conftest.$ac_ext <<_LT_EOF > -#line 11540 "configure" > +#line 11530 "configure" > #include "confdefs.h" > > #if HAVE_DLFCN_H > @@ -14251,16 +14251,6 @@ freebsd* | dragonfly*) > esac > ;; > > -gnu*) > - version_type=linux > - need_lib_prefix=no > - need_version=no > - library_names_spec='${libname}${release}${shared_ext}$versuffix > ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' > - soname_spec='${libname}${release}${shared_ext}$major' > - shlibpath_var=LD_LIBRARY_PATH > - hardcode_into_libs=yes > - ;; > - > haiku*) > version_type=linux > need_lib_prefix=no > @@ -14382,7 +14372,7 @@ linux*oldld* | linux*aout* | linux*coff* > # project, but have not yet been accepted: they are GCC-local changes > # for the time being. (See > # https://lists.gnu.org/archive/html/libtool-patches/2018-05/msg00000.html) > -linux* | k*bsd*-gnu | kopensolaris*-gnu | uclinuxfdpiceabi) > +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | uclinuxfdpiceabi) > version_type=linux > need_lib_prefix=no > need_version=no > @@ -15005,9 +14995,43 @@ $as_echo "#define LIBGOMP_OFFLOADED_ONLY > > fi > > +# The cast to long int works around a bug in the HP C Compiler > +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects > +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. > +# This bug is HP SR number 8606223364. > +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 > +$as_echo_n "checking size of void *... " >&6; } > +if ${ac_cv_sizeof_void_p+:} false; then : > + $as_echo_n "(cached) " >&6 > +else > + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" > "ac_cv_sizeof_void_p" "$ac_includes_default"; then : > + > +else > + if test "$ac_cv_type_void_p" = yes; then > + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 > +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} > +as_fn_error 77 "cannot compute sizeof (void *) > +See \`config.log' for more details" "$LINENO" 5; } > + else > + ac_cv_sizeof_void_p=0 > + fi > +fi > + > +fi > +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 > +$as_echo "$ac_cv_sizeof_void_p" >&6; } > + > + > + > +cat >>confdefs.h <<_ACEOF > +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p > +_ACEOF > + > + > + > # Plugins for offload execution, configure.ac fragment. -*- mode: autoconf > -*- > # > -# Copyright (C) 2014-2020 Free Software Foundation, Inc. > +# Copyright (C) 2014-2021 Free Software Foundation, Inc. > # > # Contributed by Mentor Embedded. > # > @@ -15274,8 +15298,8 @@ if test x"$enable_offload_targets" != x; > nvptx*) > case "${target}" in > aarch64*-*-* | powerpc64le-*-* | x86_64-*-*) > - case " ${CC} ${CFLAGS} " in > - *" -m32 "* | *" -mx32 "*) > + case "$ac_cv_sizeof_void_p" in > + 4) > # PR libgomp/65099: Currently, we only support offloading in > # 64-bit configurations. > PLUGIN_NVPTX=0 > @@ -15343,8 +15367,8 @@ rm -f core conftest.err conftest.$ac_obj > amdgcn*) > case "${target}" in > x86_64-*-*) > - case " ${CC} ${CFLAGS} " in > - *" -m32 "*|*" -mx32 "*) > + case "$ac_cv_sizeof_void_p" in > + 4) > PLUGIN_GCN=0 > ;; > *) > > > Jakub ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf