aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stubbs <ams@codesourcery.com>2019-01-17 12:34:28 +0000
committerAndrew Stubbs <ams@gcc.gnu.org>2019-01-17 12:34:28 +0000
commit7431c1a19641953d1d941b346b496c41711c9f0e (patch)
treeebf4c58ef5c9d46348fb5acae6db010302d1c17f
parent5326695a6d3585f5c49633813909342098d1714c (diff)
downloadgcc-7431c1a19641953d1d941b346b496c41711c9f0e.zip
gcc-7431c1a19641953d1d941b346b496c41711c9f0e.tar.gz
gcc-7431c1a19641953d1d941b346b496c41711c9f0e.tar.bz2
GCN back-end config
This patch contains the configuration adjustments needed to enable the GCN back-end. The new configure check for dlopen is required to allow building the new gcn-run tool. This tool uses libdl to load the HSA runtime libraries, which are required to run programs on the GPU. The tool is disabled if libdl is not available. 2019-01-17 Andrew Stubbs <ams@codesourcery.com> Kwok Cheung Yeung <kcy@codesourcery.com> Julian Brown <julian@codesourcery.com> Tom de Vries <tom@codesourcery.com> Jan Hubicka <hubicka@ucw.cz> Martin Jambor <mjambor@suse.cz> * configure.ac: Likewise. * configure: Regenerate. * contrib/config-list.mk: Add amdgcn-amdhsa. gcc/ * config.gcc: Add amdgcn*-*-amdhsa configuration. * configure.ac: Check for dlopen. * configure: Regenerate. Co-Authored-By: Jan Hubicka <hubicka@ucw.cz> Co-Authored-By: Julian Brown <julian@codesourcery.com> Co-Authored-By: Kwok Cheung Yeung <kcy@codesourcery.com> Co-Authored-By: Martin Jambor <mjambor@suse.cz> Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r268024
-rw-r--r--ChangeLog11
-rwxr-xr-xconfigure2
-rw-r--r--configure.ac2
-rw-r--r--contrib/config-list.mk1
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/config.gcc41
-rwxr-xr-xgcc/configure68
-rw-r--r--gcc/configure.ac8
8 files changed, 142 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 5ec57e1..2cd14ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2019-01-17 Andrew Stubbs <ams@codesourcery.com>
+ Kwok Cheung Yeung <kcy@codesourcery.com>
+ Julian Brown <julian@codesourcery.com>
+ Tom de Vries <tom@codesourcery.com>
+ Jan Hubicka <hubicka@ucw.cz>
+ Martin Jambor <mjambor@suse.cz>
+
+ * configure.ac: Likewise.
+ * configure: Regenerate.
+ * contrib/config-list.mk: Add amdgcn-amdhsa.
+
2019-01-16 Kewen Lin <linkw@gcc.gnu.org>
* MAINTAINERS (Write After Approval): Add myself.
diff --git a/configure b/configure
index 4b095de..adf4fda 100755
--- a/configure
+++ b/configure
@@ -3652,6 +3652,8 @@ case "${target}" in
noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
+ amdgcn*-*-*)
+ ;;
arm-*-darwin*)
noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
diff --git a/configure.ac b/configure.ac
index 0547510..87f2aee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -934,6 +934,8 @@ case "${target}" in
noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
+ amdgcn*-*-*)
+ ;;
arm-*-darwin*)
noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
diff --git a/contrib/config-list.mk b/contrib/config-list.mk
index 5acd766..69c826e 100644
--- a/contrib/config-list.mk
+++ b/contrib/config-list.mk
@@ -33,6 +33,7 @@ GCC_SRC_DIR=../../gcc
LIST = aarch64-elf aarch64-linux-gnu aarch64-rtems \
alpha-linux-gnu alpha-netbsd alpha-openbsd \
alpha64-dec-vms alpha-dec-vms \
+ amdgcn-amdhsa \
arc-elf32OPT-with-cpu=arc600 arc-elf32OPT-with-cpu=arc700 \
arc-linux-uclibcOPT-with-cpu=arc700 arceb-linux-uclibcOPT-with-cpu=arc700 \
arm-wrs-vxworks arm-netbsdelf \
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2f1a36f..4cc44d7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -5,6 +5,17 @@
Jan Hubicka <hubicka@ucw.cz>
Martin Jambor <mjambor@suse.cz>
+ * config.gcc: Add amdgcn*-*-amdhsa configuration.
+ * configure.ac: Check for dlopen.
+ * configure: Regenerate.
+
+2019-01-17 Andrew Stubbs <ams@codesourcery.com>
+ Kwok Cheung Yeung <kcy@codesourcery.com>
+ Julian Brown <julian@codesourcery.com>
+ Tom de Vries <tom@codesourcery.com>
+ Jan Hubicka <hubicka@ucw.cz>
+ Martin Jambor <mjambor@suse.cz>
+
* common/config/gcn/gcn-common.c: New file.
* config/gcn/driver-gcn.c: New file.
* config/gcn/gcn-builtins.def: New file.
diff --git a/gcc/config.gcc b/gcc/config.gcc
index f7ddb12..a189cb1 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -326,6 +326,10 @@ alpha*-*-*)
cpu_type=alpha
extra_options="${extra_options} g.opt"
;;
+amdgcn*)
+ cpu_type=gcn
+ use_gcc_stdint=wrap
+ ;;
am33_2.0-*-linux*)
cpu_type=mn10300
;;
@@ -1401,6 +1405,25 @@ ft32-*-elf)
tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
tmake_file="${tmake_file} ft32/t-ft32"
;;
+amdgcn-*-amdhsa)
+ tm_file="elfos.h gcn/gcn-hsa.h gcn/gcn.h newlib-stdint.h"
+ tmake_file="gcn/t-gcn-hsa"
+ native_system_header_dir=/include
+ extra_modes=gcn/gcn-modes.def
+ extra_objs="${extra_objs} gcn-tree.o"
+ extra_gcc_objs="driver-gcn.o"
+ case "$host" in
+ x86_64*-*-linux-gnu )
+ if test "$ac_cv_search_dlopen" != 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"
+ fi
+ ;;
moxie-*-elf)
gas=yes
gnu_ld=yes
@@ -4087,6 +4110,24 @@ case "${target}" in
esac
;;
+ amdgcn-*-*)
+ supported_defaults="arch tune"
+
+ for which in arch tune; do
+ eval "val=\$with_$which"
+ case ${val} in
+ "" | carrizo | fiji | gfx900 )
+ # OK
+ ;;
+ *)
+ echo "Unknown cpu used in --with-$which=$val." 1>&2
+ exit 1
+ ;;
+ esac
+ done
+ [ "x$with_arch" = x ] && with_arch=fiji
+ ;;
+
hppa*-*-*)
supported_defaults="arch schedule"
diff --git a/gcc/configure b/gcc/configure
index ed76a7e..d6a48ef 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -782,6 +782,7 @@ manext
LIBICONV_DEP
LTLIBICONV
LIBICONV
+DL_LIB
LDEXP_LIB
EXTRA_GCC_LIBS
GNAT_LIBEXC
@@ -9735,6 +9736,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 ${ac_cv_search_dlopen+:} false; 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 ${ac_cv_search_dlopen+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_dlopen+:} false; 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 <inttypes.h> only if it exists,
# doesn't clash with <sys/types.h>, declares intmax_t and defines
# PRId64
@@ -18582,7 +18646,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 18576 "configure"
+#line 18640 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18688,7 +18752,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 18682 "configure"
+#line 18746 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index e3a4558..7837035 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1228,6 +1228,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 <inttypes.h> only if it exists,
# doesn't clash with <sys/types.h>, declares intmax_t and defines
# PRId64