[libc][musl] support arm-linux-musleabi toolchain

目前基本功能已经可以在QEMU上跑起来,但是pthread和内核signal选中会报冲突。先合并一版本,后续解决这些问题。
This commit is contained in:
Man, Jianting (Meco)
2022-11-22 21:40:50 -05:00
committed by GitHub
parent fc83546cf5
commit bdd663a33f
11 changed files with 247 additions and 126 deletions
@@ -12,7 +12,7 @@
#ifndef __SYS_SELECT_H__
#define __SYS_SELECT_H__
#include <rtthread.h>
#include <rtconfig.h>
#include <sys/types.h>
#include <sys/time.h>
@@ -14,12 +14,11 @@
#ifdef __cplusplus
extern "C" {
#endif
#endif /* __cplusplus */
#include <stdint.h>
#include <sys/types.h>
/* sigev_notify values
NOTE: P1003.1c/D10, p. 34 adds SIGEV_THREAD. */
@@ -54,7 +53,6 @@ struct siginfo
{
uint16_t si_signo;
uint16_t si_code;
union sigval si_value;
};
typedef struct siginfo siginfo_t;
@@ -216,17 +214,16 @@ int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
#define SIGUSR2 31 /* user defined signal 2 */
#define NSIG 32 /* signal 0 implied */
#ifndef _SIGNAL_H_
#if defined(RT_USING_NEWLIBC)
/* Some applications take advantage of the fact that <sys/signal.h>
* and <signal.h> are equivalent in glibc. Allow for that here. */
#include <signal.h>
#endif
#endif
#endif /* defined(RT_USING_NEWLIBC) */
#endif /* __ARMCC_VERSION */
#ifdef __cplusplus
}
#endif
#endif /* __cplusplus */
#endif
#endif /* __SYS_SIGNAL_H__ */
@@ -22,7 +22,7 @@ typedef __time64_t time_t;
#ifdef __cplusplus
extern "C" {
#endif
#endif /* __cplusplus */
#undef CLOCKS_PER_SEC
#define CLOCKS_PER_SEC RT_TICK_PER_SECOND
@@ -79,22 +79,21 @@ int stime(const time_t *t);
time_t timegm(struct tm * const t);
int gettimeofday(struct timeval *tv, struct timezone *tz);
int settimeofday(const struct timeval *tv, const struct timezone *tz);
#if defined(__ARMCC_VERSION) || defined (__ICCARM__)
#if defined(__ARMCC_VERSION) || defined (__ICCARM__) || defined(_WIN32)
struct tm *gmtime_r(const time_t *timep, struct tm *r);
struct tm* localtime_r(const time_t* t, struct tm* r);
char* asctime_r(const struct tm *t, char *buf);
char *ctime_r(const time_t * tim_p, char * result);
#elif defined(_WIN32)
struct tm* gmtime_r(const time_t* timep, struct tm* r);
struct tm* gmtime(const time_t* t);
struct tm* localtime_r(const time_t* t, struct tm* r);
#endif /* defined(__ARMCC_VERSION) || defined (__ICCARM__) || defined(_WIN32) */
#ifdef _WIN32
struct tm* gmtime(const time_t* t);
struct tm* localtime(const time_t* t);
time_t mktime(struct tm* const t);
char* asctime_r(const struct tm* t, char* buf);
char* ctime_r(const time_t* tim_p, char* result);
char* ctime(const time_t* tim_p);
time_t time(time_t* t);
#endif
#endif /* _WIN32 */
#ifdef RT_USING_POSIX_DELAY
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
@@ -112,20 +111,21 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME 1
#endif
#endif /* CLOCK_REALTIME */
#define CLOCK_CPUTIME_ID 2
#ifndef CLOCK_PROCESS_CPUTIME_ID
#define CLOCK_PROCESS_CPUTIME_ID CLOCK_CPUTIME_ID
#endif
#endif /* CLOCK_PROCESS_CPUTIME_ID */
#ifndef CLOCK_THREAD_CPUTIME_ID
#define CLOCK_THREAD_CPUTIME_ID CLOCK_CPUTIME_ID
#endif
#endif /* CLOCK_THREAD_CPUTIME_ID */
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC 4
#endif
#endif /* CLOCK_MONOTONIC */
#endif /* defined(RT_USING_POSIX_CLOCK) || defined (RT_USING_POSIX_TIMER) */
#ifdef RT_USING_POSIX_CLOCK
@@ -142,8 +142,7 @@ int timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid);
int timer_delete(timer_t timerid);
int timer_getoverrun(timer_t timerid);
int timer_gettime(timer_t timerid, struct itimerspec *its);
int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
struct itimerspec *ovalue);
int timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue);
#endif /* RT_USING_POSIX_TIMER */
/* timezone */
@@ -153,6 +152,6 @@ int8_t tz_is_dst(void);
#ifdef __cplusplus
}
#endif
#endif /* __cplusplus */
#endif /* _SYS_TIME_H_ */