From: Thomas Schwinge <thomas@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: <gcc-patches@gcc.gnu.org>
Subject: Re: [committed] libgomp: Use sizeof(void*) based checks instead of looking through $CC $CFLAGS for -m32/-mx32
Date: Mon, 22 Mar 2021 12:24:23 +0100 [thread overview]
Message-ID: <875z1jfn2w.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <20210304085241.GO4020736@tucnak>
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 <jakub@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
next prev parent reply other threads:[~2021-03-22 11:24 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-20 14:19 The nvptx port [0/11+] Bernd Schmidt
2014-10-20 14:21 ` The nvptx port [1/11+] indirect jumps Bernd Schmidt
2014-10-21 18:29 ` Jeff Law
2014-10-21 21:03 ` Bernd Schmidt
2014-10-21 21:30 ` Jakub Jelinek
2014-10-21 21:37 ` Bernd Schmidt
2014-10-22 8:21 ` Richard Biener
2014-10-22 8:34 ` Jakub Jelinek
2014-10-22 8:37 ` Thomas Schwinge
2014-10-22 10:03 ` Richard Biener
2014-10-22 10:32 ` Jakub Jelinek
2014-11-04 15:35 ` Bernd Schmidt
2014-11-04 15:43 ` Richard Henderson
2014-10-20 14:22 ` The nvptx port [2/11+] No register allocation Bernd Schmidt
2014-10-20 14:24 ` Bernd Schmidt
2014-10-21 18:36 ` Jeff Law
2014-10-20 14:24 ` The nvptx port [3/11+] Struct returns Bernd Schmidt
2014-10-21 18:41 ` Jeff Law
2014-10-20 14:27 ` The nvptx port [5/11+] Variable declarations Bernd Schmidt
2014-10-21 18:44 ` Jeff Law
2014-10-20 14:27 ` The nvptx port [4/11+] Post-RA pipeline Bernd Schmidt
2014-10-21 18:42 ` Jeff Law
2024-06-28 15:07 ` Document 'pass_postreload' vs. 'pass_late_compilation' (was: The nvptx port [4/11+] Post-RA pipeline) Thomas Schwinge
2014-10-20 14:31 ` The nvptx port [6/11+] Pseudo call args Bernd Schmidt
2014-10-21 18:56 ` Jeff Law
2014-10-20 14:32 ` The nvptx port [7/11+] Inform the port about call arguments Bernd Schmidt
2014-10-21 21:25 ` Jeff Law
2014-10-21 21:33 ` Bernd Schmidt
2014-10-21 21:55 ` Jeff Law
2014-10-21 22:16 ` Bernd Schmidt
2014-10-22 18:23 ` Jeff Law
2014-10-28 14:57 ` Bernd Schmidt
2014-10-29 23:42 ` Jeff Law
2014-10-20 14:32 ` The nvptx port [8/11+] Write undefined decls Bernd Schmidt
2014-10-21 22:07 ` Jeff Law
2014-10-21 22:30 ` Bernd Schmidt
2014-10-22 18:23 ` Jeff Law
2014-11-05 12:05 ` Bernd Schmidt
2014-11-05 20:05 ` Jeff Law
2014-10-20 14:35 ` The nvptx port [9/11+] Epilogues Bernd Schmidt
2014-10-21 22:08 ` Jeff Law
2014-10-20 14:50 ` The nvptx port [10/11+] Target files Bernd Schmidt
2014-10-22 18:12 ` Jeff Law
2014-10-28 15:10 ` Bernd Schmidt
2014-10-29 23:51 ` Jeff Law
2014-10-30 2:53 ` Bernd Schmidt
2014-10-30 3:09 ` Jeff Law
2014-11-10 16:33 ` Bernd Schmidt
2014-11-10 20:06 ` Jakub Jelinek
2014-11-10 20:37 ` H.J. Lu
2014-11-10 20:40 ` H.J. Lu
2014-11-10 20:42 ` Mike Stump
2014-12-12 20:18 ` Thomas Schwinge
2014-12-23 18:51 ` nvptx-tools and nvptx-newlib (was: The nvptx port [10/11+] Target files) Thomas Schwinge
2015-02-02 15:33 ` Thomas Schwinge
2015-02-04 9:43 ` Jakub Jelinek
2015-02-18 8:50 ` Thomas Schwinge
2015-02-18 9:03 ` Jakub Jelinek
2015-07-08 15:03 ` [nvptx offloading] Only 64-bit configurations are currently supported (was: nvptx-tools and nvptx-newlib) Thomas Schwinge
2015-07-14 20:10 ` [nvptx offloading] Only 64-bit configurations are currently supported Thomas Schwinge
2015-07-14 20:25 ` Richard Biener
2021-01-14 18:18 ` [nvptx libgomp plugin] Build only in supported configurations (was: [nvptx offloading] Only 64-bit configurations are currently supported) Thomas Schwinge
2021-03-04 8:52 ` [committed] libgomp: Use sizeof(void*) based checks instead of looking through $CC $CFLAGS for -m32/-mx32 Jakub Jelinek
2021-03-22 11:24 ` Thomas Schwinge [this message]
2014-11-04 16:48 ` The nvptx port [10/11+] Target files Richard Henderson
2014-11-04 16:55 ` Bernd Schmidt
2014-11-05 13:07 ` Bernd Schmidt
2014-10-20 14:58 ` The nvptx port [11/11] More tools Bernd Schmidt
2014-10-21 0:16 ` Joseph S. Myers
2014-10-22 20:40 ` Jeff Law
2014-10-22 21:16 ` Bernd Schmidt
2014-10-24 19:52 ` Jeff Law
2014-10-31 21:04 ` Jeff Law
[not found] ` <54542050.6010908@codesourcery.com>
2014-11-03 21:49 ` Jeff Law
2014-10-21 8:23 ` The nvptx port [0/11+] Richard Biener
2014-10-21 10:57 ` Bernd Schmidt
2014-10-21 11:27 ` Richard Biener
2014-10-21 9:17 ` Jakub Jelinek
2014-10-21 11:19 ` Bernd Schmidt
2014-11-12 12:36 ` Richard Biener
2014-11-12 21:39 ` Jeff Law
2015-02-18 7:48 ` nvptx-none: Define empty GOMP_SELF_SPECS (was: The nvptx port [0/11+]) Thomas Schwinge
2015-02-18 8:01 ` The nvptx port [0/11+] Thomas Schwinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875z1jfn2w.fsf@euler.schwinge.homeip.net \
--to=thomas@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).