diff --git a/configure b/configure
index 9c2d7df1bb2..c270ea34098 100755
--- a/configure
+++ b/configure
@@ -766,6 +766,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -936,6 +937,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE}'
@@ -1188,6 +1190,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;

+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1325,7 +1336,7 @@ fi
 for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
  datadir sysconfdir sharedstatedir localstatedir includedir \
  oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1485,6 +1496,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data
[PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am
index f8b2a06d63e..e9ffb898096 100644
--- a/libgomp/Makefile.am
+++ b/libgomp/Makefile.am
@@ -20,7 +20,7 @@ AM_CPPFLAGS = $(addprefix -I, $(search_path))
 AM_CFLAGS = $(XCFLAGS)
 AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)

-toolexeclib_LTLIBRARIES = libgomp.la
+toolexeclib_LTLIBRARIES = libgomp.la libgompd.la
 nodist_toolexeclib_HEADERS = libgomp.spec

 if LIBGOMP_BUILD_VERSIONED_SHLIB
@@ -32,13 +32,21 @@ libgomp.ver: $(top_srcdir)/libgomp.map
  $(EGREP) -v '#(#| |$$)' $< | \
   $(PREPROCESS) -P -include config.h - > $@ || (rm -f $@ ; exit 1)

+libgompd.ver: $(top_srcdir)/libgompd.map
+ $(EGREP) -v '#(#| |$$)' $< | \
+ $(PREPROCESS) -P -include config.h - > $@ || (rm -f $@ ; exit 1)
+
 if LIBGOMP_BUILD_VERSIONED_SHLIB_GNU
 libgomp_version_script = -Wl,--version-script,libgomp.ver
+libgompd_version_script = -Wl,--version-script,libgompd.ver
 libgomp_version_dep = libgomp.ver
+libgompd_version_dep = libgompd.ver
 endif
 if LIBGOMP_BUILD_VERSIONED_SHLIB_SUN
 libgomp_version_script = -Wl,-M,libgomp.ver-sun
+libgompd_version_script = -Wl,-M,libgompd.ver-sun
 libgomp_version_dep = libgomp.ver-sun
+libgompd_version_dep = libgompd.ver-sun
 libgomp.ver-sun : libgomp.ver \
  $(top_srcdir)/../contrib/make_sunver.pl \
  $(libgomp_la_OBJECTS) $(libgomp_la_LIBADD)
@@ -48,17 +56,34 @@ libgomp.ver-sun : libgomp.ver \
  `echo $(libgomp_la_LIBADD) | \
     sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
  > $@ || (rm -f $@ ; exit 1)
+
+libgompd.ver-sun : libgompd.ver \
+ $(top_srcdir)/../contrib/make_sunver.pl \
+ $(libgompd_la_OBJECTS) $(libgompd_la_LIBADD)
+ perl $(top_srcdir)/../contrib/make_sunver.pl \
+ libgompd.ver \
+ $(libgompd_la_OBJECTS:%.lo=.libs/%.o) \
+ `echo $(libgompd_la_LIBADD) | \
+ sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
+ > $@ || (rm -f $@ ; exit 1)
+
 endif
 else
 libgomp_version_script =
+libgompd_version_script =
 libgomp_version_dep =
+libgompd_version_dep =
 endif
 libgomp_version_info = -version-info $(libtool_VERSION)
+libgompd_version_info = -version-info $(libtool_VERSION)
 libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
         $(lt_host_flags)
+libgompd_la_LDFLAGS = $(libgompd_version_info) $(libgompd_version_script) \
+ $(lt_host_flags)
 libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
+libgompd_la_DEPENDENCIES = $(libgompd_version_dep)
 libgomp_la_LINK = $(LINK) $(libgomp_la_LDFLAGS)
-
+libgompd_la_LINK = $(LINK) $(libgompd_la_LDFLAGS)
 libgomp_la_SOURCES = alloc.c atomic.c barrier.c critical.c env.c error.c \
  icv.c icv-device.c iter.c iter_ull.c loop.c loop_ull.c ordered.c \
  parallel.c scope.c sections.c single.c task.c team.c work.c lock.c \
@@ -66,8 +91,9 @@ libgomp_la_SOURCES = alloc.c atomic.c barrier.c
critical.c env.c error.c \
  target.c splay-tree.c libgomp-plugin.c oacc-parallel.c oacc-host.c \
  oacc-init.c oacc-mem.c oacc-async.c oacc-plugin.c oacc-cuda.c \
  priority_queue.c affinity-fmt.c teams.c allocator.c oacc-profiling.c \
- oacc-target.c
+ oacc-target.c ompd-support.c

+libgompd_la_SOURCES = ompd-init.c ompd-helper.c
 include $(top_srcdir)/plugin/Makefrag.am

 if USE_FORTRAN
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 22cb2136a08..6cc7007e090 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@

-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.

 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,7 @@

 # Plugins for offload execution, Makefile.am fragment.
 #
-# Copyright (C) 2014-2021 Free Software Foundation, Inc.
+# Copyright (C) 2014-2022 Free Software Foundation, Inc.
 #
 # Contributed by Mentor Embedded.
 #
@@ -220,8 +220,11 @@ am_libgomp_la_OBJECTS = alloc.lo atomic.lo barrier.lo
critical.lo \
  oacc-parallel.lo oacc-host.lo oacc-init.lo oacc-mem.lo \
  oacc-async.lo oacc-plugin.lo oacc-cuda.lo priority_queue.lo \
  affinity-fmt.lo teams.lo allocator.lo oacc-profiling.lo \
- oacc-target.lo $(am__objects_1)
+ oacc-target.lo ompd-support.lo $(am__objects_1)
 libgomp_la_OBJECTS = $(am_libgomp_la_OBJECTS)
+libgompd_la_LIBADD =
+am_libgompd_la_OBJECTS = ompd-init.lo ompd-helper.lo
+libgompd_la_OBJECTS = $(am_libgompd_la_OBJECTS)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -236,7 +239,34 @@ am__v_at_0 = @
 am__v_at_1 =
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/../depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/affinity-fmt.Plo \
+ ./$(DEPDIR)/affinity.Plo ./$(DEPDIR)/alloc.Plo \
+ ./$(DEPDIR)/allocator.Plo ./$(DEPDIR)/atomic.Plo \
+ ./$(DEPDIR)/bar.Plo ./$(DEPDIR)/barrier.Plo \
+ ./$(DEPDIR)/critical.Plo ./$(DEPDIR)/env.Plo \
+ ./$(DEPDIR)/error.Plo ./$(DEPDIR)/fortran.Plo \
+ ./$(DEPDIR)/icv-device.Plo ./$(DEPDIR)/icv.Plo \
+ ./$(DEPDIR)/iter.Plo ./$(DEPDIR)/iter_ull.Plo \
+ ./$(DEPDIR)/libgomp-plugin.Plo \
+ ./$(DEPDIR)/libgomp_plugin_gcn_la-plugin-gcn.Plo \
+ ./$(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Plo \
+ ./$(DEPDIR)/lock.Plo ./$(DEPDIR)/loop.Plo \
+ ./$(DEPDIR)/loop_ull.Plo ./$(DEPDIR)/mutex.Plo \
+ ./$(DEPDIR)/oacc-async.Plo ./$(DEPDIR)/oacc-cuda.Plo \
+ ./$(DEPDIR)/oacc-host.Plo ./$(DEPDIR)/oacc-init.Plo \
+ ./$(DEPDIR)/oacc-mem.Plo ./$(DEPDIR)/oacc-parallel.Plo \
+ ./$(DEPDIR)/oacc-plugin.Plo ./$(DEPDIR)/oacc-profiling.Plo \
+ ./$(DEPDIR)/oacc-target.Plo ./$(DEPDIR)/ompd-helper.Plo \
+ ./$(DEPDIR)/ompd-init.Plo ./$(DEPDIR)/ompd-support.Plo \
+ ./$(DEPDIR)/ordered.Plo ./$(DEPDIR)/parallel.Plo \
+ ./$(DEPDIR)/priority_queue.Plo ./$(DEPDIR)/proc.Plo \
+ ./$(DEPDIR)/ptrlock.Plo ./$(DEPDIR)/scope.Plo \
+ ./$(DEPDIR)/sections.Plo ./$(DEPDIR)/sem.Plo \
+ ./$(DEPDIR)/single.Plo ./$(DEPDIR)/splay-tree.Plo \
+ ./$(DEPDIR)/target.Plo ./$(DEPDIR)/task.Plo \
+ ./$(DEPDIR)/team.Plo ./$(DEPDIR)/teams.Plo \
+ ./$(DEPDIR)/time.Plo ./$(DEPDIR)/work.Plo
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
  $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -269,7 +299,8 @@ am__v_FCLD_ = $(am__v_FCLD_@AM_DEFAULT_V@)
 am__v_FCLD_0 = @echo "  FCLD    " $@;
 am__v_FCLD_1 =
 SOURCES = $(libgomp_plugin_gcn_la_SOURCES) \
- $(libgomp_plugin_nvptx_la_SOURCES) $(libgomp_la_SOURCES)
+ $(libgomp_plugin_nvptx_la_SOURCES) $(libgomp_la_SOURCES) \
+ $(libgompd_la_SOURCES)
 AM_V_DVIPS = $(am__v_DVIPS_@AM_V@)
 am__v_DVIPS_ = $(am__v_DVIPS_@AM_DEFAULT_V@)
 am__v_DVIPS_0 = @echo "  DVIPS   " $@;
@@ -506,6 +537,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -533,7 +565,8 @@ libsubincludedir =
$(libdir)/gcc/$(target_alias)/$(gcc_version)/include
 AM_CPPFLAGS = $(addprefix -I, $(search_path))
 AM_CFLAGS = $(XCFLAGS)
 AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
-toolexeclib_LTLIBRARIES = libgomp.la $(am__append_1) $(am__append_2)
+toolexeclib_LTLIBRARIES = libgomp.la libgompd.la $(am__append_1) \
+ $(am__append_2)
 nodist_toolexeclib_HEADERS = libgomp.spec

 # -Wc is only a libtool option.
@@ -542,15 +575,27 @@ nodist_toolexeclib_HEADERS = libgomp.spec
 @LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE@libgomp_version_script =
 @LIBGOMP_BUILD_VERSIONED_SHLIB_GNU_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_script =
-Wl,--version-script,libgomp.ver
 @LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_script =
-Wl,-M,libgomp.ver-sun
+@LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE@libgompd_version_script =
+@LIBGOMP_BUILD_VERSIONED_SHLIB_GNU_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgompd_version_script =
-Wl,--version-script,libgompd.ver
+@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgompd_version_script =
-Wl,-M,libgompd.ver-sun
 @LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE@libgomp_version_dep =
 @LIBGOMP_BUILD_VERSIONED_SHLIB_GNU_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver
 @LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp_version_dep = libgomp.ver-sun
+@LIBGOMP_BUILD_VERSIONED_SHLIB_FALSE@libgompd_version_dep =
+@LIBGOMP_BUILD_VERSIONED_SHLIB_GNU_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgompd_version_dep = libgompd.ver
+@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgompd_version_dep = libgompd.ver-sun
 libgomp_version_info = -version-info $(libtool_VERSION)
+libgompd_version_info = -version-info $(libtool_VERSION)
 libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script) \
         $(lt_host_flags)

