* [PATCH 13/29] [AARCH64] Use PTR_* macros in dl-trampoline.S
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (10 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 15/29] [AARCH64] Use PTR_REG in getcontext.S Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-11-18 12:33 ` Will Newton
2014-10-27 8:00 ` [PATCH 10/29] [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE. Use it in LDST_PCREL and LDST_GLOBAL Andrew Pinski
` (18 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
Use the PTR_* macros in dl-trampoline.S so it can be used for
both ILP32 and LP64. Also add a comment about what was an magic number
(the size of the rela relocation entries).
* sysdeps/aarch64/dl-trampoline.S (ip0l): New define.
(RELA_SIZE): New define.
(_dl_runtime_resolve): Use PTR_REG, PTR_SIZE.
(_dl_runtime_profile): Likewise. Use RELA_SIZE and ip0l.
---
sysdeps/aarch64/dl-trampoline.S | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S
index 2037f18..22b28ce 100644
--- a/sysdeps/aarch64/dl-trampoline.S
+++ b/sysdeps/aarch64/dl-trampoline.S
@@ -22,9 +22,13 @@
#include "dl-link.h"
#define ip0 x16
+#define ip0l PTR_REG (16)
#define ip1 x17
#define lr x30
+/* RELA relocatons are 3 pointers */
+#define RELA_SIZE (PTR_SIZE * 3)
+
.text
.globl _dl_runtime_resolve
.type _dl_runtime_resolve, #function
@@ -79,7 +83,7 @@ _dl_runtime_resolve:
cfi_rel_offset (q1, 80+7*16)
/* Get pointer to linker struct. */
- ldr x0, [ip0, #-8]
+ ldr PTR_REG (0), [ip0, #-PTR_SIZE]
/* Prepare to call _dl_fixup(). */
ldr x1, [sp, 80+8*16] /* Recover &PLTGOT[n] */
@@ -87,7 +91,7 @@ _dl_runtime_resolve:
sub x1, x1, ip0
add x1, x1, x1, lsl #1
lsl x1, x1, #3
- sub x1, x1, #192
+ sub x1, x1, #(RELA_SIZE<<3)
lsr x1, x1, #3
/* Call fixup routine. */
@@ -191,7 +195,7 @@ _dl_runtime_profile:
stp x0, x1, [x29, #OFFSET_RG + DL_OFFSET_RG_SP]
/* Get pointer to linker struct. */
- ldr x0, [ip0, #-8]
+ ldr PTR_REG (0), [ip0, #-PTR_SIZE]
/* Prepare to call _dl_profile_fixup(). */
ldr x1, [x29, OFFSET_PLTGOTN] /* Recover &PLTGOT[n] */
@@ -199,7 +203,7 @@ _dl_runtime_profile:
sub x1, x1, ip0
add x1, x1, x1, lsl #1
lsl x1, x1, #3
- sub x1, x1, #192
+ sub x1, x1, #(RELA_SIZE<<3)
lsr x1, x1, #3
stp x0, x1, [x29, #OFFSET_SAVED_CALL_X0]
@@ -210,8 +214,8 @@ _dl_runtime_profile:
add x4, x29, #OFFSET_FS /* address of framesize */
bl _dl_profile_fixup
- ldr ip0, [x29, #OFFSET_FS] /* framesize == 0 */
- cmp ip0, #0
+ ldr ip0l, [x29, #OFFSET_FS] /* framesize == 0 */
+ cmp ip0l, #0
bge 1f
cfi_remember_state
@@ -243,7 +247,7 @@ _dl_runtime_profile:
1:
/* The new frame size is in ip0. */
- sub x1, x29, ip0
+ sub PTR_REG (1), PTR_REG (29), ip0l
and sp, x1, #0xfffffffffffffff0
str x0, [x29, #OFFSET_T1]
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 02/29] Allow sigset be an array of a different type
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (3 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 24/29] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-10-27 20:32 ` Roland McGrath
2014-10-27 8:00 ` [PATCH 12/29] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S Andrew Pinski
` (25 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
For AARCH64 ILP32, sigset needs to be an array of unsigned long long as
it needs to be 64bit to match AARCH64 lP64.
* sysdeps/unix/sysv/linux/bits/sigset.h: Include bits/types.h.
(__sigset_inner_t): New typedef.
(_SIGSET_NWORDS): Use __sigset_inner_t instead of unsigned long.
(__sigset_t): Likewise.
(__sigmask): Likewise.
(__sigword): Likewise.
(__SIGSETFN): Likewise.
---
sysdeps/unix/sysv/linux/bits/sigset.h | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/bits/sigset.h b/sysdeps/unix/sysv/linux/bits/sigset.h
index af4ae83..4648e7b 100644
--- a/sysdeps/unix/sysv/linux/bits/sigset.h
+++ b/sysdeps/unix/sysv/linux/bits/sigset.h
@@ -19,14 +19,22 @@
#ifndef _SIGSET_H_types
# define _SIGSET_H_types 1
+#include <bits/types.h>
+
typedef int __sig_atomic_t;
+#ifndef __SIGSET_INNER_T
+typedef unsigned long __sigset_inner_t;
+#else
+typedef __SIGSET_INNER_T __sigset_inner_t;
+#endif
+
/* A `sigset_t' has a bit for each signal. */
-# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
+# define _SIGSET_NWORDS (1024 / (8 * sizeof (__sigset_inner_t)))
typedef struct
{
- unsigned long int __val[_SIGSET_NWORDS];
+ __sigset_inner_t __val[_SIGSET_NWORDS];
} __sigset_t;
#endif
@@ -47,10 +55,10 @@ typedef struct
/* Return a mask that includes the bit for SIG only. */
# define __sigmask(sig) \
- (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int))))
+ (((__sigset_inner_t) 1) << (((sig) - 1) % (8 * sizeof (__sigset_inner_t))))
/* Return the word index for SIG. */
-# define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned long int)))
+# define __sigword(sig) (((sig) - 1) / (8 * sizeof (__sigset_inner_t)))
# if defined __GNUC__ && __GNUC__ >= 2
# define __sigemptyset(set) \
@@ -108,8 +116,8 @@ extern int __sigdelset (__sigset_t *, int);
_EXTERN_INLINE int \
NAME (CONST __sigset_t *__set, int __sig) \
{ \
- unsigned long int __mask = __sigmask (__sig); \
- unsigned long int __word = __sigword (__sig); \
+ __sigset_inner_t __mask = __sigmask (__sig); \
+ __sigset_inner_t __word = __sigword (__sig); \
return BODY; \
}
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 25/29] [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (6 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 09/29] Add dynamic ILP32 AARCH64 relocations to elf.h Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-11-18 14:42 ` Will Newton
2014-10-27 8:00 ` [PATCH 04/29] Allow rusage work on a big-endian 32bit-on-64bit target Andrew Pinski
` (22 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
In ILP32, the sigaction struct is the same as AARCH64 so we need
the header file kernel_sigaction.h. To allow for this to work,
we use a long long fields and then add extra casts when converting
between the user exposed struct and the kernel exposed struct.
* sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h: New file.
* sysdeps/unix/sysv/linux/aarch64/sigaction.c (__libc_sigaction):
Add cast here it is necessary.
---
sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h | 12 ++++++++++++
sysdeps/unix/sysv/linux/aarch64/sigaction.c | 10 ++++++----
2 files changed, 18 insertions(+), 4 deletions(-)
create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h b/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
new file mode 100644
index 0000000..7b3023b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
@@ -0,0 +1,12 @@
+
+#define HAVE_SA_RESTORER
+
+/* This is the sigaction structure in aarch64 kernel.
+ Note the ILP32 struct uses the same struct as LP64
+ which is why the fields are 64bit in size. */
+struct kernel_sigaction {
+ unsigned long long k_sa_handler;
+ unsigned long long sa_flags;
+ unsigned long long sa_restorer;
+ sigset_t sa_mask;
+};
diff --git a/sysdeps/unix/sysv/linux/aarch64/sigaction.c b/sysdeps/unix/sysv/linux/aarch64/sigaction.c
index ae6c3fd..8adcbba 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sigaction.c
+++ b/sysdeps/unix/sysv/linux/aarch64/sigaction.c
@@ -39,15 +39,17 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
if (act)
{
- kact.k_sa_handler = act->sa_handler;
+ kact.k_sa_handler = (unsigned long long)(uintptr_t)act->sa_handler;
memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
kact.sa_flags = act->sa_flags;
#ifdef HAVE_SA_RESTORER
if (kact.sa_flags & SA_RESTORER)
- kact.sa_restorer = act->sa_restorer;
+ kact.sa_restorer = (unsigned long long)(uintptr_t)act->sa_restorer;
#endif
}
+ /* This is needed for ILP32 as the structures are two different sizes due to
+ using the LP64 structure. */
result = INLINE_SYSCALL (rt_sigaction, 4, sig,
act ? &kact : NULL,
oact ? &koact : NULL, _NSIG / 8);
@@ -55,11 +57,11 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
{
if (oact && result >= 0)
{
- oact->sa_handler = koact.k_sa_handler;
+ oact->sa_handler = (void*)(uintptr_t)koact.k_sa_handler;
memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
oact->sa_flags = koact.sa_flags;
#ifdef HAVE_SA_RESTORER
- oact->sa_restorer = koact.sa_restorer;
+ oact->sa_restorer = (void*)(uintptr_t)koact.sa_restorer;
#endif
}
}
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 10/29] [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE. Use it in LDST_PCREL and LDST_GLOBAL.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (11 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 13/29] [AARCH64] Use PTR_* macros in dl-trampoline.S Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-11-18 12:04 ` Will Newton
2014-10-27 8:00 ` [PATCH 05/29] Allow fd_mask type not be an array of long Andrew Pinski
` (17 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
This patch adds a few extra macros which are useful for ILP32 and updates
PTR_MANGLE and PTR_DEMANGLE to use the some of the new macros.
* sysdeps/aarch64/sysdep.h (PTR_REG): New macro.
(PTR_LOG_SIZE): New macro.
(PTR_SIZE): New macro.
(LDST_PCREL): Use arguments as register numbers rather register names.
Use PTR_REG for the register when loading.
* sysdeps/unix/sysv/linux/aarch64/sysdep.h (PTR_MANGLE): Add a comment
about that the arguments are register numbers rather register names.
(PTR_DEMANGLE): Likewise.
* sysdeps/aarch64/__longjmp.S (__longjmp): Update calls to PTR_DEMANGLE.
* sysdeps/aarch64/setjmp.S (__sigsetjmp): Update calls to PTR_MANGLE.
---
sysdeps/aarch64/__longjmp.S | 4 ++--
sysdeps/aarch64/setjmp.S | 4 ++--
sysdeps/aarch64/sysdep.h | 28 ++++++++++++++++++----------
sysdeps/unix/sysv/linux/aarch64/sysdep.h | 8 ++++++--
4 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/sysdeps/aarch64/__longjmp.S b/sysdeps/aarch64/__longjmp.S
index 1bb7be36..e1a1cf2 100644
--- a/sysdeps/aarch64/__longjmp.S
+++ b/sysdeps/aarch64/__longjmp.S
@@ -53,7 +53,7 @@ ENTRY (__longjmp)
ldp x27, x28, [x0, #JB_X27<<3]
#ifdef PTR_DEMANGLE
ldp x29, x4, [x0, #JB_X29<<3]
- PTR_DEMANGLE (x30, x4, x3, x2)
+ PTR_DEMANGLE (30, 4, 3, 2)
#else
ldp x29, x30, [x0, #JB_X29<<3]
#endif
@@ -98,7 +98,7 @@ ENTRY (__longjmp)
cfi_same_value(d15)
#ifdef PTR_DEMANGLE
ldr x4, [x0, #JB_SP<<3]
- PTR_DEMANGLE (x5, x4, x3, x2)
+ PTR_DEMANGLE (5, 4, 3, 2)
#else
ldr x5, [x0, #JB_SP<<3]
#endif
diff --git a/sysdeps/aarch64/setjmp.S b/sysdeps/aarch64/setjmp.S
index d548dd5..41d5321 100644
--- a/sysdeps/aarch64/setjmp.S
+++ b/sysdeps/aarch64/setjmp.S
@@ -42,7 +42,7 @@ ENTRY (__sigsetjmp)
stp x27, x28, [x0, #JB_X27<<3]
#ifdef PTR_MANGLE
- PTR_MANGLE (x4, x30, x3, x2)
+ PTR_MANGLE (4, 30, 3, 2)
stp x29, x4, [x0, #JB_X29<<3]
#else
stp x29, x30, [x0, #JB_X29<<3]
@@ -57,7 +57,7 @@ ENTRY (__sigsetjmp)
stp d14, d15, [x0, #JB_D14<<3]
#ifdef PTR_MANGLE
mov x4, sp
- PTR_MANGLE (x5, x4, x3, x2)
+ PTR_MANGLE (5, 4, 3, 2)
str x5, [x0, #JB_SP<<3]
#else
mov x2, sp
diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
index 55d1759..ab2ee91 100644
--- a/sysdeps/aarch64/sysdep.h
+++ b/sysdeps/aarch64/sysdep.h
@@ -23,10 +23,16 @@
#ifdef __LP64__
#define AARCH64_R(NAME) R_AARCH64_ ## NAME
+#define PTR_REG(n) x##n
+#define PTR_LOG_SIZE 3
#else
#define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME
+#define PTR_REG(n) w##n
+#define PTR_LOG_SIZE 2
#endif
+#define PTR_SIZE (1<<PTR_LOG_SIZE)
+
#ifdef __ASSEMBLER__
/* Syntactic details of assembler. */
@@ -87,16 +93,18 @@
# define L(name) .L##name
#endif
-/* Load or store to/from a pc-relative EXPR into/from R, using T. */
-#define LDST_PCREL(OP, R, T, EXPR) \
- adrp T, EXPR; \
- OP R, [T, #:lo12:EXPR];\
-
-/* Load or store to/from a got-relative EXPR into/from R, using T. */
-#define LDST_GLOBAL(OP, R, T, EXPR) \
- adrp T, :got:EXPR; \
- ldr T, [T, #:got_lo12:EXPR];\
- OP R, [T];
+/* Load or store to/from a pc-relative EXPR into/from R, using T.
+ Note R and T are register numbers and not register names. */
+#define LDST_PCREL(OP, R, T, EXPR) \
+ adrp x##T, EXPR; \
+ OP PTR_REG (R), [x##T, #:lo12:EXPR]; \
+
+/* Load or store to/from a got-relative EXPR into/from R, using T.
+ Note R and T are register numbers and not register names. */
+#define LDST_GLOBAL(OP, R, T, EXPR) \
+ adrp x##T, :got:EXPR; \
+ ldr PTR_REG (T), [x##T, #:got_lo12:EXPR]; \
+ OP x##R, [x##T];
/* Since C identifiers are not normally prefixed with an underscore
on this system, the asm identifier `syscall_error' intrudes on the
diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index 84999f1..fc31661 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -313,12 +313,14 @@
(!defined SHARED && (!defined NOT_IN_libc \
|| defined 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)\
@@ -331,12 +333,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)\
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 11/29] [AARCH64] Use PTR_REG in crti.S.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
2014-10-27 8:00 ` [PATCH 27/29] [AARCH64] Fix up ucontext for ILP32 Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-11-18 12:09 ` Will Newton
2014-10-27 8:00 ` [PATCH 08/29] [AARCH64] Add header guards to sysdep.h headers Andrew Pinski
` (28 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
call_weak_fn loads from a pointer, so use PTR_REG so the load
is 32bits for ILP32.
* sysdeps/aarch64/crti.S: Include sysdep.h
(call_weak_fn): Use PTR_REG when loading from
PREINIT_FUNCTION.
AARCH64: Make RTLD_START paramatizable
Make RTLD_START paramatizable for ILP32 and LP64 usage and provides common
code between ILP32.
* sysdeps/aarch64/dl-machine.h (RTLD_START): Rename to ...
(RTLD_START_1): This and add PTR, PTR_SIZE_LOG, and PTR_SP arguments.
(RTLD_START): New macro which uses RTLD_START_1.
---
sysdeps/aarch64/crti.S | 3 +-
sysdeps/aarch64/dl-machine.h | 130 ++++++++++++++++++++++--------------------
2 files changed, 70 insertions(+), 63 deletions(-)
diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S
index 2db7b67..d31bb50 100644
--- a/sysdeps/aarch64/crti.S
+++ b/sysdeps/aarch64/crti.S
@@ -39,6 +39,7 @@
they can be called as functions. The symbols _init and _fini are
magic and cause the linker to emit DT_INIT and DT_FINI. */
+#include <sysdep.h>
#include <libc-symbols.h>
#ifndef PREINIT_FUNCTION
@@ -60,7 +61,7 @@
.type call_weak_fn, %function
call_weak_fn:
adrp x0, :got:PREINIT_FUNCTION
- ldr x0, [x0, #:got_lo12:PREINIT_FUNCTION]
+ ldr PTR_REG(0), [x0, #:got_lo12:PREINIT_FUNCTION]
cbz x0, 1f
b PREINIT_FUNCTION
1:
diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index 4317669..6e041b1 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -123,68 +123,74 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
/* Initial entry point for the dynamic linker. The C function
_dl_start is the real entry point, its return value is the user
program's entry point */
+#ifdef __LP64__
+#define RTLD_START RTLD_START_1("x", "3", "sp")
+#else
+#define RTLD_START RTLD_START_1("w", "2", "wsp")
+#endif
+
-#define RTLD_START asm ("\
-.text \n\
-.globl _start \n\
-.type _start, %function \n\
-.globl _dl_start_user \n\
-.type _dl_start_user, %function \n\
-_start: \n\
- mov x0, sp \n\
- bl _dl_start \n\
- // returns user entry point in x0 \n\
- mov x21, x0 \n\
-_dl_start_user: \n\
- // get the original arg count \n\
- ldr x1, [sp] \n\
- // get the argv address \n\
- add x2, sp, #8 \n\
- // get _dl_skip_args to see if we were \n\
- // invoked as an executable \n\
- adrp x4, _dl_skip_args \n\
- ldr w4, [x4, #:lo12:_dl_skip_args] \n\
- // do we need to adjust argc/argv \n\
- cmp w4, 0 \n\
- beq .L_done_stack_adjust \n\
- // subtract _dl_skip_args from original arg count \n\
- sub x1, x1, x4 \n\
- // store adjusted argc back to stack \n\
- str x1, [sp] \n\
- // find the first unskipped argument \n\
- mov x3, x2 \n\
- add x4, x2, x4, lsl #3 \n\
- // shuffle argv down \n\
-1: ldr x5, [x4], #8 \n\
- str x5, [x3], #8 \n\
- cmp x5, #0 \n\
- bne 1b \n\
- // shuffle envp down \n\
-1: ldr x5, [x4], #8 \n\
- str x5, [x3], #8 \n\
- cmp x5, #0 \n\
- bne 1b \n\
- // shuffle auxv down \n\
-1: ldp x0, x5, [x4, #16]! \n\
- stp x0, x5, [x3], #16 \n\
- cmp x0, #0 \n\
- bne 1b \n\
- // Update _dl_argv \n\
- adrp x3, _dl_argv \n\
- str x2, [x3, #:lo12:_dl_argv] \n\
-.L_done_stack_adjust: \n\
- // compute envp \n\
- add x3, x2, x1, lsl #3 \n\
- add x3, x3, #8 \n\
- adrp x16, _rtld_local \n\
- add x16, x16, #:lo12:_rtld_local \n\
- ldr x0, [x16] \n\
- bl _dl_init_internal \n\
- // load the finalizer function \n\
- adrp x0, _dl_fini \n\
- add x0, x0, #:lo12:_dl_fini \n\
- // jump to the user_s entry point \n\
- br x21 \n\
+#define RTLD_START_1(PTR, PTR_SIZE_LOG, PTR_SP) asm ("\
+.text \n\
+.globl _start \n\
+.type _start, %function \n\
+.globl _dl_start_user \n\
+.type _dl_start_user, %function \n\
+_start: \n\
+ mov " PTR "0, " PTR_SP " \n\
+ bl _dl_start \n\
+ // returns user entry point in x0 \n\
+ mov x21, x0 \n\
+_dl_start_user: \n\
+ // get the original arg count \n\
+ ldr " PTR "1, [sp] \n\
+ // get the argv address \n\
+ add " PTR "2, " PTR_SP ", #(1<<" PTR_SIZE_LOG ") \n\
+ // get _dl_skip_args to see if we were \n\
+ // invoked as an executable \n\
+ adrp x4, _dl_skip_args \n\
+ ldr w4, [x4, #:lo12:_dl_skip_args] \n\
+ // do we need to adjust argc/argv \n\
+ cmp w4, 0 \n\
+ beq .L_done_stack_adjust \n\
+ // subtract _dl_skip_args from original arg count \n\
+ sub " PTR "1, " PTR "1, " PTR "4 \n\
+ // store adjusted argc back to stack \n\
+ str " PTR "1, [sp] \n\
+ // find the first unskipped argument \n\
+ mov " PTR "3, " PTR "2 \n\
+ add " PTR "4, " PTR "2, " PTR "4, lsl #" PTR_SIZE_LOG " \n\
+ // shuffle argv down \n\
+1: ldr " PTR "5, [x4], #(1<<" PTR_SIZE_LOG ") \n\
+ str " PTR "5, [x3], #(1<<" PTR_SIZE_LOG ") \n\
+ cmp " PTR "5, #0 \n\
+ bne 1b \n\
+ // shuffle envp down \n\
+1: ldr " PTR "5, [x4], #(1<<" PTR_SIZE_LOG ") \n\
+ str " PTR "5, [x3], #(1<<" PTR_SIZE_LOG ") \n\
+ cmp " PTR "5, #0 \n\
+ bne 1b \n\
+ // shuffle auxv down \n\
+1: ldp " PTR "0, " PTR "5, [x4, #(2<<" PTR_SIZE_LOG ")]! \n\
+ stp " PTR "0, " PTR "5, [x3], #(2<<" PTR_SIZE_LOG ") \n\
+ cmp " PTR "0, #0 \n\
+ bne 1b \n\
+ // Update _dl_argv \n\
+ adrp x3, _dl_argv \n\
+ str " PTR "2, [x3, #:lo12:_dl_argv] \n\
+.L_done_stack_adjust: \n\
+ // compute envp \n\
+ add " PTR "3, " PTR "2, " PTR "1, lsl #" PTR_SIZE_LOG " \n\
+ add " PTR "3, " PTR "3, #(1<<" PTR_SIZE_LOG ") \n\
+ adrp x16, _rtld_local \n\
+ add " PTR "16, " PTR "16, #:lo12:_rtld_local \n\
+ ldr " PTR "0, [x16] \n\
+ bl _dl_init_internal \n\
+ // load the finalizer function \n\
+ adrp x0, _dl_fini \n\
+ add " PTR "0, " PTR "0, #:lo12:_dl_fini \n\
+ // jump to the user_s entry point \n\
+ br x21 \n\
");
#define elf_machine_type_class(type) \
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 04/29] Allow rusage work on a big-endian 32bit-on-64bit target
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (7 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 25/29] [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32 Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-10-28 20:05 ` Mike Frysinger
2014-10-27 8:00 ` [PATCH 19/29] [AARCH64] Add ILP32 support to elf_machine_load_address Andrew Pinski
` (21 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
Right now rusage works for x32 like ABIs but only for little-endian.
Since AARCH64:ILP32 is a big-endian ABI also. We need to invent a
new way to handle big-endian ABIs also. This adds __RUSAGE_LONG
which is used for this purpose.
* sysdeps/unix/sysv/linux/bits/resource.h (__RUSAGE_LONG): New define.
(struct rusage): Use __RUSAGE_LONG instead of unions.
---
sysdeps/unix/sysv/linux/bits/resource.h | 99 ++++++++----------------------
1 files changed, 27 insertions(+), 72 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index 95c1702..698069d 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -182,8 +182,19 @@ enum __rusage_who
/* The purpose of all the unions is to have the kernel-compatible layout
while keeping the API type as 'long int', and among machines where
- __syscall_slong_t is not 'long int', this only does the right thing
- for little-endian ones, like x32. */
+ __syscall_slong_t is not 'long int'. */
+
+#ifndef __RUSAGE_LONG
+/* This definition works where __syscall_slong_t is the same as 'long int'
+ and on little-endian when __syscall_slong_t is not 'long int' like x32. */
+# define __RUSAGE_LONG(__field) \
+ __extension__ union \
+ { \
+ long int __field; \
+ __syscall_slong_t __##__field##_word; \
+ }
+#endif
+
struct rusage
{
/* Total amount of user time used. */
@@ -191,96 +202,40 @@ struct rusage
/* Total amount of system time used. */
struct timeval ru_stime;
/* Maximum resident set size (in kilobytes). */
- __extension__ union
- {
- long int ru_maxrss;
- __syscall_slong_t __ru_maxrss_word;
- };
+ __RUSAGE_LONG(ru_maxrss);
/* Amount of sharing of text segment memory
with other processes (kilobyte-seconds). */
/* Maximum resident set size (in kilobytes). */
- __extension__ union
- {
- long int ru_ixrss;
- __syscall_slong_t __ru_ixrss_word;
- };
+ __RUSAGE_LONG(ru_ixrss);
/* Amount of data segment memory used (kilobyte-seconds). */
- __extension__ union
- {
- long int ru_idrss;
- __syscall_slong_t __ru_idrss_word;
- };
+ __RUSAGE_LONG(ru_idrss);
/* Amount of stack memory used (kilobyte-seconds). */
- __extension__ union
- {
- long int ru_isrss;
- __syscall_slong_t __ru_isrss_word;
- };
+ __RUSAGE_LONG(ru_isrss);
/* Number of soft page faults (i.e. those serviced by reclaiming
a page from the list of pages awaiting reallocation. */
- __extension__ union
- {
- long int ru_minflt;
- __syscall_slong_t __ru_minflt_word;
- };
+ __RUSAGE_LONG(ru_minflt);
/* Number of hard page faults (i.e. those that required I/O). */
- __extension__ union
- {
- long int ru_majflt;
- __syscall_slong_t __ru_majflt_word;
- };
+ __RUSAGE_LONG(ru_majflt);
/* Number of times a process was swapped out of physical memory. */
- __extension__ union
- {
- long int ru_nswap;
- __syscall_slong_t __ru_nswap_word;
- };
+ __RUSAGE_LONG(ru_nswap);
/* Number of input operations via the file system. Note: This
and `ru_oublock' do not include operations with the cache. */
- __extension__ union
- {
- long int ru_inblock;
- __syscall_slong_t __ru_inblock_word;
- };
+ __RUSAGE_LONG(ru_inblock);
/* Number of output operations via the file system. */
- __extension__ union
- {
- long int ru_oublock;
- __syscall_slong_t __ru_oublock_word;
- };
+ __RUSAGE_LONG(ru_oublock);
/* Number of IPC messages sent. */
- __extension__ union
- {
- long int ru_msgsnd;
- __syscall_slong_t __ru_msgsnd_word;
- };
+ __RUSAGE_LONG(ru_msgsnd);
/* Number of IPC messages received. */
- __extension__ union
- {
- long int ru_msgrcv;
- __syscall_slong_t __ru_msgrcv_word;
- };
+ __RUSAGE_LONG(ru_msgrcv);
/* Number of signals delivered. */
- __extension__ union
- {
- long int ru_nsignals;
- __syscall_slong_t __ru_nsignals_word;
- };
+ __RUSAGE_LONG(ru_nsignals);
/* Number of voluntary context switches, i.e. because the process
gave up the process before it had to (usually to wait for some
resource to be available). */
- __extension__ union
- {
- long int ru_nvcsw;
- __syscall_slong_t __ru_nvcsw_word;
- };
+ __RUSAGE_LONG(ru_nvcsw);
/* Number of involuntary context switches, i.e. a higher priority process
became runnable or the current process used up its time slice. */
- __extension__ union
- {
- long int ru_nivcsw;
- __syscall_slong_t __ru_nivcsw_word;
- };
+ __RUSAGE_LONG(ru_nivcsw);
};
/* Priority limits. */
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 15/29] [AARCH64] Use PTR_REG in getcontext.S.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (9 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 19/29] [AARCH64] Add ILP32 support to elf_machine_load_address Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-11-18 12:37 ` Will Newton
2014-10-27 8:00 ` [PATCH 13/29] [AARCH64] Use PTR_* macros in dl-trampoline.S Andrew Pinski
` (19 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
Just like the other patches, this patch allows for getcontext.S to be used
between ILP32 and LP64.
* sysdeps/unix/sysv/linux/aarch64/getcontext.S: Use PTR_REG when
doing an add so wrapping of the pointer is correct for ILP32.
---
sysdeps/unix/sysv/linux/aarch64/getcontext.S | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/aarch64/getcontext.S b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
index 70b2e32..4507040 100644
--- a/sysdeps/unix/sysv/linux/aarch64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
@@ -90,7 +90,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
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 27/29] [AARCH64] Fix up ucontext for ILP32
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-10-28 20:10 ` Mike Frysinger
2014-11-18 14:54 ` Will Newton
2014-10-27 8:00 ` [PATCH 11/29] [AARCH64] Use PTR_REG in crti.S Andrew Pinski
` (29 subsequent siblings)
30 siblings, 2 replies; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
In ILP32 we want to use the same layout of the structure ucontext as LP64 so
we need to add a padding for uc_link and change the type of uc_flags to
be the kernel unsigned long type.
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (struct ucontext):
Change the type of uc_flags to __SYSCALL_ULONG_TYPE.
Add padding for uc_link if ILP32.
---
sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
index 476f5de..5d224fb 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
@@ -46,8 +46,14 @@ typedef struct sigcontext mcontext_t;
/* Userlevel context. */
typedef struct ucontext
{
- unsigned long uc_flags;
- struct ucontext *uc_link;
+ __SYSCALL_ULONG_TYPE uc_flags;
+#if defined(__ILP32__) && defined(__AARCH64EB__)
+ int __pad_uc_link;
+#endif
+ struct ucontext *uc_link;
+#if defined(__ILP32__) && !defined(__AARCH64EB__)
+ int __pad_uc_link;
+#endif
stack_t uc_stack;
__sigset_t uc_sigmask;
mcontext_t uc_mcontext;
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 09/29] Add dynamic ILP32 AARCH64 relocations to elf.h
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (5 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 12/29] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-10-27 20:36 ` Roland McGrath
2014-10-27 8:00 ` [PATCH 25/29] [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32 Andrew Pinski
` (23 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
elf/elf.h (R_AARCH64_P32_ABS32, R_AARCH64_P32_COPY,
R_AARCH64_P32_GLOB_DAT, R_AARCH64_P32_JUMP_SLOT,
R_AARCH64_P32_RELATIVE, R_AARCH64_P32_TLS_DTPMOD,
R_AARCH64_P32_TLS_DTPREL, R_AARCH64_P32_TLS_TPREL,
R_AARCH64_P32_TLSDESC, R_AARCH64_P32_IRELATIVE): Define.
[AARCH64] Use ELFW and ElfW macros instead of ELF64 and Elf64 names.
* sysdeps/aarch64/dl-machine.h
(elf_machine_runtime_setup): Use ElfW(Addr).
(elf_machine_rela): Use ELFW(R_TYPE).
(elf_machine_lazy_rel): Likewise.
[AARCH64] Introduce AARCH64_R so we can reuse the reloc code between ILP32 and LP64.
* sysdeps/aarch64/sysdep.h (AARCH64_R): Define.
* sysdeps/aarch64/dl-irel.h: Include sysdep.h
(elf_irela): Use reloc names based on AARCH64_R.
* sysdeps/aarch64/dl-machine.h: Include sysdep.h
(elf_machine_type_class): Use reloc names based on AARCH64_R.
(elf_machine_rela): Likewise.
(elf_machine_lazy_rel): Likewise.
---
elf/elf.h | 14 ++++++++++
sysdeps/aarch64/dl-irel.h | 3 +-
sysdeps/aarch64/dl-machine.h | 57 ++++++++++++++++++++++--------------------
sysdeps/aarch64/sysdep.h | 6 ++++
4 files changed, 52 insertions(+), 28 deletions(-)
diff --git a/elf/elf.h b/elf/elf.h
index 0dbf52b..030f398 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -2362,6 +2362,20 @@ typedef Elf32_Addr Elf32_Conflict;
/* AArch64 relocs. */
#define R_AARCH64_NONE 0 /* No relocation. */
+
+/* ILP32 AARCH64 relocs. */
+#define R_AARCH64_P32_ABS32 1 /* Direct 32 bit. */
+#define R_AARCH64_P32_COPY 180 /* Copy symbol at runtime. */
+#define R_AARCH64_P32_GLOB_DAT 181 /* Create GOT entry. */
+#define R_AARCH64_P32_JUMP_SLOT 182 /* Create PLT entry. */
+#define R_AARCH64_P32_RELATIVE 183 /* Adjust by program base. */
+#define R_AARCH64_P32_TLS_DTPMOD 184 /* Module number, 32 bit. */
+#define R_AARCH64_P32_TLS_DTPREL 185 /* Module-relative offset, 32 bit. */
+#define R_AARCH64_P32_TLS_TPREL 186 /* TP-relative offset, 32 bit. */
+#define R_AARCH64_P32_TLSDESC 187 /* TLS Descriptor. */
+#define R_AARCH64_P32_IRELATIVE 188 /* STT_GNU_IFUNC relocation. */
+
+/* LP64 AARCH64 relocs. */
#define R_AARCH64_ABS64 257 /* Direct 64 bit. */
#define R_AARCH64_ABS32 258 /* Direct 32 bit. */
#define R_AARCH64_ABS16 259 /* Direct 16-bit. */
diff --git a/sysdeps/aarch64/dl-irel.h b/sysdeps/aarch64/dl-irel.h
index 78395ca..79964c2 100644
--- a/sysdeps/aarch64/dl-irel.h
+++ b/sysdeps/aarch64/dl-irel.h
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <unistd.h>
#include <ldsodefs.h>
+#include <sysdep.h>
#define ELF_MACHINE_IRELA 1
@@ -40,7 +41,7 @@ elf_irela (const ElfW(Rela) *reloc)
ElfW(Addr) *const reloc_addr = (void *) reloc->r_offset;
const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
- if (__glibc_likely (r_type == R_AARCH64_IRELATIVE))
+ if (__glibc_likely (r_type == AARCH64_R(IRELATIVE)))
{
ElfW(Addr) value = elf_ifunc_invoke (reloc->r_addend);
*reloc_addr = value;
diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index ebac353..4317669 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -21,6 +21,7 @@
#define ELF_MACHINE_NAME "aarch64"
+#include <sysdep.h>
#include <tls.h>
#include <dl-tlsdesc.h>
#include <dl-irel.h>
@@ -113,8 +114,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
}
if (l->l_info[ADDRIDX (DT_TLSDESC_GOT)] && lazy)
- *(Elf64_Addr*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_GOT)]) + l->l_addr)
- = (Elf64_Addr) &_dl_tlsdesc_resolve_rela;
+ *(ElfW(Addr)*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_GOT)]) + l->l_addr)
+ = (ElfW(Addr)) &_dl_tlsdesc_resolve_rela;
return lazy;
}
@@ -186,15 +187,15 @@ _dl_start_user: \n\
br x21 \n\
");
-#define elf_machine_type_class(type) \
- ((((type) == R_AARCH64_JUMP_SLOT || \
- (type) == R_AARCH64_TLS_DTPMOD || \
- (type) == R_AARCH64_TLS_DTPREL || \
- (type) == R_AARCH64_TLS_TPREL || \
- (type) == R_AARCH64_TLSDESC) * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_AARCH64_COPY) * ELF_RTYPE_CLASS_COPY))
+#define elf_machine_type_class(type) \
+ ((((type) == AARCH64_R(JUMP_SLOT) || \
+ (type) == AARCH64_R(TLS_DTPMOD) || \
+ (type) == AARCH64_R(TLS_DTPREL) || \
+ (type) == AARCH64_R(TLS_TPREL) || \
+ (type) == AARCH64_R(TLSDESC)) * ELF_RTYPE_CLASS_PLT) \
+ | (((type) == AARCH64_R(COPY)) * ELF_RTYPE_CLASS_COPY))
-#define ELF_MACHINE_JMP_SLOT R_AARCH64_JUMP_SLOT
+#define ELF_MACHINE_JMP_SLOT AARCH64_R(JUMP_SLOT)
/* AArch64 uses RELA not REL */
#define ELF_MACHINE_NO_REL 1
@@ -233,9 +234,9 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
void *const reloc_addr_arg, int skip_ifunc)
{
ElfW(Addr) *const reloc_addr = reloc_addr_arg;
- const unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
+ const unsigned int r_type = ELFW(R_TYPE) (reloc->r_info);
- if (__builtin_expect (r_type == R_AARCH64_RELATIVE, 0))
+ if (__builtin_expect (r_type == AARCH64_R(RELATIVE), 0))
*reloc_addr = map->l_addr + reloc->r_addend;
else if (__builtin_expect (r_type == R_AARCH64_NONE, 0))
return;
@@ -253,7 +254,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
switch (r_type)
{
- case R_AARCH64_COPY:
+ case AARCH64_R(COPY):
if (sym == NULL)
break;
@@ -271,15 +272,17 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
MIN (sym->st_size, refsym->st_size));
break;
- case R_AARCH64_RELATIVE:
- case R_AARCH64_GLOB_DAT:
- case R_AARCH64_JUMP_SLOT:
- case R_AARCH64_ABS32:
- case R_AARCH64_ABS64:
+ case AARCH64_R(RELATIVE):
+ case AARCH64_R(GLOB_DAT):
+ case AARCH64_R(JUMP_SLOT):
+ case AARCH64_R(ABS32):
+#ifdef __LP64__
+ case AARCH64_R(ABS64):
+#endif
*reloc_addr = value + reloc->r_addend;
break;
- case R_AARCH64_TLSDESC:
+ case AARCH64_R(TLSDESC):
{
struct tlsdesc volatile *td =
(struct tlsdesc volatile *)reloc_addr;
@@ -314,7 +317,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
break;
}
- case R_AARCH64_TLS_DTPMOD:
+ case AARCH64_R(TLS_DTPMOD):
#ifdef RTLD_BOOTSTRAP
*reloc_addr = 1;
#else
@@ -325,12 +328,12 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
#endif
break;
- case R_AARCH64_TLS_DTPREL:
+ case AARCH64_R(TLS_DTPREL):
if (sym)
*reloc_addr = sym->st_value + reloc->r_addend;
break;
- case R_AARCH64_TLS_TPREL:
+ case AARCH64_R(TLS_TPREL):
if (sym)
{
CHECK_STATIC_TLS (map, sym_map);
@@ -339,7 +342,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
}
break;
- case R_AARCH64_IRELATIVE:
+ case AARCH64_R(IRELATIVE):
value = map->l_addr + reloc->r_addend;
value = elf_ifunc_invoke (value);
*reloc_addr = value;
@@ -370,16 +373,16 @@ elf_machine_lazy_rel (struct link_map *map,
int skip_ifunc)
{
ElfW(Addr) *const reloc_addr = (void *) (l_addr + reloc->r_offset);
- const unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
+ const unsigned int r_type = ELFW(R_TYPE) (reloc->r_info);
/* Check for unexpected PLT reloc type. */
- if (__builtin_expect (r_type == R_AARCH64_JUMP_SLOT, 1))
+ if (__builtin_expect (r_type == AARCH64_R(JUMP_SLOT), 1))
{
if (__builtin_expect (map->l_mach.plt, 0) == 0)
*reloc_addr += l_addr;
else
*reloc_addr = map->l_mach.plt;
}
- else if (__builtin_expect (r_type == R_AARCH64_TLSDESC, 1))
+ else if (__builtin_expect (r_type == AARCH64_R(TLSDESC), 1))
{
struct tlsdesc volatile *td =
(struct tlsdesc volatile *)reloc_addr;
@@ -388,7 +391,7 @@ elf_machine_lazy_rel (struct link_map *map,
td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)])
+ map->l_addr);
}
- else if (__glibc_unlikely (r_type == R_AARCH64_IRELATIVE))
+ else if (__glibc_unlikely (r_type == AARCH64_R(IRELATIVE)))
{
ElfW(Addr) value = map->l_addr + reloc->r_addend;
if (__glibc_likely (!skip_ifunc))
diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
index af196f2..55d1759 100644
--- a/sysdeps/aarch64/sysdep.h
+++ b/sysdeps/aarch64/sysdep.h
@@ -21,6 +21,12 @@
#include <sysdeps/generic/sysdep.h>
+#ifdef __LP64__
+#define AARCH64_R(NAME) R_AARCH64_ ## NAME
+#else
+#define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME
+#endif
+
#ifdef __ASSEMBLER__
/* Syntactic details of assembler. */
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 08/29] [AARCH64] Add header guards to sysdep.h headers.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
2014-10-27 8:00 ` [PATCH 27/29] [AARCH64] Fix up ucontext for ILP32 Andrew Pinski
2014-10-27 8:00 ` [PATCH 11/29] [AARCH64] Use PTR_REG in crti.S Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-10-27 16:32 ` Chris Metcalf
2014-10-27 8:00 ` [PATCH 24/29] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found Andrew Pinski
` (27 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
* sysdeps/aarch64/sysdep.h: Add header guards.
[AARCH64] Remove 64 from some relocation names as they have been renamed in later versions of the spec.
The AARCH64 elf ABI spec renamed some relocations removing 64 from the TLS
relocation names to make them constaint with the ILP32 named ones.
* elf/elf.h (R_AARCH64_TLS_DTPMOD64): Rename to ..
(R_AARCH64_TLS_DTPMOD): This.
(R_AARCH64_TLS_DTPREL64): Rename to ...
(R_AARCH64_TLS_DTPREL): This.
(R_AARCH64_TLS_TPREL64): Rename to ...
(R_AARCH64_TLS_TPREL): This.
* sysdeps/aarch64/dl-machine.h (elf_machine_type_class): Update
R_AARCH64_TLS_DTPMOD64, R_AARCH64_TLS_DTPREL64, and R_AARCH64_TLS_TPREL64.
(elf_machine_rela): Likewise.
[AARCH64] Fix pltenter and pltexit for ILP32.
* sysdeps/aarch64/bits/link.h (la_aarch64_gnu_pltenter): Use
ElfW macro instead of hardcoded Elf64 types.
---
elf/elf.h | 6 +++---
sysdeps/aarch64/bits/link.h | 6 +++---
sysdeps/aarch64/dl-machine.h | 12 ++++++------
sysdeps/aarch64/sysdep.h | 5 +++++
4 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/elf/elf.h b/elf/elf.h
index 78815e8..0dbf52b 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -2479,9 +2479,9 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */
#define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */
#define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
-#define R_AARCH64_TLS_DTPMOD64 1028 /* Module number, 64 bit. */
-#define R_AARCH64_TLS_DTPREL64 1029 /* Module-relative offset, 64 bit. */
-#define R_AARCH64_TLS_TPREL64 1030 /* TP-relative offset, 64 bit. */
+#define R_AARCH64_TLS_DTPMOD 1028 /* Module number, 64 bit. */
+#define R_AARCH64_TLS_DTPREL 1029 /* Module-relative offset, 64 bit. */
+#define R_AARCH64_TLS_TPREL 1030 /* TP-relative offset, 64 bit. */
#define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */
#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
diff --git a/sysdeps/aarch64/bits/link.h b/sysdeps/aarch64/bits/link.h
index fe06827..3a84a18 100644
--- a/sysdeps/aarch64/bits/link.h
+++ b/sysdeps/aarch64/bits/link.h
@@ -40,8 +40,8 @@ typedef struct La_aarch64_retval
} La_aarch64_retval;
__BEGIN_DECLS
-extern Elf64_Addr
-la_aarch64_gnu_pltenter (Elf64_Sym *__sym, unsigned int __ndx,
+extern ElfW(Addr)
+la_aarch64_gnu_pltenter (ElfW(Sym) *__sym, unsigned int __ndx,
uintptr_t *__refcook,
uintptr_t *__defcook,
La_aarch64_regs *__regs,
@@ -50,7 +50,7 @@ la_aarch64_gnu_pltenter (Elf64_Sym *__sym, unsigned int __ndx,
long int *__framesizep);
extern unsigned int
-la_aarch64_gnu_pltexit (Elf64_Sym *__sym, unsigned int __ndx,
+la_aarch64_gnu_pltexit (ElfW(Sym) *__sym, unsigned int __ndx,
uintptr_t *__refcook,
uintptr_t *__defcook,
const La_aarch64_regs *__inregs,
diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index 6615b8f..ebac353 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -188,9 +188,9 @@ _dl_start_user: \n\
#define elf_machine_type_class(type) \
((((type) == R_AARCH64_JUMP_SLOT || \
- (type) == R_AARCH64_TLS_DTPMOD64 || \
- (type) == R_AARCH64_TLS_DTPREL64 || \
- (type) == R_AARCH64_TLS_TPREL64 || \
+ (type) == R_AARCH64_TLS_DTPMOD || \
+ (type) == R_AARCH64_TLS_DTPREL || \
+ (type) == R_AARCH64_TLS_TPREL || \
(type) == R_AARCH64_TLSDESC) * ELF_RTYPE_CLASS_PLT) \
| (((type) == R_AARCH64_COPY) * ELF_RTYPE_CLASS_COPY))
@@ -314,7 +314,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
break;
}
- case R_AARCH64_TLS_DTPMOD64:
+ case R_AARCH64_TLS_DTPMOD:
#ifdef RTLD_BOOTSTRAP
*reloc_addr = 1;
#else
@@ -325,12 +325,12 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
#endif
break;
- case R_AARCH64_TLS_DTPREL64:
+ case R_AARCH64_TLS_DTPREL:
if (sym)
*reloc_addr = sym->st_value + reloc->r_addend;
break;
- case R_AARCH64_TLS_TPREL64:
+ case R_AARCH64_TLS_TPREL:
if (sym)
{
CHECK_STATIC_TLS (map, sym_map);
diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
index 7169ba7..af196f2 100644
--- a/sysdeps/aarch64/sysdep.h
+++ b/sysdeps/aarch64/sysdep.h
@@ -16,6 +16,9 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#ifndef _AARCH64_SYSDEP_H
+#define _AARCH64_SYSDEP_H
+
#include <sysdeps/generic/sysdep.h>
#ifdef __ASSEMBLER__
@@ -96,3 +99,5 @@
#define mcount _mcount
#endif /* __ASSEMBLER__ */
+
+#endif /* _AARCH64_SYSDEP_H */
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 19/29] [AARCH64] Add ILP32 support to elf_machine_load_address.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (8 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 04/29] Allow rusage work on a big-endian 32bit-on-64bit target Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-11-18 13:56 ` Will Newton
2014-10-27 8:00 ` [PATCH 15/29] [AARCH64] Use PTR_REG in getcontext.S Andrew Pinski
` (20 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
This adds ILP32 support to elf_machine_load_address.
Since elf_machine_load_address depends on the static address being
found without relocations, we need to use 16bit relocation which gets
resolved at link time for ILP32. This is just like how the 32bit
relocation gets resolved at link time for LP64.
* sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Add support
for ILP32.
---
sysdeps/aarch64/dl-machine.h | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index 121b178..f3bcad1 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -54,19 +54,33 @@ elf_machine_load_address (void)
by constructing a non GOT reference to the symbol, the dynamic
address of the symbol we compute using adrp/add to compute the
symbol's address relative to the PC.
- This depends on 32bit relocations being resolved at link time
- and that the static address fits in the 32bits. */
+ This depends on 32/16bit relocations being resolved at link time
+ and that the static address fits in the 32/16 bits. */
ElfW(Addr) static_addr;
ElfW(Addr) dynamic_addr;
asm (" \n"
" adrp %1, _dl_start; \n"
+#ifdef __LP64__
" add %1, %1, #:lo12:_dl_start \n"
-" ldr %w0, 1f \n"
+#else
+" add %w1, %w1, #:lo12:_dl_start \n"
+#endif
+" ldr %w0, 1f \n"
" b 2f \n"
"1: \n"
+#ifdef __LP64__
" .word _dl_start \n"
+#else
+# ifdef __AARCH64EB__
+" .short 0 \n"
+# endif
+" .short _dl_start \n"
+# ifndef __AARCH64EB__
+" .short 0 \n"
+# endif
+#endif
"2: \n"
: "=r" (static_addr), "=r" (dynamic_addr));
return dynamic_addr - static_addr;
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 00/29] Add Support for AARCH64:ILP32
@ 2014-10-27 8:00 Andrew Pinski
2014-10-27 8:00 ` [PATCH 27/29] [AARCH64] Fix up ucontext for ILP32 Andrew Pinski
` (30 more replies)
0 siblings, 31 replies; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
This patch series adds AARCH64:ILP32 support to glibc.
The first patch fixes a bug and it should go in even without the rest
of the patches being approved.
The next 6 patches are common/generic changes to allow AARCH64 to
use the generic headers rather than a copy of its own.
The next patch just adds header guards which is needed to make
sure sysdep.h is not included twice.
The next one adds the relocations to elf.h; these relocations are defined
in the beta version of the ABI.
Then the rest of the patches fully add support for ILP32, split up for easier
review.
I have ran LTO on with the kernel changes that were submitted (but not committed)
and there was no unexpected failures (there are a few testcase issues dealing with
sigaction strcuture not being the same between the kernel and the userland).
Andrew Pinski (29):
[AARCH64] Fix utmp struct for compatibility reasons.
Allow sigset be an array of a different type
Add ability for the IPC structures (msqid_ds, semid_ds, shmid_ds,
etc.) to have time_t being 64bit
Allow rusage work on a big-endian 32bit-on-64bit target
Allow fd_mask type not be an array of long.
Allow some fields of siginfo to be different from the generic one
Allow generic stat and statfs not have padding for 32bit targets
[AARCH64] Add header guards to sysdep.h headers.
Add dynamic ILP32 AARCH64 relocations to elf.h
[AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE. Use it in
LDST_PCREL and LDST_GLOBAL.
[AARCH64] Use PTR_REG in crti.S.
[AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
[AARCH64] Use PTR_* macros in dl-trampoline.S
[AARCH64] Use PTR_* in start.S
[AARCH64] Use PTR_REG in getcontext.S.
[AARCH64] Detect ILP32 in configure scripts.
[AARCH64] Syscalls for ILP32 are passed always via 64bit values.
[AARCH64] Reformat inline-asm in elf_machine_load_address.
[AARCH64] Add ILP32 support to elf_machine_load_address.
[AARCH64] Set up wordsize for ILP32.
[AARCH64] Add ILP32 to makefiles
[AARCH64] Add support to ldconfig for ILP32 and libilp32
[AARCH64] Add ILP32 ld.so to the known interpreter names.
[AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found
[AARCH64] Add kernel_sigaction.h for AARCH64 ILP32
[AARCH64] Add sigstack.h header for ILP32 reasons.
[AARCH64] Fix up ucontext for ILP32
[AARCH64] Add typesizes.h for ILP32
[AARCH64] Make lp64 and ilp32 directories.
elf/cache.c | 2 +
elf/elf.h | 20 ++-
misc/sys/select.h | 10 +-
sysdeps/aarch64/Implies | 6 -
sysdeps/aarch64/__longjmp.S | 4 +-
sysdeps/aarch64/bits/link.h | 6 +-
sysdeps/aarch64/bits/wordsize.h | 30 +++
sysdeps/aarch64/configure | 15 +-
sysdeps/aarch64/configure.ac | 11 +-
sysdeps/aarch64/crti.S | 3 +-
sysdeps/aarch64/dl-irel.h | 3 +-
sysdeps/aarch64/dl-machine.h | 220 +++++++++++---------
sysdeps/aarch64/dl-tlsdesc.S | 36 ++--
sysdeps/aarch64/dl-trampoline.S | 18 +-
sysdeps/aarch64/ilp32/Implies | 6 +
sysdeps/aarch64/lp64/Implies | 7 +
sysdeps/aarch64/preconfigure | 11 +-
sysdeps/aarch64/setjmp.S | 4 +-
sysdeps/aarch64/start.S | 20 +-
sysdeps/aarch64/sysdep.h | 37 +++-
sysdeps/generic/ldconfig.h | 1 +
sysdeps/unix/sysv/linux/aarch64/Makefile | 16 +-
sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h | 71 +++++++
sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h | 135 ++++++++++++
sysdeps/unix/sysv/linux/aarch64/configure | 24 ++-
sysdeps/unix/sysv/linux/aarch64/configure.ac | 11 +-
sysdeps/unix/sysv/linux/aarch64/dl-cache.h | 13 +-
sysdeps/unix/sysv/linux/aarch64/getcontext.S | 2 +-
sysdeps/unix/sysv/linux/aarch64/ilp32/Implies | 3 +
sysdeps/unix/sysv/linux/aarch64/ilp32/Versions | 5 +
sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c | 2 +
.../unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c | 6 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c | 1 +
.../unix/sysv/linux/aarch64/ilp32/fallocate64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c | 1 +
.../unix/sysv/linux/aarch64/ilp32/ftruncate64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c | 2 +
.../unix/sysv/linux/aarch64/ilp32/getrlimit64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c | 1 +
.../unix/sysv/linux/aarch64/ilp32/kernel_stat.h | 24 ++
sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c | 1 +
.../sysv/linux/aarch64/ilp32/posix_fadvise64.c | 1 +
.../sysv/linux/aarch64/ilp32/posix_fallocate.c | 1 +
.../sysv/linux/aarch64/ilp32/posix_fallocate64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c | 66 ++++++
sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c | 1 +
.../unix/sysv/linux/aarch64/ilp32/setrlimit64.c | 1 +
.../unix/sysv/linux/aarch64/ilp32/shlib-versions | 7 +
sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c | 5 +
sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c | 1 +
.../unix/sysv/linux/aarch64/ilp32/syscalls.list | 21 ++
sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ioctl.S | 31 ---
sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h | 12 +
sysdeps/unix/sysv/linux/aarch64/ldconfig.h | 2 +
sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed | 1 +
sysdeps/unix/sysv/linux/aarch64/lp64/Implies | 4 +
sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S | 31 +++
.../unix/sysv/linux/aarch64/lp64/shlib-versions | 7 +
sysdeps/unix/sysv/linux/aarch64/mmap.c | 34 ---
sysdeps/unix/sysv/linux/aarch64/shlib-versions | 7 -
sysdeps/unix/sysv/linux/aarch64/sigaction.c | 10 +-
sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h | 10 +-
sysdeps/unix/sysv/linux/aarch64/sysdep.h | 60 ++++--
sysdeps/unix/sysv/linux/arm/readelflib.c | 4 +-
sysdeps/unix/sysv/linux/bits/resource.h | 99 +++-------
sysdeps/unix/sysv/linux/bits/siginfo.h | 26 ++-
sysdeps/unix/sysv/linux/bits/sigset.h | 20 ++-
sysdeps/unix/sysv/linux/generic/bits/msq.h | 21 ++-
sysdeps/unix/sysv/linux/generic/bits/sem.h | 14 +-
sysdeps/unix/sysv/linux/generic/bits/shm.h | 50 +++--
sysdeps/unix/sysv/linux/generic/bits/stat.h | 5 +-
sysdeps/unix/sysv/linux/generic/bits/statfs.h | 4 +-
87 files changed, 962 insertions(+), 401 deletions(-)
delete mode 100644 sysdeps/aarch64/Implies
create mode 100644 sysdeps/aarch64/bits/wordsize.h
mode change 100644 => 100755 sysdeps/aarch64/configure
create mode 100644 sysdeps/aarch64/ilp32/Implies
create mode 100644 sysdeps/aarch64/lp64/Implies
create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
mode change 100644 => 100755 sysdeps/unix/sysv/linux/aarch64/configure
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/Implies
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/Versions
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/kernel_stat.h
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ioctl.S
create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/Implies
create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S
create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions
delete mode 100644 sysdeps/unix/sysv/linux/aarch64/mmap.c
delete mode 100644 sysdeps/unix/sysv/linux/aarch64/shlib-versions
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 07/29] Allow generic stat and statfs not have padding for 32bit targets
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (15 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 18/29] [AARCH64] Reformat inline-asm in elf_machine_load_address Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-10-27 16:32 ` Chris Metcalf
2014-10-27 8:00 ` [PATCH 01/29] [AARCH64] Fix utmp struct for compatibility reasons Andrew Pinski
` (13 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
With ILP32, off_t, ino_t, blkcnt_t, fsbcnt_t, fsbfilcnt_t are all
64bit types, this allows us to use the same layout for the
structure stat and statfs as LP64. So we need to remove
the padding which is added for non 64bit targets.
* sysdeps/unix/sysv/linux/generic/bits/stat.h (__field64): Use
the 64bit version when off_t, ino_t and blkcnt_t match their 64bit
version.
* sysdeps/unix/sysv/linux/generic/bits/statfs.h (__field64): Use
the 64bit version when fsblkcnt_t and fsfilcnt_t match their 64bit
version.
---
sysdeps/unix/sysv/linux/generic/bits/stat.h | 5 ++++-
sysdeps/unix/sysv/linux/generic/bits/statfs.h | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h
index faa2800..3c92184 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h
@@ -42,7 +42,10 @@
#if defined __USE_FILE_OFFSET64
# define __field64(type, type64, name) type64 name
-#elif __WORDSIZE == 64
+#elif __WORDSIZE == 64 \
+ || (defined(__OFF_T_MATCHES_OFF64_T) \
+ && defined(__INO_T_MATCHES_INO64_T) \
+ && defined (__BLKCNT_T_TYPE_MATCHES_BLKCNT64_T_TYPE))
# define __field64(type, type64, name) type name
#elif __BYTE_ORDER == __LITTLE_ENDIAN
# define __field64(type, type64, name) \
diff --git a/sysdeps/unix/sysv/linux/generic/bits/statfs.h b/sysdeps/unix/sysv/linux/generic/bits/statfs.h
index e32cf76..d3bfb50 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/statfs.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/statfs.h
@@ -34,7 +34,9 @@
#if defined __USE_FILE_OFFSET64
# define __field64(type, type64, name) type64 name
-#elif __WORDSIZE == 64
+#elif __WORDSIZE == 64 \
+ || (defined (__FSBLKCNT_T_TYPE_MATCHES_FSBLKCNT64_T_TYPE) \
+ && defined (__FSFILCNT_T_TYPE_MATCHES_FSFILCNT64_T_TYPE))
# define __field64(type, type64, name) type name
#elif __BYTE_ORDER == __LITTLE_ENDIAN
# define __field64(type, type64, name) \
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 06/29] Allow some fields of siginfo to be different from the generic one
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (17 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 01/29] [AARCH64] Fix utmp struct for compatibility reasons Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-11-18 11:31 ` Will Newton
2014-10-27 8:03 ` [PATCH 16/29] [AARCH64] Detect ILP32 in configure scripts Andrew Pinski
` (11 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
In AARCH64:ILP32, we want to use the layout for siginfo as AARCH64:LP64,
so we need to add a few hooks into siginfo.h to support this.
* sysdeps/unix/sysv/linux/bits/siginfo.h (__SIGINFO_VOIDPTR): New define.
(__SIGINFO_BAND): New define.
(union sigval): Use __SIGINFO_VOIDPTR for the pointer.
(__SI_PAD_SIZE): Don't define if it is already defined.
(struct siginfo): Use __SIGINFO_VOIDPTR for the pointer types.
Use __SIGINFO_BAND for the si_band field.
(struct sigevent): Add a comment on why the remaining fields
don't need special handling.
---
sysdeps/unix/sysv/linux/bits/siginfo.h | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/bits/siginfo.h b/sysdeps/unix/sysv/linux/bits/siginfo.h
index ae603e8..f319d44 100644
--- a/sysdeps/unix/sysv/linux/bits/siginfo.h
+++ b/sysdeps/unix/sysv/linux/bits/siginfo.h
@@ -23,6 +23,14 @@
#include <bits/wordsize.h>
+#ifndef __SIGINFO_VOIDPTR
+#define __SIGINFO_VOIDPTR(field) void *field
+#endif
+
+#ifndef __SIGINFO_BAND
+#define __SIGINFO_BAND(field) long field
+#endif
+
#if (!defined __have_sigval_t \
&& (defined _SIGNAL_H || defined __need_siginfo_t \
|| defined __need_sigevent_t))
@@ -32,7 +40,7 @@
typedef union sigval
{
int sival_int;
- void *sival_ptr;
+ __SIGINFO_VOIDPTR (sival_ptr);
} sigval_t;
#endif
@@ -41,10 +49,13 @@ typedef union sigval
# define __have_siginfo_t 1
# define __SI_MAX_SIZE 128
-# if __WORDSIZE == 64
-# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
+
+# ifndef __SI_PAD_SIZE
+# if __WORDSIZE == 64
+# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
# else
-# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
+# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
+# endif
# endif
typedef struct
@@ -94,21 +105,21 @@ typedef struct
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
struct
{
- void *si_addr; /* Faulting insn/memory ref. */
+ __SIGINFO_VOIDPTR (si_addr); /* Faulting insn/memory ref. */
short int si_addr_lsb; /* Valid LSB of the reported address. */
} _sigfault;
/* SIGPOLL. */
struct
{
- long int si_band; /* Band event for SIGPOLL. */
+ __SIGINFO_BAND (si_band); /* Band event for SIGPOLL. */
int si_fd;
} _sigpoll;
/* SIGSYS. */
struct
{
- void *_call_addr; /* Calling user insn. */
+ __SIGINFO_VOIDPTR (_call_addr); /* Calling user insn. */
int _syscall; /* Triggering system call number. */
unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
} _sigsys;
@@ -312,6 +323,7 @@ typedef struct sigevent
thread to receive the signal. */
__pid_t _tid;
+ /* Note these two are handled only in userspace. */
struct
{
void (*_function) (sigval_t); /* Function to start. */
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 05/29] Allow fd_mask type not be an array of long.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (12 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 10/29] [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE. Use it in LDST_PCREL and LDST_GLOBAL Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-10-27 16:32 ` Chris Metcalf
2014-10-27 8:00 ` [PATCH 03/29] Add ability for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.) to have time_t being 64bit Andrew Pinski
` (16 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
Even though XPG4.2 requires fd_set member be a long, AARCH64:ILP32
needs it to be the same size as AARCH64:LP64 for big-endian so we
need it to be long long.
* misc/sys/select.h (__FD_MASK_TYPE): Define.
(__FD_MASK_CONST): Define.
(__fd_mask): Change to base on __FD_MASK_TYPE.
(__FD_MASK): Use __FD_MASK_CONST.
---
misc/sys/select.h | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/misc/sys/select.h b/misc/sys/select.h
index 941588d..0ca660e 100644
--- a/misc/sys/select.h
+++ b/misc/sys/select.h
@@ -49,16 +49,20 @@ typedef __suseconds_t suseconds_t;
# define __suseconds_t_defined
#endif
+/* The fd_set member is required to be an array of longs by XPG4.2. */
+#ifndef __FD_MASK_TYPE
+#define __FD_MASK_TYPE long
+#define __FD_MASK_CONST(a) a##ul
+#endif
-/* The fd_set member is required to be an array of longs. */
-typedef long int __fd_mask;
+typedef __FD_MASK_TYPE __fd_mask;
/* Some versions of <linux/posix_types.h> define this macros. */
#undef __NFDBITS
/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */
#define __NFDBITS (8 * (int) sizeof (__fd_mask))
#define __FD_ELT(d) ((d) / __NFDBITS)
-#define __FD_MASK(d) ((__fd_mask) (1UL << ((d) % __NFDBITS)))
+#define __FD_MASK(d) ((__fd_mask) (__FD_MASK_CONST(1) << ((d) % __NFDBITS)))
/* fd_set for select and pselect. */
typedef struct
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 03/29] Add ability for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.) to have time_t being 64bit
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (13 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 05/29] Allow fd_mask type not be an array of long Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-10-27 16:32 ` Chris Metcalf
2014-11-18 10:57 ` Will Newton
2014-10-27 8:00 ` [PATCH 18/29] [AARCH64] Reformat inline-asm in elf_machine_load_address Andrew Pinski
` (15 subsequent siblings)
30 siblings, 2 replies; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
The generic headers for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.)
already have the ability to already take account time_t being 64bit but only
if WORDSIZE is set 64. Also for AARCH64:ILP32, we want these structures to
match up with the LP64 size, so we add change the all of the unsigned long
types in these headers to be __syscall_ulong_t. Also there is one size_t
field which we need to be changed for AARCH64:ILP32 so we add
a macro which can be changed but defaulting to size_t.
* sysdeps/unix/sysv/linux/generic/bits/msq.h (msgqnum_t): Change to
__syscall_ulong_t.
(msglen_t): Likewise.
(__IPC_TIME_T_64_BITS): Define if not defined already and WORDSIZE
is 64.
(struct msqid_ds): Change WORD_SIZE check to check __IPC_TIME_T_64_BITS.
Also change some unsigned long fields to __syscall_ulong_t.
* sysdeps/unix/sysv/linux/generic/bits/sem.h (__IPC_TIME_T_64_BITS):
Define if not defined already and WORDSIZE is 64.
(struct semid_ds): Change WORD_SIZE check to check __IPC_TIME_T_64_BITS.
Also change some unsigned long fields to __syscall_ulong_t.
* sysdeps/unix/sysv/linux/generic/bits/shm.h (__IPC_TIME_T_64_BITS):
Define if not defined already and WORDSIZE is 64.
(__SHMID_DS_SIZE_TYPE): Define if not already defined.
(struct shmid_ds): Change WORD_SIZE check to check __IPC_TIME_T_64_BITS.
Change shm_segsz definition to be based on __SHMID_DS_SIZE_TYPE.
Also change some unsigned long fields to __syscall_ulong_t.
(struct shminfo): change some unsigned long fields to __syscall_ulong_t.
(struct shm_info): Likewise.
---
sysdeps/unix/sysv/linux/generic/bits/msq.h | 21 +++++++----
sysdeps/unix/sysv/linux/generic/bits/sem.h | 14 +++++---
sysdeps/unix/sysv/linux/generic/bits/shm.h | 50 ++++++++++++++++------------
3 files changed, 51 insertions(+), 34 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/generic/bits/msq.h b/sysdeps/unix/sysv/linux/generic/bits/msq.h
index f3fcd8d..df5128e 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/msq.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/msq.h
@@ -31,8 +31,13 @@
#endif
/* Types used in the structure definition. */
-typedef unsigned long int msgqnum_t;
-typedef unsigned long int msglen_t;
+typedef __syscall_ulong_t msgqnum_t;
+typedef __syscall_ulong_t msglen_t;
+
+#if !defined(__IPC_TIME_T_64_BITS) && __WORDSIZE == 64
+#define __IPC_TIME_T_64_BITS
+#endif
+
/* Structure of record for one message inside the kernel.
The type `struct msg' is opaque. */
@@ -40,24 +45,24 @@ struct msqid_ds
{
struct ipc_perm msg_perm; /* structure describing operation permission */
__time_t msg_stime; /* time of last msgsnd command */
-#if __WORDSIZE == 32
+#ifndef __IPC_TIME_T_64_BITS
unsigned long int __glibc_reserved1;
#endif
__time_t msg_rtime; /* time of last msgrcv command */
-#if __WORDSIZE == 32
+#ifndef __IPC_TIME_T_64_BITS
unsigned long int __glibc_reserved2;
#endif
__time_t msg_ctime; /* time of last change */
-#if __WORDSIZE == 32
+#ifndef __IPC_TIME_T_64_BITS
unsigned long int __glibc_reserved3;
#endif
- unsigned long int __msg_cbytes; /* current number of bytes on queue */
+ __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */
msgqnum_t msg_qnum; /* number of messages currently on queue */
msglen_t msg_qbytes; /* max number of bytes allowed on queue */
__pid_t msg_lspid; /* pid of last msgsnd() */
__pid_t msg_lrpid; /* pid of last msgrcv() */
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
+ __syscall_ulong_t __glibc_reserved4;
+ __syscall_ulong_t __glibc_reserved5;
};
#ifdef __USE_MISC
diff --git a/sysdeps/unix/sysv/linux/generic/bits/sem.h b/sysdeps/unix/sysv/linux/generic/bits/sem.h
index 3c9aea8..a0a5d47 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/sem.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/sem.h
@@ -36,21 +36,25 @@
#define SETALL 17 /* set all semval's */
+#if !defined(__IPC_TIME_T_64_BITS) && __WORDSIZE == 64
+#define __IPC_TIME_T_64_BITS
+#endif
+
/* Data structure describing a set of semaphores. */
struct semid_ds
{
struct ipc_perm sem_perm; /* operation permission struct */
__time_t sem_otime; /* last semop() time */
-#if __WORDSIZE == 32
+#ifndef __IPC_TIME_T_64_BITS
unsigned long int __glibc_reserved1;
#endif
__time_t sem_ctime; /* last time changed by semctl() */
-#if __WORDSIZE == 32
+#ifndef __IPC_TIME_T_64_BITS
unsigned long int __glibc_reserved2;
#endif
- unsigned long int sem_nsems; /* number of semaphores in set */
- unsigned long int __glibc_reserved3;
- unsigned long int __glibc_reserved4;
+ __syscall_ulong_t sem_nsems; /* number of semaphores in set */
+ __syscall_ulong_t __glibc_reserved3;
+ __syscall_ulong_t __glibc_reserved4;
};
/* The user should define a union like the following to use it for arguments
diff --git a/sysdeps/unix/sysv/linux/generic/bits/shm.h b/sysdeps/unix/sysv/linux/generic/bits/shm.h
index 0dbed61..78ff79d 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/shm.h
@@ -44,31 +44,39 @@ __BEGIN_DECLS
extern int __getpagesize (void) __THROW __attribute__ ((__const__));
+#if !defined(__IPC_TIME_T_64_BITS) && __WORDSIZE == 64
+#define __IPC_TIME_T_64_BITS
+#endif
+
/* Type to count number of attaches. */
-typedef unsigned long int shmatt_t;
+typedef __syscall_ulong_t shmatt_t;
+
+#ifndef __SHMID_DS_SIZE_TYPE
+#define __SHMID_DS_SIZE_TYPE(field) size_t field
+#endif
/* Data structure describing a shared memory segment. */
struct shmid_ds
{
struct ipc_perm shm_perm; /* operation permission struct */
- size_t shm_segsz; /* size of segment in bytes */
+ __SHMID_DS_SIZE_TYPE(shm_segsz); /* size of segment in bytes */
__time_t shm_atime; /* time of last shmat() */
-#if __WORDSIZE == 32
+#ifndef __IPC_TIME_T_64_BITS
unsigned long int __glibc_reserved1;
#endif
__time_t shm_dtime; /* time of last shmdt() */
-#if __WORDSIZE == 32
+#ifndef __IPC_TIME_T_64_BITS
unsigned long int __glibc_reserved2;
#endif
__time_t shm_ctime; /* time of last change by shmctl() */
-#if __WORDSIZE == 32
+#ifndef __IPC_TIME_T_64_BITS
unsigned long int __glibc_reserved3;
#endif
__pid_t shm_cpid; /* pid of creator */
__pid_t shm_lpid; /* pid of last shmop */
shmatt_t shm_nattch; /* number of current attaches */
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
+ __syscall_ulong_t __glibc_reserved4;
+ __syscall_ulong_t __glibc_reserved5;
};
#ifdef __USE_MISC
@@ -85,25 +93,25 @@ struct shmid_ds
struct shminfo
{
- unsigned long int shmmax;
- unsigned long int shmmin;
- unsigned long int shmmni;
- unsigned long int shmseg;
- unsigned long int shmall;
- unsigned long int __glibc_reserved1;
- unsigned long int __glibc_reserved2;
- unsigned long int __glibc_reserved3;
- unsigned long int __glibc_reserved4;
+ __syscall_ulong_t shmmax;
+ __syscall_ulong_t shmmin;
+ __syscall_ulong_t shmmni;
+ __syscall_ulong_t shmseg;
+ __syscall_ulong_t shmall;
+ __syscall_ulong_t __glibc_reserved1;
+ __syscall_ulong_t __glibc_reserved2;
+ __syscall_ulong_t __glibc_reserved3;
+ __syscall_ulong_t __glibc_reserved4;
};
struct shm_info
{
int used_ids;
- unsigned long int shm_tot; /* total allocated shm */
- unsigned long int shm_rss; /* total resident shm */
- unsigned long int shm_swp; /* total swapped shm */
- unsigned long int swap_attempts;
- unsigned long int swap_successes;
+ __syscall_ulong_t shm_tot; /* total allocated shm */
+ __syscall_ulong_t shm_rss; /* total resident shm */
+ __syscall_ulong_t shm_swp; /* total swapped shm */
+ __syscall_ulong_t swap_attempts;
+ __syscall_ulong_t swap_successes;
};
#endif /* __USE_MISC */
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 24/29] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (2 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 08/29] [AARCH64] Add header guards to sysdep.h headers Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-11-18 14:31 ` Will Newton
2014-10-27 8:00 ` [PATCH 02/29] Allow sigset be an array of a different type Andrew Pinski
` (26 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
To be support multi-lib with ldd, we need to add a ldd-rewrite.sed file
to rewrite RTLDLIST to include both ld.so's.
* sysdeps/unix/sysv/linux/aarch64/configure.ac (ldd_rewrite_script):
Set.
* sysdeps/unix/sysv/linux/aarch64/configure: Regenerate.
* sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed: New file.
---
sysdeps/unix/sysv/linux/aarch64/configure | 2 ++
sysdeps/unix/sysv/linux/aarch64/configure.ac | 2 ++
sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed | 1 +
3 files changed, 5 insertions(+), 0 deletions(-)
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/aarch64/configure b/sysdeps/unix/sysv/linux/aarch64/configure
index 59372d2..faef1dd 100755
--- a/sysdeps/unix/sysv/linux/aarch64/configure
+++ b/sysdeps/unix/sysv/linux/aarch64/configure
@@ -31,3 +31,5 @@ case "$prefix" in
esac
fi
+ldd_rewrite_script=$dir/ldd-rewrite.sed
+
diff --git a/sysdeps/unix/sysv/linux/aarch64/configure.ac b/sysdeps/unix/sysv/linux/aarch64/configure.ac
index 6526816..3ca8ed1 100644
--- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
+++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
@@ -9,3 +9,5 @@ else
LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
fi
+ldd_rewrite_script=$dir/ldd-rewrite.sed
+
diff --git a/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
new file mode 100644
index 0000000..2f3bbb9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
@@ -0,0 +1 @@
+s_^\(RTLDLIST=\)\(.*lib/\)\([^/]*\)\(-aarch64\)\(\|\_be\)\(\|\_ilp32\)\(.so\.[0-9.]*\)$_\1"\2\3-aarch64\5\7 \2\3-aarch64\5\_ilp32\7"_
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 01/29] [AARCH64] Fix utmp struct for compatibility reasons.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (16 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 07/29] Allow generic stat and statfs not have padding for 32bit targets Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-10-27 17:57 ` Joseph S. Myers
2014-10-27 8:00 ` [PATCH 06/29] Allow some fields of siginfo to be different from the generic one Andrew Pinski
` (12 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
NOTE This is an ABI change for AARCH64.
If you have some AARCH32 and AARCH64 applications and they both use
utmp, one of them will fail due to the use of time_t inside the
utmp binary format.
This fixes the problem by setting __WORDSIZE_TIME64_COMPAT32.
* sysdeps/aarch64/bits/wordsize.h: New file.
---
sysdeps/aarch64/bits/wordsize.h | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
create mode 100644 sysdeps/aarch64/bits/wordsize.h
diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
new file mode 100644
index 0000000..3ecccaa
--- /dev/null
+++ b/sysdeps/aarch64/bits/wordsize.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 2014 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#define __WORDSIZE 64
+
+/* LP64 ABI has a 64bit time_t.
+ This allows aarch32 and AARCH64 applications
+ both access utmp. */
+#define __WORDSIZE_TIME64_COMPAT32 1
+
+/* LP64 use the 64bit system call interface. */
+#define __SYSCALL_WORDSIZE 64
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 12/29] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (4 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 02/29] Allow sigset be an array of a different type Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-11-18 12:23 ` Will Newton
2014-10-27 8:00 ` [PATCH 09/29] Add dynamic ILP32 AARCH64 relocations to elf.h Andrew Pinski
` (24 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
This converts dl-tlsdesc.S code over to use the new macros which allows for
sharing between ILP32 and LP64 code.
* sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return): Use PTR_REG.
(_dl_tlsdesc_undefweak): Use PTR_REG, PTR_SIZE.
(_dl_tlsdesc_dynamic): Likewise.
(_dl_tlsdesc_resolve_rela): Likewise.
(_dl_tlsdesc_resolve_hold): Likewise.
---
sysdeps/aarch64/dl-tlsdesc.S | 36 ++++++++++++++++++------------------
1 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index ded5471..6004115 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -74,7 +74,7 @@
cfi_startproc
.align 2
_dl_tlsdesc_return:
- ldr x0, [x0, #8]
+ ldr PTR_REG (0), [x0, #PTR_SIZE]
RET
cfi_endproc
.size _dl_tlsdesc_return, .-_dl_tlsdesc_return
@@ -96,9 +96,9 @@ _dl_tlsdesc_return:
_dl_tlsdesc_undefweak:
str x1, [sp, #-16]!
cfi_adjust_cfa_offset(16)
- ldr x0, [x0, #8]
+ ldr PTR_REG (0), [x0, #PTR_SIZE]
mrs x1, tpidr_el0
- sub x0, x0, x1
+ sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
ldr x1, [sp], #16
cfi_adjust_cfa_offset(16)
RET
@@ -152,20 +152,20 @@ _dl_tlsdesc_dynamic:
stp x3, x4, [sp, #32+16*1]
mrs x4, tpidr_el0
- ldr x1, [x0,#8]
- ldr x0, [x4]
- ldr x3, [x1,#16]
- ldr x2, [x0]
- cmp x3, x2
+ ldr PTR_REG (1), [x0,#PTR_SIZE]
+ ldr PTR_REG (0), [x4]
+ ldr PTR_REG (3), [x1,#(PTR_SIZE * 2)]
+ ldr PTR_REG (2), [x0]
+ cmp PTR_REG (3), PTR_REG (2)
b.hi 2f
- ldr x2, [x1]
- add x0, x0, x2, lsl #4
- ldr x0, [x0]
+ ldr PTR_REG (2), [x1]
+ add PTR_REG (0), PTR_REG (0), PTR_REG (2), lsl #(PTR_LOG_SIZE + 1)
+ ldr PTR_REG (0), [x0]
cmn x0, #0x1
b.eq 2f
- ldr x1, [x1,#8]
- add x0, x0, x1
- sub x0, x0, x4
+ ldr PTR_REG (1), [x1,#(PTR_SIZE * 2)]
+ add PTR_REG (0), PTR_REG (0), PTR_REG (1)
+ sub PTR_REG (0), PTR_REG (0), PTR_REG (4)
1:
ldp x1, x2, [sp, #32+16*0]
ldp x3, x4, [sp, #32+16*1]
@@ -196,7 +196,7 @@ _dl_tlsdesc_dynamic:
bl __tls_get_addr
mrs x1, tpidr_el0
- sub x0, x0, x1
+ sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
RESTORE_Q_REGISTERS
@@ -242,13 +242,13 @@ _dl_tlsdesc_resolve_rela:
SAVE_Q_REGISTERS
- ldr x1, [x3, #8]
+ ldr PTR_REG (1), [x3, #PTR_SIZE]
bl _dl_tlsdesc_resolve_rela_fixup
RESTORE_Q_REGISTERS
ldr x0, [sp, #32+16*8]
- ldr x1, [x0]
+ ldr PTR_REG (1), [x0]
blr x1
ldp x1, x4, [sp, #32+16*0]
@@ -309,7 +309,7 @@ _dl_tlsdesc_resolve_hold:
RESTORE_Q_REGISTERS
ldr x0, [sp, #32+16*9]
- ldr x1, [x0]
+ ldr PTR_REG (1), [x0]
blr x1
ldp x1, x2, [sp, #32+16*0]
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 18/29] [AARCH64] Reformat inline-asm in elf_machine_load_address.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (14 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 03/29] Add ability for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.) to have time_t being 64bit Andrew Pinski
@ 2014-10-27 8:00 ` Andrew Pinski
2014-11-18 13:51 ` Will Newton
2014-10-27 8:00 ` [PATCH 07/29] Allow generic stat and statfs not have padding for 32bit targets Andrew Pinski
` (14 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:00 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
This patch reformats the inline-asm in elf_machine_load_address so it is
easier to change only part of the inline-asm. That is using string
concating instead of string continueing.
Also document on why this inline-asm works, it depends on the 32bit
relocation being resolved at link time.
* sysdeps/aarch64/dl-machine.h (elf_machine_load_address):
Refactor inline-asm. Also add comment.
---
sysdeps/aarch64/dl-machine.h | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index 6e041b1..121b178 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -53,19 +53,22 @@ elf_machine_load_address (void)
The choice of symbol is arbitrary. The static address we obtain
by constructing a non GOT reference to the symbol, the dynamic
address of the symbol we compute using adrp/add to compute the
- symbol's address relative to the PC. */
+ symbol's address relative to the PC.
+ This depends on 32bit relocations being resolved at link time
+ and that the static address fits in the 32bits. */
ElfW(Addr) static_addr;
ElfW(Addr) dynamic_addr;
- asm (" \n\
- adrp %1, _dl_start; \n\
- add %1, %1, #:lo12:_dl_start \n\
- ldr %w0, 1f \n\
- b 2f \n\
-1: .word _dl_start \n\
-2: \n\
- " : "=r" (static_addr), "=r" (dynamic_addr));
+ asm (" \n"
+" adrp %1, _dl_start; \n"
+" add %1, %1, #:lo12:_dl_start \n"
+" ldr %w0, 1f \n"
+" b 2f \n"
+"1: \n"
+" .word _dl_start \n"
+"2: \n"
+ : "=r" (static_addr), "=r" (dynamic_addr));
return dynamic_addr - static_addr;
}
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 20/29] [AARCH64] Set up wordsize for ILP32.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (19 preceding siblings ...)
2014-10-27 8:03 ` [PATCH 16/29] [AARCH64] Detect ILP32 in configure scripts Andrew Pinski
@ 2014-10-27 8:03 ` Andrew Pinski
2014-11-18 13:58 ` Will Newton
2014-10-27 8:03 ` [PATCH 22/29] [AARCH64] Add support to ldconfig for ILP32 and libilp32 Andrew Pinski
` (9 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:03 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
__WORDSIZE needs to be set to 32 for ILP32.
* sysdeps/aarch64/bits/wordsize.h (__WORDSIZE): Set to 32 for ILP32.
Update comments.
---
sysdeps/aarch64/bits/wordsize.h | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
index 3ecccaa..3d5a79d 100644
--- a/sysdeps/aarch64/bits/wordsize.h
+++ b/sysdeps/aarch64/bits/wordsize.h
@@ -15,12 +15,16 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define __WORDSIZE 64
+#ifdef __LP64__
+# define __WORDSIZE 64
+#else
+# define __WORDSIZE 32
+#endif
-/* LP64 ABI has a 64bit time_t.
+/* LP64 and ILP32s ABI uses a 64bit time_t.
This allows aarch32 and AARCH64 applications
both access utmp. */
#define __WORDSIZE_TIME64_COMPAT32 1
-/* LP64 use the 64bit system call interface. */
+/* LP64 and ILP32 use the 64bit system call interface. */
#define __SYSCALL_WORDSIZE 64
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 14/29] [AARCH64] Use PTR_* in start.S
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (24 preceding siblings ...)
2014-10-27 8:03 ` [PATCH 29/29] [AARCH64] Make lp64 and ilp32 directories Andrew Pinski
@ 2014-10-27 8:03 ` Andrew Pinski
2014-11-18 12:35 ` Will Newton
2014-10-27 8:03 ` [PATCH 17/29] [AARCH64] Syscalls for ILP32 are passed always via 64bit values Andrew Pinski
` (4 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:03 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
To support ILP32 without much sources changes, this changes
sysdeps/aarch64/start.S to use the PTR_* macros which was defined
earlier.
* sysdeps/aarch64/start.S: Include sysdep.h
(_start): Use PTR_REG, PTR_SIZE macros.
---
sysdeps/aarch64/start.S | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S
index 35d603a..dfa0622 100644
--- a/sysdeps/aarch64/start.S
+++ b/sysdeps/aarch64/start.S
@@ -16,6 +16,8 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
+#include <sysdep.h>
+
/* This is the canonical entry point, usually the first thing in the text
segment.
@@ -25,7 +27,7 @@
At this entry point, most registers' values are unspecified, except:
- x0 Contains a function pointer to be registered with `atexit'.
+ x0/w0 Contains a function pointer to be registered with `atexit'.
This is how the dynamic linker arranges to have DT_FINI
functions called for shared libraries that have been loaded
before this code runs.
@@ -53,26 +55,26 @@ _start:
mov x5, x0
/* Load argc and a pointer to argv */
- ldr x1, [sp, #0]
- add x2, sp, #8
+ ldr PTR_REG (1), [sp, #0]
+ add x2, sp, #PTR_SIZE
/* Setup stack limit in argument register */
mov x6, sp
#ifdef SHARED
adrp x0, :got:main
- ldr x0, [x0, #:got_lo12:main]
+ ldr PTR_REG (0), [x0, #:got_lo12:main]
adrp x3, :got:__libc_csu_init
- ldr x3, [x3, #:got_lo12:__libc_csu_init]
+ ldr PTR_REG (3), [x3, #:got_lo12:__libc_csu_init]
adrp x4, :got:__libc_csu_fini
- ldr x4, [x4, #:got_lo12:__libc_csu_fini]
+ ldr PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini]
#else
/* Set up the other arguments in registers */
- ldr x0, =main
- ldr x3, =__libc_csu_init
- ldr x4, =__libc_csu_fini
+ ldr PTR_REG (0), =main
+ ldr PTR_REG (3), =__libc_csu_init
+ ldr PTR_REG (4), =__libc_csu_fini
#endif
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 29/29] [AARCH64] Make lp64 and ilp32 directories.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (23 preceding siblings ...)
2014-10-27 8:03 ` [PATCH 23/29] [AARCH64] Add ILP32 ld.so to the known interpreter names Andrew Pinski
@ 2014-10-27 8:03 ` Andrew Pinski
2014-10-27 18:07 ` Joseph S. Myers
2014-10-27 8:03 ` [PATCH 14/29] [AARCH64] Use PTR_* in start.S Andrew Pinski
` (5 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:03 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
The patch makes the ilp32 and lp64 have their own directory under aarch64.
Since ILP32 uses most of the same system calls as LP64 and has a 64bit
off_t, we need make the functions that end in 64 the same as the ones without.
We also need not to special case ioctl or use the already provided mmap.c file.
ChangeLog:
* sysdeps/aarch64/ilp32/Implies: New file.
* sysdeps/aarch64/Implies: Rename to
* sysdeps/aarch64/lp64/Implies: This.
* sysdeps/unix/sysv/linux/aarch64/shlib-versions: Rename to ...
* sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions: This.
* sysdeps/unix/sysv/linux/aarch64/ilp32/Implies: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/Versions: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c: New file
* sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/kernel_stat.h: New file.
* sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c: New file.
---
sysdeps/aarch64/Implies | 6 --
sysdeps/aarch64/ilp32/Implies | 6 ++
sysdeps/aarch64/lp64/Implies | 7 ++
sysdeps/unix/sysv/linux/aarch64/ilp32/Implies | 3 +
sysdeps/unix/sysv/linux/aarch64/ilp32/Versions | 5 ++
sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c | 2 +
.../unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c | 6 ++
sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c | 1 +
.../unix/sysv/linux/aarch64/ilp32/fallocate64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c | 1 +
.../unix/sysv/linux/aarch64/ilp32/ftruncate64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c | 2 +
.../unix/sysv/linux/aarch64/ilp32/getrlimit64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c | 1 +
.../unix/sysv/linux/aarch64/ilp32/kernel_stat.h | 24 +++++++
sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c | 1 +
.../sysv/linux/aarch64/ilp32/posix_fadvise64.c | 1 +
.../sysv/linux/aarch64/ilp32/posix_fallocate.c | 1 +
.../sysv/linux/aarch64/ilp32/posix_fallocate64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c | 66 ++++++++++++++++++++
sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c | 1 +
.../unix/sysv/linux/aarch64/ilp32/setrlimit64.c | 1 +
.../unix/sysv/linux/aarch64/ilp32/shlib-versions | 7 ++
sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c | 5 ++
sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c | 1 +
.../unix/sysv/linux/aarch64/ilp32/syscalls.list | 21 ++++++
sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ioctl.S | 31 ---------
sysdeps/unix/sysv/linux/aarch64/lp64/Implies | 4 +
sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S | 31 +++++++++
.../unix/sysv/linux/aarch64/lp64/shlib-versions | 7 ++
sysdeps/unix/sysv/linux/aarch64/mmap.c | 34 ----------
sysdeps/unix/sysv/linux/aarch64/shlib-versions | 7 --
47 files changed, 224 insertions(+), 78 deletions(-)
delete mode 100644 sysdeps/aarch64/Implies
create mode 100644 sysdeps/aarch64/ilp32/Implies
create mode 100644 sysdeps/aarch64/lp64/Implies
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/Implies
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/Versions
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/kernel_stat.h
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ioctl.S
create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/Implies
create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S
create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions
delete mode 100644 sysdeps/unix/sysv/linux/aarch64/mmap.c
delete mode 100644 sysdeps/unix/sysv/linux/aarch64/shlib-versions
diff --git a/sysdeps/aarch64/Implies b/sysdeps/aarch64/Implies
deleted file mode 100644
index e5adf4d..0000000
--- a/sysdeps/aarch64/Implies
+++ /dev/null
@@ -1,6 +0,0 @@
-wordsize-64
-ieee754/ldbl-128
-ieee754/dbl-64/wordsize-64
-ieee754/dbl-64
-ieee754/flt-32
-aarch64/soft-fp
diff --git a/sysdeps/aarch64/ilp32/Implies b/sysdeps/aarch64/ilp32/Implies
new file mode 100644
index 0000000..705bc5b
--- /dev/null
+++ b/sysdeps/aarch64/ilp32/Implies
@@ -0,0 +1,6 @@
+aarch64
+wordsize-32
+ieee754/ldbl-128
+ieee754/dbl-64
+ieee754/flt-32
+aarch64/soft-fp
diff --git a/sysdeps/aarch64/lp64/Implies b/sysdeps/aarch64/lp64/Implies
new file mode 100644
index 0000000..d2fbde7
--- /dev/null
+++ b/sysdeps/aarch64/lp64/Implies
@@ -0,0 +1,7 @@
+aarch64
+wordsize-64
+ieee754/ldbl-128
+ieee754/dbl-64/wordsize-64
+ieee754/dbl-64
+ieee754/flt-32
+aarch64/soft-fp
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/Implies b/sysdeps/unix/sysv/linux/aarch64/ilp32/Implies
new file mode 100644
index 0000000..a88511b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/Implies
@@ -0,0 +1,3 @@
+aarch64/nptl
+unix/sysv/linux/aarch64
+unix/sysv/linux/generic
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/Versions b/sysdeps/unix/sysv/linux/aarch64/ilp32/Versions
new file mode 100644
index 0000000..58b6bfb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/Versions
@@ -0,0 +1,5 @@
+libc {
+ GLIBC_2.21 {
+ fallocate64;
+ }
+}
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c
new file mode 100644
index 0000000..05feb3d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c
@@ -0,0 +1,2 @@
+#include <sysdeps/unix/sysv/linux/generic/creat.c>
+weak_alias (__libc_creat, creat64)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
new file mode 100644
index 0000000..339e5f4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
@@ -0,0 +1,6 @@
+/* In this implementation we do not really care whether the call fails
+ because of missing kernel support since we do not even call the
+ function in this case. */
+#undef __ASSUME_ATFCTS
+#define __ASSUME_ATFCTS 1
+#include "fxstatat.c"
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
new file mode 100644
index 0000000..d3b7218
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/wordsize-64/fallocate.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
new file mode 100644
index 0000000..df33112
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
@@ -0,0 +1 @@
+/* fallocate64 is in posix_fallocate.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
new file mode 100644
index 0000000..2be4e59
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
@@ -0,0 +1 @@
+/* fstatfs64 is the same as fstatfs. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
new file mode 100644
index 0000000..673a8b5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
@@ -0,0 +1 @@
+/* ftruncate64 is the same as ftruncate. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
new file mode 100644
index 0000000..272b6be
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/wordsize-64/fxstat.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
new file mode 100644
index 0000000..9eff9eb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
@@ -0,0 +1 @@
+/* fxstat64 is in fxstat.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
new file mode 100644
index 0000000..689cd57
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c
new file mode 100644
index 0000000..05e7f41
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c
@@ -0,0 +1 @@
+/* fxstatat64 is in fxstatat.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
new file mode 100644
index 0000000..14dbbc7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
@@ -0,0 +1 @@
+/* Defined in getdents64.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c
new file mode 100644
index 0000000..08987ea
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c
@@ -0,0 +1,2 @@
+#include <sysdeps/unix/sysv/linux/generic/getdents64.c>
+strong_alias (__getdents64, __getdents)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c
new file mode 100644
index 0000000..9feab0e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c
@@ -0,0 +1 @@
+/* getrlimit64 is the same as getrlimit. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c
new file mode 100644
index 0000000..e542747
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c
@@ -0,0 +1 @@
+#include <sysdeps/wordsize-64/glob.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/kernel_stat.h b/sysdeps/unix/sysv/linux/aarch64/ilp32/kernel_stat.h
new file mode 100644
index 0000000..91e01ba
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/kernel_stat.h
@@ -0,0 +1,24 @@
+/* Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdeps/unix/sysv/linux/generic/kernel_stat.h>
+
+/* ILP32 has no overflow checks. */
+#ifndef __LP64__
+#define XSTAT_IS_XSTAT64 1
+#endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c
new file mode 100644
index 0000000..24013a8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c
@@ -0,0 +1 @@
+/* lseek() is 64-bit capable already. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
new file mode 100644
index 0000000..bb5dbd0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
@@ -0,0 +1 @@
+/* lxstat64 is in lxstat.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c
new file mode 100644
index 0000000..8e32bae
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c
@@ -0,0 +1 @@
+/* mmap64 is provided by mmap as they are the same. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
new file mode 100644
index 0000000..c9f72c4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
@@ -0,0 +1 @@
+/* posix_fadvise64 is in posix_fadvise.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate.c
new file mode 100644
index 0000000..b3fe81b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate64.c
new file mode 100644
index 0000000..f466f13
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate64.c
@@ -0,0 +1 @@
+/* posix_fallocate64 is in posix_fallocate.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c
new file mode 100644
index 0000000..b7f298d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c
@@ -0,0 +1 @@
+/* Empty since the pread syscall is equivalent. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
new file mode 100644
index 0000000..0a20301
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
@@ -0,0 +1 @@
+/* preadv64 is the same as preadv. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c
new file mode 100644
index 0000000..b7f298d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c
@@ -0,0 +1 @@
+/* Empty since the pread syscall is equivalent. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
new file mode 100644
index 0000000..e96c6f2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
@@ -0,0 +1 @@
+/* pwritev64 is the same as pwritev. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c
new file mode 100644
index 0000000..0652405
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stdarg.h>
+#include <sys/sem.h>
+#include <ipc_priv.h>
+#include <sysdep.h>
+
+/* Define a `union semun' that is for glibc here. */
+union semun
+{
+ int val; /* value for SETVAL */
+ struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
+ unsigned short int *array; /* array for GETALL & SETALL */
+ struct seminfo *__buf; /* buffer for IPC_INFO */
+};
+
+union semun_kernel
+{
+ int val; /* value for SETVAL */
+ unsigned long long kern_ptr;
+};
+
+int __semctl (int semid, int semnum, int cmd, ...);
+
+int
+__semctl (int semid, int semnum, int cmd, ...)
+{
+ union semun arg;
+ union semun_kernel arg_real;
+ va_list ap;
+
+ va_start (ap, cmd);
+
+ /* Get the argument. */
+ arg = va_arg (ap, union semun);
+
+ va_end (ap);
+
+ arg_real.kern_ptr = 0;
+ if (cmd == SETVAL)
+ arg_real.val = arg.val;
+ else
+ arg_real.kern_ptr = (unsigned long long)(uintptr_t)arg.array;
+
+ return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd,
+ arg_real.kern_ptr);
+}
+
+#include <shlib-compat.h>
+versioned_symbol (libc, __semctl, semctl, GLIBC_2_0);
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c
new file mode 100644
index 0000000..4c451bd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c
@@ -0,0 +1 @@
+/* sendfile64 is alias of sendfile syscall. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c
new file mode 100644
index 0000000..8edcff0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c
@@ -0,0 +1 @@
+/* setrlimit64 is the same as setrlimit. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions b/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
new file mode 100644
index 0000000..17db764
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
@@ -0,0 +1,7 @@
+DEFAULT GLIBC_2.21
+
+%ifdef HAVE_AARCH64_BE
+ld=ld-linux-aarch64_be_ilp32.so.1
+%else
+ld=ld-linux-aarch64_ilp32.so.1
+%endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
new file mode 100644
index 0000000..06bc688
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
@@ -0,0 +1 @@
+/* statfs64 is the same as statfs. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c
new file mode 100644
index 0000000..48a1d6d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c
@@ -0,0 +1,5 @@
+#define __statvfs64(file, buf) __no_statvfs64(file, buf)
+#define statvfs64(file, buf) no_statvfs64(file, buf)
+#include "sysdeps/unix/sysv/linux/statvfs.c"
+strong_alias (statvfs, __statvfs64)
+weak_alias (statvfs, statvfs64)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c
new file mode 100644
index 0000000..510015e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c
@@ -0,0 +1 @@
+/* statvfs64 is the same as statvfs. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list b/sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
new file mode 100644
index 0000000..1a3834b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
@@ -0,0 +1,21 @@
+# File name Caller Syscall name # args Strong name Weak names
+
+truncate - truncate i:si truncate __truncate truncate64
+ftruncate - ftruncate i:ii __ftruncate ftruncate ftruncate64 __ftruncate64
+preadv - preadv Ci:ipii preadv preadv64
+pwritev - pwritev Ci:ipii pwritev pwritev64
+pread - pread64 Ci:ibni __libc_pread __libc_pread64 __pread pread __pread64 pread64
+pwrite - pwrite64 Ci:ibni __libc_pwrite __libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
+readahead - readahead i:iii __readahead readahead
+getrlimit - getrlimit i:ip __getrlimit getrlimit getrlimit64
+setrlimit - setrlimit i:ip __setrlimit setrlimit setrlimit64
+prlimit EXTRA prlimit64 i:iipp prlimit
+sendfile - sendfile i:iipi sendfile sendfile64
+lseek - lseek Ci:iii __libc_lseek __lseek lseek __llseek llseek __libc_lseek64 __lseek64 lseek64
+sync_file_range - sync_file_range Ci:iiii sync_file_range
+mmap - mmap b:aniiii __mmap mmap __mmap64 mmap64
+posix_fadvise - fadvise64 Vi:iiii posix_fadvise posix_fadvise64
+fstatfs - fstatfs i:ip __fstatfs fstatfs fstatfs64 __fstatfs64
+statfs - statfs i:sp __statfs statfs statfs64 __statfs64
+fanotify_mark EXTRA fanotify_mark i:iiiiis fanotify_mark
+
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
new file mode 100644
index 0000000..8999768
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
@@ -0,0 +1 @@
+/* truncate64 is the same as truncate. */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
new file mode 100644
index 0000000..96927fe
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/generic/xstat.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
new file mode 100644
index 0000000..e7acd3b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
@@ -0,0 +1 @@
+/* xstat64 is in xstat.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ioctl.S b/sysdeps/unix/sysv/linux/aarch64/ioctl.S
deleted file mode 100644
index 8920a20..0000000
--- a/sysdeps/unix/sysv/linux/aarch64/ioctl.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2012-2014 Free Software Foundation, Inc.
-
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
- .text
-ENTRY(__ioctl)
- mov x8, #__NR_ioctl
- sxtw x0, w0
- svc #0x0
- cmn x0, #4095
- b.cs .Lsyscall_error
- ret
-PSEUDO_END (__ioctl)
-
-weak_alias (__ioctl, ioctl)
diff --git a/sysdeps/unix/sysv/linux/aarch64/lp64/Implies b/sysdeps/unix/sysv/linux/aarch64/lp64/Implies
new file mode 100644
index 0000000..6418211
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/lp64/Implies
@@ -0,0 +1,4 @@
+aarch64/nptl
+unix/sysv/linux/aarch64
+unix/sysv/linux/generic
+unix/sysv/linux/wordsize-64
diff --git a/sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S b/sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S
new file mode 100644
index 0000000..8920a20
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S
@@ -0,0 +1,31 @@
+/* Copyright (C) 2012-2014 Free Software Foundation, Inc.
+
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+ .text
+ENTRY(__ioctl)
+ mov x8, #__NR_ioctl
+ sxtw x0, w0
+ svc #0x0
+ cmn x0, #4095
+ b.cs .Lsyscall_error
+ ret
+PSEUDO_END (__ioctl)
+
+weak_alias (__ioctl, ioctl)
diff --git a/sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions b/sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions
new file mode 100644
index 0000000..e1768a7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions
@@ -0,0 +1,7 @@
+DEFAULT GLIBC_2.17
+
+%ifdef HAVE_AARCH64_BE
+ld=ld-linux-aarch64_be.so.1
+%else
+ld=ld-linux-aarch64.so.1
+%endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/mmap.c b/sysdeps/unix/sysv/linux/aarch64/mmap.c
deleted file mode 100644
index 54ecc10..0000000
--- a/sysdeps/unix/sysv/linux/aarch64/mmap.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include <sys/syscall.h>
-#include <sysdep.h>
-#include <unistd.h>
-
-__ptr_t
-__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
- return (__ptr_t) INLINE_SYSCALL (mmap, 6, addr, len, prot, flags, fd, offset);
-}
-
-weak_alias (__mmap, mmap)
-weak_alias (__mmap, mmap64)
-weak_alias (__mmap, __mmap64)
diff --git a/sysdeps/unix/sysv/linux/aarch64/shlib-versions b/sysdeps/unix/sysv/linux/aarch64/shlib-versions
deleted file mode 100644
index e1768a7..0000000
--- a/sysdeps/unix/sysv/linux/aarch64/shlib-versions
+++ /dev/null
@@ -1,7 +0,0 @@
-DEFAULT GLIBC_2.17
-
-%ifdef HAVE_AARCH64_BE
-ld=ld-linux-aarch64_be.so.1
-%else
-ld=ld-linux-aarch64.so.1
-%endif
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 22/29] [AARCH64] Add support to ldconfig for ILP32 and libilp32
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (20 preceding siblings ...)
2014-10-27 8:03 ` [PATCH 20/29] [AARCH64] Set up wordsize for ILP32 Andrew Pinski
@ 2014-10-27 8:03 ` Andrew Pinski
2014-11-18 14:20 ` Will Newton
2014-10-27 8:03 ` [PATCH 26/29] [AARCH64] Add sigstack.h header for ILP32 reasons Andrew Pinski
` (8 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:03 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
This patch adds support to ldconfig for libilp32 which is used by
ILP32.
* sysdeps/generic/ldconfig.h (FLAG_AARCH64_LIB32): New define.
* elf/cache.c (print_entry): Handle FLAG_AARCH64_LIB32.
* sysdeps/unix/sysv/linux/aarch64/dl-cache.h (_DL_CACHE_DEFAULT_ID):
Define it to be the FLAG_AARCH64_LIB32 if compiling for ILP32.
(add_system_dir): Add libilp32 to the list of system directories.
* sysdeps/unix/sysv/linux/arm/readelflib.c (process_elf_file):
Handle ILP32 elf binaries.
---
elf/cache.c | 2 ++
sysdeps/generic/ldconfig.h | 1 +
sysdeps/unix/sysv/linux/aarch64/dl-cache.h | 13 ++++++++++++-
sysdeps/unix/sysv/linux/arm/readelflib.c | 4 +++-
4 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/elf/cache.c b/elf/cache.c
index 4cbf8d9..267214f 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -101,6 +101,8 @@ print_entry (const char *lib, int flag, unsigned int osversion,
case FLAG_AARCH64_LIB64:
fputs (",AArch64", stdout);
break;
+ case FLAG_AARCH64_LIB32:
+ fputs (",ILP32", stdout);
/* Uses the ARM soft-float ABI. */
case FLAG_ARM_LIBSF:
fputs (",soft-float", stdout);
diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h
index ba1d953..1dd8b4e 100644
--- a/sysdeps/generic/ldconfig.h
+++ b/sysdeps/generic/ldconfig.h
@@ -42,6 +42,7 @@
#define FLAG_MIPS_LIB32_NAN2008 0x0c00
#define FLAG_MIPS64_LIBN32_NAN2008 0x0d00
#define FLAG_MIPS64_LIBN64_NAN2008 0x0e00
+#define FLAG_AARCH64_LIB32 0x0f00
/* Name of auxiliary cache. */
#define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
index 32851d0..930aa20 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>
+#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/arm/readelflib.c b/sysdeps/unix/sysv/linux/arm/readelflib.c
index a15ebe4..e255fb0 100644
--- a/sysdeps/unix/sysv/linux/arm/readelflib.c
+++ b/sysdeps/unix/sysv/linux/arm/readelflib.c
@@ -41,7 +41,9 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
ret = process_elf32_file (file_name, lib, flag, osversion, soname,
file_contents, file_length);
- if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == EF_ARM_EABI_VER5)
+ if (!ret && elf_header->e_machine == EM_AARCH64)
+ *flag = FLAG_AARCH64_LIB32|FLAG_ELF_LIBC6;
+ else if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == EF_ARM_EABI_VER5)
{
if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_HARD)
*flag = FLAG_ARM_LIBHF|FLAG_ELF_LIBC6;
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 21/29] [AARCH64] Add ILP32 to makefiles
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (27 preceding siblings ...)
2014-10-27 8:03 ` [PATCH 28/29] [AARCH64] Add typesizes.h for ILP32 Andrew Pinski
@ 2014-10-27 8:03 ` Andrew Pinski
2014-10-28 20:14 ` Mike Frysinger
2014-10-28 9:15 ` [PATCH 00/29] Add Support for AARCH64:ILP32 Marcus Shawcroft
2015-05-26 13:37 ` Andreas Schwab
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:03 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
This patch adds ilp32 and ilp32_be as abi variants to the aarch64 linux
makefile.
* sysdeps/unix/sysv/linux/aarch64/Makefile (abi-variants): Add ilp32
and ilp32_be.
(abi-lp64-options): Add defining of LP64 and undef of ILP32 macros.
(abi-lp64-condition): Check word size macro also.
(abi-lp64_be-options): Add defining of LP64 and undef of ILP32 macros.
(abi-lp64_be-condition): Check word size macro also.
(abi-ilp32-options): Define.
(abi-ilp32-condition): Likewise.
(abi-ilp32_be-options): Define.
(abi-ilp32_be-condition): Likewise.
---
sysdeps/unix/sysv/linux/aarch64/Makefile | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/aarch64/Makefile b/sysdeps/unix/sysv/linux/aarch64/Makefile
index f2f28ee..dfb5cce 100644
--- a/sysdeps/unix/sysv/linux/aarch64/Makefile
+++ b/sysdeps/unix/sysv/linux/aarch64/Makefile
@@ -25,13 +25,21 @@ endif
abi-variants := lp64
abi-variants += lp64_be
+abi-variants += ilp32
+abi-variants += ilp32_be
ifeq (,$(filter $(default-abi),$(abi-variants)))
Unknown ABI, must be one of $(abi-variants)
endif
-abi-lp64-options := -U__AARCH64EB__
-abi-lp64-condition := !defined __AARCH64EB__
+abi-lp64-options := -U__AARCH64EB__ -D__LP64__ -U__ILP32__
+abi-lp64-condition := __WORDSIZE == 64 && !defined __AARCH64EB__
-abi-lp64_be-options := -D__AARCH64EB__
-abi-lp64_be-condition := defined __AARCH64EB__
+abi-lp64_be-options := -D__AARCH64EB__ -D__LP64__ -U__ILP32__
+abi-lp64_be-condition := __WORDSIZE == 64 && defined __AARCH64EB__
+
+abi-ilp32-options := -U__AARCH64EB__ -U__LP64__ -D__ILP32__
+abi-ilp32-condition := __WORDSIZE == 32 && !defined __AARCH64EB__
+
+abi-ilp32_be-options := -D__AARCH64EB__ -U__LP64__ -D__ILP32__
+abi-ilp32_be-condition := __WORDSIZE == 32 && defined __AARCH64EB__
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 17/29] [AARCH64] Syscalls for ILP32 are passed always via 64bit values.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (25 preceding siblings ...)
2014-10-27 8:03 ` [PATCH 14/29] [AARCH64] Use PTR_* in start.S Andrew Pinski
@ 2014-10-27 8:03 ` Andrew Pinski
2014-11-18 12:50 ` Will Newton
2014-10-27 8:03 ` [PATCH 28/29] [AARCH64] Add typesizes.h for ILP32 Andrew Pinski
` (3 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:03 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
This patch adds support for ILP32 syscalls, sign and zero extending
where needed. Unlike LP64, pointers are 32bit and need to be zero
extended rather than the standard sign extend that the code would do.
We take advatage of ssize_t being long rather than int for ILP32,
to get this correct.
* sysdeps/unix/sysv/linux/aarch64/sysdep.h
(INLINE_VSYSCALL): Use long long instead of long.
(INTERNAL_VSYSCALL): Likewise.
(INLINE_SYSCALL): Likewise.
(INTERNAL_SYSCALL_RAW): Likewise.
(ARGIFY): New macro.
(LOAD_ARGS_0): Use long long instead of long.
(LOAD_ARGS_1): Use long long instead of long
and use ARGIFY.
(LOAD_ARGS_2): Likewise.
(LOAD_ARGS_3): Likewise.
(LOAD_ARGS_4): Likewise.
(LOAD_ARGS_5): Likewise.
(LOAD_ARGS_6): Likewise.
(LOAD_ARGS_7): Likewise.
---
sysdeps/unix/sysv/linux/aarch64/sysdep.h | 52 ++++++++++++++++++-----------
1 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index fc31661..0d9fa8a 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -156,7 +156,7 @@
({ \
__label__ out; \
__label__ iserr; \
- long sc_ret; \
+ long long sc_ret; \
INTERNAL_SYSCALL_DECL (sc_err); \
\
if (__vdso_##name != NULL) \
@@ -187,7 +187,7 @@
# define INTERNAL_VSYSCALL(name, err, nr, args...) \
({ \
__label__ out; \
- long v_ret; \
+ long long v_ret; \
\
if (__vdso_##name != NULL) \
{ \
@@ -224,11 +224,11 @@
call. */
# undef INLINE_SYSCALL
# define INLINE_SYSCALL(name, nr, args...) \
- ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
+ ({ unsigned long long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
{ \
__set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
- _sys_result = (unsigned long) -1; \
+ _sys_result = (unsigned long long) -1; \
} \
(long) _sys_result; })
@@ -237,10 +237,10 @@
# undef INTERNAL_SYSCALL_RAW
# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
- ({ long _sys_result; \
+ ({ long long _sys_result; \
{ \
LOAD_ARGS_##nr (args) \
- register long _x8 asm ("x8") = (name); \
+ register long long _x8 asm ("x8") = (name); \
asm volatile ("svc 0 // syscall " # name \
: "=r" (_x0) : "r"(_x8) ASM_ARGS_##nr : "memory"); \
_sys_result = _x0; \
@@ -262,36 +262,48 @@
# undef INTERNAL_SYSCALL_ERRNO
# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
+/* Convert X to a long long, without losing any bits if it is one
+ already or warning if it is a 32-bit pointer. This zero extends
+ 32-bit pointers and sign extends other signed types. Note this only
+ works because ssize_t is long and short-short is promoted to int. */
+#define ARGIFY(X) \
+ ((unsigned long long) \
+ __builtin_choose_expr(__builtin_types_compatible_p(__typeof__(X), __typeof__((X) - (X))), \
+ (X), \
+ __builtin_choose_expr(__builtin_types_compatible_p(int, __typeof__((X) - (X))), \
+ (X), \
+ (unsigned long)(X))))
+
# define LOAD_ARGS_0() \
- register long _x0 asm ("x0");
+ register long long _x0 asm ("x0");
# define LOAD_ARGS_1(x0) \
- long _x0tmp = (long) (x0); \
+ long long _x0tmp = ARGIFY (x0); \
LOAD_ARGS_0 () \
_x0 = _x0tmp;
# define LOAD_ARGS_2(x0, x1) \
- long _x1tmp = (long) (x1); \
+ long long _x1tmp = ARGIFY (x1); \
LOAD_ARGS_1 (x0) \
- register long _x1 asm ("x1") = _x1tmp;
+ register long long _x1 asm ("x1") = _x1tmp;
# define LOAD_ARGS_3(x0, x1, x2) \
- long _x2tmp = (long) (x2); \
+ long long _x2tmp = ARGIFY (x2); \
LOAD_ARGS_2 (x0, x1) \
- register long _x2 asm ("x2") = _x2tmp;
+ register long long _x2 asm ("x2") = _x2tmp;
# define LOAD_ARGS_4(x0, x1, x2, x3) \
- long _x3tmp = (long) (x3); \
+ long long _x3tmp = ARGIFY (x3); \
LOAD_ARGS_3 (x0, x1, x2) \
- register long _x3 asm ("x3") = _x3tmp;
+ register long long _x3 asm ("x3") = _x3tmp;
# define LOAD_ARGS_5(x0, x1, x2, x3, x4) \
- long _x4tmp = (long) (x4); \
+ long long _x4tmp = ARGIFY (x4); \
LOAD_ARGS_4 (x0, x1, x2, x3) \
- register long _x4 asm ("x4") = _x4tmp;
+ register long long _x4 asm ("x4") = _x4tmp;
# define LOAD_ARGS_6(x0, x1, x2, x3, x4, x5) \
- long _x5tmp = (long) (x5); \
+ long long _x5tmp = ARGIFY (x5); \
LOAD_ARGS_5 (x0, x1, x2, x3, x4) \
- register long _x5 asm ("x5") = _x5tmp;
+ register long long _x5 asm ("x5") = _x5tmp;
# define LOAD_ARGS_7(x0, x1, x2, x3, x4, x5, x6)\
- long _x6tmp = (long) (x6); \
+ long long _x6tmp = ARGIFY (x6); \
LOAD_ARGS_6 (x0, x1, x2, x3, x4, x5) \
- register long _x6 asm ("x6") = _x6tmp;
+ register long long _x6 asm ("x6") = _x6tmp;
# define ASM_ARGS_0
# define ASM_ARGS_1 , "r" (_x0)
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 16/29] [AARCH64] Detect ILP32 in configure scripts.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (18 preceding siblings ...)
2014-10-27 8:00 ` [PATCH 06/29] Allow some fields of siginfo to be different from the generic one Andrew Pinski
@ 2014-10-27 8:03 ` Andrew Pinski
2014-10-27 18:05 ` Joseph S. Myers
2014-10-28 20:16 ` Mike Frysinger
2014-10-27 8:03 ` [PATCH 20/29] [AARCH64] Set up wordsize for ILP32 Andrew Pinski
` (10 subsequent siblings)
30 siblings, 2 replies; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:03 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
This adds detecting of ILP32 to the configure scripts.
Adding to preconfigure detection of ilp32 in preconfigure and then writing out the default-abi in configure.
* sysdeps/aarch64/preconfigure: Detect ILP32 and set aarch64_config_abi
to ilp32 for ilp32 and lp64 for lp64. Set machine to either
aarch64/ilp32 or aarch64/lp64 depending on the ABI that is selected.
* sysdeps/aarch64/configure.ac: Define HAVE_AARCH64_ILP32 if this is ILP32.
Set the default-abi to either ilp32, lp64, ilp32_be or lp64_be depending
on the ABI.
* sysdeps/aarch64/configure: Regenerate.
* sysdeps/unix/sysv/linux/aarch64/configure.ac: Set arch_minimum_kernel
to 3.19.0 for ILP32.
Set LIBC_SLIBDIR_RTLDDIR to libilp32/lib for ilp32.
* sysdeps/unix/sysv/linux/aarch64/configure: Regenerate.
---
sysdeps/aarch64/configure | 15 +++++++++++----
sysdeps/aarch64/configure.ac | 11 +++++++++--
sysdeps/aarch64/preconfigure | 11 ++++++++++-
sysdeps/unix/sysv/linux/aarch64/configure | 22 +++++++++++++++++++---
sysdeps/unix/sysv/linux/aarch64/configure.ac | 9 +++++++--
5 files changed, 56 insertions(+), 12 deletions(-)
mode change 100644 => 100755 sysdeps/aarch64/configure
mode change 100644 => 100755 sysdeps/unix/sysv/linux/aarch64/configure
diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
old mode 100644
new mode 100755
index 5bd355a..7dd56e8
--- a/sysdeps/aarch64/configure
+++ b/sysdeps/aarch64/configure
@@ -163,12 +163,19 @@ rm -f conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_aarch64_be" >&5
$as_echo "$libc_cv_aarch64_be" >&6; }
+
+if test $aarch64_config_abi = ilp32; then
+ $as_echo "#define HAVE_AARCH64_ILP32 1" >>confdefs.h
+
+fi
+
if test $libc_cv_aarch64_be = yes; then
$as_echo "#define HAVE_AARCH64_BE 1" >>confdefs.h
- config_vars="$config_vars
-default-abi = lp64_be"
+ libc_aarch64_be=_be
else
- config_vars="$config_vars
-default-abi = lp64"
+ libc_aarch64_be=
fi
+
+config_vars="$config_vars
+default-abi = ${aarch64_config_abi}${libc_aarch64_be}"
diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
index 7851dd4..9069325 100644
--- a/sysdeps/aarch64/configure.ac
+++ b/sysdeps/aarch64/configure.ac
@@ -14,9 +14,16 @@ AC_CACHE_CHECK([for big endian],
yes
#endif
], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)])
+
+if test $aarch64_config_abi = ilp32; then
+ AC_DEFINE(HAVE_AARCH64_ILP32)
+fi
+
if test $libc_cv_aarch64_be = yes; then
AC_DEFINE(HAVE_AARCH64_BE)
- LIBC_CONFIG_VAR([default-abi], [lp64_be])
+ libc_aarch64_be=_be
else
- LIBC_CONFIG_VAR([default-abi], [lp64])
+ libc_aarch64_be=
fi
+
+LIBC_CONFIG_VAR([default-abi], [${aarch64_config_abi}${libc_aarch64_be}])
diff --git a/sysdeps/aarch64/preconfigure b/sysdeps/aarch64/preconfigure
index d9bd1f8..4bcd8e3 100644
--- a/sysdeps/aarch64/preconfigure
+++ b/sysdeps/aarch64/preconfigure
@@ -1,6 +1,15 @@
case "$machine" in
aarch64*)
base_machine=aarch64
- machine=aarch64
+ case "$CC $CFLAGS $CPPFLAGS " in
+ *" -mabi=ilp32 "*) aarch64_config_abi=ilp32 ;;
+ *" -mabi=lp64 "*) aarch64_config_abi=lp64 ;;
+ *) aarch64_config_abi=default ;;
+ esac
+ case $aarch64_config_abi in
+ default) machine=aarch64/lp64 aarch64_config_abi=lp64 ;;
+ ilp32) machine=aarch64/ilp32 ;;
+ lp64) machine=aarch64/lp64 ;;
+ esac
;;
esac
diff --git a/sysdeps/unix/sysv/linux/aarch64/configure b/sysdeps/unix/sysv/linux/aarch64/configure
old mode 100644
new mode 100755
index 60230a2..59372d2
--- a/sysdeps/unix/sysv/linux/aarch64/configure
+++ b/sysdeps/unix/sysv/linux/aarch64/configure
@@ -1,9 +1,23 @@
# This file is generated from configure.ac by Autoconf. DO NOT EDIT!
# Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
-arch_minimum_kernel=3.7.0
-
-test -n "$libc_cv_slibdir" ||
+if test $aarch64_config_abi = ilp32; then
+ arch_minimum_kernel=3.19.0
+ test -n "$libc_cv_slibdir" ||
+case "$prefix" in
+/usr | /usr/)
+ libc_cv_slibdir=/libilp32
+ libc_cv_rtlddir=/lib
+ if test "$libdir" = '${exec_prefix}/lib'; then
+ libdir='${exec_prefix}/libilp32';
+ # Locale data can be shared between 32-bit and 64-bit libraries.
+ libc_cv_localedir='${exec_prefix}/lib/locale'
+ fi
+ ;;
+esac
+else
+ arch_minimum_kernel=3.7.0
+ test -n "$libc_cv_slibdir" ||
case "$prefix" in
/usr | /usr/)
libc_cv_slibdir=/lib64
@@ -15,3 +29,5 @@ case "$prefix" in
fi
;;
esac
+fi
+
diff --git a/sysdeps/unix/sysv/linux/aarch64/configure.ac b/sysdeps/unix/sysv/linux/aarch64/configure.ac
index 211fa9c..6526816 100644
--- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
+++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
@@ -1,6 +1,11 @@
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
# Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
-arch_minimum_kernel=3.7.0
+if test $aarch64_config_abi = ilp32; then
+ arch_minimum_kernel=3.19.0
+ LIBC_SLIBDIR_RTLDDIR([libilp32], [lib])
+else
+ arch_minimum_kernel=3.7.0
+ LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
+fi
-LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 26/29] [AARCH64] Add sigstack.h header for ILP32 reasons.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (21 preceding siblings ...)
2014-10-27 8:03 ` [PATCH 22/29] [AARCH64] Add support to ldconfig for ILP32 and libilp32 Andrew Pinski
@ 2014-10-27 8:03 ` Andrew Pinski
2014-11-18 14:49 ` Will Newton
2014-10-27 8:03 ` [PATCH 23/29] [AARCH64] Add ILP32 ld.so to the known interpreter names Andrew Pinski
` (7 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:03 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
ILP32 uses the same structure layout for sigaltstack as
LP64 so we need a special header file.
* sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h: New file.
---
sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h | 71 +++++++++++++++++++++++
1 files changed, 71 insertions(+), 0 deletions(-)
create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h b/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
new file mode 100644
index 0000000..2dd8f6b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
@@ -0,0 +1,71 @@
+/* sigstack, sigaltstack definitions.
+ Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SIGNAL_H
+# error "Never include this file directly. Use <signal.h> instead"
+#endif
+
+
+/* Structure describing a signal stack (obsolete). */
+struct sigstack
+ {
+ void *ss_sp; /* Signal stack pointer. */
+ int ss_onstack; /* Nonzero if executing on this stack. */
+ };
+
+
+/* Possible values for `ss_flags.'. */
+enum
+{
+ SS_ONSTACK = 1,
+#define SS_ONSTACK SS_ONSTACK
+ SS_DISABLE
+#define SS_DISABLE SS_DISABLE
+};
+
+/* Minimum stack size for a signal handler. */
+#define MINSIGSTKSZ 2048
+
+/* System default stack size. */
+#define SIGSTKSZ 8192
+
+
+/* Alternate, preferred interface.
+ This structure matches the same size and layout
+ for both ILP32 and LP64. */
+typedef struct sigaltstack
+ {
+#if defined(__ILP32__) && defined(__AARCH64EB__)
+ int __pad_ss_sp;
+#endif
+ void *ss_sp;
+#if defined(__ILP32__) && !defined(__AARCH64EB__)
+ int __pad_ss_sp;
+#endif
+ int ss_flags;
+#if defined(__ILP32__)
+ int __pad_after_ss_flags;
+#endif
+#if defined(__ILP32__) && defined(__AARCH64EB__)
+ int __pad_ss_size;
+#endif
+ size_t ss_size;
+#if defined(__ILP32__) && !defined(__AARCH64EB__)
+ int __pad_ss_size;
+#endif
+ } stack_t;
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 23/29] [AARCH64] Add ILP32 ld.so to the known interpreter names.
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (22 preceding siblings ...)
2014-10-27 8:03 ` [PATCH 26/29] [AARCH64] Add sigstack.h header for ILP32 reasons Andrew Pinski
@ 2014-10-27 8:03 ` Andrew Pinski
2014-11-18 14:26 ` Will Newton
2014-10-27 8:03 ` [PATCH 29/29] [AARCH64] Make lp64 and ilp32 directories Andrew Pinski
` (6 subsequent siblings)
30 siblings, 1 reply; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:03 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
This patch adds ILP32 ld.so names to the known interpreter names.
* sysdeps/unix/sysv/linux/aarch64/ldconfig.h (SYSDEP_KNOWN_INTERPRETER_NAMES):
Add ilp32 ld.so names.
---
sysdeps/unix/sysv/linux/aarch64/ldconfig.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
index b0e6b6a..a70eafc 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 \
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* [PATCH 28/29] [AARCH64] Add typesizes.h for ILP32
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (26 preceding siblings ...)
2014-10-27 8:03 ` [PATCH 17/29] [AARCH64] Syscalls for ILP32 are passed always via 64bit values Andrew Pinski
@ 2014-10-27 8:03 ` Andrew Pinski
2014-10-27 16:32 ` Chris Metcalf
2014-10-28 20:06 ` Mike Frysinger
2014-10-27 8:03 ` [PATCH 21/29] [AARCH64] Add ILP32 to makefiles Andrew Pinski
` (2 subsequent siblings)
30 siblings, 2 replies; 73+ messages in thread
From: Andrew Pinski @ 2014-10-27 8:03 UTC (permalink / raw)
To: libc-alpha; +Cc: Andrew Pinski
The generic typesizes does not work for ILP32 as the kernel long type
needs to be long long (quad). time_t, off_t, clock_t, suseconds_t,
ino_t, rlim_t are 64bits.
FDSET bitmask is a 64bit type.
* sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h: New file.
---
sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h | 135 ++++++++++++++++++++++
1 files changed, 135 insertions(+), 0 deletions(-)
create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
new file mode 100644
index 0000000..f8e3206
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
@@ -0,0 +1,135 @@
+/* bits/typesizes.h -- underlying types for *_t. Linux/AARCh64 version.
+ Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef _BITS_TYPESIZES_H
+#define _BITS_TYPESIZES_H 1
+
+/* See <bits/types.h> for the meaning of these macros. This file exists so
+ that <bits/types.h> need not vary across different GNU platforms. */
+
+/* ILP32 kernel interface is 64-bit. */
+#ifndef __LP64__
+# define __SYSCALL_SLONG_TYPE __SQUAD_TYPE
+# define __SYSCALL_ULONG_TYPE __UQUAD_TYPE
+#else
+# define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE
+# define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE
+#endif
+#define __DEV_T_TYPE __UQUAD_TYPE
+#define __UID_T_TYPE __U32_TYPE
+#define __GID_T_TYPE __U32_TYPE
+#define __INO_T_TYPE __SYSCALL_ULONG_TYPE
+#define __INO64_T_TYPE __UQUAD_TYPE
+#define __MODE_T_TYPE __U32_TYPE
+#define __NLINK_T_TYPE __U32_TYPE
+#define __OFF_T_TYPE __SYSCALL_SLONG_TYPE
+#define __OFF64_T_TYPE __SQUAD_TYPE
+#define __PID_T_TYPE __S32_TYPE
+#define __RLIM_T_TYPE __SYSCALL_ULONG_TYPE
+#define __RLIM64_T_TYPE __UQUAD_TYPE
+#define __BLKCNT_T_TYPE __SYSCALL_SLONG_TYPE
+#define __BLKCNT64_T_TYPE __SQUAD_TYPE
+#define __FSBLKCNT_T_TYPE __SYSCALL_ULONG_TYPE
+#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
+#define __FSFILCNT_T_TYPE __SYSCALL_ULONG_TYPE
+#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
+#define __FSWORD_T_TYPE __SYSCALL_SLONG_TYPE
+#define __ID_T_TYPE __U32_TYPE
+#define __CLOCK_T_TYPE __SYSCALL_SLONG_TYPE
+#define __TIME_T_TYPE __SYSCALL_SLONG_TYPE
+#define __USECONDS_T_TYPE __U32_TYPE
+#define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE
+#define __DADDR_T_TYPE __S32_TYPE
+#define __SWBLK_T_TYPE __SYSCALL_SLONG_TYPE
+#define __KEY_T_TYPE __S32_TYPE
+#define __CLOCKID_T_TYPE __S32_TYPE
+#define __TIMER_T_TYPE void *
+#define __BLKSIZE_T_TYPE __S32_TYPE
+#define __FSID_T_TYPE struct { int __val[2]; }
+#define __SSIZE_T_TYPE __SLONGWORD_TYPE
+
+/* Number of descriptors that can fit in an `fd_set'. */
+#define __FD_SETSIZE 1024
+
+/* Tell the libc code that off_t and off64_t are actually the same type
+ for all ABI purposes, even if possibly expressed as different base types
+ for C type-checking purposes. */
+#define __OFF_T_MATCHES_OFF64_T 1
+
+/* Same for ino_t and ino64_t. */
+#define __INO_T_MATCHES_INO64_T 1
+
+/* Same for __blkcnt_t and __blkcnt64_t. */
+#define __BLKCNT_T_TYPE_MATCHES_BLKCNT64_T_TYPE 1
+
+/* Same for __fsblkcnt_t and __fsblkcnt64_t. */
+#define __FSBLKCNT_T_TYPE_MATCHES_FSBLKCNT64_T_TYPE 1
+
+/* Same for __fsfilcnt_t and __fsfilcnt64_t. */
+#define __FSFILCNT_T_TYPE_MATCHES_FSFILCNT64_T_TYPE 1
+
+/* LP32 needs some padding in some cases */
+
+#ifndef __LP64__
+
+# undef __SIGINFO_INNER
+# ifdef __AARCH64EB__
+# define __SIGINFO_INNER(type, field) \
+ __extension__ struct { \
+ int __pad_##field; \
+ type field; \
+ } __attribute__((aligned(8) ))
+# else
+# define __SIGINFO_INNER(type, field) \
+ __extension__ struct { \
+ type field; \
+ int __pad_##field; \
+ } __attribute__((aligned(8) ))
+# endif
+
+# define __RUSAGE_LONG(__field) \
+ __SIGINFO_INNER(long, __field)
+
+# define __SHMID_DS_SIZE_TYPE(__field) \
+ __SIGINFO_INNER(size_t, __field)
+
+# undef __SIGINFO_VOIDPTR
+# define __SIGINFO_VOIDPTR(field) \
+ __SIGINFO_INNER(void*, field)
+
+# undef __SIGINFO_BAND
+# define __SIGINFO_BAND(field) \
+ __SIGINFO_INNER(long, field)
+
+#define __SIGSET_INNER_T __SYSCALL_ULONG_TYPE
+#define __FD_MASK_TYPE __SYSCALL_SLONG_TYPE
+#define __FD_MASK_CONST(a) (__extension__ a##ull)
+#endif
+
+
+#define __IPC_TIME_T_64_BITS
+
+#define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
+
+
+#endif /* bits/typesizes.h */
--
1.7.2.5
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 08/29] [AARCH64] Add header guards to sysdep.h headers.
2014-10-27 8:00 ` [PATCH 08/29] [AARCH64] Add header guards to sysdep.h headers Andrew Pinski
@ 2014-10-27 16:32 ` Chris Metcalf
0 siblings, 0 replies; 73+ messages in thread
From: Chris Metcalf @ 2014-10-27 16:32 UTC (permalink / raw)
To: Andrew Pinski, libc-alpha
On 10/27/2014 3:59 AM, Andrew Pinski wrote:
> * sysdeps/aarch64/sysdep.h: Add header guards.
>
> [AARCH64] Remove 64 from some relocation names as they have been renamed in later versions of the spec.
>
> The AARCH64 elf ABI spec renamed some relocations removing 64 from the TLS
> relocation names to make them constaint with the ILP32 named ones.
>
> * elf/elf.h (R_AARCH64_TLS_DTPMOD64): Rename to ..
> (R_AARCH64_TLS_DTPMOD): This.
> (R_AARCH64_TLS_DTPREL64): Rename to ...
> (R_AARCH64_TLS_DTPREL): This.
> (R_AARCH64_TLS_TPREL64): Rename to ...
> (R_AARCH64_TLS_TPREL): This.
> * sysdeps/aarch64/dl-machine.h (elf_machine_type_class): Update
> R_AARCH64_TLS_DTPMOD64, R_AARCH64_TLS_DTPREL64, and R_AARCH64_TLS_TPREL64.
> (elf_machine_rela): Likewise.
>
> [AARCH64] Fix pltenter and pltexit for ILP32.
>
> * sysdeps/aarch64/bits/link.h (la_aarch64_gnu_pltenter): Use
> ElfW macro instead of hardcoded Elf64 types.
The git commit subject is too narrow and should also cover the other changes here, or more likely, you should break the sysdep.h header guard change into a separate change from the "64" suffix removal stuff for the elf.h headers.
That said, why exactly do you need header guards on sysdep.h? A quick audit suggests that some versions of sysdep.h do, some don't, so it feels like we have some confusion in the glibc build system such that this situation has developed. It would be nice to have a standard that we should, or should not, have header guards on this header.
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 28/29] [AARCH64] Add typesizes.h for ILP32
2014-10-27 8:03 ` [PATCH 28/29] [AARCH64] Add typesizes.h for ILP32 Andrew Pinski
@ 2014-10-27 16:32 ` Chris Metcalf
2014-10-28 20:06 ` Mike Frysinger
1 sibling, 0 replies; 73+ messages in thread
From: Chris Metcalf @ 2014-10-27 16:32 UTC (permalink / raw)
To: Andrew Pinski, libc-alpha
On 10/27/2014 3:59 AM, Andrew Pinski wrote:
> +# undef __SIGINFO_INNER
> +# ifdef __AARCH64EB__
> +# define __SIGINFO_INNER(type, field) \
> + __extension__ struct { \
> + int __pad_##field; \
> + type field; \
> + } __attribute__((aligned(8) ))
Since __SIGINFO_INNER is used for a bunch of non-siginfo purposes in this header, I think it would be clearer to define some more generic name (__TYPESIZES_PAD32 or whatever) and then use that name throughout.
In fact I wonder if it would be clearer to require that type (bomb the typesizes.h headers) and just use it directly in places like the linux-generic "struct shmid_ds", etc. The "64-bit everywhere" model seems to be the new standard (x32 and now aarch64 compat) so we may want to think forward.
A more standard macro model for this would also moot your __RUSAGE_LONG #ifndef (along with __SIGINFO_VOIDPTR, __SIGINFO_BAND, your hand-rolled "struct sigaltstack" and "struct ucontext", etc), and you could just directly use the now-standard macro in that spot. The more I think about it the more it seems like it does less damage to the header files to switch to a single common macro defined for all platforms that captures ILP32 and endianness conversions from kernel data structures.
Arguably I should have done this originally for linux-generic, but now that we have another 32-bit case to handle here, I think it's time for a more general solution.
> [...]
> +
> +#define __SIGSET_INNER_T __SYSCALL_ULONG_TYPE
> +#define __FD_MASK_TYPE __SYSCALL_SLONG_TYPE
> +#define __FD_MASK_CONST(a) (__extension__ a##ull)
> +#endif
Missing indent for these #defines.
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 03/29] Add ability for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.) to have time_t being 64bit
2014-10-27 8:00 ` [PATCH 03/29] Add ability for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.) to have time_t being 64bit Andrew Pinski
@ 2014-10-27 16:32 ` Chris Metcalf
2014-11-18 10:57 ` Will Newton
1 sibling, 0 replies; 73+ messages in thread
From: Chris Metcalf @ 2014-10-27 16:32 UTC (permalink / raw)
To: Andrew Pinski, libc-alpha
On 10/27/2014 3:59 AM, Andrew Pinski wrote:
> The generic headers for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.)
> already have the ability to already take account time_t being 64bit but only
> if WORDSIZE is set 64. Also for AARCH64:ILP32, we want these structures to
> match up with the LP64 size, so we add change the all of the unsigned long
> types in these headers to be __syscall_ulong_t. Also there is one size_t
> field which we need to be changed for AARCH64:ILP32 so we add
> a macro which can be changed but defaulting to size_t.
Looks good to me.
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 05/29] Allow fd_mask type not be an array of long.
2014-10-27 8:00 ` [PATCH 05/29] Allow fd_mask type not be an array of long Andrew Pinski
@ 2014-10-27 16:32 ` Chris Metcalf
2014-11-18 11:24 ` Will Newton
0 siblings, 1 reply; 73+ messages in thread
From: Chris Metcalf @ 2014-10-27 16:32 UTC (permalink / raw)
To: Andrew Pinski, libc-alpha
On 10/27/2014 3:59 AM, Andrew Pinski wrote:
> +/* The fd_set member is required to be an array of longs by XPG4.2. */
So on aarch64 compat it's now an array of long longs. Is this a problem? Would it be better to make it an array of longs but twice as many longs on ILP32 as on LP64? I suppose this becomes problematic when supporting big-endian, though. But it would be good to address the XPG4.2 issue somewhere in the headers.
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 07/29] Allow generic stat and statfs not have padding for 32bit targets
2014-10-27 8:00 ` [PATCH 07/29] Allow generic stat and statfs not have padding for 32bit targets Andrew Pinski
@ 2014-10-27 16:32 ` Chris Metcalf
0 siblings, 0 replies; 73+ messages in thread
From: Chris Metcalf @ 2014-10-27 16:32 UTC (permalink / raw)
To: Andrew Pinski, libc-alpha
On 10/27/2014 3:59 AM, Andrew Pinski wrote:
> --- a/sysdeps/unix/sysv/linux/generic/bits/stat.h
> +++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h
> @@ -42,7 +42,10 @@
>
> #if defined __USE_FILE_OFFSET64
> # define __field64(type, type64, name) type64 name
> -#elif __WORDSIZE == 64
> +#elif __WORDSIZE == 64 \
> + || (defined(__OFF_T_MATCHES_OFF64_T) \
> + && defined(__INO_T_MATCHES_INO64_T) \
> + && defined (__BLKCNT_T_TYPE_MATCHES_BLKCNT64_T_TYPE))
I'm somewhat skeptical of this approach. I suspect it would be better to have a single #define that says "hey, I use 64-bit kernel types for long" and then use that. If you (for some reason) had ino match ino64, but not off_t match off64_t, this header would then break for ino_t, as far as I can see. It seems better to take the simpler approach, and if some later architecture somehow wants finer granularity, let it be their problem to tease apart the different types here.
This single #define would then also feed into my proposed standard __TYPESIZES_PAD32 macro, or whatever it ends up being called.
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 01/29] [AARCH64] Fix utmp struct for compatibility reasons.
2014-10-27 8:00 ` [PATCH 01/29] [AARCH64] Fix utmp struct for compatibility reasons Andrew Pinski
@ 2014-10-27 17:57 ` Joseph S. Myers
2014-10-27 21:18 ` Andreas Schwab
0 siblings, 1 reply; 73+ messages in thread
From: Joseph S. Myers @ 2014-10-27 17:57 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On Mon, 27 Oct 2014, Andrew Pinski wrote:
> NOTE This is an ABI change for AARCH64.
Shouldn't that imply symbol version changes for affected functions (I'm
not sure how much compat functions at the old versions could do, given
there's a file format change involved here, but it still seems prudent to
avoid binaries expecting the new format running the libc built for the old
format), and warnings in NEWS?
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 16/29] [AARCH64] Detect ILP32 in configure scripts.
2014-10-27 8:03 ` [PATCH 16/29] [AARCH64] Detect ILP32 in configure scripts Andrew Pinski
@ 2014-10-27 18:05 ` Joseph S. Myers
2014-10-28 20:16 ` Mike Frysinger
1 sibling, 0 replies; 73+ messages in thread
From: Joseph S. Myers @ 2014-10-27 18:05 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On Mon, 27 Oct 2014, Andrew Pinski wrote:
> diff --git a/sysdeps/aarch64/preconfigure b/sysdeps/aarch64/preconfigure
> index d9bd1f8..4bcd8e3 100644
> --- a/sysdeps/aarch64/preconfigure
> +++ b/sysdeps/aarch64/preconfigure
> @@ -1,6 +1,15 @@
> case "$machine" in
> aarch64*)
> base_machine=aarch64
> - machine=aarch64
> + case "$CC $CFLAGS $CPPFLAGS " in
> + *" -mabi=ilp32 "*) aarch64_config_abi=ilp32 ;;
> + *" -mabi=lp64 "*) aarch64_config_abi=lp64 ;;
> + *) aarch64_config_abi=default ;;
> + esac
> + case $aarch64_config_abi in
> + default) machine=aarch64/lp64 aarch64_config_abi=lp64 ;;
It would seem better to test how the compiler behaves (what it
predefines), as now done for MIPS, so that this works with a compiler
configured --with-abi=ilp32 without needing to add an explicit ABI option
to CC or CFLAGS.
> diff --git a/sysdeps/unix/sysv/linux/aarch64/configure.ac b/sysdeps/unix/sysv/linux/aarch64/configure.ac
> index 211fa9c..6526816 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
> +++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
> @@ -1,6 +1,11 @@
> GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
> # Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
>
> -arch_minimum_kernel=3.7.0
> +if test $aarch64_config_abi = ilp32; then
> + arch_minimum_kernel=3.19.0
Since 3.19 doesn't yet exist, this should be 10.0.0 (following the MIPS
NaN2008 precedent) until the ILP32 support goes into Linus's git tree,
after which it can be set to the actual version in which ILP32 support
appears.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 29/29] [AARCH64] Make lp64 and ilp32 directories.
2014-10-27 8:03 ` [PATCH 29/29] [AARCH64] Make lp64 and ilp32 directories Andrew Pinski
@ 2014-10-27 18:07 ` Joseph S. Myers
0 siblings, 0 replies; 73+ messages in thread
From: Joseph S. Myers @ 2014-10-27 18:07 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On Mon, 27 Oct 2014, Andrew Pinski wrote:
> The patch makes the ilp32 and lp64 have their own directory under aarch64.
> Since ILP32 uses most of the same system calls as LP64 and has a 64bit
> off_t, we need make the functions that end in 64 the same as the ones without.
> We also need not to special case ioctl or use the already provided mmap.c file.
I'd expect you to need to move the ABI test baselines to the lp64
directory, and to add new baselines for ILP32 in the corresponding
directory, but I don't see that in this patch series. What do your glibc
test results look like? (I don't know if c++-types.data needs to move and
have an ILP32 version as well, but I'd guess at least some affected types
are different and so it does.)
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 02/29] Allow sigset be an array of a different type
2014-10-27 8:00 ` [PATCH 02/29] Allow sigset be an array of a different type Andrew Pinski
@ 2014-10-27 20:32 ` Roland McGrath
0 siblings, 0 replies; 73+ messages in thread
From: Roland McGrath @ 2014-10-27 20:32 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
Is there a reason this shouldn't just use __syscall_ulong_t?
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 09/29] Add dynamic ILP32 AARCH64 relocations to elf.h
2014-10-27 8:00 ` [PATCH 09/29] Add dynamic ILP32 AARCH64 relocations to elf.h Andrew Pinski
@ 2014-10-27 20:36 ` Roland McGrath
0 siblings, 0 replies; 73+ messages in thread
From: Roland McGrath @ 2014-10-27 20:36 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
Send the elf.h change separately and not in any long series. It can go in
as soon as official names/values are pretty well certain and are already
used in trunk binutils.
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 01/29] [AARCH64] Fix utmp struct for compatibility reasons.
2014-10-27 17:57 ` Joseph S. Myers
@ 2014-10-27 21:18 ` Andreas Schwab
0 siblings, 0 replies; 73+ messages in thread
From: Andreas Schwab @ 2014-10-27 21:18 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: Andrew Pinski, libc-alpha
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> On Mon, 27 Oct 2014, Andrew Pinski wrote:
>
>> NOTE This is an ABI change for AARCH64.
>
> Shouldn't that imply symbol version changes for affected functions (I'm
> not sure how much compat functions at the old versions could do, given
> there's a file format change involved here, but it still seems prudent to
> avoid binaries expecting the new format running the libc built for the old
> format), and warnings in NEWS?
IIRC we already had such a migration in 2002.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 00/29] Add Support for AARCH64:ILP32
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (28 preceding siblings ...)
2014-10-27 8:03 ` [PATCH 21/29] [AARCH64] Add ILP32 to makefiles Andrew Pinski
@ 2014-10-28 9:15 ` Marcus Shawcroft
2015-05-26 13:37 ` Andreas Schwab
30 siblings, 0 replies; 73+ messages in thread
From: Marcus Shawcroft @ 2014-10-28 9:15 UTC (permalink / raw)
To: Andrew Pinski; +Cc: GNU C Library
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
>
> This patch series adds AARCH64:ILP32 support to glibc.
> The first patch fixes a bug and it should go in even without the rest
> of the patches being approved.
>
> The next 6 patches are common/generic changes to allow AARCH64 to
> use the generic headers rather than a copy of its own.
Andrew, I'm away from the office this week, I'll look at your patches
when I get back next week. Cheers /Marcus
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 04/29] Allow rusage work on a big-endian 32bit-on-64bit target
2014-10-27 8:00 ` [PATCH 04/29] Allow rusage work on a big-endian 32bit-on-64bit target Andrew Pinski
@ 2014-10-28 20:05 ` Mike Frysinger
0 siblings, 0 replies; 73+ messages in thread
From: Mike Frysinger @ 2014-10-28 20:05 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 721 bytes --]
On 27 Oct 2014 00:59, Andrew Pinski wrote:
> +#ifndef __RUSAGE_LONG
> +/* This definition works where __syscall_slong_t is the same as 'long int'
> + and on little-endian when __syscall_slong_t is not 'long int' like x32. */
two spaces after the period
> +# define __RUSAGE_LONG(__field) \
there's a bad space after the ) and before the tabs
> + __extension__ union \
> + { \
> + long int __field; \
> + __syscall_slong_t __##__field##_word; \
> + }
couldn't we also handle big endian here ? we check __BYTE_ORDER in many common
headers, so seems like we should be able to also provide a sensible default
here.
otherwise, i like the clean up in this file.
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 28/29] [AARCH64] Add typesizes.h for ILP32
2014-10-27 8:03 ` [PATCH 28/29] [AARCH64] Add typesizes.h for ILP32 Andrew Pinski
2014-10-27 16:32 ` Chris Metcalf
@ 2014-10-28 20:06 ` Mike Frysinger
1 sibling, 0 replies; 73+ messages in thread
From: Mike Frysinger @ 2014-10-28 20:06 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 131 bytes --]
On 27 Oct 2014 00:59, Andrew Pinski wrote:
> +#define __ID_T_TYPE __U32_TYPE
should be a space after the define, not a tab
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 27/29] [AARCH64] Fix up ucontext for ILP32
2014-10-27 8:00 ` [PATCH 27/29] [AARCH64] Fix up ucontext for ILP32 Andrew Pinski
@ 2014-10-28 20:10 ` Mike Frysinger
2014-11-18 14:54 ` Will Newton
1 sibling, 0 replies; 73+ messages in thread
From: Mike Frysinger @ 2014-10-28 20:10 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 806 bytes --]
On 27 Oct 2014 00:59, Andrew Pinski wrote:
> --- a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
> @@ -46,8 +46,14 @@ typedef struct sigcontext mcontext_t;
> /* Userlevel context. */
> typedef struct ucontext
> {
> - unsigned long uc_flags;
> - struct ucontext *uc_link;
> + __SYSCALL_ULONG_TYPE uc_flags;
> +#if defined(__ILP32__) && defined(__AARCH64EB__)
> + int __pad_uc_link;
> +#endif
> + struct ucontext *uc_link;
> +#if defined(__ILP32__) && !defined(__AARCH64EB__)
> + int __pad_uc_link;
> +#endif
would it be better to leverage the common __BYTE_ORDER ? would make it easier
for other people to make changes and be confident on not screwing up if we used
the same set of defines ...
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 21/29] [AARCH64] Add ILP32 to makefiles
2014-10-27 8:03 ` [PATCH 21/29] [AARCH64] Add ILP32 to makefiles Andrew Pinski
@ 2014-10-28 20:14 ` Mike Frysinger
2014-10-28 22:46 ` Joseph S. Myers
0 siblings, 1 reply; 73+ messages in thread
From: Mike Frysinger @ 2014-10-28 20:14 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 924 bytes --]
On 27 Oct 2014 00:59, Andrew Pinski wrote:
> -abi-lp64-options := -U__AARCH64EB__
> -abi-lp64-condition := !defined __AARCH64EB__
> +abi-lp64-options := -U__AARCH64EB__ -D__LP64__ -U__ILP32__
> +abi-lp64-condition := __WORDSIZE == 64 && !defined __AARCH64EB__
>
> -abi-lp64_be-options := -D__AARCH64EB__
> -abi-lp64_be-condition := defined __AARCH64EB__
> +abi-lp64_be-options := -D__AARCH64EB__ -D__LP64__ -U__ILP32__
> +abi-lp64_be-condition := __WORDSIZE == 64 && defined __AARCH64EB__
> +
> +abi-ilp32-options := -U__AARCH64EB__ -U__LP64__ -D__ILP32__
> +abi-ilp32-condition := __WORDSIZE == 32 && !defined __AARCH64EB__
> +
> +abi-ilp32_be-options := -D__AARCH64EB__ -U__LP64__ -D__ILP32__
> +abi-ilp32_be-condition := __WORDSIZE == 32 && defined __AARCH64EB__
why all this CPP magic ? shouldn't the compiler be producing the right objects
in the first place with all the right defines ?
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 16/29] [AARCH64] Detect ILP32 in configure scripts.
2014-10-27 8:03 ` [PATCH 16/29] [AARCH64] Detect ILP32 in configure scripts Andrew Pinski
2014-10-27 18:05 ` Joseph S. Myers
@ 2014-10-28 20:16 ` Mike Frysinger
2014-10-28 20:18 ` Andrew Pinski
1 sibling, 1 reply; 73+ messages in thread
From: Mike Frysinger @ 2014-10-28 20:16 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 699 bytes --]
On 27 Oct 2014 00:59, Andrew Pinski wrote:
> --- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
> +++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
> @@ -1,6 +1,11 @@
> GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
> # Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
>
> -arch_minimum_kernel=3.7.0
> +if test $aarch64_config_abi = ilp32; then
> + arch_minimum_kernel=3.19.0
> + LIBC_SLIBDIR_RTLDDIR([libilp32], [lib])
"libilp32" is pretty ugly. why not something simpler ? MIPS n32 uses "lib32"
(since o32 is "lib" and n64 is "lib64"). seems reasonable to also use "lib32"
here and make the next 32bit ABI pick an uglier name.
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 16/29] [AARCH64] Detect ILP32 in configure scripts.
2014-10-28 20:16 ` Mike Frysinger
@ 2014-10-28 20:18 ` Andrew Pinski
0 siblings, 0 replies; 73+ messages in thread
From: Andrew Pinski @ 2014-10-28 20:18 UTC (permalink / raw)
To: Andrew Pinski, GNU C Library
On Tue, Oct 28, 2014 at 1:16 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 27 Oct 2014 00:59, Andrew Pinski wrote:
>> --- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
>> +++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
>> @@ -1,6 +1,11 @@
>> GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>> # Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
>>
>> -arch_minimum_kernel=3.7.0
>> +if test $aarch64_config_abi = ilp32; then
>> + arch_minimum_kernel=3.19.0
>> + LIBC_SLIBDIR_RTLDDIR([libilp32], [lib])
>
> "libilp32" is pretty ugly. why not something simpler ? MIPS n32 uses "lib32"
> (since o32 is "lib" and n64 is "lib64"). seems reasonable to also use "lib32"
> here and make the next 32bit ABI pick an uglier name.
I had used lib32 but the maintainers had asked to move it over to
libilp32 when I submitted the GCC patches:
https://gcc.gnu.org/ml/gcc-patches/2013-12/msg00282.html
Thanks,
Andrew Pinski
> -mike
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 21/29] [AARCH64] Add ILP32 to makefiles
2014-10-28 20:14 ` Mike Frysinger
@ 2014-10-28 22:46 ` Joseph S. Myers
0 siblings, 0 replies; 73+ messages in thread
From: Joseph S. Myers @ 2014-10-28 22:46 UTC (permalink / raw)
To: Mike Frysinger; +Cc: Andrew Pinski, libc-alpha
On Tue, 28 Oct 2014, Mike Frysinger wrote:
> On 27 Oct 2014 00:59, Andrew Pinski wrote:
> > -abi-lp64-options := -U__AARCH64EB__
> > -abi-lp64-condition := !defined __AARCH64EB__
> > +abi-lp64-options := -U__AARCH64EB__ -D__LP64__ -U__ILP32__
> > +abi-lp64-condition := __WORDSIZE == 64 && !defined __AARCH64EB__
> >
> > -abi-lp64_be-options := -D__AARCH64EB__
> > -abi-lp64_be-condition := defined __AARCH64EB__
> > +abi-lp64_be-options := -D__AARCH64EB__ -D__LP64__ -U__ILP32__
> > +abi-lp64_be-condition := __WORDSIZE == 64 && defined __AARCH64EB__
> > +
> > +abi-ilp32-options := -U__AARCH64EB__ -U__LP64__ -D__ILP32__
> > +abi-ilp32-condition := __WORDSIZE == 32 && !defined __AARCH64EB__
> > +
> > +abi-ilp32_be-options := -D__AARCH64EB__ -U__LP64__ -D__ILP32__
> > +abi-ilp32_be-condition := __WORDSIZE == 32 && defined __AARCH64EB__
>
> why all this CPP magic ? shouldn't the compiler be producing the right objects
> in the first place with all the right defines ?
abi-$(variant)-options is used to generate bits/syscall.h, with a single
glibc install generating a version of bits/syscall.h suitable for all
ABIs. This means that a compiler with options set up to generate code for
one ABI needs to be forced to define macros that make asm/unistd.h define
the syscall macros for another ABI.
If we moved bits/syscall.h to the same approach as gnu/stubs.h and
gnu/lib-names.h (a glibc build only generates a full header for its own
ABI, and a wrapper that selects such a header depending on the ABI in
use), it should no longer be necessary to have abi-$(variant)-options
variables at all.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 03/29] Add ability for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.) to have time_t being 64bit
2014-10-27 8:00 ` [PATCH 03/29] Add ability for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.) to have time_t being 64bit Andrew Pinski
2014-10-27 16:32 ` Chris Metcalf
@ 2014-11-18 10:57 ` Will Newton
1 sibling, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 10:57 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> The generic headers for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.)
> already have the ability to already take account time_t being 64bit but only
> if WORDSIZE is set 64. Also for AARCH64:ILP32, we want these structures to
> match up with the LP64 size, so we add change the all of the unsigned long
> types in these headers to be __syscall_ulong_t. Also there is one size_t
> field which we need to be changed for AARCH64:ILP32 so we add
> a macro which can be changed but defaulting to size_t.
>
> * sysdeps/unix/sysv/linux/generic/bits/msq.h (msgqnum_t): Change to
> __syscall_ulong_t.
> (msglen_t): Likewise.
> (__IPC_TIME_T_64_BITS): Define if not defined already and WORDSIZE
> is 64.
> (struct msqid_ds): Change WORD_SIZE check to check __IPC_TIME_T_64_BITS.
> Also change some unsigned long fields to __syscall_ulong_t.
> * sysdeps/unix/sysv/linux/generic/bits/sem.h (__IPC_TIME_T_64_BITS):
> Define if not defined already and WORDSIZE is 64.
> (struct semid_ds): Change WORD_SIZE check to check __IPC_TIME_T_64_BITS.
> Also change some unsigned long fields to __syscall_ulong_t.
> * sysdeps/unix/sysv/linux/generic/bits/shm.h (__IPC_TIME_T_64_BITS):
> Define if not defined already and WORDSIZE is 64.
> (__SHMID_DS_SIZE_TYPE): Define if not already defined.
> (struct shmid_ds): Change WORD_SIZE check to check __IPC_TIME_T_64_BITS.
> Change shm_segsz definition to be based on __SHMID_DS_SIZE_TYPE.
> Also change some unsigned long fields to __syscall_ulong_t.
> (struct shminfo): change some unsigned long fields to __syscall_ulong_t.
> (struct shm_info): Likewise.
> ---
> sysdeps/unix/sysv/linux/generic/bits/msq.h | 21 +++++++----
> sysdeps/unix/sysv/linux/generic/bits/sem.h | 14 +++++---
> sysdeps/unix/sysv/linux/generic/bits/shm.h | 50 ++++++++++++++++------------
> 3 files changed, 51 insertions(+), 34 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/generic/bits/msq.h b/sysdeps/unix/sysv/linux/generic/bits/msq.h
> index f3fcd8d..df5128e 100644
> --- a/sysdeps/unix/sysv/linux/generic/bits/msq.h
> +++ b/sysdeps/unix/sysv/linux/generic/bits/msq.h
> @@ -31,8 +31,13 @@
> #endif
>
> /* Types used in the structure definition. */
> -typedef unsigned long int msgqnum_t;
> -typedef unsigned long int msglen_t;
> +typedef __syscall_ulong_t msgqnum_t;
> +typedef __syscall_ulong_t msglen_t;
> +
> +#if !defined(__IPC_TIME_T_64_BITS) && __WORDSIZE == 64
> +#define __IPC_TIME_T_64_BITS
> +#endif
> +
Can we use __WORDSIZE_TIME64_COMPAT32 for this? It seems like more
than IPC might care about time_t being 64bit.
The #define needs indenting.
>
> /* Structure of record for one message inside the kernel.
> The type `struct msg' is opaque. */
> @@ -40,24 +45,24 @@ struct msqid_ds
> {
> struct ipc_perm msg_perm; /* structure describing operation permission */
> __time_t msg_stime; /* time of last msgsnd command */
> -#if __WORDSIZE == 32
> +#ifndef __IPC_TIME_T_64_BITS
Practice now seems to be to use #if rather than #ifdef.
Similar comments apply to the other files.
> unsigned long int __glibc_reserved1;
> #endif
> __time_t msg_rtime; /* time of last msgrcv command */
> -#if __WORDSIZE == 32
> +#ifndef __IPC_TIME_T_64_BITS
> unsigned long int __glibc_reserved2;
> #endif
> __time_t msg_ctime; /* time of last change */
> -#if __WORDSIZE == 32
> +#ifndef __IPC_TIME_T_64_BITS
> unsigned long int __glibc_reserved3;
> #endif
> - unsigned long int __msg_cbytes; /* current number of bytes on queue */
> + __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */
> msgqnum_t msg_qnum; /* number of messages currently on queue */
> msglen_t msg_qbytes; /* max number of bytes allowed on queue */
> __pid_t msg_lspid; /* pid of last msgsnd() */
> __pid_t msg_lrpid; /* pid of last msgrcv() */
> - unsigned long int __glibc_reserved4;
> - unsigned long int __glibc_reserved5;
> + __syscall_ulong_t __glibc_reserved4;
> + __syscall_ulong_t __glibc_reserved5;
> };
>
> #ifdef __USE_MISC
> diff --git a/sysdeps/unix/sysv/linux/generic/bits/sem.h b/sysdeps/unix/sysv/linux/generic/bits/sem.h
> index 3c9aea8..a0a5d47 100644
> --- a/sysdeps/unix/sysv/linux/generic/bits/sem.h
> +++ b/sysdeps/unix/sysv/linux/generic/bits/sem.h
> @@ -36,21 +36,25 @@
> #define SETALL 17 /* set all semval's */
>
>
> +#if !defined(__IPC_TIME_T_64_BITS) && __WORDSIZE == 64
> +#define __IPC_TIME_T_64_BITS
> +#endif
> +
> /* Data structure describing a set of semaphores. */
> struct semid_ds
> {
> struct ipc_perm sem_perm; /* operation permission struct */
> __time_t sem_otime; /* last semop() time */
> -#if __WORDSIZE == 32
> +#ifndef __IPC_TIME_T_64_BITS
> unsigned long int __glibc_reserved1;
> #endif
> __time_t sem_ctime; /* last time changed by semctl() */
> -#if __WORDSIZE == 32
> +#ifndef __IPC_TIME_T_64_BITS
> unsigned long int __glibc_reserved2;
> #endif
> - unsigned long int sem_nsems; /* number of semaphores in set */
> - unsigned long int __glibc_reserved3;
> - unsigned long int __glibc_reserved4;
> + __syscall_ulong_t sem_nsems; /* number of semaphores in set */
> + __syscall_ulong_t __glibc_reserved3;
> + __syscall_ulong_t __glibc_reserved4;
> };
>
> /* The user should define a union like the following to use it for arguments
> diff --git a/sysdeps/unix/sysv/linux/generic/bits/shm.h b/sysdeps/unix/sysv/linux/generic/bits/shm.h
> index 0dbed61..78ff79d 100644
> --- a/sysdeps/unix/sysv/linux/generic/bits/shm.h
> +++ b/sysdeps/unix/sysv/linux/generic/bits/shm.h
> @@ -44,31 +44,39 @@ __BEGIN_DECLS
> extern int __getpagesize (void) __THROW __attribute__ ((__const__));
>
>
> +#if !defined(__IPC_TIME_T_64_BITS) && __WORDSIZE == 64
> +#define __IPC_TIME_T_64_BITS
> +#endif
> +
> /* Type to count number of attaches. */
> -typedef unsigned long int shmatt_t;
> +typedef __syscall_ulong_t shmatt_t;
> +
> +#ifndef __SHMID_DS_SIZE_TYPE
> +#define __SHMID_DS_SIZE_TYPE(field) size_t field
> +#endif
>
> /* Data structure describing a shared memory segment. */
> struct shmid_ds
> {
> struct ipc_perm shm_perm; /* operation permission struct */
> - size_t shm_segsz; /* size of segment in bytes */
> + __SHMID_DS_SIZE_TYPE(shm_segsz); /* size of segment in bytes */
> __time_t shm_atime; /* time of last shmat() */
> -#if __WORDSIZE == 32
> +#ifndef __IPC_TIME_T_64_BITS
> unsigned long int __glibc_reserved1;
> #endif
> __time_t shm_dtime; /* time of last shmdt() */
> -#if __WORDSIZE == 32
> +#ifndef __IPC_TIME_T_64_BITS
> unsigned long int __glibc_reserved2;
> #endif
> __time_t shm_ctime; /* time of last change by shmctl() */
> -#if __WORDSIZE == 32
> +#ifndef __IPC_TIME_T_64_BITS
> unsigned long int __glibc_reserved3;
> #endif
> __pid_t shm_cpid; /* pid of creator */
> __pid_t shm_lpid; /* pid of last shmop */
> shmatt_t shm_nattch; /* number of current attaches */
> - unsigned long int __glibc_reserved4;
> - unsigned long int __glibc_reserved5;
> + __syscall_ulong_t __glibc_reserved4;
> + __syscall_ulong_t __glibc_reserved5;
> };
>
> #ifdef __USE_MISC
> @@ -85,25 +93,25 @@ struct shmid_ds
>
> struct shminfo
> {
> - unsigned long int shmmax;
> - unsigned long int shmmin;
> - unsigned long int shmmni;
> - unsigned long int shmseg;
> - unsigned long int shmall;
> - unsigned long int __glibc_reserved1;
> - unsigned long int __glibc_reserved2;
> - unsigned long int __glibc_reserved3;
> - unsigned long int __glibc_reserved4;
> + __syscall_ulong_t shmmax;
> + __syscall_ulong_t shmmin;
> + __syscall_ulong_t shmmni;
> + __syscall_ulong_t shmseg;
> + __syscall_ulong_t shmall;
> + __syscall_ulong_t __glibc_reserved1;
> + __syscall_ulong_t __glibc_reserved2;
> + __syscall_ulong_t __glibc_reserved3;
> + __syscall_ulong_t __glibc_reserved4;
> };
>
> struct shm_info
> {
> int used_ids;
> - unsigned long int shm_tot; /* total allocated shm */
> - unsigned long int shm_rss; /* total resident shm */
> - unsigned long int shm_swp; /* total swapped shm */
> - unsigned long int swap_attempts;
> - unsigned long int swap_successes;
> + __syscall_ulong_t shm_tot; /* total allocated shm */
> + __syscall_ulong_t shm_rss; /* total resident shm */
> + __syscall_ulong_t shm_swp; /* total swapped shm */
> + __syscall_ulong_t swap_attempts;
> + __syscall_ulong_t swap_successes;
> };
>
> #endif /* __USE_MISC */
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 05/29] Allow fd_mask type not be an array of long.
2014-10-27 16:32 ` Chris Metcalf
@ 2014-11-18 11:24 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 11:24 UTC (permalink / raw)
To: Chris Metcalf; +Cc: Andrew Pinski, libc-alpha
On 27 October 2014 16:32, Chris Metcalf <cmetcalf@tilera.com> wrote:
> On 10/27/2014 3:59 AM, Andrew Pinski wrote:
>>
>> +/* The fd_set member is required to be an array of longs by XPG4.2. */
>
>
> So on aarch64 compat it's now an array of long longs. Is this a problem?
> Would it be better to make it an array of longs but twice as many longs on
> ILP32 as on LP64? I suppose this becomes problematic when supporting
> big-endian, though. But it would be good to address the XPG4.2 issue
> somewhere in the headers.
Yes, this seems strange to me. Maybe it might be best handled by a
wrapper in the kernel?
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 06/29] Allow some fields of siginfo to be different from the generic one
2014-10-27 8:00 ` [PATCH 06/29] Allow some fields of siginfo to be different from the generic one Andrew Pinski
@ 2014-11-18 11:31 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 11:31 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> In AARCH64:ILP32, we want to use the layout for siginfo as AARCH64:LP64,
> so we need to add a few hooks into siginfo.h to support this.
>
> * sysdeps/unix/sysv/linux/bits/siginfo.h (__SIGINFO_VOIDPTR): New define.
> (__SIGINFO_BAND): New define.
> (union sigval): Use __SIGINFO_VOIDPTR for the pointer.
> (__SI_PAD_SIZE): Don't define if it is already defined.
> (struct siginfo): Use __SIGINFO_VOIDPTR for the pointer types.
> Use __SIGINFO_BAND for the si_band field.
> (struct sigevent): Add a comment on why the remaining fields
> don't need special handling.
> ---
> sysdeps/unix/sysv/linux/bits/siginfo.h | 26 +++++++++++++++++++-------
> 1 files changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/bits/siginfo.h b/sysdeps/unix/sysv/linux/bits/siginfo.h
> index ae603e8..f319d44 100644
> --- a/sysdeps/unix/sysv/linux/bits/siginfo.h
> +++ b/sysdeps/unix/sysv/linux/bits/siginfo.h
> @@ -23,6 +23,14 @@
>
> #include <bits/wordsize.h>
>
> +#ifndef __SIGINFO_VOIDPTR
> +#define __SIGINFO_VOIDPTR(field) void *field
> +#endif
> +
> +#ifndef __SIGINFO_BAND
> +#define __SIGINFO_BAND(field) long field
> +#endif
> +
These #defines need indenting.
> #if (!defined __have_sigval_t \
> && (defined _SIGNAL_H || defined __need_siginfo_t \
> || defined __need_sigevent_t))
> @@ -32,7 +40,7 @@
> typedef union sigval
> {
> int sival_int;
> - void *sival_ptr;
> + __SIGINFO_VOIDPTR (sival_ptr);
> } sigval_t;
> #endif
>
> @@ -41,10 +49,13 @@ typedef union sigval
> # define __have_siginfo_t 1
>
> # define __SI_MAX_SIZE 128
> -# if __WORDSIZE == 64
> -# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
> +
> +# ifndef __SI_PAD_SIZE
> +# if __WORDSIZE == 64
> +# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
> # else
This #else needs indenting further too.
Otherwise this looks ok to me.
> -# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
> +# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
> +# endif
> # endif
>
> typedef struct
> @@ -94,21 +105,21 @@ typedef struct
> /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
> struct
> {
> - void *si_addr; /* Faulting insn/memory ref. */
> + __SIGINFO_VOIDPTR (si_addr); /* Faulting insn/memory ref. */
> short int si_addr_lsb; /* Valid LSB of the reported address. */
> } _sigfault;
>
> /* SIGPOLL. */
> struct
> {
> - long int si_band; /* Band event for SIGPOLL. */
> + __SIGINFO_BAND (si_band); /* Band event for SIGPOLL. */
> int si_fd;
> } _sigpoll;
>
> /* SIGSYS. */
> struct
> {
> - void *_call_addr; /* Calling user insn. */
> + __SIGINFO_VOIDPTR (_call_addr); /* Calling user insn. */
> int _syscall; /* Triggering system call number. */
> unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
> } _sigsys;
> @@ -312,6 +323,7 @@ typedef struct sigevent
> thread to receive the signal. */
> __pid_t _tid;
>
> + /* Note these two are handled only in userspace. */
> struct
> {
> void (*_function) (sigval_t); /* Function to start. */
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 10/29] [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE. Use it in LDST_PCREL and LDST_GLOBAL.
2014-10-27 8:00 ` [PATCH 10/29] [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE. Use it in LDST_PCREL and LDST_GLOBAL Andrew Pinski
@ 2014-11-18 12:04 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 12:04 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> This patch adds a few extra macros which are useful for ILP32 and updates
> PTR_MANGLE and PTR_DEMANGLE to use the some of the new macros.
>
> * sysdeps/aarch64/sysdep.h (PTR_REG): New macro.
> (PTR_LOG_SIZE): New macro.
> (PTR_SIZE): New macro.
> (LDST_PCREL): Use arguments as register numbers rather register names.
> Use PTR_REG for the register when loading.
> * sysdeps/unix/sysv/linux/aarch64/sysdep.h (PTR_MANGLE): Add a comment
> about that the arguments are register numbers rather register names.
> (PTR_DEMANGLE): Likewise.
> * sysdeps/aarch64/__longjmp.S (__longjmp): Update calls to PTR_DEMANGLE.
> * sysdeps/aarch64/setjmp.S (__sigsetjmp): Update calls to PTR_MANGLE.
> ---
> sysdeps/aarch64/__longjmp.S | 4 ++--
> sysdeps/aarch64/setjmp.S | 4 ++--
> sysdeps/aarch64/sysdep.h | 28 ++++++++++++++++++----------
> sysdeps/unix/sysv/linux/aarch64/sysdep.h | 8 ++++++--
> 4 files changed, 28 insertions(+), 16 deletions(-)
This looks ok to me.
> diff --git a/sysdeps/aarch64/__longjmp.S b/sysdeps/aarch64/__longjmp.S
> index 1bb7be36..e1a1cf2 100644
> --- a/sysdeps/aarch64/__longjmp.S
> +++ b/sysdeps/aarch64/__longjmp.S
> @@ -53,7 +53,7 @@ ENTRY (__longjmp)
> ldp x27, x28, [x0, #JB_X27<<3]
> #ifdef PTR_DEMANGLE
> ldp x29, x4, [x0, #JB_X29<<3]
> - PTR_DEMANGLE (x30, x4, x3, x2)
> + PTR_DEMANGLE (30, 4, 3, 2)
> #else
> ldp x29, x30, [x0, #JB_X29<<3]
> #endif
> @@ -98,7 +98,7 @@ ENTRY (__longjmp)
> cfi_same_value(d15)
> #ifdef PTR_DEMANGLE
> ldr x4, [x0, #JB_SP<<3]
> - PTR_DEMANGLE (x5, x4, x3, x2)
> + PTR_DEMANGLE (5, 4, 3, 2)
> #else
> ldr x5, [x0, #JB_SP<<3]
> #endif
> diff --git a/sysdeps/aarch64/setjmp.S b/sysdeps/aarch64/setjmp.S
> index d548dd5..41d5321 100644
> --- a/sysdeps/aarch64/setjmp.S
> +++ b/sysdeps/aarch64/setjmp.S
> @@ -42,7 +42,7 @@ ENTRY (__sigsetjmp)
> stp x27, x28, [x0, #JB_X27<<3]
>
> #ifdef PTR_MANGLE
> - PTR_MANGLE (x4, x30, x3, x2)
> + PTR_MANGLE (4, 30, 3, 2)
> stp x29, x4, [x0, #JB_X29<<3]
> #else
> stp x29, x30, [x0, #JB_X29<<3]
> @@ -57,7 +57,7 @@ ENTRY (__sigsetjmp)
> stp d14, d15, [x0, #JB_D14<<3]
> #ifdef PTR_MANGLE
> mov x4, sp
> - PTR_MANGLE (x5, x4, x3, x2)
> + PTR_MANGLE (5, 4, 3, 2)
> str x5, [x0, #JB_SP<<3]
> #else
> mov x2, sp
> diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
> index 55d1759..ab2ee91 100644
> --- a/sysdeps/aarch64/sysdep.h
> +++ b/sysdeps/aarch64/sysdep.h
> @@ -23,10 +23,16 @@
>
> #ifdef __LP64__
> #define AARCH64_R(NAME) R_AARCH64_ ## NAME
> +#define PTR_REG(n) x##n
> +#define PTR_LOG_SIZE 3
> #else
> #define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME
> +#define PTR_REG(n) w##n
> +#define PTR_LOG_SIZE 2
> #endif
>
> +#define PTR_SIZE (1<<PTR_LOG_SIZE)
> +
> #ifdef __ASSEMBLER__
>
> /* Syntactic details of assembler. */
> @@ -87,16 +93,18 @@
> # define L(name) .L##name
> #endif
>
> -/* Load or store to/from a pc-relative EXPR into/from R, using T. */
> -#define LDST_PCREL(OP, R, T, EXPR) \
> - adrp T, EXPR; \
> - OP R, [T, #:lo12:EXPR];\
> -
> -/* Load or store to/from a got-relative EXPR into/from R, using T. */
> -#define LDST_GLOBAL(OP, R, T, EXPR) \
> - adrp T, :got:EXPR; \
> - ldr T, [T, #:got_lo12:EXPR];\
> - OP R, [T];
> +/* Load or store to/from a pc-relative EXPR into/from R, using T.
> + Note R and T are register numbers and not register names. */
> +#define LDST_PCREL(OP, R, T, EXPR) \
> + adrp x##T, EXPR; \
> + OP PTR_REG (R), [x##T, #:lo12:EXPR]; \
> +
> +/* Load or store to/from a got-relative EXPR into/from R, using T.
> + Note R and T are register numbers and not register names. */
> +#define LDST_GLOBAL(OP, R, T, EXPR) \
> + adrp x##T, :got:EXPR; \
> + ldr PTR_REG (T), [x##T, #:got_lo12:EXPR]; \
> + OP x##R, [x##T];
>
> /* Since C identifiers are not normally prefixed with an underscore
> on this system, the asm identifier `syscall_error' intrudes on the
> diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> index 84999f1..fc31661 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> @@ -313,12 +313,14 @@
> (!defined SHARED && (!defined NOT_IN_libc \
> || defined 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)\
> @@ -331,12 +333,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)\
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 11/29] [AARCH64] Use PTR_REG in crti.S.
2014-10-27 8:00 ` [PATCH 11/29] [AARCH64] Use PTR_REG in crti.S Andrew Pinski
@ 2014-11-18 12:09 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 12:09 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> call_weak_fn loads from a pointer, so use PTR_REG so the load
> is 32bits for ILP32.
>
> * sysdeps/aarch64/crti.S: Include sysdep.h
> (call_weak_fn): Use PTR_REG when loading from
> PREINIT_FUNCTION.
>
> AARCH64: Make RTLD_START paramatizable
>
> Make RTLD_START paramatizable for ILP32 and LP64 usage and provides common
> code between ILP32.
>
> * sysdeps/aarch64/dl-machine.h (RTLD_START): Rename to ...
> (RTLD_START_1): This and add PTR, PTR_SIZE_LOG, and PTR_SP arguments.
> (RTLD_START): New macro which uses RTLD_START_1.
> ---
> sysdeps/aarch64/crti.S | 3 +-
> sysdeps/aarch64/dl-machine.h | 130 ++++++++++++++++++++++--------------------
> 2 files changed, 70 insertions(+), 63 deletions(-)
This looks ok to me.
> diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S
> index 2db7b67..d31bb50 100644
> --- a/sysdeps/aarch64/crti.S
> +++ b/sysdeps/aarch64/crti.S
> @@ -39,6 +39,7 @@
> they can be called as functions. The symbols _init and _fini are
> magic and cause the linker to emit DT_INIT and DT_FINI. */
>
> +#include <sysdep.h>
> #include <libc-symbols.h>
>
> #ifndef PREINIT_FUNCTION
> @@ -60,7 +61,7 @@
> .type call_weak_fn, %function
> call_weak_fn:
> adrp x0, :got:PREINIT_FUNCTION
> - ldr x0, [x0, #:got_lo12:PREINIT_FUNCTION]
> + ldr PTR_REG(0), [x0, #:got_lo12:PREINIT_FUNCTION]
> cbz x0, 1f
> b PREINIT_FUNCTION
> 1:
> diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
> index 4317669..6e041b1 100644
> --- a/sysdeps/aarch64/dl-machine.h
> +++ b/sysdeps/aarch64/dl-machine.h
> @@ -123,68 +123,74 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
> /* Initial entry point for the dynamic linker. The C function
> _dl_start is the real entry point, its return value is the user
> program's entry point */
> +#ifdef __LP64__
> +#define RTLD_START RTLD_START_1("x", "3", "sp")
> +#else
> +#define RTLD_START RTLD_START_1("w", "2", "wsp")
> +#endif
> +
>
> -#define RTLD_START asm ("\
> -.text \n\
> -.globl _start \n\
> -.type _start, %function \n\
> -.globl _dl_start_user \n\
> -.type _dl_start_user, %function \n\
> -_start: \n\
> - mov x0, sp \n\
> - bl _dl_start \n\
> - // returns user entry point in x0 \n\
> - mov x21, x0 \n\
> -_dl_start_user: \n\
> - // get the original arg count \n\
> - ldr x1, [sp] \n\
> - // get the argv address \n\
> - add x2, sp, #8 \n\
> - // get _dl_skip_args to see if we were \n\
> - // invoked as an executable \n\
> - adrp x4, _dl_skip_args \n\
> - ldr w4, [x4, #:lo12:_dl_skip_args] \n\
> - // do we need to adjust argc/argv \n\
> - cmp w4, 0 \n\
> - beq .L_done_stack_adjust \n\
> - // subtract _dl_skip_args from original arg count \n\
> - sub x1, x1, x4 \n\
> - // store adjusted argc back to stack \n\
> - str x1, [sp] \n\
> - // find the first unskipped argument \n\
> - mov x3, x2 \n\
> - add x4, x2, x4, lsl #3 \n\
> - // shuffle argv down \n\
> -1: ldr x5, [x4], #8 \n\
> - str x5, [x3], #8 \n\
> - cmp x5, #0 \n\
> - bne 1b \n\
> - // shuffle envp down \n\
> -1: ldr x5, [x4], #8 \n\
> - str x5, [x3], #8 \n\
> - cmp x5, #0 \n\
> - bne 1b \n\
> - // shuffle auxv down \n\
> -1: ldp x0, x5, [x4, #16]! \n\
> - stp x0, x5, [x3], #16 \n\
> - cmp x0, #0 \n\
> - bne 1b \n\
> - // Update _dl_argv \n\
> - adrp x3, _dl_argv \n\
> - str x2, [x3, #:lo12:_dl_argv] \n\
> -.L_done_stack_adjust: \n\
> - // compute envp \n\
> - add x3, x2, x1, lsl #3 \n\
> - add x3, x3, #8 \n\
> - adrp x16, _rtld_local \n\
> - add x16, x16, #:lo12:_rtld_local \n\
> - ldr x0, [x16] \n\
> - bl _dl_init_internal \n\
> - // load the finalizer function \n\
> - adrp x0, _dl_fini \n\
> - add x0, x0, #:lo12:_dl_fini \n\
> - // jump to the user_s entry point \n\
> - br x21 \n\
> +#define RTLD_START_1(PTR, PTR_SIZE_LOG, PTR_SP) asm ("\
> +.text \n\
> +.globl _start \n\
> +.type _start, %function \n\
> +.globl _dl_start_user \n\
> +.type _dl_start_user, %function \n\
> +_start: \n\
> + mov " PTR "0, " PTR_SP " \n\
> + bl _dl_start \n\
> + // returns user entry point in x0 \n\
> + mov x21, x0 \n\
> +_dl_start_user: \n\
> + // get the original arg count \n\
> + ldr " PTR "1, [sp] \n\
> + // get the argv address \n\
> + add " PTR "2, " PTR_SP ", #(1<<" PTR_SIZE_LOG ") \n\
> + // get _dl_skip_args to see if we were \n\
> + // invoked as an executable \n\
> + adrp x4, _dl_skip_args \n\
> + ldr w4, [x4, #:lo12:_dl_skip_args] \n\
> + // do we need to adjust argc/argv \n\
> + cmp w4, 0 \n\
> + beq .L_done_stack_adjust \n\
> + // subtract _dl_skip_args from original arg count \n\
> + sub " PTR "1, " PTR "1, " PTR "4 \n\
> + // store adjusted argc back to stack \n\
> + str " PTR "1, [sp] \n\
> + // find the first unskipped argument \n\
> + mov " PTR "3, " PTR "2 \n\
> + add " PTR "4, " PTR "2, " PTR "4, lsl #" PTR_SIZE_LOG " \n\
> + // shuffle argv down \n\
> +1: ldr " PTR "5, [x4], #(1<<" PTR_SIZE_LOG ") \n\
> + str " PTR "5, [x3], #(1<<" PTR_SIZE_LOG ") \n\
> + cmp " PTR "5, #0 \n\
> + bne 1b \n\
> + // shuffle envp down \n\
> +1: ldr " PTR "5, [x4], #(1<<" PTR_SIZE_LOG ") \n\
> + str " PTR "5, [x3], #(1<<" PTR_SIZE_LOG ") \n\
> + cmp " PTR "5, #0 \n\
> + bne 1b \n\
> + // shuffle auxv down \n\
> +1: ldp " PTR "0, " PTR "5, [x4, #(2<<" PTR_SIZE_LOG ")]! \n\
> + stp " PTR "0, " PTR "5, [x3], #(2<<" PTR_SIZE_LOG ") \n\
> + cmp " PTR "0, #0 \n\
> + bne 1b \n\
> + // Update _dl_argv \n\
> + adrp x3, _dl_argv \n\
> + str " PTR "2, [x3, #:lo12:_dl_argv] \n\
> +.L_done_stack_adjust: \n\
> + // compute envp \n\
> + add " PTR "3, " PTR "2, " PTR "1, lsl #" PTR_SIZE_LOG " \n\
> + add " PTR "3, " PTR "3, #(1<<" PTR_SIZE_LOG ") \n\
> + adrp x16, _rtld_local \n\
> + add " PTR "16, " PTR "16, #:lo12:_rtld_local \n\
> + ldr " PTR "0, [x16] \n\
> + bl _dl_init_internal \n\
> + // load the finalizer function \n\
> + adrp x0, _dl_fini \n\
> + add " PTR "0, " PTR "0, #:lo12:_dl_fini \n\
> + // jump to the user_s entry point \n\
> + br x21 \n\
> ");
>
> #define elf_machine_type_class(type) \
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 12/29] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
2014-10-27 8:00 ` [PATCH 12/29] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S Andrew Pinski
@ 2014-11-18 12:23 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 12:23 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> This converts dl-tlsdesc.S code over to use the new macros which allows for
> sharing between ILP32 and LP64 code.
>
> * sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return): Use PTR_REG.
> (_dl_tlsdesc_undefweak): Use PTR_REG, PTR_SIZE.
> (_dl_tlsdesc_dynamic): Likewise.
> (_dl_tlsdesc_resolve_rela): Likewise.
> (_dl_tlsdesc_resolve_hold): Likewise.
> ---
> sysdeps/aarch64/dl-tlsdesc.S | 36 ++++++++++++++++++------------------
> 1 files changed, 18 insertions(+), 18 deletions(-)
This looks ok, although as with all these patches I would want to see
the test results for AArch64 and AArch64 ILP32 before they are
committed.
> diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
> index ded5471..6004115 100644
> --- a/sysdeps/aarch64/dl-tlsdesc.S
> +++ b/sysdeps/aarch64/dl-tlsdesc.S
> @@ -74,7 +74,7 @@
> cfi_startproc
> .align 2
> _dl_tlsdesc_return:
> - ldr x0, [x0, #8]
> + ldr PTR_REG (0), [x0, #PTR_SIZE]
> RET
> cfi_endproc
> .size _dl_tlsdesc_return, .-_dl_tlsdesc_return
> @@ -96,9 +96,9 @@ _dl_tlsdesc_return:
> _dl_tlsdesc_undefweak:
> str x1, [sp, #-16]!
> cfi_adjust_cfa_offset(16)
> - ldr x0, [x0, #8]
> + ldr PTR_REG (0), [x0, #PTR_SIZE]
> mrs x1, tpidr_el0
> - sub x0, x0, x1
> + sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
> ldr x1, [sp], #16
> cfi_adjust_cfa_offset(16)
> RET
> @@ -152,20 +152,20 @@ _dl_tlsdesc_dynamic:
> stp x3, x4, [sp, #32+16*1]
>
> mrs x4, tpidr_el0
> - ldr x1, [x0,#8]
> - ldr x0, [x4]
> - ldr x3, [x1,#16]
> - ldr x2, [x0]
> - cmp x3, x2
> + ldr PTR_REG (1), [x0,#PTR_SIZE]
> + ldr PTR_REG (0), [x4]
> + ldr PTR_REG (3), [x1,#(PTR_SIZE * 2)]
> + ldr PTR_REG (2), [x0]
> + cmp PTR_REG (3), PTR_REG (2)
> b.hi 2f
> - ldr x2, [x1]
> - add x0, x0, x2, lsl #4
> - ldr x0, [x0]
> + ldr PTR_REG (2), [x1]
> + add PTR_REG (0), PTR_REG (0), PTR_REG (2), lsl #(PTR_LOG_SIZE + 1)
> + ldr PTR_REG (0), [x0]
> cmn x0, #0x1
> b.eq 2f
> - ldr x1, [x1,#8]
> - add x0, x0, x1
> - sub x0, x0, x4
> + ldr PTR_REG (1), [x1,#(PTR_SIZE * 2)]
> + add PTR_REG (0), PTR_REG (0), PTR_REG (1)
> + sub PTR_REG (0), PTR_REG (0), PTR_REG (4)
> 1:
> ldp x1, x2, [sp, #32+16*0]
> ldp x3, x4, [sp, #32+16*1]
> @@ -196,7 +196,7 @@ _dl_tlsdesc_dynamic:
> bl __tls_get_addr
>
> mrs x1, tpidr_el0
> - sub x0, x0, x1
> + sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
>
> RESTORE_Q_REGISTERS
>
> @@ -242,13 +242,13 @@ _dl_tlsdesc_resolve_rela:
>
> SAVE_Q_REGISTERS
>
> - ldr x1, [x3, #8]
> + ldr PTR_REG (1), [x3, #PTR_SIZE]
> bl _dl_tlsdesc_resolve_rela_fixup
>
> RESTORE_Q_REGISTERS
>
> ldr x0, [sp, #32+16*8]
> - ldr x1, [x0]
> + ldr PTR_REG (1), [x0]
> blr x1
>
> ldp x1, x4, [sp, #32+16*0]
> @@ -309,7 +309,7 @@ _dl_tlsdesc_resolve_hold:
> RESTORE_Q_REGISTERS
>
> ldr x0, [sp, #32+16*9]
> - ldr x1, [x0]
> + ldr PTR_REG (1), [x0]
> blr x1
>
> ldp x1, x2, [sp, #32+16*0]
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 13/29] [AARCH64] Use PTR_* macros in dl-trampoline.S
2014-10-27 8:00 ` [PATCH 13/29] [AARCH64] Use PTR_* macros in dl-trampoline.S Andrew Pinski
@ 2014-11-18 12:33 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 12:33 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> Use the PTR_* macros in dl-trampoline.S so it can be used for
> both ILP32 and LP64. Also add a comment about what was an magic number
> (the size of the rela relocation entries).
>
> * sysdeps/aarch64/dl-trampoline.S (ip0l): New define.
> (RELA_SIZE): New define.
> (_dl_runtime_resolve): Use PTR_REG, PTR_SIZE.
> (_dl_runtime_profile): Likewise. Use RELA_SIZE and ip0l.
> ---
> sysdeps/aarch64/dl-trampoline.S | 18 +++++++++++-------
> 1 files changed, 11 insertions(+), 7 deletions(-)
This looks ok to me. Not a massive fan of the name ip0l but I don't
have a better suggestion right now.
> diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S
> index 2037f18..22b28ce 100644
> --- a/sysdeps/aarch64/dl-trampoline.S
> +++ b/sysdeps/aarch64/dl-trampoline.S
> @@ -22,9 +22,13 @@
> #include "dl-link.h"
>
> #define ip0 x16
> +#define ip0l PTR_REG (16)
> #define ip1 x17
> #define lr x30
>
> +/* RELA relocatons are 3 pointers */
> +#define RELA_SIZE (PTR_SIZE * 3)
> +
> .text
> .globl _dl_runtime_resolve
> .type _dl_runtime_resolve, #function
> @@ -79,7 +83,7 @@ _dl_runtime_resolve:
> cfi_rel_offset (q1, 80+7*16)
>
> /* Get pointer to linker struct. */
> - ldr x0, [ip0, #-8]
> + ldr PTR_REG (0), [ip0, #-PTR_SIZE]
>
> /* Prepare to call _dl_fixup(). */
> ldr x1, [sp, 80+8*16] /* Recover &PLTGOT[n] */
> @@ -87,7 +91,7 @@ _dl_runtime_resolve:
> sub x1, x1, ip0
> add x1, x1, x1, lsl #1
> lsl x1, x1, #3
> - sub x1, x1, #192
> + sub x1, x1, #(RELA_SIZE<<3)
> lsr x1, x1, #3
>
> /* Call fixup routine. */
> @@ -191,7 +195,7 @@ _dl_runtime_profile:
> stp x0, x1, [x29, #OFFSET_RG + DL_OFFSET_RG_SP]
>
> /* Get pointer to linker struct. */
> - ldr x0, [ip0, #-8]
> + ldr PTR_REG (0), [ip0, #-PTR_SIZE]
>
> /* Prepare to call _dl_profile_fixup(). */
> ldr x1, [x29, OFFSET_PLTGOTN] /* Recover &PLTGOT[n] */
> @@ -199,7 +203,7 @@ _dl_runtime_profile:
> sub x1, x1, ip0
> add x1, x1, x1, lsl #1
> lsl x1, x1, #3
> - sub x1, x1, #192
> + sub x1, x1, #(RELA_SIZE<<3)
> lsr x1, x1, #3
>
> stp x0, x1, [x29, #OFFSET_SAVED_CALL_X0]
> @@ -210,8 +214,8 @@ _dl_runtime_profile:
> add x4, x29, #OFFSET_FS /* address of framesize */
> bl _dl_profile_fixup
>
> - ldr ip0, [x29, #OFFSET_FS] /* framesize == 0 */
> - cmp ip0, #0
> + ldr ip0l, [x29, #OFFSET_FS] /* framesize == 0 */
> + cmp ip0l, #0
> bge 1f
> cfi_remember_state
>
> @@ -243,7 +247,7 @@ _dl_runtime_profile:
> 1:
> /* The new frame size is in ip0. */
>
> - sub x1, x29, ip0
> + sub PTR_REG (1), PTR_REG (29), ip0l
> and sp, x1, #0xfffffffffffffff0
>
> str x0, [x29, #OFFSET_T1]
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 14/29] [AARCH64] Use PTR_* in start.S
2014-10-27 8:03 ` [PATCH 14/29] [AARCH64] Use PTR_* in start.S Andrew Pinski
@ 2014-11-18 12:35 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 12:35 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> To support ILP32 without much sources changes, this changes
> sysdeps/aarch64/start.S to use the PTR_* macros which was defined
> earlier.
>
> * sysdeps/aarch64/start.S: Include sysdep.h
> (_start): Use PTR_REG, PTR_SIZE macros.
> ---
> sysdeps/aarch64/start.S | 20 +++++++++++---------
> 1 files changed, 11 insertions(+), 9 deletions(-)
This looks ok to me.
> diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S
> index 35d603a..dfa0622 100644
> --- a/sysdeps/aarch64/start.S
> +++ b/sysdeps/aarch64/start.S
> @@ -16,6 +16,8 @@
> License along with the GNU C Library. If not, see
> <http://www.gnu.org/licenses/>. */
>
> +#include <sysdep.h>
> +
> /* This is the canonical entry point, usually the first thing in the text
> segment.
>
> @@ -25,7 +27,7 @@
>
> At this entry point, most registers' values are unspecified, except:
>
> - x0 Contains a function pointer to be registered with `atexit'.
> + x0/w0 Contains a function pointer to be registered with `atexit'.
> This is how the dynamic linker arranges to have DT_FINI
> functions called for shared libraries that have been loaded
> before this code runs.
> @@ -53,26 +55,26 @@ _start:
> mov x5, x0
>
> /* Load argc and a pointer to argv */
> - ldr x1, [sp, #0]
> - add x2, sp, #8
> + ldr PTR_REG (1), [sp, #0]
> + add x2, sp, #PTR_SIZE
>
> /* Setup stack limit in argument register */
> mov x6, sp
>
> #ifdef SHARED
> adrp x0, :got:main
> - ldr x0, [x0, #:got_lo12:main]
> + ldr PTR_REG (0), [x0, #:got_lo12:main]
>
> adrp x3, :got:__libc_csu_init
> - ldr x3, [x3, #:got_lo12:__libc_csu_init]
> + ldr PTR_REG (3), [x3, #:got_lo12:__libc_csu_init]
>
> adrp x4, :got:__libc_csu_fini
> - ldr x4, [x4, #:got_lo12:__libc_csu_fini]
> + ldr PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini]
> #else
> /* Set up the other arguments in registers */
> - ldr x0, =main
> - ldr x3, =__libc_csu_init
> - ldr x4, =__libc_csu_fini
> + ldr PTR_REG (0), =main
> + ldr PTR_REG (3), =__libc_csu_init
> + ldr PTR_REG (4), =__libc_csu_fini
> #endif
>
> /* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 15/29] [AARCH64] Use PTR_REG in getcontext.S.
2014-10-27 8:00 ` [PATCH 15/29] [AARCH64] Use PTR_REG in getcontext.S Andrew Pinski
@ 2014-11-18 12:37 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 12:37 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> Just like the other patches, this patch allows for getcontext.S to be used
> between ILP32 and LP64.
>
> * sysdeps/unix/sysv/linux/aarch64/getcontext.S: Use PTR_REG when
> doing an add so wrapping of the pointer is correct for ILP32.
> ---
> sysdeps/unix/sysv/linux/aarch64/getcontext.S | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
This looks ok to me.
> diff --git a/sysdeps/unix/sysv/linux/aarch64/getcontext.S b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
> index 70b2e32..4507040 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/getcontext.S
> +++ b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
> @@ -90,7 +90,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
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 17/29] [AARCH64] Syscalls for ILP32 are passed always via 64bit values.
2014-10-27 8:03 ` [PATCH 17/29] [AARCH64] Syscalls for ILP32 are passed always via 64bit values Andrew Pinski
@ 2014-11-18 12:50 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 12:50 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> This patch adds support for ILP32 syscalls, sign and zero extending
> where needed. Unlike LP64, pointers are 32bit and need to be zero
> extended rather than the standard sign extend that the code would do.
> We take advatage of ssize_t being long rather than int for ILP32,
> to get this correct.
>
> * sysdeps/unix/sysv/linux/aarch64/sysdep.h
> (INLINE_VSYSCALL): Use long long instead of long.
> (INTERNAL_VSYSCALL): Likewise.
> (INLINE_SYSCALL): Likewise.
> (INTERNAL_SYSCALL_RAW): Likewise.
> (ARGIFY): New macro.
> (LOAD_ARGS_0): Use long long instead of long.
> (LOAD_ARGS_1): Use long long instead of long
> and use ARGIFY.
> (LOAD_ARGS_2): Likewise.
> (LOAD_ARGS_3): Likewise.
> (LOAD_ARGS_4): Likewise.
> (LOAD_ARGS_5): Likewise.
> (LOAD_ARGS_6): Likewise.
> (LOAD_ARGS_7): Likewise.
> ---
> sysdeps/unix/sysv/linux/aarch64/sysdep.h | 52 ++++++++++++++++++-----------
> 1 files changed, 32 insertions(+), 20 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> index fc31661..0d9fa8a 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> @@ -156,7 +156,7 @@
> ({ \
> __label__ out; \
> __label__ iserr; \
> - long sc_ret; \
> + long long sc_ret; \
> INTERNAL_SYSCALL_DECL (sc_err); \
> \
> if (__vdso_##name != NULL) \
> @@ -187,7 +187,7 @@
> # define INTERNAL_VSYSCALL(name, err, nr, args...) \
> ({ \
> __label__ out; \
> - long v_ret; \
> + long long v_ret; \
> \
> if (__vdso_##name != NULL) \
> { \
> @@ -224,11 +224,11 @@
> call. */
> # undef INLINE_SYSCALL
> # define INLINE_SYSCALL(name, nr, args...) \
> - ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
> + ({ unsigned long long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
> if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
> { \
> __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
> - _sys_result = (unsigned long) -1; \
> + _sys_result = (unsigned long long) -1; \
> } \
> (long) _sys_result; })
>
> @@ -237,10 +237,10 @@
>
> # undef INTERNAL_SYSCALL_RAW
> # define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
> - ({ long _sys_result; \
> + ({ long long _sys_result; \
> { \
> LOAD_ARGS_##nr (args) \
> - register long _x8 asm ("x8") = (name); \
> + register long long _x8 asm ("x8") = (name); \
> asm volatile ("svc 0 // syscall " # name \
> : "=r" (_x0) : "r"(_x8) ASM_ARGS_##nr : "memory"); \
> _sys_result = _x0; \
> @@ -262,36 +262,48 @@
> # undef INTERNAL_SYSCALL_ERRNO
> # define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
>
> +/* Convert X to a long long, without losing any bits if it is one
> + already or warning if it is a 32-bit pointer. This zero extends
> + 32-bit pointers and sign extends other signed types. Note this only
> + works because ssize_t is long and short-short is promoted to int. */
> +#define ARGIFY(X) \
> + ((unsigned long long) \
> + __builtin_choose_expr(__builtin_types_compatible_p(__typeof__(X), __typeof__((X) - (X))), \
> + (X), \
> + __builtin_choose_expr(__builtin_types_compatible_p(int, __typeof__((X) - (X))), \
> + (X), \
> + (unsigned long)(X))))
> +
This could do with spaces before parentheses and the line wrapping
could be made more readable, but otherwise this looks ok.
> # define LOAD_ARGS_0() \
> - register long _x0 asm ("x0");
> + register long long _x0 asm ("x0");
> # define LOAD_ARGS_1(x0) \
> - long _x0tmp = (long) (x0); \
> + long long _x0tmp = ARGIFY (x0); \
> LOAD_ARGS_0 () \
> _x0 = _x0tmp;
> # define LOAD_ARGS_2(x0, x1) \
> - long _x1tmp = (long) (x1); \
> + long long _x1tmp = ARGIFY (x1); \
> LOAD_ARGS_1 (x0) \
> - register long _x1 asm ("x1") = _x1tmp;
> + register long long _x1 asm ("x1") = _x1tmp;
> # define LOAD_ARGS_3(x0, x1, x2) \
> - long _x2tmp = (long) (x2); \
> + long long _x2tmp = ARGIFY (x2); \
> LOAD_ARGS_2 (x0, x1) \
> - register long _x2 asm ("x2") = _x2tmp;
> + register long long _x2 asm ("x2") = _x2tmp;
> # define LOAD_ARGS_4(x0, x1, x2, x3) \
> - long _x3tmp = (long) (x3); \
> + long long _x3tmp = ARGIFY (x3); \
> LOAD_ARGS_3 (x0, x1, x2) \
> - register long _x3 asm ("x3") = _x3tmp;
> + register long long _x3 asm ("x3") = _x3tmp;
> # define LOAD_ARGS_5(x0, x1, x2, x3, x4) \
> - long _x4tmp = (long) (x4); \
> + long long _x4tmp = ARGIFY (x4); \
> LOAD_ARGS_4 (x0, x1, x2, x3) \
> - register long _x4 asm ("x4") = _x4tmp;
> + register long long _x4 asm ("x4") = _x4tmp;
> # define LOAD_ARGS_6(x0, x1, x2, x3, x4, x5) \
> - long _x5tmp = (long) (x5); \
> + long long _x5tmp = ARGIFY (x5); \
> LOAD_ARGS_5 (x0, x1, x2, x3, x4) \
> - register long _x5 asm ("x5") = _x5tmp;
> + register long long _x5 asm ("x5") = _x5tmp;
> # define LOAD_ARGS_7(x0, x1, x2, x3, x4, x5, x6)\
> - long _x6tmp = (long) (x6); \
> + long long _x6tmp = ARGIFY (x6); \
> LOAD_ARGS_6 (x0, x1, x2, x3, x4, x5) \
> - register long _x6 asm ("x6") = _x6tmp;
> + register long long _x6 asm ("x6") = _x6tmp;
>
> # define ASM_ARGS_0
> # define ASM_ARGS_1 , "r" (_x0)
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 18/29] [AARCH64] Reformat inline-asm in elf_machine_load_address.
2014-10-27 8:00 ` [PATCH 18/29] [AARCH64] Reformat inline-asm in elf_machine_load_address Andrew Pinski
@ 2014-11-18 13:51 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 13:51 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> This patch reformats the inline-asm in elf_machine_load_address so it is
> easier to change only part of the inline-asm. That is using string
> concating instead of string continueing.
>
> Also document on why this inline-asm works, it depends on the 32bit
> relocation being resolved at link time.
>
> * sysdeps/aarch64/dl-machine.h (elf_machine_load_address):
> Refactor inline-asm. Also add comment.
> ---
> sysdeps/aarch64/dl-machine.h | 21 ++++++++++++---------
> 1 files changed, 12 insertions(+), 9 deletions(-)
This looks ok to me.
> diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
> index 6e041b1..121b178 100644
> --- a/sysdeps/aarch64/dl-machine.h
> +++ b/sysdeps/aarch64/dl-machine.h
> @@ -53,19 +53,22 @@ elf_machine_load_address (void)
> The choice of symbol is arbitrary. The static address we obtain
> by constructing a non GOT reference to the symbol, the dynamic
> address of the symbol we compute using adrp/add to compute the
> - symbol's address relative to the PC. */
> + symbol's address relative to the PC.
> + This depends on 32bit relocations being resolved at link time
> + and that the static address fits in the 32bits. */
>
> ElfW(Addr) static_addr;
> ElfW(Addr) dynamic_addr;
>
> - asm (" \n\
> - adrp %1, _dl_start; \n\
> - add %1, %1, #:lo12:_dl_start \n\
> - ldr %w0, 1f \n\
> - b 2f \n\
> -1: .word _dl_start \n\
> -2: \n\
> - " : "=r" (static_addr), "=r" (dynamic_addr));
> + asm (" \n"
> +" adrp %1, _dl_start; \n"
> +" add %1, %1, #:lo12:_dl_start \n"
> +" ldr %w0, 1f \n"
> +" b 2f \n"
> +"1: \n"
> +" .word _dl_start \n"
> +"2: \n"
> + : "=r" (static_addr), "=r" (dynamic_addr));
> return dynamic_addr - static_addr;
> }
>
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 19/29] [AARCH64] Add ILP32 support to elf_machine_load_address.
2014-10-27 8:00 ` [PATCH 19/29] [AARCH64] Add ILP32 support to elf_machine_load_address Andrew Pinski
@ 2014-11-18 13:56 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 13:56 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> This adds ILP32 support to elf_machine_load_address.
> Since elf_machine_load_address depends on the static address being
> found without relocations, we need to use 16bit relocation which gets
> resolved at link time for ILP32. This is just like how the 32bit
> relocation gets resolved at link time for LP64.
>
> * sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Add support
> for ILP32.
> ---
> sysdeps/aarch64/dl-machine.h | 20 +++++++++++++++++---
> 1 files changed, 17 insertions(+), 3 deletions(-)
Looks ok to me.
> diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
> index 121b178..f3bcad1 100644
> --- a/sysdeps/aarch64/dl-machine.h
> +++ b/sysdeps/aarch64/dl-machine.h
> @@ -54,19 +54,33 @@ elf_machine_load_address (void)
> by constructing a non GOT reference to the symbol, the dynamic
> address of the symbol we compute using adrp/add to compute the
> symbol's address relative to the PC.
> - This depends on 32bit relocations being resolved at link time
> - and that the static address fits in the 32bits. */
> + This depends on 32/16bit relocations being resolved at link time
> + and that the static address fits in the 32/16 bits. */
>
> ElfW(Addr) static_addr;
> ElfW(Addr) dynamic_addr;
>
> asm (" \n"
> " adrp %1, _dl_start; \n"
> +#ifdef __LP64__
> " add %1, %1, #:lo12:_dl_start \n"
> -" ldr %w0, 1f \n"
> +#else
> +" add %w1, %w1, #:lo12:_dl_start \n"
> +#endif
> +" ldr %w0, 1f \n"
> " b 2f \n"
> "1: \n"
> +#ifdef __LP64__
> " .word _dl_start \n"
> +#else
> +# ifdef __AARCH64EB__
> +" .short 0 \n"
> +# endif
> +" .short _dl_start \n"
> +# ifndef __AARCH64EB__
> +" .short 0 \n"
> +# endif
> +#endif
> "2: \n"
> : "=r" (static_addr), "=r" (dynamic_addr));
> return dynamic_addr - static_addr;
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 20/29] [AARCH64] Set up wordsize for ILP32.
2014-10-27 8:03 ` [PATCH 20/29] [AARCH64] Set up wordsize for ILP32 Andrew Pinski
@ 2014-11-18 13:58 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 13:58 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> __WORDSIZE needs to be set to 32 for ILP32.
>
> * sysdeps/aarch64/bits/wordsize.h (__WORDSIZE): Set to 32 for ILP32.
> Update comments.
> ---
> sysdeps/aarch64/bits/wordsize.h | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
> index 3ecccaa..3d5a79d 100644
> --- a/sysdeps/aarch64/bits/wordsize.h
> +++ b/sysdeps/aarch64/bits/wordsize.h
> @@ -15,12 +15,16 @@
> License along with the GNU C Library; if not, see
> <http://www.gnu.org/licenses/>. */
>
> -#define __WORDSIZE 64
> +#ifdef __LP64__
> +# define __WORDSIZE 64
> +#else
> +# define __WORDSIZE 32
> +#endif
>
> -/* LP64 ABI has a 64bit time_t.
> +/* LP64 and ILP32s ABI uses a 64bit time_t.
LP64 and ILP32 ABIs have a 64bit time_t.
Otherwise OK.
> This allows aarch32 and AARCH64 applications
> both access utmp. */
> #define __WORDSIZE_TIME64_COMPAT32 1
>
> -/* LP64 use the 64bit system call interface. */
> +/* LP64 and ILP32 use the 64bit system call interface. */
> #define __SYSCALL_WORDSIZE 64
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 22/29] [AARCH64] Add support to ldconfig for ILP32 and libilp32
2014-10-27 8:03 ` [PATCH 22/29] [AARCH64] Add support to ldconfig for ILP32 and libilp32 Andrew Pinski
@ 2014-11-18 14:20 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 14:20 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> This patch adds support to ldconfig for libilp32 which is used by
> ILP32.
>
> * sysdeps/generic/ldconfig.h (FLAG_AARCH64_LIB32): New define.
> * elf/cache.c (print_entry): Handle FLAG_AARCH64_LIB32.
> * sysdeps/unix/sysv/linux/aarch64/dl-cache.h (_DL_CACHE_DEFAULT_ID):
> Define it to be the FLAG_AARCH64_LIB32 if compiling for ILP32.
> (add_system_dir): Add libilp32 to the list of system directories.
> * sysdeps/unix/sysv/linux/arm/readelflib.c (process_elf_file):
> Handle ILP32 elf binaries.
> ---
> elf/cache.c | 2 ++
> sysdeps/generic/ldconfig.h | 1 +
> sysdeps/unix/sysv/linux/aarch64/dl-cache.h | 13 ++++++++++++-
> sysdeps/unix/sysv/linux/arm/readelflib.c | 4 +++-
> 4 files changed, 18 insertions(+), 2 deletions(-)
This looks ok to me.
> diff --git a/elf/cache.c b/elf/cache.c
> index 4cbf8d9..267214f 100644
> --- a/elf/cache.c
> +++ b/elf/cache.c
> @@ -101,6 +101,8 @@ print_entry (const char *lib, int flag, unsigned int osversion,
> case FLAG_AARCH64_LIB64:
> fputs (",AArch64", stdout);
> break;
> + case FLAG_AARCH64_LIB32:
> + fputs (",ILP32", stdout);
> /* Uses the ARM soft-float ABI. */
> case FLAG_ARM_LIBSF:
> fputs (",soft-float", stdout);
> diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h
> index ba1d953..1dd8b4e 100644
> --- a/sysdeps/generic/ldconfig.h
> +++ b/sysdeps/generic/ldconfig.h
> @@ -42,6 +42,7 @@
> #define FLAG_MIPS_LIB32_NAN2008 0x0c00
> #define FLAG_MIPS64_LIBN32_NAN2008 0x0d00
> #define FLAG_MIPS64_LIBN64_NAN2008 0x0e00
> +#define FLAG_AARCH64_LIB32 0x0f00
>
> /* Name of auxiliary cache. */
> #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"
> diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
> index 32851d0..930aa20 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>
>
> +#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/arm/readelflib.c b/sysdeps/unix/sysv/linux/arm/readelflib.c
> index a15ebe4..e255fb0 100644
> --- a/sysdeps/unix/sysv/linux/arm/readelflib.c
> +++ b/sysdeps/unix/sysv/linux/arm/readelflib.c
> @@ -41,7 +41,9 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
> ret = process_elf32_file (file_name, lib, flag, osversion, soname,
> file_contents, file_length);
>
> - if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == EF_ARM_EABI_VER5)
> + if (!ret && elf_header->e_machine == EM_AARCH64)
> + *flag = FLAG_AARCH64_LIB32|FLAG_ELF_LIBC6;
> + else if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == EF_ARM_EABI_VER5)
> {
> if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_HARD)
> *flag = FLAG_ARM_LIBHF|FLAG_ELF_LIBC6;
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 23/29] [AARCH64] Add ILP32 ld.so to the known interpreter names.
2014-10-27 8:03 ` [PATCH 23/29] [AARCH64] Add ILP32 ld.so to the known interpreter names Andrew Pinski
@ 2014-11-18 14:26 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 14:26 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> This patch adds ILP32 ld.so names to the known interpreter names.
>
> * sysdeps/unix/sysv/linux/aarch64/ldconfig.h (SYSDEP_KNOWN_INTERPRETER_NAMES):
> Add ilp32 ld.so names.
> ---
> sysdeps/unix/sysv/linux/aarch64/ldconfig.h | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
Looks ok to me.
> diff --git a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
> index b0e6b6a..a70eafc 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 \
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 24/29] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found
2014-10-27 8:00 ` [PATCH 24/29] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found Andrew Pinski
@ 2014-11-18 14:31 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 14:31 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> To be support multi-lib with ldd, we need to add a ldd-rewrite.sed file
> to rewrite RTLDLIST to include both ld.so's.
>
> * sysdeps/unix/sysv/linux/aarch64/configure.ac (ldd_rewrite_script):
> Set.
> * sysdeps/unix/sysv/linux/aarch64/configure: Regenerate.
> * sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed: New file.
> ---
> sysdeps/unix/sysv/linux/aarch64/configure | 2 ++
> sysdeps/unix/sysv/linux/aarch64/configure.ac | 2 ++
> sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed | 1 +
> 3 files changed, 5 insertions(+), 0 deletions(-)
> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
Looks ok to me.
> diff --git a/sysdeps/unix/sysv/linux/aarch64/configure b/sysdeps/unix/sysv/linux/aarch64/configure
> index 59372d2..faef1dd 100755
> --- a/sysdeps/unix/sysv/linux/aarch64/configure
> +++ b/sysdeps/unix/sysv/linux/aarch64/configure
> @@ -31,3 +31,5 @@ case "$prefix" in
> esac
> fi
>
> +ldd_rewrite_script=$dir/ldd-rewrite.sed
> +
> diff --git a/sysdeps/unix/sysv/linux/aarch64/configure.ac b/sysdeps/unix/sysv/linux/aarch64/configure.ac
> index 6526816..3ca8ed1 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
> +++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
> @@ -9,3 +9,5 @@ else
> LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
> fi
>
> +ldd_rewrite_script=$dir/ldd-rewrite.sed
> +
> diff --git a/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
> new file mode 100644
> index 0000000..2f3bbb9
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
> @@ -0,0 +1 @@
> +s_^\(RTLDLIST=\)\(.*lib/\)\([^/]*\)\(-aarch64\)\(\|\_be\)\(\|\_ilp32\)\(.so\.[0-9.]*\)$_\1"\2\3-aarch64\5\7 \2\3-aarch64\5\_ilp32\7"_
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 25/29] [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32
2014-10-27 8:00 ` [PATCH 25/29] [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32 Andrew Pinski
@ 2014-11-18 14:42 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 14:42 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> In ILP32, the sigaction struct is the same as AARCH64 so we need
> the header file kernel_sigaction.h. To allow for this to work,
> we use a long long fields and then add extra casts when converting
> between the user exposed struct and the kernel exposed struct.
>
> * sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h: New file.
> * sysdeps/unix/sysv/linux/aarch64/sigaction.c (__libc_sigaction):
> Add cast here it is necessary.
Add casts where necessary.
> ---
> sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h | 12 ++++++++++++
> sysdeps/unix/sysv/linux/aarch64/sigaction.c | 10 ++++++----
> 2 files changed, 18 insertions(+), 4 deletions(-)
> create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
>
> diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h b/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
> new file mode 100644
> index 0000000..7b3023b
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
> @@ -0,0 +1,12 @@
> +
> +#define HAVE_SA_RESTORER
> +
> +/* This is the sigaction structure in aarch64 kernel.
> + Note the ILP32 struct uses the same struct as LP64
> + which is why the fields are 64bit in size. */
Two spaces before end of comment.
> +struct kernel_sigaction {
> + unsigned long long k_sa_handler;
> + unsigned long long sa_flags;
> + unsigned long long sa_restorer;
> + sigset_t sa_mask;
> +};
> diff --git a/sysdeps/unix/sysv/linux/aarch64/sigaction.c b/sysdeps/unix/sysv/linux/aarch64/sigaction.c
> index ae6c3fd..8adcbba 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/sigaction.c
> +++ b/sysdeps/unix/sysv/linux/aarch64/sigaction.c
> @@ -39,15 +39,17 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
>
> if (act)
> {
> - kact.k_sa_handler = act->sa_handler;
> + kact.k_sa_handler = (unsigned long long)(uintptr_t)act->sa_handler;
> memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
> kact.sa_flags = act->sa_flags;
> #ifdef HAVE_SA_RESTORER
> if (kact.sa_flags & SA_RESTORER)
> - kact.sa_restorer = act->sa_restorer;
> + kact.sa_restorer = (unsigned long long)(uintptr_t)act->sa_restorer;
> #endif
> }
>
> + /* This is needed for ILP32 as the structures are two different sizes due to
> + using the LP64 structure. */
It's not clear to me what this comment refers to.
> result = INLINE_SYSCALL (rt_sigaction, 4, sig,
> act ? &kact : NULL,
> oact ? &koact : NULL, _NSIG / 8);
> @@ -55,11 +57,11 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
> {
> if (oact && result >= 0)
> {
> - oact->sa_handler = koact.k_sa_handler;
> + oact->sa_handler = (void*)(uintptr_t)koact.k_sa_handler;
> memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
> oact->sa_flags = koact.sa_flags;
> #ifdef HAVE_SA_RESTORER
> - oact->sa_restorer = koact.sa_restorer;
> + oact->sa_restorer = (void*)(uintptr_t)koact.sa_restorer;
Space before * and after casts.
> #endif
> }
> }
> --
> 1.7.2.5
>
Otherwise looks ok.
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 26/29] [AARCH64] Add sigstack.h header for ILP32 reasons.
2014-10-27 8:03 ` [PATCH 26/29] [AARCH64] Add sigstack.h header for ILP32 reasons Andrew Pinski
@ 2014-11-18 14:49 ` Will Newton
0 siblings, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 14:49 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> ILP32 uses the same structure layout for sigaltstack as
> LP64 so we need a special header file.
>
> * sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h: New file.
> ---
> sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h | 71 +++++++++++++++++++++++
> 1 files changed, 71 insertions(+), 0 deletions(-)
> create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
>
> diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h b/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
> new file mode 100644
> index 0000000..2dd8f6b
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
> @@ -0,0 +1,71 @@
> +/* sigstack, sigaltstack definitions.
> + Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Copyright needs updating.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library 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
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#ifndef _SIGNAL_H
> +# error "Never include this file directly. Use <signal.h> instead"
> +#endif
> +
> +
> +/* Structure describing a signal stack (obsolete). */
> +struct sigstack
> + {
> + void *ss_sp; /* Signal stack pointer. */
> + int ss_onstack; /* Nonzero if executing on this stack. */
> + };
> +
> +
> +/* Possible values for `ss_flags.'. */
> +enum
> +{
> + SS_ONSTACK = 1,
> +#define SS_ONSTACK SS_ONSTACK
> + SS_DISABLE
> +#define SS_DISABLE SS_DISABLE
> +};
> +
> +/* Minimum stack size for a signal handler. */
> +#define MINSIGSTKSZ 2048
> +
> +/* System default stack size. */
> +#define SIGSTKSZ 8192
> +
> +
> +/* Alternate, preferred interface.
> + This structure matches the same size and layout
> + for both ILP32 and LP64. */
> +typedef struct sigaltstack
> + {
> +#if defined(__ILP32__) && defined(__AARCH64EB__)
> + int __pad_ss_sp;
> +#endif
> + void *ss_sp;
> +#if defined(__ILP32__) && !defined(__AARCH64EB__)
> + int __pad_ss_sp;
> +#endif
> + int ss_flags;
> +#if defined(__ILP32__)
> + int __pad_after_ss_flags;
> +#endif
> +#if defined(__ILP32__) && defined(__AARCH64EB__)
> + int __pad_ss_size;
> +#endif
> + size_t ss_size;
> +#if defined(__ILP32__) && !defined(__AARCH64EB__)
> + int __pad_ss_size;
> +#endif
> + } stack_t;
It might be simpler to have two definitions, one for __ILP32__ and one
for !__ILP32__ to tidy up the #ifdefs.
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 27/29] [AARCH64] Fix up ucontext for ILP32
2014-10-27 8:00 ` [PATCH 27/29] [AARCH64] Fix up ucontext for ILP32 Andrew Pinski
2014-10-28 20:10 ` Mike Frysinger
@ 2014-11-18 14:54 ` Will Newton
1 sibling, 0 replies; 73+ messages in thread
From: Will Newton @ 2014-11-18 14:54 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> In ILP32 we want to use the same layout of the structure ucontext as LP64 so
> we need to add a padding for uc_link and change the type of uc_flags to
> be the kernel unsigned long type.
>
> * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (struct ucontext):
> Change the type of uc_flags to __SYSCALL_ULONG_TYPE.
> Add padding for uc_link if ILP32.
> ---
> sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h | 10 ++++++++--
> 1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
> index 476f5de..5d224fb 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
> @@ -46,8 +46,14 @@ typedef struct sigcontext mcontext_t;
> /* Userlevel context. */
> typedef struct ucontext
> {
> - unsigned long uc_flags;
> - struct ucontext *uc_link;
> + __SYSCALL_ULONG_TYPE uc_flags;
Is there a reason to use this instead of __syscall_ulong_t?
> +#if defined(__ILP32__) && defined(__AARCH64EB__)
> + int __pad_uc_link;
> +#endif
> + struct ucontext *uc_link;
> +#if defined(__ILP32__) && !defined(__AARCH64EB__)
> + int __pad_uc_link;
> +#endif
> stack_t uc_stack;
> __sigset_t uc_sigmask;
> mcontext_t uc_mcontext;
> --
> 1.7.2.5
>
--
Will Newton
Toolchain Working Group, Linaro
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 00/29] Add Support for AARCH64:ILP32
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
` (29 preceding siblings ...)
2014-10-28 9:15 ` [PATCH 00/29] Add Support for AARCH64:ILP32 Marcus Shawcroft
@ 2015-05-26 13:37 ` Andreas Schwab
2015-05-26 14:13 ` Pinski, Andrew
30 siblings, 1 reply; 73+ messages in thread
From: Andreas Schwab @ 2015-05-26 13:37 UTC (permalink / raw)
To: Andrew Pinski; +Cc: libc-alpha
Andrew Pinski <apinski@cavium.com> writes:
> This patch series adds AARCH64:ILP32 support to glibc.
Where can I find a specification of the ILP32 ABI?
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 00/29] Add Support for AARCH64:ILP32
2015-05-26 13:37 ` Andreas Schwab
@ 2015-05-26 14:13 ` Pinski, Andrew
2015-05-26 14:39 ` Andreas Schwab
0 siblings, 1 reply; 73+ messages in thread
From: Pinski, Andrew @ 2015-05-26 14:13 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Andrew Pinski, libc-alpha
> On May 26, 2015, at 8:28 PM, Andreas Schwab <schwab@suse.de> wrote:
>
> Andrew Pinski <apinski@cavium.com> writes:
>
>> This patch series adds AARCH64:ILP32 support to glibc.
>
> Where can I find a specification of the ILP32 ABI?
The kernel uapi or elf abi? You can find a "beta" version of the elf abi on arm's web site. I suspect there is a few assembly files that need to be changed to support ilp32. Memcpy.S is one of them. I can't dig up the patch to fix them tonight though.
Thanks,
Andrew
>
> Andreas.
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 00/29] Add Support for AARCH64:ILP32
2015-05-26 14:13 ` Pinski, Andrew
@ 2015-05-26 14:39 ` Andreas Schwab
2015-05-26 15:10 ` Pinski, Andrew
0 siblings, 1 reply; 73+ messages in thread
From: Andreas Schwab @ 2015-05-26 14:39 UTC (permalink / raw)
To: Pinski, Andrew; +Cc: Andrew Pinski, libc-alpha
"Pinski, Andrew" <Andrew.Pinski@caviumnetworks.com> writes:
> The kernel uapi or elf abi?
The C ABI.
> You can find a "beta" version of the elf abi on arm's web site. I suspect there is a few assembly files that need to be changed to support ilp32. Memcpy.S is one of them. I can't dig up the patch to fix them tonight though.
Something like this?
diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S
index b0b34fa..51dcba9 100644
--- a/sysdeps/aarch64/memcmp.S
+++ b/sysdeps/aarch64/memcmp.S
@@ -47,6 +47,11 @@
#define mask x13
ENTRY_ALIGN (memcmp, 6)
+#ifdef __ILP32__
+ uxtw src1, src1
+ uxtw src2, src2
+ uxtw limit, limit
+#endif
cbz limit, L(ret0)
eor tmp1, src1, src2
tst tmp1, #7
diff --git a/sysdeps/aarch64/memcpy.S b/sysdeps/aarch64/memcpy.S
index b3d550e..63b3e2d 100644
--- a/sysdeps/aarch64/memcpy.S
+++ b/sysdeps/aarch64/memcpy.S
@@ -47,6 +47,11 @@
ENTRY_ALIGN (memcpy, 6)
+#ifdef __ILP32__
+ uxtw dstin, dstin
+ uxtw src, src
+ uxtw count, count
+#endif
mov dst, dstin
cmp count, #64
b.ge L(cpy_not_short)
diff --git a/sysdeps/aarch64/memmove.S b/sysdeps/aarch64/memmove.S
index 8d0b328..82b571a 100644
--- a/sysdeps/aarch64/memmove.S
+++ b/sysdeps/aarch64/memmove.S
@@ -47,6 +47,11 @@
ENTRY_ALIGN (memmove, 6)
+#ifdef __ILP32__
+ uxtw dstin, dstin
+ uxtw src, src
+ uxtw count, count
+#endif
cmp dstin, src
b.lo L(downwards)
add tmp1, src, count
diff --git a/sysdeps/aarch64/memset.S b/sysdeps/aarch64/memset.S
index 816640a..2ea2ace 100644
--- a/sysdeps/aarch64/memset.S
+++ b/sysdeps/aarch64/memset.S
@@ -53,6 +53,10 @@
ENTRY_ALIGN (__memset, 6)
+#ifdef __ILP32__
+ uxtw dstin, dstin
+ uxtw count, count
+#endif
mov dst, dstin /* Preserve return value. */
ands A_lw, val, #255
#ifndef DONT_USE_DC
--
2.4.1
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 00/29] Add Support for AARCH64:ILP32
2015-05-26 14:39 ` Andreas Schwab
@ 2015-05-26 15:10 ` Pinski, Andrew
2015-05-26 15:16 ` Andreas Schwab
0 siblings, 1 reply; 73+ messages in thread
From: Pinski, Andrew @ 2015-05-26 15:10 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Andrew Pinski, libc-alpha
> On May 26, 2015, at 8:54 PM, Andreas Schwab <schwab@suse.de> wrote:
>
> "Pinski, Andrew" <Andrew.Pinski@caviumnetworks.com> writes:
>
>> The kernel uapi or elf abi?
>
> The C ABI.
>
>> You can find a "beta" version of the elf abi on arm's web site. I suspect there is a few assembly files that need to be changed to support ilp32. Memcpy.S is one of them. I can't dig up the patch to fix them tonight though.
>
> Something like this?
Yes exactly like that.
Thanks,
Andrew
>
> diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S
> index b0b34fa..51dcba9 100644
> --- a/sysdeps/aarch64/memcmp.S
> +++ b/sysdeps/aarch64/memcmp.S
> @@ -47,6 +47,11 @@
> #define mask x13
>
> ENTRY_ALIGN (memcmp, 6)
> +#ifdef __ILP32__
> + uxtw src1, src1
> + uxtw src2, src2
> + uxtw limit, limit
> +#endif
> cbz limit, L(ret0)
> eor tmp1, src1, src2
> tst tmp1, #7
> diff --git a/sysdeps/aarch64/memcpy.S b/sysdeps/aarch64/memcpy.S
> index b3d550e..63b3e2d 100644
> --- a/sysdeps/aarch64/memcpy.S
> +++ b/sysdeps/aarch64/memcpy.S
> @@ -47,6 +47,11 @@
>
> ENTRY_ALIGN (memcpy, 6)
>
> +#ifdef __ILP32__
> + uxtw dstin, dstin
> + uxtw src, src
> + uxtw count, count
> +#endif
> mov dst, dstin
> cmp count, #64
> b.ge L(cpy_not_short)
> diff --git a/sysdeps/aarch64/memmove.S b/sysdeps/aarch64/memmove.S
> index 8d0b328..82b571a 100644
> --- a/sysdeps/aarch64/memmove.S
> +++ b/sysdeps/aarch64/memmove.S
> @@ -47,6 +47,11 @@
>
> ENTRY_ALIGN (memmove, 6)
>
> +#ifdef __ILP32__
> + uxtw dstin, dstin
> + uxtw src, src
> + uxtw count, count
> +#endif
> cmp dstin, src
> b.lo L(downwards)
> add tmp1, src, count
> diff --git a/sysdeps/aarch64/memset.S b/sysdeps/aarch64/memset.S
> index 816640a..2ea2ace 100644
> --- a/sysdeps/aarch64/memset.S
> +++ b/sysdeps/aarch64/memset.S
> @@ -53,6 +53,10 @@
>
> ENTRY_ALIGN (__memset, 6)
>
> +#ifdef __ILP32__
> + uxtw dstin, dstin
> + uxtw count, count
> +#endif
> mov dst, dstin /* Preserve return value. */
> ands A_lw, val, #255
> #ifndef DONT_USE_DC
> --
> 2.4.1
>
>
> Andreas.
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
^ permalink raw reply [flat|nested] 73+ messages in thread
* Re: [PATCH 00/29] Add Support for AARCH64:ILP32
2015-05-26 15:10 ` Pinski, Andrew
@ 2015-05-26 15:16 ` Andreas Schwab
0 siblings, 0 replies; 73+ messages in thread
From: Andreas Schwab @ 2015-05-26 15:16 UTC (permalink / raw)
To: Pinski, Andrew; +Cc: Andrew Pinski, libc-alpha
"Pinski, Andrew" <Andrew.Pinski@caviumnetworks.com> writes:
>> On May 26, 2015, at 8:54 PM, Andreas Schwab <schwab@suse.de> wrote:
>>
>> "Pinski, Andrew" <Andrew.Pinski@caviumnetworks.com> writes:
>>
>>> The kernel uapi or elf abi?
>>
>> The C ABI.
>>
>>> You can find a "beta" version of the elf abi on arm's web site. I suspect there is a few assembly files that need to be changed to support ilp32. Memcpy.S is one of them. I can't dig up the patch to fix them tonight though.
>>
>> Something like this?
>
> Yes exactly like that.
Well, not exactly, since I got the syntax wrong...
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 73+ messages in thread
end of thread, other threads:[~2015-05-26 13:22 UTC | newest]
Thread overview: 73+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-27 8:00 [PATCH 00/29] Add Support for AARCH64:ILP32 Andrew Pinski
2014-10-27 8:00 ` [PATCH 27/29] [AARCH64] Fix up ucontext for ILP32 Andrew Pinski
2014-10-28 20:10 ` Mike Frysinger
2014-11-18 14:54 ` Will Newton
2014-10-27 8:00 ` [PATCH 11/29] [AARCH64] Use PTR_REG in crti.S Andrew Pinski
2014-11-18 12:09 ` Will Newton
2014-10-27 8:00 ` [PATCH 08/29] [AARCH64] Add header guards to sysdep.h headers Andrew Pinski
2014-10-27 16:32 ` Chris Metcalf
2014-10-27 8:00 ` [PATCH 24/29] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found Andrew Pinski
2014-11-18 14:31 ` Will Newton
2014-10-27 8:00 ` [PATCH 02/29] Allow sigset be an array of a different type Andrew Pinski
2014-10-27 20:32 ` Roland McGrath
2014-10-27 8:00 ` [PATCH 12/29] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S Andrew Pinski
2014-11-18 12:23 ` Will Newton
2014-10-27 8:00 ` [PATCH 09/29] Add dynamic ILP32 AARCH64 relocations to elf.h Andrew Pinski
2014-10-27 20:36 ` Roland McGrath
2014-10-27 8:00 ` [PATCH 25/29] [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32 Andrew Pinski
2014-11-18 14:42 ` Will Newton
2014-10-27 8:00 ` [PATCH 04/29] Allow rusage work on a big-endian 32bit-on-64bit target Andrew Pinski
2014-10-28 20:05 ` Mike Frysinger
2014-10-27 8:00 ` [PATCH 19/29] [AARCH64] Add ILP32 support to elf_machine_load_address Andrew Pinski
2014-11-18 13:56 ` Will Newton
2014-10-27 8:00 ` [PATCH 15/29] [AARCH64] Use PTR_REG in getcontext.S Andrew Pinski
2014-11-18 12:37 ` Will Newton
2014-10-27 8:00 ` [PATCH 13/29] [AARCH64] Use PTR_* macros in dl-trampoline.S Andrew Pinski
2014-11-18 12:33 ` Will Newton
2014-10-27 8:00 ` [PATCH 10/29] [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE. Use it in LDST_PCREL and LDST_GLOBAL Andrew Pinski
2014-11-18 12:04 ` Will Newton
2014-10-27 8:00 ` [PATCH 05/29] Allow fd_mask type not be an array of long Andrew Pinski
2014-10-27 16:32 ` Chris Metcalf
2014-11-18 11:24 ` Will Newton
2014-10-27 8:00 ` [PATCH 03/29] Add ability for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.) to have time_t being 64bit Andrew Pinski
2014-10-27 16:32 ` Chris Metcalf
2014-11-18 10:57 ` Will Newton
2014-10-27 8:00 ` [PATCH 18/29] [AARCH64] Reformat inline-asm in elf_machine_load_address Andrew Pinski
2014-11-18 13:51 ` Will Newton
2014-10-27 8:00 ` [PATCH 07/29] Allow generic stat and statfs not have padding for 32bit targets Andrew Pinski
2014-10-27 16:32 ` Chris Metcalf
2014-10-27 8:00 ` [PATCH 01/29] [AARCH64] Fix utmp struct for compatibility reasons Andrew Pinski
2014-10-27 17:57 ` Joseph S. Myers
2014-10-27 21:18 ` Andreas Schwab
2014-10-27 8:00 ` [PATCH 06/29] Allow some fields of siginfo to be different from the generic one Andrew Pinski
2014-11-18 11:31 ` Will Newton
2014-10-27 8:03 ` [PATCH 16/29] [AARCH64] Detect ILP32 in configure scripts Andrew Pinski
2014-10-27 18:05 ` Joseph S. Myers
2014-10-28 20:16 ` Mike Frysinger
2014-10-28 20:18 ` Andrew Pinski
2014-10-27 8:03 ` [PATCH 20/29] [AARCH64] Set up wordsize for ILP32 Andrew Pinski
2014-11-18 13:58 ` Will Newton
2014-10-27 8:03 ` [PATCH 22/29] [AARCH64] Add support to ldconfig for ILP32 and libilp32 Andrew Pinski
2014-11-18 14:20 ` Will Newton
2014-10-27 8:03 ` [PATCH 26/29] [AARCH64] Add sigstack.h header for ILP32 reasons Andrew Pinski
2014-11-18 14:49 ` Will Newton
2014-10-27 8:03 ` [PATCH 23/29] [AARCH64] Add ILP32 ld.so to the known interpreter names Andrew Pinski
2014-11-18 14:26 ` Will Newton
2014-10-27 8:03 ` [PATCH 29/29] [AARCH64] Make lp64 and ilp32 directories Andrew Pinski
2014-10-27 18:07 ` Joseph S. Myers
2014-10-27 8:03 ` [PATCH 14/29] [AARCH64] Use PTR_* in start.S Andrew Pinski
2014-11-18 12:35 ` Will Newton
2014-10-27 8:03 ` [PATCH 17/29] [AARCH64] Syscalls for ILP32 are passed always via 64bit values Andrew Pinski
2014-11-18 12:50 ` Will Newton
2014-10-27 8:03 ` [PATCH 28/29] [AARCH64] Add typesizes.h for ILP32 Andrew Pinski
2014-10-27 16:32 ` Chris Metcalf
2014-10-28 20:06 ` Mike Frysinger
2014-10-27 8:03 ` [PATCH 21/29] [AARCH64] Add ILP32 to makefiles Andrew Pinski
2014-10-28 20:14 ` Mike Frysinger
2014-10-28 22:46 ` Joseph S. Myers
2014-10-28 9:15 ` [PATCH 00/29] Add Support for AARCH64:ILP32 Marcus Shawcroft
2015-05-26 13:37 ` Andreas Schwab
2015-05-26 14:13 ` Pinski, Andrew
2015-05-26 14:39 ` Andreas Schwab
2015-05-26 15:10 ` Pinski, Andrew
2015-05-26 15:16 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).