From 7a645349468c61bb1b843ffac6a06d22a61d243c Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10walls@gmail.com>
Date: Tue, 8 Sep 2020 15:05:44 +0200
Subject: [PATCH 08/13] Cygwin: libgomp soname

---
 libgomp/config/cygwin/plugin-suffix.h | 2 ++
 libgomp/config/darwin/plugin-suffix.h | 1 +
 libgomp/config/hpux/plugin-suffix.h   | 1 +
 libgomp/config/posix/plugin-suffix.h  | 1 +
 libgomp/configure.tgt                 | 4 ++++
 libgomp/target.c                      | 2 +-
 6 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 libgomp/config/cygwin/plugin-suffix.h

diff --git a/libgomp/config/cygwin/plugin-suffix.h b/libgomp/config/cygwin/plugin-suffix.h
new file mode 100644
index 00000000000..7ea6e7241d9
--- /dev/null
+++ b/libgomp/config/cygwin/plugin-suffix.h
@@ -0,0 +1,2 @@
+#define SONAME_PREFIX "cyg"
+#define SONAME_SUFFIX(n) ("-" #n ".dll")
diff --git a/libgomp/config/darwin/plugin-suffix.h b/libgomp/config/darwin/plugin-suffix.h
index af06b7ab87d..d8d172b3a45 100644
--- a/libgomp/config/darwin/plugin-suffix.h
+++ b/libgomp/config/darwin/plugin-suffix.h
@@ -23,4 +23,5 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define SONAME_PREFIX "lib"
 #define SONAME_SUFFIX(n) ("." #n ".dylib")
diff --git a/libgomp/config/hpux/plugin-suffix.h b/libgomp/config/hpux/plugin-suffix.h
index 3bd094898f9..9f594f3a6a9 100644
--- a/libgomp/config/hpux/plugin-suffix.h
+++ b/libgomp/config/hpux/plugin-suffix.h
@@ -23,4 +23,5 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define SONAME_PREFIX "lib"
 #define SONAME_SUFFIX(n) (".sl." #n)
diff --git a/libgomp/config/posix/plugin-suffix.h b/libgomp/config/posix/plugin-suffix.h
index 3232fb65e01..707f42cce62 100644
--- a/libgomp/config/posix/plugin-suffix.h
+++ b/libgomp/config/posix/plugin-suffix.h
@@ -23,4 +23,5 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define SONAME_PREFIX "lib"
 #define SONAME_SUFFIX(n) (".so." #n)
diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt
index fe2bf1dac51..f539a6b9302 100644
--- a/libgomp/configure.tgt
+++ b/libgomp/configure.tgt
@@ -141,6 +141,10 @@ case "${target}" in
 	esac
 	;;
 
+  *-*-cygwin*)
+	config_path="cygwin posix"
+	;;
+
   *-*-mingw32*)
 	config_path="mingw32 posix"
 	;;
diff --git a/libgomp/target.c b/libgomp/target.c
index 4a4e1f80745..05264438992 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -3844,7 +3844,7 @@ gomp_target_fini (void)
 static void
 gomp_target_init (void)
 {
-  const char *prefix ="libgomp-plugin-";
+  const char *prefix = SONAME_PREFIX "gomp-plugin-";
   const char *suffix = SONAME_SUFFIX (1);
   const char *cur, *next;
   char *plugin_name;
-- 
2.39.0