+libgompd_la_LDFLAGS = $(libgompd_version_info) $(libgompd_version_script) \
+ $(lt_host_flags)
+
 libgomp_la_DEPENDENCIES = $(libgomp_version_dep)
+libgompd_la_DEPENDENCIES = $(libgompd_version_dep)
 libgomp_la_LINK = $(LINK) $(libgomp_la_LDFLAGS)
+libgompd_la_LINK = $(LINK) $(libgompd_la_LDFLAGS)
 libgomp_la_SOURCES = alloc.c atomic.c barrier.c critical.c env.c \
  error.c icv.c icv-device.c iter.c iter_ull.c loop.c loop_ull.c \
  ordered.c parallel.c scope.c sections.c single.c task.c team.c \
@@ -559,7 +604,8 @@ libgomp_la_SOURCES = alloc.c atomic.c barrier.c
critical.c env.c \
  oacc-parallel.c oacc-host.c oacc-init.c oacc-mem.c \
  oacc-async.c oacc-plugin.c oacc-cuda.c priority_queue.c \
  affinity-fmt.c teams.c allocator.c oacc-profiling.c \
- oacc-target.c $(am__append_3)
+ oacc-target.c ompd-support.c $(am__append_3)
+libgompd_la_SOURCES = ompd-init.c ompd-helper.c

 # Nvidia PTX OpenACC plugin.
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_version_info = -version-info
$(libtool_VERSION)
@@ -644,8 +690,8 @@ Makefile: $(srcdir)/Makefile.in
$(top_builddir)/config.status
     echo ' $(SHELL) ./config.status'; \
     $(SHELL) ./config.status;; \
   *) \
-    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@
$(am__depfiles_maybe)'; \
-    cd $(top_builddir) && $(SHELL) ./config.status $@
$(am__depfiles_maybe);; \
+    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@
$(am__maybe_remake_depfiles)'; \
+    cd $(top_builddir) && $(SHELL) ./config.status $@
$(am__maybe_remake_depfiles);; \
  esac;
 $(top_srcdir)/plugin/Makefrag.am $(top_srcdir)/../multilib.am $(am__empty):

