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.
This commit is contained in:
parent
4feb21d705
commit
007bc1923c
|
@ -121,6 +121,7 @@ case "${host_cpu}" in
|
||||||
amdgcn*)
|
amdgcn*)
|
||||||
newlib_cflags="${newlib_cflags} -D__DYNAMIC_REENT__"
|
newlib_cflags="${newlib_cflags} -D__DYNAMIC_REENT__"
|
||||||
machine_dir=amdgcn
|
machine_dir=amdgcn
|
||||||
|
libc_cv_initfinit_array=yes
|
||||||
;;
|
;;
|
||||||
arc*)
|
arc*)
|
||||||
machine_dir=arc
|
machine_dir=arc
|
||||||
|
|
|
@ -8,7 +8,8 @@ AM_CCASFLAGS = $(INCLUDES) $(CFLAGS)
|
||||||
|
|
||||||
noinst_LIBRARIES = lib.a
|
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_CCASFLAGS = $(AM_CCASFLAGS)
|
||||||
lib_a_CFLAGS = $(AM_CFLAGS)
|
lib_a_CFLAGS = $(AM_CFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,11 @@ lib_a_AR = $(AR) $(ARFLAGS)
|
||||||
lib_a_LIBADD =
|
lib_a_LIBADD =
|
||||||
am_lib_a_OBJECTS = lib_a-close.$(OBJEXT) lib_a-fstat.$(OBJEXT) \
|
am_lib_a_OBJECTS = lib_a-close.$(OBJEXT) lib_a-fstat.$(OBJEXT) \
|
||||||
lib_a-isatty.$(OBJEXT) lib_a-lseek.$(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)
|
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
|
||||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||||
depcomp =
|
depcomp =
|
||||||
|
@ -195,7 +199,9 @@ AUTOMAKE_OPTIONS = cygnus
|
||||||
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
|
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
|
||||||
AM_CCASFLAGS = $(INCLUDES) $(CFLAGS)
|
AM_CCASFLAGS = $(INCLUDES) $(CFLAGS)
|
||||||
noinst_LIBRARIES = lib.a
|
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_CCASFLAGS = $(AM_CCASFLAGS)
|
||||||
lib_a_CFLAGS = $(AM_CFLAGS)
|
lib_a_CFLAGS = $(AM_CFLAGS)
|
||||||
ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
|
ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
|
||||||
|
@ -294,6 +300,48 @@ lib_a-write.o: write.c
|
||||||
lib_a-write.obj: 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`
|
$(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)
|
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue