diff --git a/libgloss/arc/hl-stub.c b/libgloss/arc/hl-stub.c index 7f5b9facc..c4d6ee67b 100644 --- a/libgloss/arc/hl-stub.c +++ b/libgloss/arc/hl-stub.c @@ -15,6 +15,7 @@ * */ +#include #include #include #include @@ -44,6 +45,19 @@ _getpid (void) return __MYPID; } +/* We do not have 64-bit compatible hostlink fstat. */ +#if defined (__ARC64__) +int +_fstat (int fd, struct stat *st) +{ + memset (st, 0, sizeof (*st)); + st->st_mode = S_IFCHR; + st->st_blksize = 1024; + + return 0; +} +#endif + /* hostlink backend has only fstat(), so use fstat() in stat(). */ int diff --git a/libgloss/arc/hl/hl_gw.c b/libgloss/arc/hl/hl_gw.c index f576f097e..4a8f8780f 100644 --- a/libgloss/arc/hl/hl_gw.c +++ b/libgloss/arc/hl/hl_gw.c @@ -15,6 +15,7 @@ * */ +#include #include "hl_gw.h" #define HL_VERSION 1 @@ -134,7 +135,15 @@ _hl_send (volatile __uncached void *p) _hl_pkt_init (pkt_hdr, _hl_payload_used (p)); +#if defined (__ARC64__) + /* + * Here we pass only low 4 bytes of the packet address (pkt_hdr). + * The high part of the address is obtained from __HOSTLINK__ address. + */ + hdr->buf_addr = (uintptr_t) pkt_hdr & 0xFFFFFFFF; +#else hdr->buf_addr = (uint32_t) pkt_hdr; +#endif hdr->payload_size = _hl_payload_size (); hdr->host2target_addr = HL_NOADDRESS; hdr->version = HL_VERSION; diff --git a/libgloss/arc/hl/hl_toolchain.h b/libgloss/arc/hl/hl_toolchain.h index bf884bf3f..946061718 100644 --- a/libgloss/arc/hl/hl_toolchain.h +++ b/libgloss/arc/hl/hl_toolchain.h @@ -19,7 +19,12 @@ #define _HL_TOOLCHAIN_H #ifndef __uncached +#if defined (__ARC64__) + /* TODO: Uncached attribute is not implemented for ARCv3 yet. */ + #define __uncached +#else #define __uncached __attribute__((uncached)) +#endif #endif /* __uncached */ #ifndef __aligned @@ -43,7 +48,12 @@ #endif /* __noreturn */ #ifndef __longcall +#if defined (__ARC64__) + /* TODO: Long call attribute is not implemented for ARCv3 yet. */ + #define __longcall +#else #define __longcall __attribute__((long_call)) +#endif #endif /* __longcall */ #define HL_MAX_DCACHE_LINE 256 diff --git a/libgloss/arc/nsim-syscalls.c b/libgloss/arc/nsim-syscalls.c index 807f95cd0..0a99ad59c 100644 --- a/libgloss/arc/nsim-syscalls.c +++ b/libgloss/arc/nsim-syscalls.c @@ -100,7 +100,12 @@ _open (const char * pathname, int flags, int mode) } /* Should be provided by crt0.S. */ +#if defined (__ARC64__) +/* TODO: long_call is not implemented yet in GCC. Fix this when implemented. */ +extern void __attribute__((noreturn)) _exit_halt (int ret); +#else extern void __attribute__((noreturn, long_call)) _exit_halt (int ret); +#endif void __attribute__((noreturn))