@@ -727,59 +773,71 @@ libgomp-plugin-nvptx.la:
$(libgomp_plugin_nvptx_la_OBJECTS) $(libgomp_plugin_nvp
 libgomp.la: $(libgomp_la_OBJECTS) $(libgomp_la_DEPENDENCIES)
$(EXTRA_libgomp_la_DEPENDENCIES)
  $(AM_V_GEN)$(libgomp_la_LINK) -rpath $(toolexeclibdir)
$(libgomp_la_OBJECTS) $(libgomp_la_LIBADD) $(LIBS)

+libgompd.la: $(libgompd_la_OBJECTS) $(libgompd_la_DEPENDENCIES)
$(EXTRA_libgompd_la_DEPENDENCIES)
+ $(AM_V_GEN)$(libgompd_la_LINK) -rpath $(toolexeclibdir)
$(libgompd_la_OBJECTS) $(libgompd_la_LIBADD) $(LIBS)
+
 mostlyclean-compile:
  -rm -f *.$(OBJEXT)

 distclean-compile:
  -rm -f *.tab.c

-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/affinity-fmt.Plo@am__quote
@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/affinity.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloc.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allocator.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bar.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/barrier.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/critical.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fortran.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icv-device.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icv.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iter.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iter_ull.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@
./$(DEPDIR)/libgomp-plugin.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@
./$(DEPDIR)/libgomp_plugin_gcn_la-plugin-gcn.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@
./$(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loop.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loop_ull.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mutex.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-async.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-cuda.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-host.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-init.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-mem.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@
./$(DEPDIR)/oacc-parallel.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-plugin.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@
./$(DEPDIR)/oacc-profiling.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-target.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ordered.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parallel.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@
./$(DEPDIR)/priority_queue.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ptrlock.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scope.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sections.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sem.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/single.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splay-tree.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/target.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/task.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/team.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/teams.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/work.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/affinity-fmt.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/affinity.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloc.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allocator.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bar.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/barrier.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/critical.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fortran.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icv-device.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icv.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iter.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iter_ull.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@
./$(DEPDIR)/libgomp-plugin.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@
./$(DEPDIR)/libgomp_plugin_gcn_la-plugin-gcn.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@
./$(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loop.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loop_ull.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mutex.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-async.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-cuda.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-host.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-init.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-mem.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@
./$(DEPDIR)/oacc-parallel.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-plugin.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@
./$(DEPDIR)/oacc-profiling.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-target.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ompd-helper.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ompd-init.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ompd-support.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ordered.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parallel.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@
./$(DEPDIR)/priority_queue.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ptrlock.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scope.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sections.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sem.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/single.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splay-tree.Plo@am__quote@
# am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/target.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/task.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/team.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/teams.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Plo@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/work.Plo@am__quote@ #
am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)

 .c.o:
 @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF
$(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -1165,7 +1223,56 @@ clean-am: clean-aminfo clean-generic clean-libtool
clean-local \

 distclean: distclean-recursive
  -rm -f $(am__CONFIG_DISTCLEAN_FILES)
- -rm -rf ./$(DEPDIR)
+ -rm -f ./$(DEPDIR)/affinity-fmt.Plo
+ -rm -f ./$(DEPDIR)/affinity.Plo
+ -rm -f ./$(DEPDIR)/alloc.Plo
+ -rm -f ./$(DEPDIR)/allocator.Plo
+ -rm -f ./$(DEPDIR)/atomic.Plo
+ -rm -f ./$(DEPDIR)/bar.Plo
+ -rm -f ./$(DEPDIR)/barrier.Plo
+ -rm -f ./$(DEPDIR)/critical.Plo
+ -rm -f ./$(DEPDIR)/env.Plo
+ -rm -f ./$(DEPDIR)/error.Plo
+ -rm -f ./$(DEPDIR)/fortran.Plo
+ -rm -f ./$(DEPDIR)/icv-device.Plo
+ -rm -f ./$(DEPDIR)/icv.Plo
+ -rm -f ./$(DEPDIR)/iter.Plo
+ -rm -f ./$(DEPDIR)/iter_ull.Plo
+ -rm -f ./$(DEPDIR)/libgomp-plugin.Plo
+ -rm -f ./$(DEPDIR)/libgomp_plugin_gcn_la-plugin-gcn.Plo
+ -rm -f ./$(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Plo
+ -rm -f ./$(DEPDIR)/lock.Plo
+ -rm -f ./$(DEPDIR)/loop.Plo
+ -rm -f ./$(DEPDIR)/loop_ull.Plo
+ -rm -f ./$(DEPDIR)/mutex.Plo
+ -rm -f ./$(DEPDIR)/oacc-async.Plo
+ -rm -f ./$(DEPDIR)/oacc-cuda.Plo
+ -rm -f ./$(DEPDIR)/oacc-host.Plo
+ -rm -f ./$(DEPDIR)/oacc-init.Plo
+ -rm -f ./$(DEPDIR)/oacc-mem.Plo
+ -rm -f ./$(DEPDIR)/oacc-parallel.Plo
+ -rm -f ./$(DEPDIR)/oacc-plugin.Plo
+ -rm -f ./$(DEPDIR)/oacc-profiling.Plo
+ -rm -f ./$(DEPDIR)/oacc-target.Plo
+ -rm -f ./$(DEPDIR)/ompd-helper.Plo
+ -rm -f ./$(DEPDIR)/ompd-init.Plo
+ -rm -f ./$(DEPDIR)/ompd-support.Plo
+ -rm -f ./$(DEPDIR)/ordered.Plo
+ -rm -f ./$(DEPDIR)/parallel.Plo
+ -rm -f ./$(DEPDIR)/priority_queue.Plo
+ -rm -f ./$(DEPDIR)/proc.Plo
+ -rm -f ./$(DEPDIR)/ptrlock.Plo
+ -rm -f ./$(DEPDIR)/scope.Plo
+ -rm -f ./$(DEPDIR)/sections.Plo
+ -rm -f ./$(DEPDIR)/sem.Plo
+ -rm -f ./$(DEPDIR)/single.Plo
+ -rm -f ./$(DEPDIR)/splay-tree.Plo
+ -rm -f ./$(DEPDIR)/target.Plo
+ -rm -f ./$(DEPDIR)/task.Plo
+ -rm -f ./$(DEPDIR)/team.Plo
+ -rm -f ./$(DEPDIR)/teams.Plo
+ -rm -f ./$(DEPDIR)/time.Plo
+ -rm -f ./$(DEPDIR)/work.Plo
  -rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
  distclean-hdr distclean-libtool distclean-local distclean-tags
@@ -1306,7 +1413,56 @@ installcheck-am:
 maintainer-clean: maintainer-clean-recursive
  -rm -f $(am__CONFIG_DISTCLEAN_FILES)
  -rm -rf $(top_srcdir)/autom4te.cache
- -rm -rf ./$(DEPDIR)
+ -rm -f ./$(DEPDIR)/affinity-fmt.Plo
+ -rm -f ./$(DEPDIR)/affinity.Plo
+ -rm -f ./$(DEPDIR)/alloc.Plo
+ -rm -f ./$(DEPDIR)/allocator.Plo
+ -rm -f ./$(DEPDIR)/atomic.Plo
+ -rm -f ./$(DEPDIR)/bar.Plo
+ -rm -f ./$(DEPDIR)/barrier.Plo
+ -rm -f ./$(DEPDIR)/critical.Plo
+ -rm -f ./$(DEPDIR)/env.Plo
+ -rm -f ./$(DEPDIR)/error.Plo
+ -rm -f ./$(DEPDIR)/fortran.Plo
+ -rm -f ./$(DEPDIR)/icv-device.Plo
+ -rm -f ./$(DEPDIR)/icv.Plo
+ -rm -f ./$(DEPDIR)/iter.Plo
+ -rm -f ./$(DEPDIR)/iter_ull.Plo
+ -rm -f ./$(DEPDIR)/libgomp-plugin.Plo
+ -rm -f ./$(DEPDIR)/libgomp_plugin_gcn_la-plugin-gcn.Plo
+ -rm -f ./$(DEPDIR)/libgomp_plugin_nvptx_la-plugin-nvptx.Plo
+ -rm -f ./$(DEPDIR)/lock.Plo
+ -rm -f ./$(DEPDIR)/loop.Plo
+ -rm -f ./$(DEPDIR)/loop_ull.Plo
+ -rm -f ./$(DEPDIR)/mutex.Plo
+ -rm -f ./$(DEPDIR)/oacc-async.Plo
+ -rm -f ./$(DEPDIR)/oacc-cuda.Plo
+ -rm -f ./$(DEPDIR)/oacc-host.Plo
+ -rm -f ./$(DEPDIR)/oacc-init.Plo
+ -rm -f ./$(DEPDIR)/oacc-mem.Plo
+ -rm -f ./$(DEPDIR)/oacc-parallel.Plo
+ -rm -f ./$(DEPDIR)/oacc-plugin.Plo
+ -rm -f ./$(DEPDIR)/oacc-profiling.Plo
+ -rm -f ./$(DEPDIR)/oacc-target.Plo
+ -rm -f ./$(DEPDIR)/ompd-helper.Plo
+ -rm -f ./$(DEPDIR)/ompd-init.Plo
+ -rm -f ./$(DEPDIR)/ompd-support.Plo
+ -rm -f ./$(DEPDIR)/ordered.Plo
+ -rm -f ./$(DEPDIR)/parallel.Plo
+ -rm -f ./$(DEPDIR)/priority_queue.Plo
+ -rm -f ./$(DEPDIR)/proc.Plo
+ -rm -f ./$(DEPDIR)/ptrlock.Plo
+ -rm -f ./$(DEPDIR)/scope.Plo
+ -rm -f ./$(DEPDIR)/sections.Plo
+ -rm -f ./$(DEPDIR)/sem.Plo
+ -rm -f ./$(DEPDIR)/single.Plo
+ -rm -f ./$(DEPDIR)/splay-tree.Plo
+ -rm -f ./$(DEPDIR)/target.Plo
+ -rm -f ./$(DEPDIR)/task.Plo
+ -rm -f ./$(DEPDIR)/team.Plo
+ -rm -f ./$(DEPDIR)/teams.Plo
+ -rm -f ./$(DEPDIR)/time.Plo
+ -rm -f ./$(DEPDIR)/work.Plo
  -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-aminfo \
  maintainer-clean-generic maintainer-clean-local
@@ -1333,8 +1489,8 @@ uninstall-am: uninstall-dvi-am uninstall-html-am
uninstall-info-am \
 .MAKE: $(am__recursive_targets) all install-am install-strip

 .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \
- am--refresh check check-am clean clean-aminfo clean-cscope \
- clean-generic clean-libtool clean-local \
+ am--depfiles am--refresh check check-am clean clean-aminfo \
+ clean-cscope clean-generic clean-libtool clean-local \
  clean-toolexeclibLTLIBRARIES cscope cscopelist-am ctags \
  ctags-am dist-info distclean distclean-compile \
  distclean-generic distclean-hdr distclean-libtool \
@@ -1366,6 +1522,10 @@ vpath % $(strip $(search_path))
 @LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp.ver: $(top_srcdir)/libgomp.map
 @LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ $(EGREP) -v '#(#| |$$)' $< | \
 @LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@  $(PREPROCESS) -P -include config.h -
> $@ || (rm -f $@ ; exit 1)
+
+@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgompd.ver:
$(top_srcdir)/libgompd.map
+@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ $(EGREP) -v '#(#| |$$)' $< | \
+@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ $(PREPROCESS) -P -include config.h -
> $@ || (rm -f $@ ; exit 1)
 @LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgomp.ver-sun : libgomp.ver \
 @LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ $(top_srcdir)/../contrib/make_sunver.pl
\
 @LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ $(libgomp_la_OBJECTS)
$(libgomp_la_LIBADD)
@@ -1376,6 +1536,16 @@ vpath % $(strip $(search_path))
 @LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@    sed
's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
 @LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ > $@ || (rm -f $@ ; exit 1)

+@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@libgompd.ver-sun : libgompd.ver \
+@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ $(top_srcdir)/../contrib/make_sunver.pl
\
+@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ $(libgompd_la_OBJECTS)
$(libgompd_la_LIBADD)
+@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ perl $(top_srcdir)/../contrib/
make_sunver.pl \
+@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ libgompd.ver \
+@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ $(libgompd_la_OBJECTS:%.lo=.libs/%.o) \
+@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ `echo $(libgompd_la_LIBADD) | \
+@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'`
\
+@LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@
@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@ > $@ || (rm -f $@ ; exit 1)
+
 omp_lib_kinds.mod: omp_lib.mod
  :
 openacc_kinds.mod: openacc.mod
diff --git a/libgomp/aclocal.m4 b/libgomp/aclocal.m4
index 55d9d71895a..471963bf607 100644
--- a/libgomp/aclocal.m4
+++ b/libgomp/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.1 -*- Autoconf -*-

-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.

 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,7 @@ You have another version of autoconf.  It may work, but
is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically
'autoreconf'.])])

