public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Add gfortran support for AMD GCN
@ 2019-06-07 17:56 Jeff Johnston
  0 siblings, 0 replies; only message in thread
From: Jeff Johnston @ 2019-06-07 17:56 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=007bc1923c505f18dce5949b57a849640f25b15c

commit 007bc1923c505f18dce5949b57a849640f25b15c
Author: Jeff Johnston <jjohnstn@redhat.com>
Date:   Fri Jun 7 13:55:43 2019 -0400

    Add gfortran support for AMD GCN
    
    From: Kwok Cheung Yeung <kcy@codesourcery.com>
    
    This patch adds enough support for constructors/destructors and OS functions
    to be able to link and run gfortran programs on AMD GCN.
    
    There's no actual ability to do I/O operations on this targets, besides
    "write" to stdout and stderr, so most of the functions are just stubs.

Diff:
---
 newlib/configure.host              |  1 +
 newlib/libc/sys/amdgcn/Makefile.am |  3 ++-
 newlib/libc/sys/amdgcn/Makefile.in | 52 ++++++++++++++++++++++++++++++++++++--
 newlib/libc/sys/amdgcn/fcntl.c     | 24 ++++++++++++++++++
 newlib/libc/sys/amdgcn/getpid.c    | 20 +++++++++++++++
 newlib/libc/sys/amdgcn/kill.c      | 23 +++++++++++++++++
 newlib/libc/sys/amdgcn/open.c      | 25 ++++++++++++++++++
 newlib/libc/sys/amdgcn/raise.c     | 20 +++++++++++++++
 newlib/libc/sys/amdgcn/stat.c      | 24 ++++++++++++++++++
 newlib/libc/sys/amdgcn/unlink.c    | 23 +++++++++++++++++
 10 files changed, 212 insertions(+), 3 deletions(-)

diff --git a/newlib/configure.host b/newlib/configure.host
index fa805d6..87bf78a 100644
--- a/newlib/configure.host
+++ b/newlib/configure.host
@@ -121,6 +121,7 @@ case "${host_cpu}" in
   amdgcn*)
 	newlib_cflags="${newlib_cflags} -D__DYNAMIC_REENT__"
 	machine_dir=amdgcn
+	libc_cv_initfinit_array=yes
 	;;
   arc*)
 	machine_dir=arc
diff --git a/newlib/libc/sys/amdgcn/Makefile.am b/newlib/libc/sys/amdgcn/Makefile.am
index 1716776..2b0c63b 100644
--- a/newlib/libc/sys/amdgcn/Makefile.am
+++ b/newlib/libc/sys/amdgcn/Makefile.am
@@ -8,7 +8,8 @@ AM_CCASFLAGS = $(INCLUDES) $(CFLAGS)
 
 noinst_LIBRARIES = lib.a
 
-lib_a_SOURCES = close.c fstat.c isatty.c lseek.c read.c write.c
+lib_a_SOURCES = close.c fstat.c isatty.c lseek.c read.c write.c \
+                fcntl.c getpid.c kill.c open.c raise.c stat.c unlink.c
 lib_a_CCASFLAGS = $(AM_CCASFLAGS)
 lib_a_CFLAGS = $(AM_CFLAGS)
 
diff --git a/newlib/libc/sys/amdgcn/Makefile.in b/newlib/libc/sys/amdgcn/Makefile.in
index dc22992..fd1a10b 100644
--- a/newlib/libc/sys/amdgcn/Makefile.in
+++ b/newlib/libc/sys/amdgcn/Makefile.in
@@ -71,7 +71,11 @@ lib_a_AR = $(AR) $(ARFLAGS)
 lib_a_LIBADD =
 am_lib_a_OBJECTS = lib_a-close.$(OBJEXT) lib_a-fstat.$(OBJEXT) \
 	lib_a-isatty.$(OBJEXT) lib_a-lseek.$(OBJEXT) \
