bionic: Fix build with gcc

Signed-off-by: Sean Cross <xobs@kosagi.com>
This commit is contained in:
Sean Cross 2014-12-30 12:30:51 +08:00
parent 912952ef9b
commit 57ee15485b
2 changed files with 17 additions and 3 deletions

View file

@ -36,6 +36,7 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "bionic.h" #include "bionic.h"
#include "printf.h"
typedef unsigned char u_char; typedef unsigned char u_char;
/* /*
@ -288,16 +289,17 @@ int _toupper(char c)
return c + ('a' - 'A'); return c + ('a' - 'A');
} }
void _memset(void *dst0, char val, size_t length) void *memset (void *dst0, int val, size_t length)
{ {
uint8_t *ptr = dst0; uint8_t *ptr = dst0;
while(length--) while(length--)
*ptr++ = val; *ptr++ = val;
return dst0;
} }
void __aeabi_memset(void *dst0, char val, size_t length) void __aeabi_memset(void *dst0, char val, size_t length)
{ {
_memset(dst0, val, length); memset(dst0, val, length);
} }
int _strlen(const char *s) int _strlen(const char *s)
@ -333,3 +335,15 @@ void _msleep(uint32_t msecs)
} }
} }
} }
int puts(const char *str)
{
printf("%s", str);
return 0;
}
int putchar(int c)
{
printf("%c", c);
return 0;
}

View file

@ -9,7 +9,7 @@ char * _strpbrk(const char *s1, const char *s2);
char *_strtok(char *str, const char *delim, char **saveptr); char *_strtok(char *str, const char *delim, char **saveptr);
int _strcasecmp(const char *s1, const char *s2); int _strcasecmp(const char *s1, const char *s2);
void *_memcpy(void *dst0, const void *src0, size_t length); void *_memcpy(void *dst0, const void *src0, size_t length);
void _memset(void *dst0, char val, size_t length); void *memset(void *__s, int __c, size_t __n) __THROW __nonnull ((1));
unsigned long strtoul(const char *nptr, char **endptr, unsigned int base); unsigned long strtoul(const char *nptr, char **endptr, unsigned int base);
int _strlen(const char *s); int _strlen(const char *s);
int _strnlen(const char *s, uint32_t maxlen); int _strnlen(const char *s, uint32_t maxlen);