summaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorSteve Ellcey <sellcey@caviumnetworks.com>2016-11-28 09:01:23 -0800
committerSteve Ellcey <sellcey@caviumnetworks.com>2016-11-28 09:01:23 -0800
commit389d1f1b232b3d6b9d73ee2c50e543ace6675621 (patch)
tree2ac5730d159f8e519d42d1df7d14ace1c5b44825 /sysdeps/unix
parent9e878fa9578469332a44ae7d9813a0d29697eeaf (diff)
downloadglibc-389d1f1b232b3d6b9d73ee2c50e543ace6675621.tar.gz
Partial ILP32 support for aarch64.
* sysdeps/aarch64/crti.S: Add include of sysdep.h. (call_weak_fn): Use PTR_REG to get correct reg name in ILP32. * sysdeps/aarch64/dl-irel.h: Add include of sysdep.h. (elf_irela): Use AARCH64_R macro to get correct relocation in ILP32. * sysdeps/aarch64/dl-machine.h: Add include of sysdep.h. (elf_machine_load_address, RTLD_START, RTLD_START_1, RTLD_START, elf_machine_type_class, ELF_MACHINE_JMP_SLOT, elf_machine_rela, elf_machine_lazy_rel): Add ifdef's for ILP32 support. * sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return, _dl_tlsdesc_return_lazy, _dl_tlsdesc_dynamic, _dl_tlsdesc_resolve_hold): Extend pointers in ILP32, use PTR_REG to get correct reg name for ILP32. * sysdeps/aarch64/dl-trampoline.S (ip01): New Macro. (RELA_SIZE): New Macro. (_dl_runtime_resolve, _dl_runtime_profile): Use new macros and PTR_REG to support ILP32. * sysdeps/aarch64/jmpbuf-unwind.h (_JMPBUF_CFA_UNWINDS_ADJ): Add cast for ILP32 mode. * sysdeps/aarch64/memcmp.S (memcmp): Extend arg pointers for ILP32 mode. * sysdeps/aarch64/memcpy.S (memmove, memcpy): Ditto. * sysdeps/aarch64/memset.S (__memset): Ditto. * sysdeps/aarch64/strchr.S (strchr): Ditto. * sysdeps/aarch64/strchrnul.S (__strchrnul): Ditto. * sysdeps/aarch64/strcmp.S (strcmp): Ditto. * sysdeps/aarch64/strcpy.S (strcpy): Ditto. * sysdeps/aarch64/strlen.S (__strlen): Ditto. * sysdeps/aarch64/strncmp.S (strncmp): Ditto. * sysdeps/aarch64/strnlen.S (strnlen): Ditto. * sysdeps/aarch64/strrchr.S (strrchr): Ditto. * sysdeps/unix/sysv/linux/aarch64/clone.S: Ditto. * sysdeps/unix/sysv/linux/aarch64/setcontext.S (__setcontext): Ditto. * sysdeps/unix/sysv/linux/aarch64/swapcontext.S (__swapcontext): Ditto. * sysdeps/aarch64/__longjmp.S (__longjmp): Extend pointers in ILP32, change PTR_MANGLE call to use register numbers instead of names. * sysdeps/unix/sysv/linux/aarch64/getcontext.S (__getcontext): Ditto. * sysdeps/aarch64/setjmp.S (__sigsetjmp): Extend arg pointers for ILP32 mode, change PTR_MANGLE calls to use register numbers. * sysdeps/aarch64/start.S (_start): Ditto. * sysdeps/aarch64/nptl/bits/pthreadtypes.h (__PTHREAD_RWLOCK_INT_FLAGS_SHARED): New define. (__SIZEOF_PTHREAD_ATTR_T, __SIZEOF_PTHREAD_MUTEX_T, __SIZEOF_PTHREAD_MUTEXATTR_T, __SIZEOF_PTHREAD_COND_T, __SIZEOF_PTHREAD_COND_COMPAT_T, __SIZEOF_PTHREAD_CONDATTR_T, __SIZEOF_PTHREAD_RWLOCK_T, __SIZEOF_PTHREAD_RWLOCKATTR_T, __SIZEOF_PTHREAD_BARRIER_T, __SIZEOF_PTHREAD_BARRIERATTR_T): Make defined values dependent on __ILP32__. * sysdeps/aarch64/nptl/bits/semaphore.h (__SIZEOF_SEM_T): Change define. (sem_t): Change __align type. * sysdeps/aarch64/sysdep.h (AARCH64_R, PTR_REG, PTR_LOG_SIZE, DELOUSE, PTR_SIZE): New Macros. (LDST_PCREL, LDST_GLOBAL) Update to use PTR_REG. * sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h (O_LARGEFILE): Set when in ILP32 mode. (F_GETLK64, F_SETLK64, F_SETLKW64): Only set in LP64 mode. * sysdeps/unix/sysv/linux/aarch64/dl-cache.h (DL_CACHE_DEFAULT_ID): Set elf flags for ILP32. (add_system_dir): Set ILP32 library directories. * sysdeps/unix/sysv/linux/aarch64/init-first.c (_libc_vdso_platform_setup): Set minimum kernel version for ILP32. * sysdeps/unix/sysv/linux/aarch64/ldconfig.h (SYSDEP_KNOWN_INTERPRETER_NAMES): Add ILP32 names. * sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h (GET_PC, SET_PC): New Macros. * sysdeps/unix/sysv/linux/aarch64/sysdep.h: Handle ILP32 pointers.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h8
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/clone.S7
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/dl-cache.h15
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/getcontext.S3
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/init-first.c12
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/ldconfig.h2
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/setcontext.S1
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h3
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/swapcontext.S1
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/sysdep.h8
10 files changed, 49 insertions, 11 deletions
diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h b/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
index 658f696ef9..1717c356cc 100644
--- a/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
@@ -25,11 +25,17 @@
#define __O_NOFOLLOW 0100000
#define __O_DIRECT 0200000
-#define __O_LARGEFILE 0
+#ifdef __ILP32__
+# define __O_LARGEFILE 0400000
+#else
+# define __O_LARGEFILE 0
+#endif
+#ifdef __LP64__
# define F_GETLK64 5
# define F_SETLK64 6
# define F_SETLKW64 7
+#endif
struct flock
{
diff --git a/sysdeps/unix/sysv/linux/aarch64/clone.S b/sysdeps/unix/sysv/linux/aarch64/clone.S
index 96482e53c0..657d28db4b 100644
--- a/sysdeps/unix/sysv/linux/aarch64/clone.S
+++ b/sysdeps/unix/sysv/linux/aarch64/clone.S
@@ -39,6 +39,13 @@
*/
.text
ENTRY(__clone)
+ DELOUSE (0)
+ DELOUSE (1)
+ DELOUSE (2)
+ DELOUSE (3)
+ DELOUSE (4)
+ DELOUSE (5)
+ DELOUSE (6)
/* Save args for the child. */
mov x10, x0
mov x11, x2
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
index 9c7b271e85..86905edcc2 100644
--- a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
@@ -18,7 +18,11 @@
#include <ldconfig.h>
-#define _DL_CACHE_DEFAULT_ID (FLAG_AARCH64_LIB64 | FLAG_ELF_LIBC6)
+#ifdef __LP64__
+# define _DL_CACHE_DEFAULT_ID (FLAG_AARCH64_LIB64 | FLAG_ELF_LIBC6)
+#else
+# define _DL_CACHE_DEFAULT_ID (FLAG_AARCH64_LIB32 | FLAG_ELF_LIBC6)
+#endif
#define _dl_cache_check_flags(flags) \
((flags) == _DL_CACHE_DEFAULT_ID)
@@ -27,18 +31,25 @@
do \
{ \
size_t len = strlen (dir); \
- char path[len + 3]; \
+ char path[len + 6]; \
memcpy (path, dir, len + 1); \
if (len >= 6 && ! memcmp (path + len - 6, "/lib64", 6)) \
{ \
len -= 2; \
path[len] = '\0'; \
} \
+ if (len >= 9 && ! memcmp (path + len - 9, "/libilp32", 9))\
+ { \
+ len -= 5; \
+ path[len] = '\0'; \
+ } \
add_dir (path); \
if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4)) \
{ \
memcpy (path + len, "64", 3); \
add_dir (path); \
+ memcpy (path + len, "ilp32", 6); \
+ add_dir (path); \
} \
} while (0)
diff --git a/sysdeps/unix/sysv/linux/aarch64/getcontext.S b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
index c2dd5b8f93..f6bf24fbd7 100644
--- a/sysdeps/unix/sysv/linux/aarch64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
@@ -30,6 +30,7 @@
.text
ENTRY(__getcontext)
+ DELOUSE (0)
/* The saved context will return to the getcontext() call point
with a return value of 0 */
str xzr, [x0, oX0 + 0 * SZREG]
@@ -90,7 +91,7 @@ ENTRY(__getcontext)
/* Grab the signal mask */
/* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */
- add x2, x0, #UCONTEXT_SIGMASK
+ add PTR_REG (2), PTR_REG (0), #UCONTEXT_SIGMASK
mov x0, SIG_BLOCK
mov x1, 0
mov x3, _NSIG8
diff --git a/sysdeps/unix/sysv/linux/aarch64/init-first.c b/sysdeps/unix/sysv/linux/aarch64/init-first.c
index f7224a25a2..f7bfc4d81c 100644
--- a/sysdeps/unix/sysv/linux/aarch64/init-first.c
+++ b/sysdeps/unix/sysv/linux/aarch64/init-first.c
@@ -27,17 +27,21 @@ int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
static inline void
_libc_vdso_platform_setup (void)
{
- PREPARE_VERSION (linux2639, "LINUX_2.6.39", 123718537);
+#ifdef __LP64__
+ PREPARE_VERSION (linux_version, "LINUX_2.6.39", 123718537);
+#else
+ PREPARE_VERSION (linux_version, "LINUX_4.9", 61765625);
+#endif
- void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2639);
+ void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux_version);
PTR_MANGLE (p);
VDSO_SYMBOL(gettimeofday) = p;
- p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2639);
+ p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux_version);
PTR_MANGLE (p);
VDSO_SYMBOL(clock_gettime) = p;
- p = _dl_vdso_vsym ("__kernel_clock_getres", &linux2639);
+ p = _dl_vdso_vsym ("__kernel_clock_getres", &linux_version);
PTR_MANGLE (p);
VDSO_SYMBOL(clock_getres) = p;
}
diff --git a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
index ee91ef82af..ac84194d6c 100644
--- a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
@@ -21,6 +21,8 @@
#define SYSDEP_KNOWN_INTERPRETER_NAMES \
{ "/lib/ld-linux-aarch64.so.1", FLAG_ELF_LIBC6 }, \
{ "/lib/ld-linux-aarch64_be.so.1", FLAG_ELF_LIBC6 }, \
+ { "/lib/ld-linux-aarch64_ilp32.so.1", FLAG_ELF_LIBC6 }, \
+ { "/lib/ld-linux-aarch64_be_ilp32.so.1", FLAG_ELF_LIBC6 }, \
{ "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \
{ "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 },
#define SYSDEP_KNOWN_LIBRARY_NAMES \
diff --git a/sysdeps/unix/sysv/linux/aarch64/setcontext.S b/sysdeps/unix/sysv/linux/aarch64/setcontext.S
index d17f8c8b7a..c2bca2696c 100644
--- a/sysdeps/unix/sysv/linux/aarch64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/setcontext.S
@@ -34,6 +34,7 @@
.text
ENTRY (__setcontext)
+ DELOUSE (0)
/* Save a copy of UCP. */
mov x9, x0
diff --git a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
index a579501186..d1185fa1cb 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
@@ -16,10 +16,11 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <stdint.h>
#include <sys/ucontext.h>
#define SIGCONTEXT siginfo_t *_si, struct ucontext *
-#define GET_PC(ctx) ((void *) (ctx)->uc_mcontext.pc)
+#define GET_PC(ctx) ((void *) (uintptr_t) (ctx)->uc_mcontext.pc)
/* There is no reliable way to get the sigcontext unless we use a
three-argument signal handler. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/swapcontext.S b/sysdeps/unix/sysv/linux/aarch64/swapcontext.S
index c1a16f3899..8e2cadd182 100644
--- a/sysdeps/unix/sysv/linux/aarch64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/swapcontext.S
@@ -27,6 +27,7 @@
.text
ENTRY(__swapcontext)
+ DELOUSE (0)
/* Set the value returned when swapcontext() returns in this context. */
str xzr, [x0, oX0 + 0 * SZREG]
diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index a397e50ef6..1ffabc2cd7 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -250,12 +250,14 @@
(!defined SHARED && (IS_IN (libc) \
|| IS_IN (libpthread))))
# ifdef __ASSEMBLER__
+/* Note, dst, src, guard, and tmp are all register numbers rather than
+ register names so they will work with both ILP32 and LP64. */
# define PTR_MANGLE(dst, src, guard, tmp) \
LDST_PCREL (ldr, guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard_local)); \
PTR_MANGLE2 (dst, src, guard)
/* Use PTR_MANGLE2 for efficiency if guard is already loaded. */
# define PTR_MANGLE2(dst, src, guard)\
- eor dst, src, guard
+ eor x##dst, x##src, x##guard
# define PTR_DEMANGLE(dst, src, guard, tmp)\
PTR_MANGLE (dst, src, guard, tmp)
# define PTR_DEMANGLE2(dst, src, guard)\
@@ -268,12 +270,14 @@ extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
# endif
#else
# ifdef __ASSEMBLER__
+/* Note, dst, src, guard, and tmp are all register numbers rather than
+ register names so they will work with both ILP32 and LP64. */
# define PTR_MANGLE(dst, src, guard, tmp) \
LDST_GLOBAL (ldr, guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard)); \
PTR_MANGLE2 (dst, src, guard)
/* Use PTR_MANGLE2 for efficiency if guard is already loaded. */
# define PTR_MANGLE2(dst, src, guard)\
- eor dst, src, guard
+ eor x##dst, x##src, x##guard
# define PTR_DEMANGLE(dst, src, guard, tmp)\
PTR_MANGLE (dst, src, guard, tmp)
# define PTR_DEMANGLE2(dst, src, guard)\