-	lib_a-read.$(OBJEXT) lib_a-write.$(OBJEXT)
+	lib_a-read.$(OBJEXT) lib_a-write.$(OBJEXT) \
+	lib_a-fcntl.$(OBJEXT) lib_a-getpid.$(OBJEXT) \
+	lib_a-kill.$(OBJEXT) lib_a-open.$(OBJEXT) \
+	lib_a-raise.$(OBJEXT) lib_a-stat.$(OBJEXT) \
+	lib_a-unlink.$(OBJEXT)
 lib_a_OBJECTS = $(am_lib_a_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp =
@@ -195,7 +199,9 @@ AUTOMAKE_OPTIONS = cygnus
 INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
 AM_CCASFLAGS = $(INCLUDES) $(CFLAGS)
 noinst_LIBRARIES = lib.a
-lib_a_SOURCES = close.c fstat.c isatty.c lseek.c read.c write.c
+lib_a_SOURCES = close.c fstat.c isatty.c lseek.c read.c write.c \
+                fcntl.c getpid.c kill.c open.c raise.c stat.c unlink.c
+
 lib_a_CCASFLAGS = $(AM_CCASFLAGS)
 lib_a_CFLAGS = $(AM_CFLAGS)
 ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
@@ -294,6 +300,48 @@ lib_a-write.o: write.c
 lib_a-write.obj: write.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-write.obj `if test -f 'write.c'; then $(CYGPATH_W) 'write.c'; else $(CYGPATH_W) '$(srcdir)/write.c'; fi`
 
+lib_a-fcntl.o: fcntl.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fcntl.o `test -f 'fcntl.c' || echo '$(srcdir)/'`fcntl.c
+
+lib_a-fcntl.obj: fcntl.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fcntl.obj `if test -f 'fcntl.c'; then $(CYGPATH_W) 'fcntl.c'; else $(CYGPATH_W) '$(srcdir)/fcntl.c'; fi`
+
+lib_a-getpid.o: getpid.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getpid.o `test -f 'getpid.c' || echo '$(srcdir)/'`getpid.c
+
+lib_a-getpid.obj: getpid.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getpid.obj `if test -f 'getpid.c'; then $(CYGPATH_W) 'getpid.c'; else $(CYGPATH_W) '$(srcdir)/getpid.c'; fi`
+
+lib_a-kill.o: kill.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-kill.o `test -f 'kill.c' || echo '$(srcdir)/'`kill.c
+
+lib_a-kill.obj: kill.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-kill.obj `if test -f 'kill.c'; then $(CYGPATH_W) 'kill.c'; else $(CYGPATH_W) '$(srcdir)/kill.c'; fi`
+
+lib_a-open.o: open.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-open.o `test -f 'open.c' || echo '$(srcdir)/'`open.c
+
+lib_a-open.obj: open.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-open.obj `if test -f 'open.c'; then $(CYGPATH_W) 'open.c'; else $(CYGPATH_W) '$(srcdir)/open.c'; fi`
+
+lib_a-raise.o: raise.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-raise.o `test -f 'raise.c' || echo '$(srcdir)/'`raise.c
+
+lib_a-raise.obj: raise.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-raise.obj `if test -f 'raise.c'; then $(CYGPATH_W) 'raise.c'; else $(CYGPATH_W) '$(srcdir)/raise.c'; fi`
+
+lib_a-stat.o: stat.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stat.o `test -f 'stat.c' || echo '$(srcdir)/'`stat.c
+
+lib_a-stat.obj: stat.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stat.obj `if test -f 'stat.c'; then $(CYGPATH_W) 'stat.c'; else $(CYGPATH_W) '$(srcdir)/stat.c'; fi`
+
+lib_a-unlink.o: unlink.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-unlink.o `test -f 'unlink.c' || echo '$(srcdir)/'`unlink.c
+
+lib_a-unlink.obj: unlink.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-unlink.obj `if test -f 'unlink.c'; then $(CYGPATH_W) 'unlink.c'; else $(CYGPATH_W) '$(srcdir)/unlink.c'; fi`
+
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
diff --git a/newlib/libc/sys/amdgcn/fcntl.c b/newlib/libc/sys/amdgcn/fcntl.c
new file mode 100644
index 0000000..b334715
--- /dev/null
+++ b/newlib/libc/sys/amdgcn/fcntl.c
@@ -0,0 +1,24 @@
+/*
+ * Support file for amdgcn in newlib.
+ * Copyright (c) 2019 Mentor Graphics.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+
+#include <errno.h>
+
+int fcntl (int fd,
+	   int flag,
+	   int arg)
+{
+  errno = EINVAL;
+  return -1;
+}
diff --git a/newlib/libc/sys/amdgcn/getpid.c b/newlib/libc/sys/amdgcn/getpid.c
new file mode 100644
index 0000000..5e9cb59
--- /dev/null
+++ b/newlib/libc/sys/amdgcn/getpid.c
@@ -0,0 +1,20 @@
+/*
+ * Support file for amdgcn in newlib.
+ * Copyright (c) 2019 Mentor Graphics.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+
+int
+getpid (void)
+{
+  return 0;
+}
diff --git a/newlib/libc/sys/amdgcn/kill.c b/newlib/libc/sys/amdgcn/kill.c
new file mode 100644
index 0000000..94c6843
--- /dev/null
+++ b/newlib/libc/sys/amdgcn/kill.c
@@ -0,0 +1,23 @@
+/*
+ * Support file for amdgcn in newlib.
+ * Copyright (c) 2019 Mentor Graphics.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+
+#include <errno.h>
+
+int kill (int pid,
+	  int sig)
+{
+  errno = ESRCH;
+  return -1;
+}
diff --git a/newlib/libc/sys/amdgcn/open.c b/newlib/libc/sys/amdgcn/open.c
new file mode 100644
index 0000000..bb2c5af
--- /dev/null
+++ b/newlib/libc/sys/amdgcn/open.c
@@ -0,0 +1,25 @@
+/*
+ * Support file for amdgcn in newlib.
+ * Copyright (c) 2019 Mentor Graphics.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+
+#include <unistd.h>
+#include <errno.h>
+
+int
+open (const char *file,
+      int flags, ...)
+{
+  errno = EACCES;
+  return -1;
+}
diff --git a/newlib/libc/sys/amdgcn/raise.c b/newlib/libc/sys/amdgcn/raise.c
new file mode 100644
index 0000000..d5c19cd
--- /dev/null
+++ b/newlib/libc/sys/amdgcn/raise.c
@@ -0,0 +1,20 @@
+/*
+ * Support file for amdgcn in newlib.
+ * Copyright (c) 2019 Mentor Graphics.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+
+int
+raise (int sig)
+{
+  return -1;
+}
diff --git a/newlib/libc/sys/amdgcn/stat.c b/newlib/libc/sys/amdgcn/stat.c
new file mode 100644
index 0000000..7100748
--- /dev/null
+++ b/newlib/libc/sys/amdgcn/stat.c
@@ -0,0 +1,24 @@
+/*
+ * Support file for amdgcn in newlib.
+ * Copyright (c) 2019 Mentor Graphics.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+
+#include <errno.h>
+
+int
+stat (const char *file,
+     struct stat *pstat)
+{
+  errno = EACCES;
+  return -1;
+}
diff --git a/newlib/libc/sys/amdgcn/unlink.c b/newlib/libc/sys/amdgcn/unlink.c
new file mode 100644
index 0000000..059c1d5
--- /dev/null
+++ b/newlib/libc/sys/amdgcn/unlink.c
@@ -0,0 +1,23 @@
+/*
+ * Support file for amdgcn in newlib.
+ * Copyright (c) 2019 Mentor Graphics.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+
+#include <errno.h>
+
+int
+unlink (const char *file)
+{
+  errno = EACCES;
+  return -1;
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-07 17:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-07 17:56 [newlib-cygwin] Add gfortran support for AMD GCN Jeff Johnston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).