mescc: Support binutils-2.30.

* lib/binutils.c (raise, strdup): New function.
  (mbstowcs): New stub.
* include/fcntl.h (O_APPEND, FD_CLOEXEC): New define.
This commit is contained in:
Jan Nieuwenhuizen 2018-06-09 17:58:47 +02:00
parent 53dd76ffc0
commit c349f6fdd8
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
4 changed files with 59 additions and 0 deletions

View file

@ -29,6 +29,7 @@
#else // ! WITH_GLIBC #else // ! WITH_GLIBC
int errno; int errno;
#define ENOENT 2 #define ENOENT 2
#define EINTR 4
#define EIO 5 #define EIO 5
#define EBADF 9 #define EBADF 9
#define EAGAIN 11 #define EAGAIN 11

View file

@ -28,12 +28,16 @@
#include_next <fcntl.h> #include_next <fcntl.h>
#else // ! WITH_GLIBC #else // ! WITH_GLIBC
#define O_RDONLY 0 #define O_RDONLY 0
#define O_WRONLY 1 #define O_WRONLY 1
#define O_RDWR 2 #define O_RDWR 2
#define O_CREAT 64 #define O_CREAT 64
#define O_EXCL 128 #define O_EXCL 128
#define O_TRUNC 512 #define O_TRUNC 512
#define O_APPEND 1024
#define FD_CLOEXEC 1
#define F_DUPFD 0 #define F_DUPFD 0
#define F_GETFD 1 #define F_GETFD 1

View file

@ -26,6 +26,8 @@
#else // ! WITH_GLIBC #else // ! WITH_GLIBC
#include <sys/time.h>
struct rusage struct rusage
{ {
struct timeval ru_utime; struct timeval ru_utime;

View file

@ -223,3 +223,55 @@ sbrk (intptr_t delta)
return malloc (delta); return malloc (delta);
return g_brk; return g_brk;
} }
// binutils 2.30
char *
strdup (char const *s)
{
size_t length = strlen (s) + 1;
char *p = (char*)malloc (length);
if (p)
return memcpy (p, s, length);
return 0;
}
int
raise (int signum)
{
kill (getpid (), signum);
}
size_t
strftime (char *s, size_t size, char const *template,
struct tm const *brokentime)
{
eputs ("strftime stub\n");
return template;
}
#if !__MESC__
typedef char wchar_t[];
size_t
mbstowcs (wchar_t *wstring, char const *string,
size_t size)
{
eputs ("mbstowcs stub\n");
strcpy (wstring, string);
return strlen (string);
}
#endif
void
clearerr (FILE *stream)
{
errno = 0;
}
double
fabs (double number)
{
if (number < 0)
return -number;
return number;
}