Add minimal implementation of syscalls in retarget file.

The nonsys specification of the newlib library, supplied with the Arm
GNU toolchain provides stubbed version of several system calls, in
order to allow linking with libc. Amongst such subroutines are _fstat,
_getpid, _isatty ,_kill, _lseek, for which the GNU toolchain also
generates a linker warning.
Patch retargets these subroutines by adding a minimal implementation.

Change-Id: I74db7ab77f49ce8c909eb24691b96d5e7b36692a
diff --git a/targets/corstone-300/retarget.c b/targets/corstone-300/retarget.c
index 9d71da0..0ddf042 100644
--- a/targets/corstone-300/retarget.c
+++ b/targets/corstone-300/retarget.c
@@ -19,6 +19,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#if !defined(__ARMCC_VERSION)
+#include <sys/stat.h>
+#endif
 #include <time.h>
 
 #include "uart_stdout.h"
@@ -222,6 +225,40 @@
     while (1) {}
 }
 
+#if !defined(__ARMCC_VERSION)
+int RETARGET(_fstat)(FILEHANDLE fh, struct stat *st) {
+    (void)fh;
+    (void)st;
+
+    return -1;
+}
+
+int RETARGET(_getpid)(void) {
+    return -1;
+}
+
+int RETARGET(_isatty)(FILEHANDLE fh) {
+    (void)fh;
+
+    return 0;
+}
+
+int RETARGET(_kill)(int pid, int sig) {
+    (void)pid;
+    (void)sig;
+
+    return -1;
+}
+
+int RETARGET(_lseek)(FILEHANDLE fh, int ptr, int dir) {
+    (void)fh;
+    (void)ptr;
+    (void)dir;
+
+    return -1;
+}
+#endif
+
 int system(const char *cmd) {
     (void)cmd;
 
diff --git a/targets/corstone-310/retarget.c b/targets/corstone-310/retarget.c
index 00772e2..760273d 100644
--- a/targets/corstone-310/retarget.c
+++ b/targets/corstone-310/retarget.c
@@ -19,6 +19,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#if !defined(__ARMCC_VERSION)
+#include <sys/stat.h>
+#endif
 #include <time.h>
 
 #include "uart_stdout.h"
@@ -222,6 +225,40 @@
     while (1) {}
 }
 
+#if !defined(__ARMCC_VERSION)
+int RETARGET(_fstat)(FILEHANDLE fh, struct stat *st) {
+    (void)fh;
+    (void)st;
+
+    return -1;
+}
+
+int RETARGET(_getpid)(void) {
+    return -1;
+}
+
+int RETARGET(_isatty)(FILEHANDLE fh) {
+    (void)fh;
+
+    return 0;
+}
+
+int RETARGET(_kill)(int pid, int sig) {
+    (void)pid;
+    (void)sig;
+
+    return -1;
+}
+
+int RETARGET(_lseek)(FILEHANDLE fh, int ptr, int dir) {
+    (void)fh;
+    (void)ptr;
+    (void)dir;
+
+    return -1;
+}
+#endif
+
 int system(const char *cmd) {
     (void)cmd;
 
diff --git a/targets/demo/retarget.c b/targets/demo/retarget.c
index 7c53ba1..9ab40eb 100644
--- a/targets/demo/retarget.c
+++ b/targets/demo/retarget.c
@@ -19,6 +19,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#if !defined(__ARMCC_VERSION)
+#include <sys/stat.h>
+#endif
 #include <time.h>
 
 #include "uart_stdout.h"
@@ -222,6 +225,40 @@
     while (1) {}
 }
 
+#if !defined(__ARMCC_VERSION)
+int RETARGET(_fstat)(FILEHANDLE fh, struct stat *st) {
+    (void)fh;
+    (void)st;
+
+    return -1;
+}
+
+int RETARGET(_getpid)(void) {
+    return -1;
+}
+
+int RETARGET(_isatty)(FILEHANDLE fh) {
+    (void)fh;
+
+    return 0;
+}
+
+int RETARGET(_kill)(int pid, int sig) {
+    (void)pid;
+    (void)sig;
+
+    return -1;
+}
+
+int RETARGET(_lseek)(FILEHANDLE fh, int ptr, int dir) {
+    (void)fh;
+    (void)ptr;
+    (void)dir;
+
+    return -1;
+}
+#endif
+
 int system(const char *cmd) {
     (void)cmd;