From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id EE7D4385700D for ; Mon, 22 Mar 2021 11:24:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EE7D4385700D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Thomas_Schwinge@mentor.com IronPort-SDR: Iv2Yj+viDgCuUmyxenopGlfjRaxOo48Bu3qHG8gEEhGLGup6LvLTKo8B77CBzjNSN68WrOvH8u raRmnIUgfK1WRvRfhQemaDRG3Se58CINPe9A6NGs9Mc4ZazkdgeaRyCpTK3SASF3bZuQRU5ntc 1bN9YUMH+OfgG8YsZDo60g0NWGwrWJSw7+dudQk+rUHZgGvriowI0ivIaykRrfsogR1FWgba6n qeUG3vclLA5XwrFUOzHDtKNgN9yKQe3nLuVocjUCiqXeAcy3MQo9Uc24EEG0kQiKXLG3HVvOQr ruA= X-IronPort-AV: E=Sophos;i="5.81,268,1610438400"; d="scan'208";a="59351378" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 22 Mar 2021 03:24:32 -0800 IronPort-SDR: oWJByQL6pz+Hn74qvsMeU7IJrFjxnVmpIWzRL7ycPteoScRxzm2p/yhU/dYWAspN+Rcs9Y+wv8 Ko066FCMY09jKjTbJ4hVC5xtuA18b96HM/Fpl8MYAyDsvm1uarCWkf5V0SXbdOfJ9jGNGS3HRe TGSYNoaujRJs88K4Zk8vQAFaLWBQVIlK3O7ufdrGr9qP3R12imbHIrL3ZEnnYD9sB2vskubI6C 4ji6jhMNTOqHjvayFhcFkzZQNCdBqMb8Ghv4cetn+HS8VI+v7l8N8qwyyLy0aOfIbgPa3J1poV +3Q= From: Thomas Schwinge To: Jakub Jelinek CC: Subject: Re: [committed] libgomp: Use sizeof(void*) based checks instead of looking through $CC $CFLAGS for -m32/-mx32 In-Reply-To: <20210304085241.GO4020736@tucnak> References: <5447F0E1.7080906@redhat.com> <544FAE8B.5010906@codesourcery.com> <545179C6.4030406@redhat.com> <5460E5AD.6060502@codesourcery.com> <87vbl2w69s.fsf@kepler.schwinge.homeip.net> <87egq8mir1.fsf@schwinge.name> <20150204094314.GH1746@tucnak.redhat.com> <8761azfvso.fsf@kepler.schwinge.homeip.net> <87zj364rq1.fsf@kepler.schwinge.homeip.net> <87lfcvidqy.fsf@euler.schwinge.homeip.net> <20210304085241.GO4020736@tucnak> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Mon, 22 Mar 2021 12:24:23 +0100 Message-ID: <875z1jfn2w.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-08.mgc.mentorg.com (139.181.222.8) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_ASCII_DIVIDERS, KAM_DMARC_STATUS, KAM_NUMSUBJECT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2021 11:24:39 -0000 Hi Jakub! On 2021-03-04T09:52:41+0100, Jakub Jelinek via Gcc-patches 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. libsaniti= zer > 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=C3=BC=C3=9Fe Thomas > 2021-03-04 Jakub Jelinek > > * 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 =3D xyes; > [Define to 1 if building libgomp for an accelerator-only tar= get.]) > 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" !=3D 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 i= n > # 64-bit configurations. > PLUGIN_NVPTX=3D0 > @@ -218,8 +218,8 @@ if test x"$enable_offload_targets" !=3D x; > amdgcn*) > case "${target}" in > x86_64-*-*) > - case " ${CC} ${CFLAGS} " in > - *" -m32 "*|*" -mx32 "*) > + case "$ac_cv_sizeof_void_p" in > + 4) > PLUGIN_GCN=3D0 > ;; > *) > --- 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 cach= e > -# variable VAR accordingly. > -ac_fn_c_check_type () > -{ > - as_lineno=3D${as_lineno-"$1"} as_lineno_stack=3Das_lineno_stack=3D$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=3Dno" > - 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=3Dyes" > -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=3D\$$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 include= s > @@ -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 cach= e > +# variable VAR accordingly. > +ac_fn_c_check_type () > +{ > + as_lineno=3D${as_lineno-"$1"} as_lineno_stack=3Das_lineno_stack=3D$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=3Dno" > + 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=3Dyes" > +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=3D\$$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=3D0; lt_dlno_uscore=3D1; lt_dlneed_uscore=3D2 > lt_status=3D$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=3D0; lt_dlno_uscore=3D1; lt_dlneed_uscore=3D2 > lt_status=3D$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=3Dlinux > - need_lib_prefix=3Dno > - need_version=3Dno > - library_names_spec=3D'${libname}${release}${shared_ext}$versuffix ${li= bname}${release}${shared_ext}${major} ${libname}${shared_ext}' > - soname_spec=3D'${libname}${release}${shared_ext}$major' > - shlibpath_var=3DLD_LIBRARY_PATH > - hardcode_into_libs=3Dyes > - ;; > - > haiku*) > version_type=3Dlinux > need_lib_prefix=3Dno > @@ -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.ht= ml) > -linux* | k*bsd*-gnu | kopensolaris*-gnu | uclinuxfdpiceabi) > +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | uclinuxfdpiceabi) > version_type=3Dlinux > need_lib_prefix=3Dno > need_version=3Dno > @@ -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)) >=3D 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" =3D 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=3D0 > + 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: autoc= onf -*- > # > -# 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" !=3D 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 i= n > # 64-bit configurations. > PLUGIN_NVPTX=3D0 > @@ -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=3D0 > ;; > *) > > > Jakub ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 M=C3=BCnchen R= egistergericht M=C3=BCnchen HRB 106955, Gesch=C3=A4ftsf=C3=BChrer: Thomas H= eurung, Frank Th=C3=BCrauf