-# Copyright (C) 2002-2017 Free Software Foundation, Inc.
+# Copyright (C) 2002-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -32,10 +32,10 @@ To do so, use the procedure documented by the package,
typically 'autoreconf'.])
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.15'
+[am__api_version='1.16'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15.1], [],
+m4_if([$1], [1.16.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])

@@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15.1])dnl
+[AM_AUTOMAKE_VERSION([1.16.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])

 # AM_AUX_DIR_EXPAND                                         -*- Autoconf
-*-

-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`

 # AM_CONDITIONAL                                            -*- Autoconf
-*-

-# Copyright (C) 1997-2017 Free Software Foundation, Inc.
+# Copyright (C) 1997-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])

-# Copyright (C) 1999-2017 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -332,13 +332,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl

 # Generate code to set up dependency tracking.              -*- Autoconf
-*-

-# Copyright (C) 1999-2017 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.

-
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
@@ -346,49 +345,41 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
   # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
-  esac
+  # TODO: see whether this extra hack can be removed once we start
+  # requiring Autoconf 2.70 or later.
+  AS_CASE([$CONFIG_FILES],
+          [*\'*], [eval set x "$CONFIG_FILES"],
+          [*], [set x $CONFIG_FILES])
   shift
-  for mf
+  # Used to flag and report bootstrapping failures.
+  am_rc=0
+  for am_mf
   do
     # Strip MF so we end up with the name of the file.
-    mf=`echo "$mf" | sed -e 's/:.*$//'`
-    # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named 'Makefile.in', but
-    # some people rename them; so instead we look at the file content.
-    # Grep'ing the first line is not enough: some people post-process
-    # each Makefile.in and add a new line on top of each file to say so.
-    # Grep'ing the whole file is not good either: AIX grep has a line
+    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile which includes
+    # dependency-tracking related rules and includes.
+    # Grep'ing the whole file directly is not great: AIX grep has a line
     # limit of 2048, but all sed's we know have understand at least 4000.
-    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X
>/dev/null 2>&1; then
-      dirpart=`AS_DIRNAME("$mf")`
-    else
-      continue
-    fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running 'make'.
-    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-    test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "$am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # Find all dependency output files, they are included files with
-    # $(DEPDIR) in their names.  We invoke sed twice because it is the
-    # simplest approach to changing $(DEPDIR) to its actual value in the
-    # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf"
| \
- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
-      # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`AS_DIRNAME(["$file"])`
-      AS_MKDIR_P([$dirpart/$fdir])
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
+    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+      || continue
+    am_dirpart=`AS_DIRNAME(["$am_mf"])`
+    am_filepart=`AS_BASENAME(["$am_mf"])`
+    AM_RUN_LOG([cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles]) || am_rc=$?
   done
+  if test $am_rc -ne 0; then
+    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
+    for automatic dependency tracking.  Try re-running configure with the
+    '--disable-dependency-tracking' option to at least be able to build
+    the package (albeit without support for automatic dependency
tracking).])
+  fi
+  AS_UNSET([am_dirpart])
+  AS_UNSET([am_filepart])
+  AS_UNSET([am_mf])
+  AS_UNSET([am_rc])
+  rm -f conftest-deps.mk
 }
 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS

@@ -397,18 +388,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 # -----------------------------
 # This macro should only be invoked once -- use via AC_REQUIRE.
 #
-# This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each '.P' file that we will
-# need in order to bootstrap the dependency handling code.
+# This code is only required when automatic dependency tracking is enabled.
+# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
+# order to bootstrap the dependency handling code.
 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 [AC_CONFIG_COMMANDS([depfiles],
      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
-     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
-])
+     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])

 # Do all the work for Automake.                             -*- Autoconf
-*-

-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -495,8 +485,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
 # For better backward compatibility.  To be removed once Automake 1.9.x
 # dies out for good.  For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
 # We need awk for the "check" target (and possibly the TAP driver).  The
 # system "awk" is bad on some platforms.
@@ -563,7 +553,7 @@ END
 Aborting the configuration process, to ensure you take notice of the issue.

 You can download and install GNU coreutils to get an 'rm' implementation
-that behaves properly: <http://www.gnu.org/software/coreutils/>.
+that behaves properly: <https://www.gnu.org/software/coreutils/>.

 If you want to complete the configuration process using your problematic
 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@@ -605,7 +595,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg"
>`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])

-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -629,7 +619,7 @@ AC_SUBST([install_sh])])
 # Add --enable-maintainer-mode option to configure.         -*- Autoconf
-*-
 # From Jim Meyering

-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -664,7 +654,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific
portions of Makefiles])

 # Check to see how 'make' treats includes.            -*- Autoconf -*-

-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -672,49 +662,42 @@ AC_MSG_CHECKING([whether to enable
maintainer-specific portions of Makefiles])

 # AM_MAKE_INCLUDE()
 # -----------------
-# Check to see how make treats includes.
+# Check whether make has an 'include' directive that can support all
+# the idioms we need for our automatic dependency tracking code.
 AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
+[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
+cat > confinc.mk << 'END'
 am__doit:
- @echo this is the am__doit target
+ @echo this is the am__doit target >confinc.out
 .PHONY: am__doit
 END
-# If we don't find an include directive, just comment out the code.
-AC_MSG_CHECKING([for style of include used by $am_make])
 am__include="#"
 am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
-     ;;
-   esac
-fi
-AC_SUBST([am__include])
-AC_SUBST([am__quote])
-AC_MSG_RESULT([$_am_result])
-rm -f confinc confmf
-])
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
+  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
+      ['0:this is the am__doit target'],
+      [AS_CASE([$s],
+          [BSD], [am__include='.include' am__quote='"'],
+          [am__include='include' am__quote=''])])
+  if test "$am__include" != "#"; then
+    _am_result="yes ($s style)"
+    break
+  fi
+done
+rm -f confinc.* confmf.*
+AC_MSG_RESULT([${_am_result}])
+AC_SUBST([am__include])])
+AC_SUBST([am__quote])])

 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf
-*-

-# Copyright (C) 1997-2017 Free Software Foundation, Inc.
+# Copyright (C) 1997-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -753,7 +736,7 @@ fi

 # Helper functions for option handling.                     -*- Autoconf
-*-

-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -782,7 +765,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])

-# Copyright (C) 1999-2017 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -829,7 +812,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])

-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -848,7 +831,7 @@ AC_DEFUN([AM_RUN_LOG],

 # Check to make sure that the build environment is sane.    -*- Autoconf
-*-

-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -929,7 +912,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])

-# Copyright (C) 2009-2017 Free Software Foundation, Inc.
+# Copyright (C) 2009-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -989,7 +972,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])

-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1017,7 +1000,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])

-# Copyright (C) 2006-2017 Free Software Foundation, Inc.
+# Copyright (C) 2006-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1036,7 +1019,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])

 # Check how to create a tarball.                            -*- Autoconf
-*-

-# Copyright (C) 2004-2017 Free Software Foundation, Inc.
+# Copyright (C) 2004-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/libgomp/config/darwin/plugin-suffix.h
b/libgomp/config/darwin/plugin-suffix.h
index 7c1ad31c9b4..57f127f6d3e 100644
--- a/libgomp/config/darwin/plugin-suffix.h
+++ b/libgomp/config/darwin/plugin-suffix.h
@@ -23,4 +23,4 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */

-#define SONAME_SUFFIX(n) ("." #n ".dylib")
+#define SONAME_SUFFIX(n) "." #n ".dylib"
diff --git a/libgomp/config/hpux/plugin-suffix.h
b/libgomp/config/hpux/plugin-suffix.h
index a4c48a45dd1..ceaf2c6e054 100644
--- a/libgomp/config/hpux/plugin-suffix.h
+++ b/libgomp/config/hpux/plugin-suffix.h
@@ -23,4 +23,4 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */

