From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121166 invoked by alias); 7 Jun 2019 17:56:16 -0000 Mailing-List: contact newlib-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-cvs-owner@sourceware.org Received: (qmail 121124 invoked by uid 447); 7 Jun 2019 17:56:16 -0000 Date: Fri, 07 Jun 2019 17:56:00 -0000 Message-ID: <20190607175616.121122.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jeff Johnston To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Add gfortran support for AMD GCN X-Act-Checkin: newlib-cygwin X-Git-Author: Jeff Johnston X-Git-Refname: refs/heads/master X-Git-Oldrev: 4feb21d705f09263cd867f4787a0d24360810577 X-Git-Newrev: 007bc1923c505f18dce5949b57a849640f25b15c X-SW-Source: 2019-q2/txt/msg00021.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=007bc1923c505f18dce5949b57a849640f25b15c commit 007bc1923c505f18dce5949b57a849640f25b15c Author: Jeff Johnston Date: Fri Jun 7 13:55:43 2019 -0400 Add gfortran support for AMD GCN From: Kwok Cheung Yeung 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 + +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 + +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 +#include + +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 + +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 + +int +unlink (const char *file) +{ + errno = EACCES; + return -1; +}