From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63908 invoked by alias); 12 Sep 2018 13:42:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 63896 invoked by uid 89); 12 Sep 2018 13:42:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=AR, fopenmp, objs X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Sep 2018 13:42:51 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-01.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1g05Ps-0007Jl-WE from Andrew_Stubbs@mentor.com for gcc-patches@gcc.gnu.org; Wed, 12 Sep 2018 06:42:49 -0700 Received: from [172.30.89.96] (137.202.0.90) by svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Wed, 12 Sep 2018 14:42:44 +0100 Subject: Re: [PATCH 21/25] GCN Back-end (part 2/2). To: Joseph Myers CC: References: <4c633833-1954-4b62-1a96-4f1c2cf541fd@codesourcery.com> From: Andrew Stubbs Message-ID: <71811e56-8c57-d691-efdc-1c7727d0465c@codesourcery.com> Date: Wed, 12 Sep 2018 13:42:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------FA5FF6485D13EE2CBBB7B734" X-SW-Source: 2018-09/txt/msg00611.txt.bz2 --------------FA5FF6485D13EE2CBBB7B734 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1001 On 05/09/18 15:22, Joseph Myers wrote: > In cases like this with alternative diagnostic messages using ?:, you need > to mark up each message with G_() so they both get extracted for > translation by exgettext. > [...] > > This concatenation with a macro won't work with exgettext extracting > messages for translation. > [...] > > Use %qs (presuming this code is using the generic diagnostic machinery > that supports it). > > +gcn-run$(exeext): gcn-run.o > + +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $< -ldl > > I'd expect this to fail on non-Unix configurations that don't have -ldl, > and thus to need appropriate conditionals / configure tests to avoid that > build failure. The attached diff from the previous patch should address these issues, I hope. If they're OK I'll incorporate the changes into the next version of the (much) larger patch when I next post them. > A new port should add an appropriate entry to contrib/config-list.mk. I'm still testing this. Andrew --------------FA5FF6485D13EE2CBBB7B734 Content-Type: text/x-patch; name="180912-fix-gcn-review-issues.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="180912-fix-gcn-review-issues.patch" Content-length: 7726 diff --git a/gcc/config.gcc b/gcc/config.gcc index d28bee5..3d7aa43 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1387,7 +1387,13 @@ amdgcn-*-amdhsa) extra_modes=gcn/gcn-modes.def extra_objs="${extra_objs} gcn-tree.o" extra_gcc_objs="driver-gcn.o" - extra_programs="${extra_programs} gcn-run\$(exeext)" + case "$host" in + x86_64*-*-linux-gnu ) + if test "$ac_res" != no; then + extra_programs="${extra_programs} gcn-run\$(exeext)" + fi + ;; + esac if test x$enable_as_accelerator = xyes; then extra_programs="${extra_programs} mkoffload\$(exeext)" tm_file="${tm_file} gcn/offload.h" diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c index ce03d5b..67cf907 100644 --- a/gcc/config/gcn/gcn.c +++ b/gcc/config/gcn/gcn.c @@ -48,6 +48,7 @@ #include "print-rtl.h" #include "attribs.h" #include "varasm.h" +#include "intl.h" /* This file should be included last. */ #include "target-def.h" @@ -4614,8 +4615,9 @@ gcn_goacc_validate_dims (tree decl, int dims[], int fn_level) warning_at (decl ? DECL_SOURCE_LOCATION (decl) : UNKNOWN_LOCATION, OPT_Wopenacc_dims, (dims[GOMP_DIM_VECTOR] - ? "using vector_length (64), ignoring %d" - : "using vector_length (64), ignoring runtime setting"), + ? G_("using vector_length (64), ignoring %d") + : G_("using vector_length (64), " + "ignoring runtime setting")), dims[GOMP_DIM_VECTOR]); dims[GOMP_DIM_VECTOR] = 1; changed = true; diff --git a/gcc/config/gcn/mkoffload.c b/gcc/config/gcn/mkoffload.c index 57e0f25..d3b5b96 100644 --- a/gcc/config/gcn/mkoffload.c +++ b/gcc/config/gcn/mkoffload.c @@ -489,7 +489,7 @@ main (int argc, char **argv) char *collect_gcc = getenv ("COLLECT_GCC"); if (collect_gcc == NULL) - fatal_error (input_location, "COLLECT_GCC must be set."); + fatal_error (input_location, "COLLECT_GCC must be set"); const char *gcc_path = dirname (ASTRDUP (collect_gcc)); const char *gcc_exec = basename (ASTRDUP (collect_gcc)); @@ -555,7 +555,7 @@ main (int argc, char **argv) offload_abi = OFFLOAD_ABI_ILP32; else fatal_error (input_location, - "unrecognizable argument of option " STR); + "unrecognizable argument of option %s", argv[i]); } #undef STR else if (strcmp (argv[i], "-fopenmp") == 0) @@ -663,11 +663,11 @@ main (int argc, char **argv) out = fopen (gcn_s2_name, "w"); if (!out) - fatal_error (input_location, "cannot open '%s'", gcn_s2_name); + fatal_error (input_location, "cannot open %qs", gcn_s2_name); cfile = fopen (gcn_cfile_name, "w"); if (!cfile) - fatal_error (input_location, "cannot open '%s'", gcn_cfile_name); + fatal_error (input_location, "cannot open %qs", gcn_cfile_name); process_asm (in, out, cfile); diff --git a/gcc/configure b/gcc/configure index b7a8e36..4123c2a 100755 --- a/gcc/configure +++ b/gcc/configure @@ -746,6 +746,7 @@ manext LIBICONV_DEP LTLIBICONV LIBICONV +DL_LIB LDEXP_LIB EXTRA_GCC_LIBS GNAT_LIBEXC @@ -9643,6 +9644,69 @@ LDEXP_LIB="$LIBS" LIBS="$save_LIBS" +# Some systems need dlopen +save_LIBS="$LIBS" +LIBS= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if test "${ac_cv_search_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_dlopen+set}" = set; then : + break +fi +done +if test "${ac_cv_search_dlopen+set}" = set; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +DL_LIB="$LIBS" +LIBS="$save_LIBS" + + # Use only if it exists, # doesn't clash with , declares intmax_t and defines # PRId64 @@ -18460,7 +18524,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18463 "configure" +#line 18527 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18566,7 +18630,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18569 "configure" +#line 18633 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19731,20 +19795,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' diff --git a/gcc/configure.ac b/gcc/configure.ac index 65f9c92..d576198 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1206,6 +1206,14 @@ LDEXP_LIB="$LIBS" LIBS="$save_LIBS" AC_SUBST(LDEXP_LIB) +# Some systems need dlopen +save_LIBS="$LIBS" +LIBS= +AC_SEARCH_LIBS(dlopen, dl) +DL_LIB="$LIBS" +LIBS="$save_LIBS" +AC_SUBST(DL_LIB) + # Use only if it exists, # doesn't clash with , declares intmax_t and defines # PRId64 --------------FA5FF6485D13EE2CBBB7B734--