-#define SONAME_SUFFIX(n) (".sl." #n)
+#define SONAME_SUFFIX(n) ".sl." #n
diff --git a/libgomp/config/posix/plugin-suffix.h
b/libgomp/config/posix/plugin-suffix.h
index cf03f64f7a3..995d34f53ea 100644
--- a/libgomp/config/posix/plugin-suffix.h
+++ b/libgomp/config/posix/plugin-suffix.h
@@ -23,4 +23,4 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */

-#define SONAME_SUFFIX(n) (".so." #n)
+#define SONAME_SUFFIX(n) ".so." #n
diff --git a/libgomp/configure b/libgomp/configure
index a73a6d44003..d8db5df2e93 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -724,7 +724,6 @@ am__nodep
 AMDEPBACKSLASH
 AMDEP_FALSE
 AMDEP_TRUE
-am__quote
 am__include
 DEPDIR
 OBJEXT
@@ -797,6 +796,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -815,7 +815,8 @@ PACKAGE_VERSION
 PACKAGE_TARNAME
 PACKAGE_NAME
 PATH_SEPARATOR
-SHELL'
+SHELL
+am__quote'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
@@ -892,6 +893,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1144,6 +1146,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;

+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1281,7 +1292,7 @@ fi
 for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
  datadir sysconfdir sharedstatedir localstatedir includedir \
  oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1434,6 +1445,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data
[PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -2887,7 +2899,7 @@ target_alias=${target_alias-$host_alias}
 #  -Wall:  turns on all automake warnings...
 #  -Wno-portability:  ...except this one, since GNU make is required.
 #  -Wno-override: ... and this one, since we do want this in testsuite.
-am__api_version='1.15'
+am__api_version='1.16'

 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -3403,8 +3415,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}

 # For better backward compatibility.  To be removed once Automake 1.9.x
 # dies out for good.  For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
 mkdir_p='$(MKDIR_P)'

 # We need awk for the "check" target (and possibly the TAP driver).  The
@@ -3455,7 +3467,7 @@ END
 Aborting the configuration process, to ensure you take notice of the issue.

 You can download and install GNU coreutils to get an 'rm' implementation
-that behaves properly: <http://www.gnu.org/software/coreutils/>.
+that behaves properly: <https://www.gnu.org/software/coreutils/>.

 If you want to complete the configuration process using your problematic
 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@@ -4416,45 +4428,45 @@ DEPDIR="${am__leading_dot}deps"

 ac_config_commands="$ac_config_commands depfiles"

-
-am_make=${MAKE-make}
-cat > confinc << 'END'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make}
supports the include directive" >&5
+$as_echo_n "checking whether ${MAKE-make} supports the include
directive... " >&6; }
+cat > confinc.mk << 'END'
 am__doit:
- @echo this is the am__doit target
+ @echo this is the am__doit target >confinc.out
 .PHONY: am__doit
 END
-# If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include
used by $am_make" >&5
-$as_echo_n "checking for style of include used by $am_make... " >&6; }
 am__include="#"
 am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+  { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
+   (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+  case $?:`cat confinc.out 2>/dev/null` in #(
+  '0:this is the am__doit target') :
+    case $s in #(
+  BSD) :
+    am__include='.include' am__quote='"' ;; #(
+  *) :
+    am__include='include' am__quote='' ;;
+esac ;; #(
+  *) :
      ;;
-   esac
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
-$as_echo "$_am_result" >&6; }
-rm -f confinc confmf
+esac
+  if test "$am__include" != "#"; then
+    _am_result="yes ($s style)"
+    break
+  fi
+done
+rm -f confinc.* confmf.*
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
+$as_echo "${_am_result}" >&6; }

 # Check whether --enable-dependency-tracking was given.
 if test "${enable_dependency_tracking+set}" = set; then :
@@ -11431,7 +11443,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 11446 "configure"
 #include "confdefs.h"

 #if HAVE_DLFCN_H
@@ -11537,7 +11549,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 11552 "configure"
 #include "confdefs.h"

 #if HAVE_DLFCN_H
@@ -17840,7 +17852,7 @@ CC="$CC"
 CXX="$CXX"
 GFORTRAN="$GFORTRAN"
 GDC="$GDC"
-AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"


 # The HP-UX ksh and POSIX shell print the target directory to stdout
@@ -18830,29 +18842,35 @@ esac ;;
   # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
-  esac
+  # TODO: see whether this extra hack can be removed once we start
+  # requiring Autoconf 2.70 or later.
+  case $CONFIG_FILES in #(
+  *\'*) :
+    eval set x "$CONFIG_FILES" ;; #(
+  *) :
+    set x $CONFIG_FILES ;; #(
+  *) :
+     ;;
+esac
   shift
-  for mf
+  # Used to flag and report bootstrapping failures.
+  am_rc=0
+  for am_mf
   do
     # Strip MF so we end up with the name of the file.
-    mf=`echo "$mf" | sed -e 's/:.*$//'`
-    # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named 'Makefile.in', but
-    # some people rename them; so instead we look at the file content.
-    # Grep'ing the first line is not enough: some people post-process
-    # each Makefile.in and add a new line on top of each file to say so.
-    # Grep'ing the whole file is not good either: AIX grep has a line
+    am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile which includes
+    # dependency-tracking related rules and includes.
+    # Grep'ing the whole file directly is not great: AIX grep has a line
     # limit of 2048, but all sed's we know have understand at least 4000.
-    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X
>/dev/null 2>&1; then
-      dirpart=`$as_dirname -- "$mf" ||
-$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$mf" : 'X\(//\)[^/]' \| \
- X"$mf" : 'X\(//\)$' \| \
- X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$mf" |
+    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+      || continue
+    am_dirpart=`$as_dirname -- "$am_mf" ||
+$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$am_mf" : 'X\(//\)[^/]' \| \
+ X"$am_mf" : 'X\(//\)$' \| \
+ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$am_mf" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
     s//\1/
     q
@@ -18870,53 +18888,48 @@ $as_echo X"$mf" |
     q
   }
   s/.*/./; q'`
