summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2011-06-24 16:24:25 +0200
committerCarmelo Amoroso <carmelo.amoroso@st.com>2011-06-24 16:24:25 +0200
commit7682323a3a798d6f15708f228f859a64cb869aa3 (patch)
tree0f3648e92245745c9828db3175651974b10c9ae4 /libc
parent3004ce0c9619f89bf8e64931edd696bf4df8d2e1 (diff)
parent74da7a88552ecf518e64642c90742fddca57be00 (diff)
Merge remote-tracking branch 'origin/master' into prelink
* origin/master: (61 commits) fts: fix warning due to old-style function definition ldso_tls: fix compiler warning due to missing cast resolv: fix bug in res_init with ipv6 nameservers config: Fix passing defconfig args buildsys: pt-initfini.s depends on uClibc_config.h libdl: search for ELF_RTYPE_CLASS_DLSYM in dlsym() resolv: try next server on SERVFAIL getaddrinfo: allow numeric service without any hints bump version to 0.9.33-git nptl/pthread: Correct path for machine specific pt-initfini.c ctor/dtor nptl: Fix init and fini function compilation Rules.mak: Rearrange appending UCLIBC_EXTRA_CFLAGS to CFLAGS ARM: remove EABI/OABI selection ARM: detect BX availibility at build time ARM: #include <bits/arm_asm.h> where __USE_BX__ is used ARM: transform the EABI/OABI choice into a boolean ARM: remove sub-arch/variants selection from menuconfig ARM: introduce blind options to select & force THUMB mode ARM: reorder "Use BX" option Fix __libc_epoll_pwait compile failure on x86 ... Conflicts: ldso/libdl/libdl.c Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/Makefile.in5
-rw-r--r--libc/inet/accept4.c8
-rw-r--r--libc/inet/getaddrinfo.c7
-rw-r--r--libc/inet/resolv.c6
-rw-r--r--libc/inet/socketcalls.c42
-rw-r--r--libc/misc/fts/fts.c64
-rw-r--r--libc/misc/wordexp/wordexp.c25
-rw-r--r--libc/stdlib/__uc_malloc.c1
-rw-r--r--libc/sysdeps/linux/arm/Makefile.arch9
-rw-r--r--libc/sysdeps/linux/arm/bits/arm_asm.h9
-rw-r--r--libc/sysdeps/linux/arm/bits/huge_val.h4
-rw-r--r--libc/sysdeps/linux/arm/crtn.S2
-rw-r--r--libc/sysdeps/linux/arm/sysdep.h1
-rw-r--r--libc/sysdeps/linux/arm/unwind.h279
-rw-r--r--libc/sysdeps/linux/avr32/crtn.S2
-rw-r--r--libc/sysdeps/linux/common/Makefile.in10
-rw-r--r--libc/sysdeps/linux/common/bits/kernel-features.h25
-rw-r--r--libc/sysdeps/linux/common/epoll.c53
-rw-r--r--libc/sysdeps/linux/common/getcwd.c3
-rw-r--r--libc/sysdeps/linux/common/longjmp.c4
-rw-r--r--libc/sysdeps/linux/common/pipe2.c16
-rw-r--r--libc/sysdeps/linux/common/stubs.c106
-rw-r--r--libc/sysdeps/linux/common/sys/epoll.h64
-rw-r--r--libc/sysdeps/linux/common/unwind.h220
-rw-r--r--libc/sysdeps/linux/cris/crtn.S2
-rw-r--r--libc/sysdeps/linux/frv/crtn.S2
-rw-r--r--libc/sysdeps/linux/h8300/crtn.S2
-rw-r--r--libc/sysdeps/linux/i386/crtn.S2
-rw-r--r--libc/sysdeps/linux/i386/posix_fadvise64.S4
-rw-r--r--libc/sysdeps/linux/microblaze/crtn.S2
-rw-r--r--libc/sysdeps/linux/mips/crtn.S15
-rw-r--r--libc/sysdeps/linux/powerpc/crtn.S2
-rw-r--r--libc/sysdeps/linux/sh/Makefile.arch4
-rw-r--r--libc/sysdeps/linux/sh/crtn.S2
-rw-r--r--libc/sysdeps/linux/sh/longjmp.c56
-rw-r--r--libc/sysdeps/linux/sh64/crtn.S2
-rw-r--r--libc/sysdeps/linux/sparc/crtn.S2
-rw-r--r--libc/sysdeps/linux/v850/crtn.S2
-rw-r--r--libc/sysdeps/linux/vax/crtn.S2
-rw-r--r--libc/sysdeps/linux/x86_64/crtn.S2
-rw-r--r--libc/sysdeps/linux/x86_64/sys/epoll.h110
41 files changed, 880 insertions, 298 deletions
diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in
index abcf2f7d7..d58822074 100644
--- a/libc/inet/Makefile.in
+++ b/libc/inet/Makefile.in
@@ -44,11 +44,12 @@ CSRC-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += \
## CSRC-y += encodep.c decodep.c formquery.c
# multi source socketcalls.c
-socketcalls_CSRC += \
+socketcalls_CSRC-y += \
accept.c bind.c connect.c getpeername.c getsockname.c \
getsockopt.c listen.c recv.c recvfrom.c recvmsg.c send.c sendmsg.c \
sendto.c setsockopt.c shutdown.c socket.c socketpair.c
-CSRC-$(UCLIBC_HAS_SOCKET) += $(socketcalls_CSRC) opensock.c
+socketcalls_CSRC-$(UCLIBC_LINUX_SPECIFIC) += accept4.c
+CSRC-$(UCLIBC_HAS_SOCKET) += $(socketcalls_CSRC-y) opensock.c
CSRC-$(findstring y,$(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += ethers.c ether_addr.c
diff --git a/libc/inet/accept4.c b/libc/inet/accept4.c
new file mode 100644
index 000000000..e2fdd6c2f
--- /dev/null
+++ b/libc/inet/accept4.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_accept4
+#include "socketcalls.c"
diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c
index 1a77c5199..e7511f6c4 100644
--- a/libc/inet/getaddrinfo.c
+++ b/libc/inet/getaddrinfo.c
@@ -820,13 +820,6 @@ getaddrinfo(const char *name, const char *service,
if (hints->ai_flags & AI_NUMERICSERV)
return EAI_NONAME;
gaih_service.num = -1;
- } else {
- /*
- * Can't specify a numerical socket unless a protocol
- * family was given.
- */
- if (hints->ai_socktype == 0 && hints->ai_protocol == 0)
- return EAI_SERVICE;
}
pservice = &gaih_service;
} else
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 021d5bf5d..dc8a752fa 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1461,7 +1461,7 @@ int attribute_hidden __dns_lookup(const char *name,
/* bug 660 says we treat negative response as an error
* and retry, which is, eh, an error. :)
* We were incurring long delays because of this. */
- if (h.rcode == NXDOMAIN) {
+ if (h.rcode == NXDOMAIN || h.rcode == SERVFAIL) {
/* if possible, try next search domain */
if (!ends_with_dot) {
DPRINTF("variant:%d sdomains:%d\n", variant, sdomains);
@@ -2964,7 +2964,7 @@ int res_init(void)
if (__nameserver[i].sa.sa_family == AF_INET6
&& m < ARRAY_SIZE(rp->_u._ext.nsaddrs)
) {
- struct sockaddr_in6 *sa6 = malloc(sizeof(sa6));
+ struct sockaddr_in6 *sa6 = malloc(sizeof(*sa6));
if (sa6) {
*sa6 = __nameserver[i].sa6; /* struct copy */
rp->_u._ext.nsaddrs[m] = sa6;
@@ -2981,7 +2981,7 @@ int res_init(void)
#else /* IPv6 only */
while (m < ARRAY_SIZE(rp->_u._ext.nsaddrs) && i < __nameservers) {
- struct sockaddr_in6 *sa6 = malloc(sizeof(sa6));
+ struct sockaddr_in6 *sa6 = malloc(sizeof(*sa6));
if (sa6) {
*sa6 = __nameserver[i].sa6; /* struct copy */
rp->_u._ext.nsaddrs[m] = sa6;
diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c
index 42a5a563f..aae7e93bf 100644
--- a/libc/inet/socketcalls.c
+++ b/libc/inet/socketcalls.c
@@ -31,6 +31,7 @@ extern int __socketcall(int call, unsigned long *args) attribute_hidden;
#define SYS_GETSOCKOPT 15
#define SYS_SENDMSG 16
#define SYS_RECVMSG 17
+#define SYS_ACCEPT4 18
#endif
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
@@ -82,6 +83,46 @@ weak_alias(__libc_accept,accept)
libc_hidden_weak(accept)
#endif
+#ifdef L_accept4
+#ifdef __NR_accept4
+# define __NR___sys_accept4 __NR_accept4
+static _syscall4(int, __sys_accept4, int, fd, struct sockaddr *, addr, socklen_t *, addrlen, int, flags)
+int accept4(int fd, struct sockaddr *addr, socklen_t * addrlen, int flags)
+{
+ if (SINGLE_THREAD_P)
+ return __sys_accept4(fd, addr, addrlen, flags);
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+ else {
+ int oldtype = LIBC_CANCEL_ASYNC ();
+ int result = __sys_accept4(fd, addr, addrlen, flags);
+ LIBC_CANCEL_RESET (oldtype);
+ return result;
+ }
+#endif
+}
+#elif defined(__NR_socketcall)
+int accept4(int fd, struct sockaddr *addr, socklen_t *addrlen, int flags)
+{
+ unsigned long args[4];
+
+ args[0] = fd;
+ args[1] = (unsigned long) addr;
+ args[2] = (unsigned long) addrlen;
+ args[3] = flags;
+ if (SINGLE_THREAD_P)
+ return __socketcall(SYS_ACCEPT4, args);
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+ else {
+ int oldtype = LIBC_CANCEL_ASYNC ();
+ int result = __socketcall(SYS_ACCEPT4, args);
+ LIBC_CANCEL_RESET (oldtype);
+ return result;
+ }
+#endif
+}
+#endif
+#endif
+
#ifdef L_bind
#ifdef __NR_bind
_syscall3(int, bind, int, sockfd, const struct sockaddr *, myaddr, socklen_t, addrlen)
@@ -560,3 +601,4 @@ int socketpair(int family, int type, int protocol, int sockvec[2])
}
#endif
#endif
+
diff --git a/libc/misc/fts/fts.c b/libc/misc/fts/fts.c
index ce5d1586b..deb8f4adc 100644
--- a/libc/misc/fts/fts.c
+++ b/libc/misc/fts/fts.c
@@ -87,10 +87,8 @@ static int fts_safe_changedir (FTS *, FTSENT *, int, const char *)
#define BREAD 3 /* fts_read */
FTS *
-fts_open(argv, options, compar)
- char * const *argv;
- register int options;
- int (*compar) (const FTSENT **, const FTSENT **);
+fts_open( char * const *argv, register int options,
+ int (*compar) (const FTSENT **, const FTSENT **))
{
register FTS *sp;
register FTSENT *p, *root;
@@ -204,9 +202,7 @@ mem1: free(sp);
static void
internal_function
-fts_load(sp, p)
- FTS *sp;
- register FTSENT *p;
+fts_load(FTS *sp, register FTSENT *p)
{
register int len;
register char *cp;
@@ -230,8 +226,7 @@ fts_load(sp, p)
}
int
-fts_close(sp)
- FTS *sp;
+fts_close(FTS *sp)
{
register FTSENT *freep, *p;
int saved_errno;
@@ -284,8 +279,7 @@ fts_close(sp)
? p->fts_pathlen - 1 : p->fts_pathlen)
FTSENT *
-fts_read(sp)
- register FTS *sp;
+fts_read(register FTS *sp)
{
register FTSENT *p, *tmp;
register int instr;
@@ -481,10 +475,7 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent);
*/
/* ARGSUSED */
int
-fts_set(sp, p, instr)
- FTS *sp;
- FTSENT *p;
- int instr;
+fts_set(FTS *sp, FTSENT *p, int instr)
{
if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
instr != FTS_NOINSTR && instr != FTS_SKIP) {
@@ -496,9 +487,7 @@ fts_set(sp, p, instr)
}
FTSENT *
-fts_children(sp, instr)
- register FTS *sp;
- int instr;
+fts_children(register FTS *sp, int instr)
{
register FTSENT *p;
int fd;
@@ -579,9 +568,7 @@ fts_children(sp, instr)
*/
static FTSENT *
internal_function
-fts_build(sp, type)
- register FTS *sp;
- int type;
+fts_build(register FTS *sp, int type)
{
register struct dirent *dp;
register FTSENT *p, *head;
@@ -851,10 +838,7 @@ mem1: saved_errno = errno;
static u_short
internal_function
-fts_stat(sp, p, follow)
- FTS *sp;
- register FTSENT *p;
- int follow;
+fts_stat(FTS *sp, register FTSENT *p, int follow)
{
register FTSENT *t;
register dev_t dev;
@@ -935,10 +919,7 @@ err: memset(sbp, 0, sizeof(struct stat));
static FTSENT *
internal_function
-fts_sort(sp, head, nitems)
- FTS *sp;
- FTSENT *head;
- register int nitems;
+fts_sort(FTS *sp, FTSENT *head, register int nitems)
{
register FTSENT **ap, *p;
@@ -973,10 +954,7 @@ fts_sort(sp, head, nitems)
static FTSENT *
internal_function
-fts_alloc(sp, name, namelen)
- FTS *sp;
- const char *name;
- size_t namelen;
+fts_alloc(FTS *sp, const char *name, size_t namelen)
{
register FTSENT *p;
size_t len;
@@ -1013,8 +991,7 @@ fts_alloc(sp, name, namelen)
static void
internal_function
-fts_lfree(head)
- register FTSENT *head;
+fts_lfree(register FTSENT *head)
{
register FTSENT *p;
@@ -1033,9 +1010,7 @@ fts_lfree(head)
*/
static int
internal_function
-fts_palloc(sp, more)
- FTS *sp;
- size_t more;
+fts_palloc(FTS *sp, size_t more)
{
char *p;
@@ -1067,9 +1042,7 @@ fts_palloc(sp, more)
*/
static void
internal_function
-fts_padjust(sp, head)
- FTS *sp;
- FTSENT *head;
+fts_padjust(FTS *sp, FTSENT *head)
{
FTSENT *p;
char *addr = sp->fts_path;
@@ -1094,8 +1067,7 @@ fts_padjust(sp, head)
static size_t
internal_function
-fts_maxarglen(argv)
- char * const *argv;
+fts_maxarglen(char * const *argv)
{
size_t len, max;
@@ -1112,11 +1084,7 @@ fts_maxarglen(argv)
*/
static int
internal_function
-fts_safe_changedir(sp, p, fd, path)
- FTS *sp;
- FTSENT *p;
- int fd;
- const char *path;
+fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const char *path)
{
int ret, oerrno, newfd;
struct stat64 sb;
diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c
index 4c25d2860..700ea2c23 100644
--- a/libc/misc/wordexp/wordexp.c
+++ b/libc/misc/wordexp/wordexp.c
@@ -20,6 +20,7 @@
Boston, MA 02111-1307, USA. */
#include <features.h>
+#include <bits/kernel-features.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
@@ -757,16 +758,21 @@ exec_comm_child(char *comm, int *fildes, int showerr, int noexec)
/* Redirect output. */
fd = fildes[1];
- if (fd != 1) {
- dup2(fd, 1);
+ if (likely(fd != STDOUT_FILENO)) {
+ dup2(fd, STDOUT_FILENO);
close(fd);
}
-
+#if defined O_CLOEXEC && defined __UCLIBC_LINUX_SPECIFIC__ && defined __ASSUME_PIPE2
+ else {
+ /* Reset the close-on-exec flag (if necessary). */
+ fcntl (fd, F_SETFD, 0);
+ }
+#endif
/* Redirect stderr to /dev/null if we have to. */
if (showerr == 0) {
- close(2);
+ close(STDERR_FILENO);
fd = open(_PATH_DEVNULL, O_WRONLY);
- if (fd >= 0 && fd != 2) {
+ if (fd >= 0 && fd != STDERR_FILENO) {
dup2(fd, 2);
close(fd);
}
@@ -802,10 +808,15 @@ exec_comm(char *comm, char **word, size_t * word_length,
/* Don't fork() unless necessary */
if (!comm || !*comm)
return 0;
-
- if (pipe(fildes))
+#if defined O_CLOEXEC && defined __UCLIBC_LINUX_SPECIFIC__ && defined __ASSUME_PIPE2
+ if (pipe2(fildes, O_CLOEXEC) < 0)
/* Bad */
return WRDE_NOSPACE;
+#else
+ if (pipe(fildes) < 0)
+ /* Bad */
+ return WRDE_NOSPACE;
+#endif
if ((pid = fork()) < 0) {
/* Bad */
diff --git a/libc/stdlib/__uc_malloc.c b/libc/stdlib/__uc_malloc.c
index 2a2e223ef..449f014fc 100644
--- a/libc/stdlib/__uc_malloc.c
+++ b/libc/stdlib/__uc_malloc.c
@@ -39,6 +39,7 @@ void *__uc_malloc(size_t size)
return p;
if (!__uc_malloc_failed)
_exit(1);
+ free(p);
__uc_malloc_failed(size);
}
}
diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch
index b53c539bf..14279e0d7 100644
--- a/libc/sysdeps/linux/arm/Makefile.arch
+++ b/libc/sysdeps/linux/arm/Makefile.arch
@@ -24,7 +24,12 @@ ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
CSRC += posix_fadvise.c posix_fadvise64.c
endif
-ifeq ($(CONFIG_ARM_EABI),y)
+# Is our compiler set up for EABI ?
+IS_EABI:=$(shell $(CC) $(CFLAGS) -x c - -E -dM </dev/null 2>/dev/null \
+ |sed -r -e '/^\#[[:space:]]*define[[:space:]]+__ARM_EABI__([[:space:]]+1)?$$/!d; s/.+/y/;' \
+ )
+
+ifeq ($(IS_EABI),y)
CSRC += aeabi_assert.c aeabi_atexit.c aeabi_errno_addr.c \
aeabi_localeconv.c aeabi_memclr.c aeabi_memcpy.c \
aeabi_memmove.c aeabi_memset.c find_exidx.c
@@ -37,7 +42,7 @@ else
CSRC += syscall.c
endif
-ifeq ($(CONFIG_ARM_EABI),y)
+ifeq ($(IS_EABI),y)
libc-static-y += $(ARCH_OUT)/aeabi_lcsts.o $(ARCH_OUT)/aeabi_math.o \
$(ARCH_OUT)/aeabi_sighandlers.o
libc-nonshared-y += $(ARCH_OUT)/aeabi_lcsts.os $(ARCH_OUT)/aeabi_math.os \
diff --git a/libc/sysdeps/linux/arm/bits/arm_asm.h b/libc/sysdeps/linux/arm/bits/arm_asm.h
index 1d87df6eb..921c9a3c9 100644
--- a/libc/sysdeps/linux/arm/bits/arm_asm.h
+++ b/libc/sysdeps/linux/arm/bits/arm_asm.h
@@ -24,5 +24,12 @@
#define THUMB1_ONLY 1
#endif
-#endif /* _ARM_ASM_H */
+#if defined(__USE_BX__)
+# if ( defined (__ARM_ARCH_2__) || defined (__ARM_ARCH_3__) \
+ || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \
+ )
+# error Use of BX was requested, but is not available on the target processor.
+# endif /* ARCH level */
+#endif /* __USE_BX__ */
+#endif /* _ARM_ASM_H */
diff --git a/libc/sysdeps/linux/arm/bits/huge_val.h b/libc/sysdeps/linux/arm/bits/huge_val.h
index a215f3c0b..745e0bbd5 100644
--- a/libc/sysdeps/linux/arm/bits/huge_val.h
+++ b/libc/sysdeps/linux/arm/bits/huge_val.h
@@ -32,7 +32,7 @@
# define HUGE_VAL (__extension__ 0x1.0p2047)
#elif defined __GNUC__
-#ifndef __CONFIG_ARM_EABI__
+#ifndef __ARM_EABI__
# define HUGE_VAL \
(__extension__ \
((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \
@@ -50,7 +50,7 @@
typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
-#ifndef __CONFIG_ARM_EABI__
+#ifndef __ARM_EABI__
# if __BYTE_ORDER == __BIG_ENDIAN
# define __HUGE_VAL_bytes { 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 }
# endif
diff --git a/libc/sysdeps/linux/arm/crtn.S b/libc/sysdeps/linux/arm/crtn.S
index de01b38dc..a4752c186 100644
--- a/libc/sysdeps/linux/arm/crtn.S
+++ b/libc/sysdeps/linux/arm/crtn.S
@@ -15,7 +15,6 @@
.arm
ldmdb fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc}
#endif
- .size _init, .-_init
.section .fini
.global _fini
@@ -29,7 +28,6 @@
.arm
ldmdb fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc}
#endif
- .size _fini, .-_fini
@ In fact this is modified to 3.4.4
.ident "GCC: (GNU) 3.3.2 20031005 (Debian prerelease)"
diff --git a/libc/sysdeps/linux/arm/sysdep.h b/libc/sysdeps/linux/arm/sysdep.h
index 013f88cdd..e498695be 100644
--- a/libc/sysdeps/linux/arm/sysdep.h
+++ b/libc/sysdeps/linux/arm/sysdep.h
@@ -21,6 +21,7 @@
#define _LINUX_ARM_SYSDEP_H 1
#include <common/sysdep.h>
+#include <bits/arm_asm.h>
#include <sys/syscall.h>
/* For Linux we can use the system call table in the header file
diff --git a/libc/sysdeps/linux/arm/unwind.h b/libc/sysdeps/linux/arm/unwind.h
new file mode 100644
index 000000000..eeb9cf8b6
--- /dev/null
+++ b/libc/sysdeps/linux/arm/unwind.h
@@ -0,0 +1,279 @@
+/* Header file for the ARM EABI unwinder
+ Copyright (C) 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
+ Contributed by Paul Brook
+
+ This file is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ In addition to the permissions in the GNU General Public License, the
+ Free Software Foundation gives you unlimited permission to link the
+ compiled version of this file into combinations with other programs,
+ and to distribute those combinations without any restriction coming
+ from the use of this file. (The General Public License restrictions
+ do apply in other respects; for example, they cover modification of
+ the file, and distribution when not linked into a combine
+ executable.)
+
+ This file is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* Language-independent unwinder header public defines. This contains both
+ ABI defined objects, and GNU support routines. */
+
+#ifndef UNWIND_ARM_H
+#define UNWIND_ARM_H
+
+#define __ARM_EABI_UNWINDER__ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ typedef unsigned _Unwind_Word __attribute__((__mode__(__word__)));
+ typedef signed _Unwind_Sword __attribute__((__mode__(__word__)));
+ typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__)));
+ typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__)));
+ typedef _Unwind_Word _uw;
+ typedef unsigned _uw64 __attribute__((mode(__DI__)));
+ typedef unsigned _uw16 __attribute__((mode(__HI__)));
+ typedef unsigned _uw8 __attribute__((mode(__QI__)));
+
+ typedef enum
+ {
+ _URC_OK = 0, /* operation completed successfully */
+ _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
+ _URC_END_OF_STACK = 5,
+ _URC_HANDLER_FOUND = 6,
+ _URC_INSTALL_CONTEXT = 7,
+ _URC_CONTINUE_UNWIND = 8,
+ _URC_FAILURE = 9 /* unspecified failure of some kind */
+ }
+ _Unwind_Reason_Code;
+
+ typedef enum
+ {
+ _US_VIRTUAL_UNWIND_FRAME = 0,
+ _US_UNWIND_FRAME_STARTING = 1,
+ _US_UNWIND_FRAME_RESUME = 2,
+ _US_ACTION_MASK = 3,
+ _US_FORCE_UNWIND = 8,
+ _US_END_OF_STACK = 16
+ }
+ _Unwind_State;
+
+ /* Provided only for for compatibility with existing code. */
+ typedef int _Unwind_Action;
+#define _UA_SEARCH_PHASE 1
+#define _UA_CLEANUP_PHASE 2
+#define _UA_HANDLER_FRAME 4
+#define _UA_FORCE_UNWIND 8
+#define _UA_END_OF_STACK 16
+#define _URC_NO_REASON _URC_OK
+
+ typedef struct _Unwind_Control_Block _Unwind_Control_Block;
+ typedef struct _Unwind_Context _Unwind_Context;
+ typedef _uw _Unwind_EHT_Header;
+
+
+ /* UCB: */
+
+ struct _Unwind_Control_Block
+ {
+#ifdef _LIBC
+ /* For the benefit of code which assumes this is a scalar. All
+ glibc ever does is clear it. */
+ _uw64 exception_class;
+#else
+ char exception_class[8];
+#endif
+ void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *);
+ /* Unwinder cache, private fields for the unwinder's use */
+ struct
+ {
+ _uw reserved1; /* Forced unwind stop fn, 0 if not forced */
+ _uw reserved2; /* Personality routine address */
+ _uw reserved3; /* Saved callsite address */
+ _uw reserved4; /* Forced unwind stop arg */
+ _uw reserved5;
+ }
+ unwinder_cache;
+ /* Propagation barrier cache (valid after phase 1): */
+ struct
+ {
+ _uw sp;
+ _uw bitpattern[5];
+ }
+ barrier_cache;
+ /* Cleanup cache (preserved over cleanup): */
+ struct
+ {
+ _uw bitpattern[4];
+ }
+ cleanup_cache;
+ /* Pr cache (for pr's benefit): */
+ struct
+ {
+ _uw fnstart; /* function start address */
+ _Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */
+ _uw additional; /* additional data */
+ _uw reserved1;
+ }
+ pr_cache;
+ long long int :0; /* Force alignment to 8-byte boundary */
+ };
+
+ /* Virtual Register Set*/
+
+ typedef enum
+ {
+ _UVRSC_CORE = 0, /* integer register */
+ _UVRSC_VFP = 1, /* vfp */
+ _UVRSC_FPA = 2, /* fpa */
+ _UVRSC_WMMXD = 3, /* Intel WMMX data register */
+ _UVRSC_WMMXC = 4 /* Intel WMMX control register */
+ }
+ _Unwind_VRS_RegClass;
+
+ typedef enum
+ {
+ _UVRSD_UINT32 = 0,
+ _UVRSD_VFPX = 1,
+ _UVRSD_FPAX = 2,
+ _UVRSD_UINT64 = 3,
+ _UVRSD_FLOAT = 4,
+ _UVRSD_DOUBLE = 5
+ }
+ _Unwind_VRS_DataRepresentation;
+
+ typedef enum
+ {
+ _UVRSR_OK = 0,
+ _UVRSR_NOT_IMPLEMENTED = 1,
+ _UVRSR_FAILED = 2
+ }
+ _Unwind_VRS_Result;
+
+ /* Frame unwinding state. */
+ typedef struct
+ {
+ /* The current word (bytes packed msb first). */
+ _uw data;
+ /* Pointer to the next word of data. */
+ _uw *next;
+ /* The number of bytes left in this word. */
+ _uw8 bytes_left;
+ /* The number of words pointed to by ptr. */
+ _uw8 words_left;
+ }
+ __gnu_unwind_state;
+
+ typedef _Unwind_Reason_Code (*personality_routine) (_Unwind_State,
+ _Unwind_Control_Block *, _Unwind_Context *);
+
+ _Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass,
+ _uw, _Unwind_VRS_DataRepresentation,
+ void *);
+
+ _Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *, _Unwind_VRS_RegClass,
+ _uw, _Unwind_VRS_DataRepresentation,
+ void *);
+
+ _Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass,
+ _uw, _Unwind_VRS_DataRepresentation);
+
+
+ /* Support functions for the PR. */
+#define _Unwind_Exception _Unwind_Control_Block
+ typedef char _Unwind_Exception_Class[8];
+
+ void * _Unwind_GetLanguageSpecificData (_Unwind_Context *);
+ _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *);
+
+ /* These two should never be used. */
+ _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *);
+ _Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context *);
+
+ /* Interface functions: */
+ _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Control_Block *ucbp);
+ void __attribute__((noreturn)) _Unwind_Resume(_Unwind_Control_Block *ucbp);
+ _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Control_Block *ucbp);
+
+ typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
+ (int, _Unwind_Action, _Unwind_Exception_Class,
+ _Unwind_Control_Block *, struct _Unwind_Context *, void *);
+ _Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Control_Block *,
+ _Unwind_Stop_Fn, void *);
+ _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *);
+ void _Unwind_Complete(_Unwin