-    else
-      continue
-    fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running 'make'.
-    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-    test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "$am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # Find all dependency output files, they are included files with
-    # $(DEPDIR) in their names.  We invoke sed twice because it is the
-    # simplest approach to changing $(DEPDIR) to its actual value in the
-    # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf"
| \
- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
-      # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`$as_dirname -- "$file" ||
-$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$file" : 'X\(//\)[^/]' \| \
- X"$file" : 'X\(//\)$' \| \
- X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-    s//\1/
-    q
-  }
-  /^X\(\/\/\)[^/].*/{
+    am_filepart=`$as_basename -- "$am_mf" ||
+$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$am_mf" : 'X\(//\)$' \| \
+ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$am_mf" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
     s//\1/
     q
   }
-  /^X\(\/\/\)$/{
+  /^X\/\(\/\/\)$/{
     s//\1/
     q
   }
-  /^X\(\/\).*/{
+  /^X\/\(\/\).*/{
     s//\1/
     q
   }
   s/.*/./; q'`
-      as_dir=$dirpart/$fdir; as_fn_mkdir_p
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
+    { echo "$as_me:$LINENO: cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles" >&5
+   (cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } || am_rc=$?
   done
+  if test $am_rc -ne 0; 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 $? "Something went wrong bootstrapping makefile fragments
+    for automatic dependency tracking.  Try re-running configure with the
+    '--disable-dependency-tracking' option to at least be able to build
+    the package (albeit without support for automatic dependency tracking).
+See \`config.log' for more details" "$LINENO" 5; }
+  fi
+  { am_dirpart=; unset am_dirpart;}
+  { am_filepart=; unset am_filepart;}
+  { am_mf=; unset am_mf;}
+  { am_rc=; unset am_rc;}
+  rm -f conftest-deps.mk
 }
  ;;
     "libtool":C)
diff --git a/libgomp/env.c b/libgomp/env.c
index 1c4ee894515..0421abf8cac 100644
--- a/libgomp/env.c
+++ b/libgomp/env.c
@@ -33,6 +33,7 @@
 #ifndef LIBGOMP_OFFLOADED_ONLY
 #include "libgomp_f.h"
 #include "oacc-int.h"
+#include "ompd-support.h"
 #include <ctype.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -1483,6 +1484,7 @@ initialize_env (void)
  = thread_limit_var > INT_MAX ? UINT_MAX : thread_limit_var;
     }
   parse_int_secure ("GOMP_DEBUG", &gomp_debug_var, true);
+  ompd_load();
 #ifndef HAVE_SYNC_BUILTINS
   gomp_mutex_init (&gomp_managed_threads_lock);
 #endif
diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map
index 2ac58094169..257dfa83d7b 100644
--- a/libgomp/libgomp.map
+++ b/libgomp/libgomp.map
@@ -226,6 +226,14 @@ OMP_5.1 {
  omp_get_teams_thread_limit_;
 } OMP_5.0.2;

+OMP_5.0.3 {
+  global:
+   ompd_dll_locations;
+   ompd_dll_locations_valid;
+   ompd_bp_parallel_begin;
+   ompd_bp_parallel_end;
+}OMP_5.0.2;
+
 GOMP_1.0 {
   global:
  GOMP_atomic_end;
diff --git a/libgomp/libgompd.map b/libgomp/libgompd.map
new file mode 100644
index 00000000000..d1299efbf54
--- /dev/null
+++ b/libgomp/libgompd.map
@@ -0,0 +1,12 @@
+OMPD_5.1 {
+  global:
+ ompd_initialize;
+ ompd_get_api_version;
+ ompd_get_version_string;
+ ompd_get_finalize;
+ ompd_process_initialize;
+ ompd_device_initialize;
+ ompd_rel_address_space_handle;
+  local:
+   *;
+};
diff --git a/libgomp/omp-tools.h b/libgomp/omp-tools.h
new file mode 100644
index 00000000000..bfab48a0a63
--- /dev/null
+++ b/libgomp/omp-tools.h
@@ -0,0 +1,282 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+   Contributed by Mohamed Atef <mohamedatef1698@gmail.com>.
+   This file is part of the GNU Offloading and Multi Processing Library
+   (libgomp).
+   Libgomp is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+   Libgomp is distributed in the hope that it will be useful, but WITHOUT
ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS
+   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+   more details.
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+
+
+/* This file contains data types and function declarations that
+   that are defined in OMPD standard.  */
+
+
+
+#ifndef _OMP_TOOLS_H
+#define _OMP_TOOLS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const char **ompd_dll_locations;
+
+void ompd_dll_locations_valid(void);
+
+typedef __UINT64_TYPE__ ompd_size_t;
+typedef __UINT64_TYPE__ ompd_wait_id_t;
+
+typedef __UINT64_TYPE__ ompd_addr_t;
+typedef __INT64_TYPE__ ompd_word_t;
+typedef __UINT64_TYPE__ ompd_seg_t;
+
+typedef struct ompd_address_t
+{
+ ompd_seg_t segment;
+ ompd_addr_t address;
+} ompd_address_t;
+
+typedef struct ompd_frame_info_t
+{
+ ompd_address_t frame_address;
+ ompd_word_t frame_flag;
+} ompd_frame_info_t;
+
+typedef __UINT64_TYPE__ ompd_device_t;
+typedef __UINT64_TYPE__ ompd_thread_id_t;
+
+typedef struct _ompd_aspace_handle ompd_address_space_handle_t;
+typedef struct _ompd_thread_handle ompd_thread_handle_t;
+typedef struct _ompd_parallel_handle ompd_parallel_handle_t;
+typedef struct _ompd_task_handle ompd_task_handle_t;
+
+typedef enum ompd_scope_t
+{
+ ompd_scope_global    = 1,
+ ompd_scope_address_space = 2,
+ ompd_scope_thread    = 3,
+ ompd_scope_parallel = 4,
+ ompd_scope_implicit_task = 5,
+ ompd_scope_task          = 6
+} ompd_scope_t;
+
+typedef __UINT64_TYPE__ ompd_icv_id_t;
+
+typedef struct _ompd_aspace_cont ompd_address_space_context_t;
+typedef struct _ompd_thread_cont ompd_thread_context_t;
+
+typedef enum ompd_rc_t
+{
+ ompd_rc_ok                   = 0,
+ ompd_rc_unavailable          = 1,
+ ompd_rc_stale_handle         = 2,
+ ompd_rc_bad_input            = 3,
+ ompd_rc_error                = 4,
+ ompd_rc_unsupported          = 5,
+ ompd_rc_needs_state_tracking = 6,
+ ompd_rc_incompatible  = 7,
+ ompd_rc_device_read_error  = 8,
+ ompd_rc_device_write_error   = 9,
+ ompd_rc_nomem                = 10,
+ ompd_rc_incomplete           = 11,
+ ompd_rc_callback_error       = 12
+} ompd_rc_t;
+
+
+typedef struct ompd_device_type_sizes_t
+{
+ __UINT8_TYPE__ sizeof_char;
+ __UINT8_TYPE__ sizeof_short;
+ __UINT8_TYPE__ sizeof_int;
+ __UINT8_TYPE__ sizeof_long;
+ __UINT8_TYPE__ sizeof_long_long;
+ __UINT8_TYPE__ sizeof_pointer;
+} ompd_device_type_sizes_t;
+
+
+typedef ompd_rc_t (*ompd_callback_memory_alloc_fn_t) (ompd_size_t, void
**);
+typedef ompd_rc_t (*ompd_callback_memory_free_fn_t) (void *);
+
+typedef ompd_rc_t (*ompd_callback_get_thread_context_for_thread_id_fn_t)
+ (ompd_address_space_context_t *, ompd_thread_id_t,
+ ompd_size_t, const void *, ompd_thread_context_t **);
+
+
+typedef ompd_rc_t (*ompd_callback_sizeof_fn_t)
+ (ompd_address_space_context_t *, ompd_device_type_sizes_t *);
+
+
+typedef ompd_rc_t (*ompd_callback_symbol_addr_fn_t)
+ (ompd_address_space_context_t *, ompd_thread_context_t *,
+ const char *, ompd_address_t *, const char *);
+
+typedef ompd_rc_t (*ompd_callback_memory_read_fn_t)
+ (ompd_address_space_context_t *, ompd_thread_context_t *,
+ const ompd_address_t *, ompd_size_t nbytes, void *);
+
+
+typedef ompd_rc_t (*ompd_callback_memory_write_fn_t)
+ (ompd_address_space_context_t *, ompd_thread_context_t *,
+ const ompd_address_t *, ompd_size_t, const void *);
+
+typedef ompd_rc_t (*ompd_callback_device_host_fn_t)
+ (ompd_address_space_context_t *, const void *,
+ ompd_size_t, ompd_size_t, void *);
+
+
+typedef ompd_rc_t (*ompd_callback_print_string_fn_t) (const char *, int);
+
+typedef struct ompd_callbacks_t
+{
+ ompd_callback_memory_alloc_fn_t alloc_memory;
+ ompd_callback_memory_free_fn_t free_memory;
+ ompd_callback_print_string_fn_t print_string;
+ ompd_callback_sizeof_fn_t sizeof_type;
+ ompd_callback_symbol_addr_fn_t symbol_addr_lookup;
+ ompd_callback_memory_read_fn_t read_memory;
+ ompd_callback_memory_write_fn_t write_memory;
+ ompd_callback_memory_read_fn_t read_string;
+ ompd_callback_device_host_fn_t device_to_host;
+ ompd_callback_device_host_fn_t host_to_device;
+ ompd_callback_get_thread_context_for_thread_id_fn_t
+ get_thread_context_for_thread_id;
+} ompd_callbacks_t;
+
+
+ompd_rc_t ompd_initialize(ompd_word_t, const ompd_callbacks_t *);
+
+ompd_rc_t ompd_get_api_version(ompd_word_t *);
+ompd_rc_t ompd_get_version_string(const char **);
+
+ompd_rc_t ompd_finalize(void);
+
+ompd_rc_t ompd_process_initialize
+ (ompd_address_space_context_t *, ompd_address_space_handle_t **);
+
+
+ompd_rc_t ompd_device_initialize
+ (ompd_address_space_handle_t *, ompd_address_space_context_t *,
+ ompd_device_t, ompd_size_t, void *, ompd_address_space_handle_t **);
+
+ompd_rc_t ompd_rel_address_space_handle(ompd_address_space_handle_t *);
+
+ompd_rc_t ompd_get_omp_version (ompd_address_space_handle_t *, ompd_word_t
*);
+
+ompd_rc_t ompd_get_omp_version_string (ompd_address_space_handle_t *,
+ const char **);
+
+
+
+ompd_rc_t ompd_get_thread_in_parallel
+ (ompd_parallel_handle_t *, int, ompd_thread_handle_t **);
+
+ompd_rc_t ompd_get_thread_handle
+ (ompd_address_space_handle_t *, ompd_thread_id_t,
+ ompd_size_t,const void *, ompd_thread_handle_t **);
+
+ompd_rc_t ompd_rel_thread_handle (ompd_thread_handle_t *);
+
+ompd_rc_t ompd_thread_handle_compare (ompd_thread_handle_t *,
+ ompd_thread_handle_t *,int *);
+
+
+ompd_rc_t ompd_get_thread_id (ompd_thread_handle_t *,
+ ompd_thread_id_t, ompd_size_t, void *);
+
+ompd_rc_t ompd_get_curr_parallel_handle (ompd_thread_handle_t *,
+ ompd_parallel_handle_t **);
+
+ompd_rc_t ompd_get_enclosing_parallel_handle (ompd_parallel_handle_t *,
+ ompd_parallel_handle_t **);
+
+
+ompd_rc_t ompd_get_task_parallel_handle (ompd_task_handle_t *,
+ ompd_parallel_handle_t **);
+
+
+ompd_rc_t ompd_rel_parallel_handle (ompd_parallel_handle_t *);
+
+ompd_rc_t ompd_parallel_handle_compare (ompd_parallel_handle_t *,
+ ompd_parallel_handle_t *, int *);
+
+ompd_rc_t ompd_get_curr_task_handle (ompd_thread_handle_t *,
+ ompd_task_handle_t **);
+
+ompd_rc_t ompd_get_generating_task_handle (ompd_task_handle_t *,
+ ompd_task_handle_t **);
+
+ompd_rc_t ompd_get_scheduling_task_handle (ompd_task_handle_t *,
+ ompd_task_handle_t **);
+
+ompd_rc_t ompd_get_task_in_parallel (ompd_parallel_handle_t *,
+ int, ompd_task_handle_t **);
+
+ompd_rc_t ompd_rel_task_handle (ompd_task_handle_t *);
+
+ompd_rc_t ompd_task_handle_compare (ompd_task_handle_t *,
+ ompd_task_handle_t *, int *);
+
+ompd_rc_t ompd_get_task_function (ompd_task_handle_t *, ompd_address_t *);
+
+ompd_rc_t ompd_get_task_frame (ompd_task_handle_t *, ompd_frame_info_t *,
+ ompd_frame_info_t *);
+
+ompd_rc_t ompd_enumerate_states (ompd_address_space_handle_t *,
ompd_word_t,
+ ompd_word_t *, const char **, ompd_word_t *);
+
+ompd_rc_t ompd_get_state (ompd_thread_handle_t *,
+ ompd_word_t *, ompd_wait_id_t *);
+
+ompd_rc_t ompd_get_display_control_vars (ompd_address_space_handle_t *,
+ const char * const **);
+
+ompd_rc_t ompd_rel_display_control_vars (const char * const **);
+
+ompd_rc_t ompd_enumerate_icvs (ompd_address_space_handle_t *,
ompd_icv_id_t,
+ ompd_icv_id_t *, const char **, ompd_scope_t *,int *);
+
+ompd_rc_t ompd_get_icv_from_scope (void *, ompd_scope_t, ompd_icv_id_t,
+ ompd_word_t *);
+
+ompd_rc_t ompd_get_icv_string_from_scope (void *, ompd_scope_t,
ompd_icv_id_t,
+ const char **);
+
+
+ompd_rc_t ompd_get_tool_data (void *, ompd_scope_t, ompd_word_t *,
+ ompd_address_t *);
+
+void ompd_bp_parallel_begin(void);
+void ompd_bp_parallel_end(void);
+
+void ompd_bp_task_begin(void);
+void ompd_bp_task_end(void);
+
+void ompd_bp_thread_begin(void);
+void ompd_bp_thread_end(void);
+
+void ompd_bp_device_begin(void);
+void ompd_bp_device_end(void);
+
+
+#define ompd_segment_none  ((ompd_seg_t) 0)
+#define ompd_icv_undefined ((ompd_icv_id_t) 0)
+
+
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
+#endif /* _OMP_TOOLS_H */
\ No newline at end of file
diff --git a/libgomp/ompd-helper.c b/libgomp/ompd-helper.c
new file mode 100644
index 00000000000..dacd5146213
--- /dev/null
+++ b/libgomp/ompd-helper.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+   Contributed by Mohamed Atef <mohamedatef1698@gmail.com>.
+   This file is part of the GNU Offloading and Multi Processing Library
+   (libgomp).
+   Libgomp is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+   Libgomp is distributed in the hope that it will be useful, but WITHOUT
ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS
+   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+   more details.
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+
+
+
+
+#include "ompd-helper.h"
+
+ompd_rc_t
+get_sizes(ompd_address_space_context_t *context)
+{
+ if(context == NULL)
+ return ompd_rc_bad_input;
+
+ static int inited = 0;
+ static ompd_rc_t ret;
+
+ if(inited)
+ return ret;
+
+ ret = callbacks->sizeof_type(context, &target_sizes);
+ if(ret != ompd_rc_ok)
+ return ret;
+
+ inited = 1;
+ return ret;
+}
diff --git a/libgomp/ompd-helper.h b/libgomp/ompd-helper.h
new file mode 100644
index 00000000000..427833e703a
--- /dev/null
+++ b/libgomp/ompd-helper.h
@@ -0,0 +1,65 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+   Contributed by Mohamed Atef <mohamedatef1698@gmail.com>.
+   This file is part of the GNU Offloading and Multi Processing Library
+   (libgomp).
+   Libgomp is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+   Libgomp is distributed in the hope that it will be useful, but WITHOUT
ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS
+   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+   more details.
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+
+
+/*This file contains the helper functions for OMPD.  */
+
+#ifndef _OMPD_HELPER_H
+#define _OMPD_HELPER_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "omp-tools.h"
+#include "ompd-types.h"
+#include <stdio.h>
+#include <stddef.h>
+
+#define stringize(x)  stringize1(x)
+#define stringize1(x) #x
+
+#define VERSION 202011
+
+extern const ompd_callbacks_t *callbacks;
+extern __UINT64_TYPE__ ompd_state;
+extern ompd_device_type_sizes_t target_sizes;
+
+
+ompd_rc_t get_sizes(ompd_address_space_context_t *);
+
+
+
+struct _ompd_aspace_handle
+{
+ ompd_address_space_context_t *context;
+ ompd_device_t kind;
+};
+
+
+
+
+#ifdef __cplusplus
+} // extern C
+#endif
+
+#endif /* OMPD_HELPER_H */
diff --git a/libgomp/ompd-init.c b/libgomp/ompd-init.c
new file mode 100644
index 00000000000..dc9603f5c58
--- /dev/null
+++ b/libgomp/ompd-init.c
@@ -0,0 +1,154 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+   Contributed by Mohamed Atef <mohamedatef1698@gmail.com>.
+   This file is part of the GNU Offloading and Multi Processing Library
+   (libgomp).
+   Libgomp is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+   Libgomp is distributed in the hope that it will be useful, but WITHOUT
ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS
+   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+   more details.
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+
+
+/*This file contains the implementation of functions defined in
+ section 5.5.1, 5.5.2.  */
+
+
+#include "ompd-helper.h"
+
+
+
+
+
+/*Per OMPD initialization and finalization.  */
+
+__UINT64_TYPE__ ompd_state;
+ompd_device_type_sizes_t target_sizes;
+
+ompd_rc_t
+ompd_initialize(ompd_word_t api_version,
+ const ompd_callbacks_t *callbacks_table)
+{
+ if(callbacks_table == NULL)
+ return ompd_rc_bad_input;
+
+ ompd_word_t version;
+ ompd_rc_t ret = ompd_get_api_version(&version);
+
+ if(version != api_version)
+ return ompd_rc_unsupported;
+
+ callbacks = callbacks_table;
+ return ret;
+}
+
+
+ompd_rc_t
+ompd_get_api_version(ompd_word_t *version)
+{
+ if(version == NULL)
+ return ompd_rc_bad_input;
+
+ *version = VERSION;
+ return ompd_rc_ok;
+}
+
+
+ompd_rc_t
+ompd_get_version_string(const char **string)
+{
+ static const char tmp_string[] =
+ "GNU OpenMP runtime implementing OMPD version "
+ stringize(VERSION) " Debugging library.";
+ *string = tmp_string;
+ return ompd_rc_ok;
+}
+
+
+ompd_rc_t
+ompd_finalize()
+{
+ return ompd_rc_ok;
+}
+
+
+
+/*Per process initialization and finalization.  */
+
+
+ompd_rc_t
+ompd_process_initialize(ompd_address_space_context_t *context,
+ ompd_address_space_handle_t **handle)
+{
+ if(context == NULL || handle == NULL)
+ return ompd_rc_bad_input;
+
+ ompd_rc_t ret = get_sizes(context);
+ if(ret != ompd_rc_ok)
+ return ret;
+
+ ompd_address_t symbol_addr = {OMPD_SEGMENT_UNSPECIFIED, 0};
+
+
+ //naive way to read from memory
+ ret = callbacks->symbol_addr_lookup(context, NULL, "ompd_state",
+ &symbol_addr, NULL);
+
+ ret = callbacks->read_memory(context, NULL, &symbol_addr,
+ target_sizes.sizeof_long_long, &ompd_state);
+
+ ret = callbacks->device_to_host(context, &ompd_state,
+ target_sizes.sizeof_long_long, 1, &ompd_state);
+
+ ret = callbacks->alloc_memory(sizeof(ompd_address_space_handle_t),
+ (void **)(handle));
+
+ if(ret != ompd_rc_ok)
+ return ret;
+
+ if(*handle == NULL)
+ return ompd_rc_error;
+
+ (*handle)->context = context;
+ (*handle)->kind = OMPD_DEVICE_KIND_HOST;
+ return ret;
+}
+
+
+
+/*OMPD will not support GPUs for now. */
+
+ompd_rc_t
+ompd_device_initialize(ompd_address_space_handle_t *process_handle,
+ ompd_address_space_context_t *device_context, ompd_device_t kind,
+ ompd_size_t sizeof_id, void *id,
+ ompd_address_space_handle_t **device_handle)
+
+{
+ if(device_context == NULL)
+ return ompd_rc_bad_input;
+
+ return ompd_rc_unsupported;
+}
+
+
+
+ompd_rc_t
+ompd_rel_address_space_handle(ompd_address_space_handle_t *handle)
+{
+ if(handle == NULL)
+ return ompd_rc_stale_handle;
+
+ ompd_rc_t ret = callbacks->free_memory((void *)handle);
+ return ret;
+}
diff --git a/libgomp/ompd-support.c b/libgomp/ompd-support.c
new file mode 100644
index 00000000000..0d24abecca1
--- /dev/null
+++ b/libgomp/ompd-support.c
@@ -0,0 +1,111 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+   Contributed by Mohamed Atef <mohamedatef1698@gmail.com>.
+   This file is part of the GNU Offloading and Multi Processing Library
+   (libgomp).
+   Libgomp is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+   Libgomp is distributed in the hope that it will be useful, but WITHOUT
ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS
+   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+   more details.
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "ompd-support.h"
+
+
+
+const char **ompd_dll_locations = NULL;
+
+void
+ompd_load()
+{
+ static int ompd_initialized = 0;
+ if(ompd_initialized)
+ return;
+ static const char *tmp_ompd_dll_locations[2]
+ = {"ligompd" SONAME_SUFFIX(1) , NULL};
+ const char *gomp_env_var = getenv("GOMP_DEBUG");
+ if(gomp_env_var != NULL && !strcmp(gomp_env_var, "1"))
+ {
+ fprintf(stderr, "OMP OMPD active\n");
+ ompd_state |= OMPD_ENABLED;
+ }
+ ompd_initialized = 1;
+ ompd_dll_locations = (const char **)malloc(2 * sizeof(const char *));
+ ompd_dll_locations[0] = tmp_ompd_dll_locations[0];
+ ompd_dll_locations[1] = tmp_ompd_dll_locations[1];
+ ompd_dll_locations_valid();
+}
+
+
+/*Dummy functions. they shoud not be optimized.  */
+
+void __attribute__ ((noinline))
+ompd_dll_locations_valid()
+{
+ asm("");
+}
+
+
+void __attribute__ ((noinline))
+ompd_bp_parallel_begin()
+{
+ asm("");
+}
+
+void __attribute__ ((noinline))
+ompd_bp_parallel_end()
+{
+ asm("");
+}
+
+
+
+void __attribute__ ((noinline))
+ompd_bp_task_begin()
+{
+ asm("");
+}
+
+
+void __attribute__ ((noinline))
+ompd_bp_task_end()
+{
+ asm("");
+}
+
+
+
+void __attribute__ ((noinline))
+ompd_bp_thread_begin()
+{
+ asm("");
+}
+
+void __attribute__ ((noinline))
+ompd_bp_thread_end()
+{
+ asm("");
+}
+
+
+
+void __attribute__ ((noinline))
+ompd_bp_device_begin()
+{
+ asm("");
+}
+
+void __attribute__ ((noinline))
+ompd_bp_device_end()
+{
+ asm("");
+}
diff --git a/libgomp/ompd-support.h b/libgomp/ompd-support.h
new file mode 100644
index 00000000000..3554ce885a1
--- /dev/null
+++ b/libgomp/ompd-support.h
@@ -0,0 +1,44 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+   Contributed by Mohamed Atef <mohamedatef1698@gmail.com>.
+   This file is part of the GNU Offloading and Multi Processing Library
+   (libgomp).
+   Libgomp is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+   Libgomp is distributed in the hope that it will be useful, but WITHOUT
ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS
+   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+   more details.
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+
+
+/*This file contains the runtime support for OMPD.  */
+
+#ifndef _OMPD_SUPPORT_H
+#define _OMPD_SUPPORT_H
+
+#include "omp-tools.h"
+#include "plugin-suffix.h"
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stddef.h>
+
+void ompd_load();
+extern __UINT64_TYPE__ ompd_state;
+
+#define OMPD_ENABLED 0x1
+
+
+
+
+
+#endif /* _OMPD_SUPPORT_H */
diff --git a/libgomp/ompd-types.h b/libgomp/ompd-types.h
new file mode 100644
index 00000000000..6c3a0e14639
--- /dev/null
+++ b/libgomp/ompd-types.h
@@ -0,0 +1,59 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+   Contributed by Mohamed Atef <mohamedatef1698@gmail.com>.
+   This file is part of the GNU Offloading and Multi Processing Library
+   (libgomp).
+   Libgomp is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+   Libgomp is distributed in the hope that it will be useful, but WITHOUT
ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS
+   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+   more details.
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+
+/*This file contains the types needed for OMPD implementation.  */
+
+
+#ifndef _OMPD_TYPES_H
+#define _OMPD_TYPES_H
+
+#ifdef __cpulsplus
+extern "C" {
+#endif
+
+#define OMPD_TYPES_VERSION   20180906 /* YYYYMMDD Format */
+
+/* Kinds of device threads  */
+#define OMPD_THREAD_ID_PTHREAD      ((ompd_thread_id_t)0)
+#define OMPD_THREAD_ID_LWP          ((ompd_thread_id_t)1)
+#define OMPD_THREAD_ID_WINTHREAD    ((ompd_thread_id_t)2)
+
+/* The range of non-standard implementation defined values */
+#define OMPD_THREAD_ID_LO       ((ompd_thread_id_t)1000000)
+#define OMPD_THREAD_ID_HI       ((ompd_thread_id_t)1100000)
+
+
+/* Memory Access Segment definitions for Host and Target Devices */
+#define OMPD_SEGMENT_UNSPECIFIED             ((ompd_seg_t)0)
+
+
+/* Kinds of device device address spaces */
+#define OMPD_DEVICE_KIND_HOST     ((ompd_device_t)1)
+
+
+/* The range of non-standard implementation defined values */
+#define OMPD_DEVICE_IMPL_LO       ((ompd_device_t)1000000)
+#define OMPD_DEVICE_IMPL_HI       ((ompd_device_t)1100000)
+
+#ifdef __cplusplus
+} // extern C
+#endif
+#endif /* _OMPD_TYPES_H */
\ No newline at end of file
diff --git a/libgomp/parallel.c b/libgomp/parallel.c
index f7722990566..f1c8a36868c 100644
--- a/libgomp/parallel.c
+++ b/libgomp/parallel.c
@@ -26,6 +26,7 @@
 /* This file handles the (bare) PARALLEL construct.  */

 #include "libgomp.h"
+#include "ompd-support.h"
 #include <limits.h>


@@ -173,10 +174,14 @@ GOMP_parallel (void (*fn) (void *), void *data,
unsigned num_threads,
        unsigned int flags)
 {
   num_threads = gomp_resolve_num_threads (num_threads, 0);
+  if(ompd_state)
+    ompd_bp_parallel_begin();
   gomp_team_start (fn, data, num_threads, flags, gomp_new_team
(num_threads),
    NULL);
   fn (data);
   ialias_call (GOMP_parallel_end) ();
+  if(ompd_state)
+    ompd_bp_parallel_end();
 }

 unsigned
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index e48c3f2f9b0..416e20e498c 100644
--- a/libgomp/testsuite/Makefile.in
+++ b/libgomp/testsuite/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@

-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.

 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -284,6 +284,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -331,8 +332,8 @@ Makefile: $(srcdir)/Makefile.in
$(top_builddir)/config.status
   *config.status*) \
     cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
   *) \
-    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
$(am__depfiles_maybe)'; \
-    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
$(am__depfiles_maybe);; \
+    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
$(am__maybe_remake_depfiles)'; \
