AArch64 Port

This commit is contained in:
Marcus Shawcroft 2012-11-09 17:53:51 +00:00
parent 2c1adbcb76
commit 554066b83b
128 changed files with 13767 additions and 0 deletions

120
ports/ChangeLog.aarch64 Normal file
View File

@ -0,0 +1,120 @@
2012-11-09 Marcus Shawcroft <marcus.shawcroft@linaro.org>
* sysdeps/aarch64/Implies: New file.
* sysdeps/aarch64/Makefile: New file.
* sysdeps/aarch64/__longjmp.S: New file.
* sysdeps/aarch64/backtrace.c: New file.
* sysdeps/aarch64/bits: New file.
* sysdeps/aarch64/bits/atomic.h: New file.
* sysdeps/aarch64/bits/endian.h: New file.
* sysdeps/aarch64/bits/fenv.h: New file.
* sysdeps/aarch64/bits/link.h: New file.
* sysdeps/aarch64/bits/linkmap.h: New file.
* sysdeps/aarch64/bits/mathdef.h: New file.
* sysdeps/aarch64/bits/setjmp.h: New file.
* sysdeps/aarch64/bsd-_setjmp.S: New file.
* sysdeps/aarch64/bsd-setjmp.S: New file.
* sysdeps/aarch64/crti.S: New file.
* sysdeps/aarch64/crtn.S: New file.
* sysdeps/aarch64/dl-irel.h: New file.
* sysdeps/aarch64/dl-link.sym: New file.
* sysdeps/aarch64/dl-machine.h: New file.
* sysdeps/aarch64/dl-sysdep.h: New file.
* sysdeps/aarch64/dl-tls.h: New file.
* sysdeps/aarch64/dl-tlsdesc.S: New file.
* sysdeps/aarch64/dl-tlsdesc.h: New file.
* sysdeps/aarch64/dl-trampoline.S: New file.
* sysdeps/aarch64/fpu/fclrexcpt.c: New file.
* sysdeps/aarch64/fpu/fedisblxcpt.c: New file.
* sysdeps/aarch64/fpu/feenablxcpt.c: New file.
* sysdeps/aarch64/fpu/fegetenv.c: New file.
* sysdeps/aarch64/fpu/fegetexcept.c: New file.
* sysdeps/aarch64/fpu/fegetround.c: New file.
* sysdeps/aarch64/fpu/feholdexcpt.c: New file.
* sysdeps/aarch64/fpu/fesetenv.c: New file.
* sysdeps/aarch64/fpu/fesetround.c: New file.
* sysdeps/aarch64/fpu/feupdateenv.c: New file.
* sysdeps/aarch64/fpu/fgetexcptflg.c: New file.
* sysdeps/aarch64/fpu/fraiseexcpt.c: New file.
* sysdeps/aarch64/fpu/fsetexcptflg.c: New file.
* sysdeps/aarch64/fpu/ftestexcept.c: New file.
* sysdeps/aarch64/fpu/get-rounding-mode.h: New file.
* sysdeps/aarch64/fpu/s_fma.c: New file.
* sysdeps/aarch64/fpu_control.h: New file.
* sysdeps/aarch64/jmpbuf-offsets.h: New file.
* sysdeps/aarch64/jmpbuf-unwind.h: New file.
* sysdeps/aarch64/ldsodefs.h: New file.
* sysdeps/aarch64/libc-tls.c: New file.
* sysdeps/aarch64/libm-test-ulps: New file.
* sysdeps/aarch64/machine-gmon.h: New file.
* sysdeps/aarch64/memusage.h: New file.
* sysdeps/aarch64/nptl/Makefile: New file.
* sysdeps/aarch64/nptl/pthread_spin_lock.c: New file.
* sysdeps/aarch64/nptl/pthreaddef.h: New file.
* sysdeps/aarch64/nptl/tcb-offsets.sym: New file.
* sysdeps/aarch64/nptl/tls.h: New file.
* sysdeps/aarch64/sotruss-lib.c: New file.
* sysdeps/unix/sysv/linux/aarch64/Implies: New file.
* sysdeps/unix/sysv/linux/aarch64/Makefile: New file.
* sysdeps/unix/sysv/linux/aarch64/Versions: New file.
* sysdeps/unix/sysv/linux/aarch64/__read_tp.S: New file.
* sysdeps/unix/sysv/linux/aarch64/bits: New file.
* sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h: New file.
* sysdeps/unix/sysv/linux/aarch64/bits/libc-vdso.h: New file.
* sysdeps/unix/sysv/linux/aarch64/bits/mman.h: New file.
* sysdeps/unix/sysv/linux/aarch64/clone.S: New file.
* sysdeps/unix/sysv/linux/aarch64/configure: New file.
* sysdeps/unix/sysv/linux/aarch64/configure.in: New file.
* sysdeps/unix/sysv/linux/aarch64/getcontext.S: New file.
* sysdeps/unix/sysv/linux/aarch64/gettimeofday.c: New file.
* sysdeps/unix/sysv/linux/aarch64/init-first.c: New file.
* sysdeps/unix/sysv/linux/aarch64/ioctl.S: New file.
* sysdeps/unix/sysv/linux/aarch64/kernel-features.h: New file.
* sysdeps/unix/sysv/linux/aarch64/kernel_rt_sigframe.h: New file.
* sysdeps/unix/sysv/linux/aarch64/ldconfig.h: New file.
* sysdeps/unix/sysv/linux/aarch64/libc-__read_tp.S: New file.
* sysdeps/unix/sysv/linux/aarch64/makecontext.c: New file.
* sysdeps/unix/sysv/linux/aarch64/mmap.c: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/bits: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/bits/local_lim.h: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/bits/pthreadtypes.h: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/bits/semaphore.h: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/c++-types.data: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/clone.S: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/createthread.c: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/fork.c: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/ld.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/libBrokenLocale.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/libanl.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/libcrypt.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/libdl.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/libm.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/libnsl.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/libpthread.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/libresolv.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/librt.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/libthread_db.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/libutil.abilist: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/lowlevellock.h: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/pt-vfork.S: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/pthread_once.c: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h: New file.
* sysdeps/unix/sysv/linux/aarch64/nptl/vfork.S: New file.
* sysdeps/unix/sysv/linux/aarch64/profil-counter.h: New file.
* sysdeps/unix/sysv/linux/aarch64/setcontext.S: New file.
* sysdeps/unix/sysv/linux/aarch64/sigaction.c: New file.
* sysdeps/unix/sysv/linux/aarch64/swapcontext.S: New file.
* sysdeps/unix/sysv/linux/aarch64/sys/elf.h: New file.
* sysdeps/unix/sysv/linux/aarch64/sys/procfs.h: New file.
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h: New file.
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: New file.
* sysdeps/unix/sysv/linux/aarch64/sys/user.h: New file.
* sysdeps/unix/sysv/linux/aarch64/syscall.S: New file.
* sysdeps/unix/sysv/linux/aarch64/syscalls.list: New file.
* sysdeps/unix/sysv/linux/aarch64/sysdep.c: New file.
* sysdeps/unix/sysv/linux/aarch64/sysdep.h: New file.
* sysdeps/unix/sysv/linux/aarch64/ucontext-internal.h: New file.
* sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym: New file.
* sysdeps/unix/sysv/linux/aarch64/vfork.S: New file.

View File

@ -0,0 +1,6 @@
wordsize-64
ieee754/ldbl-128
ieee754/dbl-64/wordsize-64
ieee754/dbl-64
ieee754/flt-32
aarch64/soft-fp

View File

@ -0,0 +1,12 @@
long-double-fcts = yes
ifeq ($(subdir),elf)
sysdep-dl-routines += tlsdesc dl-tlsdesc
sysdep_routines += tlsdesc dl-tlsdesc
sysdep-rtld-routines += tlsdesc dl-tlsdesc
gen-as-const-headers += dl-link.sym
endif
ifeq ($(subdir),csu)
gen-as-const-headers += tlsdesc.sym
endif

View File

@ -0,0 +1,98 @@
/* Copyright (C) 1997-2012 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>
#include <jmpbuf-offsets.h>
/* __longjmp(jmpbuf, val) */
ENTRY (__longjmp)
cfi_def_cfa(x0, 0)
cfi_offset(x19, JB_X19<<3)
cfi_offset(x20, JB_X20<<3)
cfi_offset(x21, JB_X21<<3)
cfi_offset(x22, JB_X22<<3)
cfi_offset(x23, JB_X23<<3)
cfi_offset(x24, JB_X24<<3)
cfi_offset(x25, JB_X25<<3)
cfi_offset(x26, JB_X26<<3)
cfi_offset(x27, JB_X27<<3)
cfi_offset(x28, JB_X28<<3)
cfi_offset(x29, JB_X29<<3)
cfi_offset(x30, JB_LR<<3)
cfi_offset( d8, JB_D8<<3)
cfi_offset( d9, JB_D9<<3)
cfi_offset(d10, JB_D10<<3)
cfi_offset(d11, JB_D11<<3)
cfi_offset(d12, JB_D12<<3)
cfi_offset(d13, JB_D13<<3)
cfi_offset(d14, JB_D14<<3)
cfi_offset(d15, JB_D15<<3)
ldp x19, x20, [x0, #JB_X19<<3]
ldp x21, x22, [x0, #JB_X21<<3]
ldp x23, x24, [x0, #JB_X23<<3]
ldp x25, x26, [x0, #JB_X25<<3]
ldp x27, x28, [x0, #JB_X27<<3]
ldp x29, x30, [x0, #JB_X29<<3]
ldp d8, d9, [x0, #JB_D8<<3]
ldp d10, d11, [x0, #JB_D10<<3]
ldp d12, d13, [x0, #JB_D12<<3]
ldp d14, d15, [x0, #JB_D14<<3]
/* Originally this was implemented with a series of
.cfi_restore() directives.
The theory was that cfi_restore should revert to previous
frame value is the same as the current value. In practice
this doesn't work, even after cfi_restore() gdb continues
to try to recover a previous frame value offset from x0,
which gets stuffed after a few more instructions. The
cfi_same_value() mechanism appears to work fine. */
cfi_same_value(x19)
cfi_same_value(x20)
cfi_same_value(x21)
cfi_same_value(x22)
cfi_same_value(x23)
cfi_same_value(x24)
cfi_same_value(x25)
cfi_same_value(x26)
cfi_same_value(x27)
cfi_same_value(x28)
cfi_same_value(x29)
cfi_same_value(x30)
cfi_same_value(d8)
cfi_same_value(d9)
cfi_same_value(d10)
cfi_same_value(d11)
cfi_same_value(d12)
cfi_same_value(d13)
cfi_same_value(d14)
cfi_same_value(d15)
ldr x5, [x0, #JB_SP<<3]
mov sp, x5
cmp x1, #0
mov x0, #1
csel x0, x1, x0, ne
/* Use br instead of ret because ret is guaranteed to mispredict */
br x30
END (__longjmp)

View File

@ -0,0 +1 @@
#include <sysdeps/x86_64/backtrace.c>

View File

@ -0,0 +1,171 @@
/* Copyright (C) 2003-2012 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 _AARCH64_BITS_ATOMIC_H
#define _AARCH64_BITS_ATOMIC_H 1
#include <stdint.h>
typedef int8_t atomic8_t;
typedef int16_t atomic16_t;
typedef int32_t atomic32_t;
typedef int64_t atomic64_t;
typedef uint8_t uatomic8_t;
typedef uint16_t uatomic16_t;
typedef uint32_t uatomic32_t;
typedef uint64_t uatomic64_t;
typedef intptr_t atomicptr_t;
typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;
/* Compare and exchange.
For all "bool" routines, we return FALSE if exchange succesful. */
# define __arch_compare_and_exchange_bool_8_int(mem, newval, oldval, model) \
({ \
typeof (*mem) __oldval = (oldval); \
!__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
model, __ATOMIC_RELAXED); \
})
# define __arch_compare_and_exchange_bool_16_int(mem, newval, oldval, model) \
({ \
typeof (*mem) __oldval = (oldval); \
!__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
model, __ATOMIC_RELAXED); \
})
# define __arch_compare_and_exchange_bool_32_int(mem, newval, oldval, model) \
({ \
typeof (*mem) __oldval = (oldval); \
!__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
model, __ATOMIC_RELAXED); \
})
# define __arch_compare_and_exchange_bool_64_int(mem, newval, oldval, model) \
({ \
typeof (*mem) __oldval = (oldval); \
!__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
model, __ATOMIC_RELAXED); \
})
# define __arch_compare_and_exchange_val_8_int(mem, newval, oldval, model) \
({ \
typeof (*mem) __oldval = (oldval); \
__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
model, __ATOMIC_RELAXED); \
__oldval; \
})
# define __arch_compare_and_exchange_val_16_int(mem, newval, oldval, model) \
({ \
typeof (*mem) __oldval = (oldval); \
__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
model, __ATOMIC_RELAXED); \
__oldval; \
})
# define __arch_compare_and_exchange_val_32_int(mem, newval, oldval, model) \
({ \
typeof (*mem) __oldval = (oldval); \
__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
model, __ATOMIC_RELAXED); \
__oldval; \
})
# define __arch_compare_and_exchange_val_64_int(mem, newval, oldval, model) \
({ \
typeof (*mem) __oldval = (oldval); \
__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0, \
model, __ATOMIC_RELAXED); \
__oldval; \
})
/* Compare and exchange with "acquire" semantics, ie barrier after. */
# define atomic_compare_and_exchange_bool_acq(mem, new, old) \
__atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
mem, new, old, __ATOMIC_ACQUIRE)
# define atomic_compare_and_exchange_val_acq(mem, new, old) \
__atomic_val_bysize (__arch_compare_and_exchange_val, int, \
mem, new, old, __ATOMIC_ACQUIRE)
/* Compare and exchange with "release" semantics, ie barrier before. */
# define atomic_compare_and_exchange_bool_rel(mem, new, old) \
__atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
mem, new, old, __ATOMIC_RELEASE)
# define atomic_compare_and_exchange_val_rel(mem, new, old) \
__atomic_val_bysize (__arch_compare_and_exchange_val, int, \
mem, new, old, __ATOMIC_RELEASE)
/* Atomic exchange (without compare). */
# define __arch_exchange_8_int(mem, newval, model) \
__atomic_exchange_n (mem, newval, model)
# define __arch_exchange_16_int(mem, newval, model) \
__atomic_exchange_n (mem, newval, model)
# define __arch_exchange_32_int(mem, newval, model) \
__atomic_exchange_n (mem, newval, model)
# define __arch_exchange_64_int(mem, newval, model) \
__atomic_exchange_n (mem, newval, model)
# define atomic_exchange_acq(mem, value) \
__atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_ACQUIRE)
# define atomic_exchange_rel(mem, value) \
__atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_RELEASE)
/* Atomically add value and return the previous (unincremented) value. */
# define __arch_exchange_and_add_8_int(mem, value, model) \
__atomic_fetch_add (mem, value, model)
# define __arch_exchange_and_add_16_int(mem, value, model) \
__atomic_fetch_add (mem, value, model)
# define __arch_exchange_and_add_32_int(mem, value, model) \
__atomic_fetch_add (mem, value, model)
# define __arch_exchange_and_add_64_int(mem, value, model) \
__atomic_fetch_add (mem, value, model)
# define atomic_exchange_and_add_acq(mem, value) \
__atomic_val_bysize (__arch_exchange_and_add, int, mem, value, \
__ATOMIC_ACQUIRE)
# define atomic_exchange_and_add_rel(mem, value) \
__atomic_val_bysize (__arch_exchange_and_add, int, mem, value, \
__ATOMIC_RELEASE)
/* Barrier macro. */
#define atomic_full_barrier() __sync_synchronize()
#endif

View File

@ -0,0 +1,30 @@
/* Copyright (C) 1997-2012 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 _ENDIAN_H
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
#endif
/* AArch64 can be either big or little endian. */
#ifdef __AARCH64EB__
# define __BYTE_ORDER __BIG_ENDIAN
#else
# define __BYTE_ORDER __LITTLE_ENDIAN
#endif
#define __FLOAT_WORD_ORDER __BYTE_ORDER

View File

@ -0,0 +1,74 @@
/* Copyright (C) 2004-2012 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 _FENV_H
# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
#endif
/* Define bits representing exceptions in the FPSR status word. */
enum
{
FE_INVALID =
#define FE_INVALID 1
FE_INVALID,
FE_DIVBYZERO =
#define FE_DIVBYZERO 2
FE_DIVBYZERO,
FE_OVERFLOW =
#define FE_OVERFLOW 4
FE_OVERFLOW,
FE_UNDERFLOW =
#define FE_UNDERFLOW 8
FE_UNDERFLOW,
FE_INEXACT =
#define FE_INEXACT 16
FE_INEXACT,
};
/* Amount to shift by to convert an exception bit in FPSR to a an
exception bit mask in FPCR. */
#define FE_EXCEPT_SHIFT 8
/* All supported exceptions. */
#define FE_ALL_EXCEPT \
(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
/* Define bits representing rounding modes in the FPCR Rmode field. */
#define FE_TONEAREST 0x000000
#define FE_UPWARD 0x400000
#define FE_DOWNWARD 0x800000
#define FE_TOWARDZERO 0xc00000
/* Type representing exception flags. */
typedef unsigned int fexcept_t;
/* Type representing floating-point environment. */
typedef struct
{
unsigned int __fpcr;
unsigned int __fpsr;
}
fenv_t;
/* If the default argument is used we use this value. */
#define FE_DFL_ENV ((const fenv_t *) -1l)
#ifdef __USE_GNU
/* Floating-point environment where none of the exceptions are masked. */
# define FE_NOMASK_ENV ((const fenv_t *) -2)
#endif

View File

@ -0,0 +1,60 @@
/* Copyright (C) 2005-2012 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 _LINK_H
# error "Never include <bits/link.h> directly; use <link.h> instead."
#endif
/* Registers for entry into PLT on AArch64. */
typedef struct La_aarch64_regs
{
uint64_t lr_xreg[8];
uint64_t lr_dreg[8];
uint64_t lr_sp;
uint64_t lr_lr;
} La_aarch64_regs;
/* Return values for calls from PLT on AArch64. */
typedef struct La_aarch64_retval
{
/* Up to two integer registers can be used for a return value. */
uint64_t lrv_xreg[2];
/* Up to four D registers can be used for a return value. */
uint64_t lrv_dreg[4];
} La_aarch64_retval;
__BEGIN_DECLS
extern Elf64_Addr
la_aarch64_gnu_pltenter (Elf64_Sym *__sym, unsigned int __ndx,
uintptr_t *__refcook,
uintptr_t *__defcook,
La_aarch64_regs *__regs,
unsigned int *__flags,
const char *__symname,
long int *__framesizep);
extern unsigned int
la_aarch64_gnu_pltexit (Elf64_Sym *__sym, unsigned int __ndx,
uintptr_t *__refcook,
uintptr_t *__defcook,
const La_aarch64_regs *__inregs,
La_aarch64_retval *__outregs,
const char *__symname);
__END_DECLS

View File

@ -0,0 +1,23 @@
/* Copyright (C) 2009-2012 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/>. */
struct link_map_machine
{
ElfW(Addr) plt; /* Address of .plt */
void *tlsdesc_table; /* Address of TLS descriptor hash table. */
};

View File

@ -0,0 +1,39 @@
/* Copyright (C) 1999-2012 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/>. */
#if !defined _MATH_H && !defined _COMPLEX_H
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
#endif
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
# define _MATH_H_MATHDEF 1
/* GCC does not promote `float' values to `double'. */
typedef float float_t; /* `float' expressions are evaluated as
`float'. */
typedef double double_t; /* `double' expressions are evaluated as
`double'. */
/* The values returned by `ilogb' for 0 and NaN respectively. */
# define FP_ILOGB0 (-2147483647)
# define FP_ILOGBNAN (2147483647)
# define FP_FAST_FMA 1
# define FP_FAST_FMAF 1
#endif /* ISO C99 */

View File

@ -0,0 +1,33 @@
/* Copyright (C) 1997-2012 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 _BITS_SETJMP_H
#define _BITS_SETJMP_H 1
#if !defined _SETJMP_H && !defined _PTHREAD_H
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
#endif
#ifndef _ASM
/* Jump buffer contains:
x19-x28, x29(fp), x30(lr), (x31)sp, d8-d15. Other registers are not
saved. */
typedef unsigned long long __jmp_buf [22];
#endif
#endif

View File

@ -0,0 +1 @@
/* _setjmp is in setjmp.S */

View File

@ -0,0 +1 @@
/* setjmp is in setjmp.S */

View File

@ -0,0 +1,90 @@
/* Special .init and .fini section support for AArch64.
Copyright (C) 1995-2012 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
/* crti.S puts a function prologue at the beginning of the .init and
.fini sections and defines global symbols for those addresses, so
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 <libc-symbols.h>
#ifndef PREINIT_FUNCTION
# define PREINIT_FUNCTION __gmon_start__
#endif
#ifndef PREINIT_FUNCTION_WEAK
# define PREINIT_FUNCTION_WEAK 1
#endif
#if PREINIT_FUNCTION_WEAK
weak_extern (PREINIT_FUNCTION)
#else
.hidden PREINIT_FUNCTION
#endif
#if PREINIT_FUNCTION_WEAK
.align 2
.type call_weak_fn, %function
call_weak_fn:
adrp x0, :got:PREINIT_FUNCTION
ldr x0, [x0, #:got_lo12:PREINIT_FUNCTION]
cbz x0, 1f
b PREINIT_FUNCTION
1:
RET
.size call_weak_fn, .-call_weak_fn
#endif
.section .init,"ax",%progbits
.align 2
.global _init
.type _init, %function
_init:
stp x29, x30, [sp, -16]!
mov x29, sp
#if PREINIT_FUNCTION_WEAK
bl call_weak_fn
#else
bl PREINIT_FUNCTION
#endif
.section .fini,"ax",%progbits
.align 2
.global _fini
.type _fini, %function
_fini:
stp x29, x30, [sp, -16]!
mov x29, sp

View File

@ -0,0 +1,46 @@
/* Special .init and .fini section support for AArch64.
Copyright (C) 1995-2012 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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/>. */
/* crtn.S puts function epilogues in the .init and .fini sections
corresponding to the prologues in crti.S. */
.section .init,"ax",%progbits
ldp x29, x30, [sp], 16
RET
.section .fini,"ax",%progbits
ldp x29, x30, [sp], 16
RET

View File

@ -0,0 +1,36 @@
/* Machine-dependent ELF indirect relocation inline functions.
AArch64 version.
Copyright (C) 2012 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 _DL_IREL_H
#define _DL_IREL_H
#include <stdio.h>
#include <unistd.h>
/* AArch64 does not yet implement IFUNC support. However since
2011-06-20 provision of a elf_ifunc_invoke has been mandatory. */
static inline ElfW(Addr)
__attribute ((always_inline))
elf_ifunc_invoke (ElfW(Addr) addr)
{
return ((ElfW(Addr) (*) (void)) (addr)) ();
}
#endif

View File

@ -0,0 +1,15 @@
#include <stddef.h>
#include <sysdep.h>
#include <link.h>
#include <dl-tlsdesc.h>
DL_SIZEOF_RG sizeof(struct La_aarch64_regs)
DL_SIZEOF_RV sizeof(struct La_aarch64_retval)
DL_OFFSET_RG_X0 offsetof(struct La_aarch64_regs, lr_xreg)
DL_OFFSET_RG_D0 offsetof(struct La_aarch64_regs, lr_dreg)
DL_OFFSET_RG_SP offsetof(struct La_aarch64_regs, lr_sp)
DL_OFFSET_RG_LR offsetof(struct La_aarch64_regs, lr_lr)
DL_OFFSET_RV_X0 offsetof(struct La_aarch64_retval, lrv_xreg)
DL_OFFSET_RV_D0 offsetof(struct La_aarch64_retval, lrv_dreg)

View File

@ -0,0 +1,388 @@
/* Copyright (C) 1995-2012 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 dl_machine_h
#define dl_machine_h
#define ELF_MACHINE_NAME "aarch64"
#include <tls.h>
#include <dl-tlsdesc.h>
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int __attribute__ ((unused))
elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
{
return ehdr->e_machine == EM_AARCH64;
}
/* Return the link-time address of _DYNAMIC. Conveniently, this is the
first element of the GOT. */
static inline ElfW(Addr) __attribute__ ((unused))
elf_machine_dynamic (void)
{
ElfW(Addr) addr = (ElfW(Addr)) &_DYNAMIC;
return addr;
}
/* Return the run-time load address of the shared object. */
static inline ElfW(Addr) __attribute__ ((unused))
elf_machine_load_address (void)
{
/* To figure out the load address we use the definition that for any symbol:
dynamic_addr(symbol) = static_addr(symbol) + load_addr
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. */
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));
return dynamic_addr - static_addr;
}
/* Set up the loaded object described by L so its unrelocated PLT
entries will jump to the on-demand fixup code in dl-runtime.c. */
static inline int __attribute__ ((unused))
elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
{
if (l->l_info[DT_JMPREL] && lazy)
{
ElfW(Addr) *got;
extern void _dl_runtime_resolve (ElfW(Word));
extern void _dl_runtime_profile (ElfW(Word));
got = (ElfW(Addr) *) D_PTR (l, l_info[DT_PLTGOT]);
if (got[1])
{
l->l_mach.plt = got[1] + l->l_addr;
}
got[1] = (ElfW(Addr)) l;
/* The got[2] entry contains the address of a function which gets
called to get the address of a so far unresolved function and
jump to it. The profiling extension of the dynamic linker allows
to intercept the calls to collect information. In this case we
don't store the address in the GOT so that all future calls also
end in this function. */
if ( profile)
{
got[2] = (ElfW(Addr)) &_dl_runtime_profile;
if (GLRO(dl_profile) != NULL
&& _dl_name_match_p (GLRO(dl_profile), l))
/* Say that we really want profiling and the timers are
started. */
GL(dl_profile_map) = l;
}
else
{
/* This function will get called to fix up the GOT entry
indicated by the offset on the stack, and then jump to
the resolved address. */
got[2] = (ElfW(Addr)) &_dl_runtime_resolve;
}
}
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;
return lazy;
}
/* 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 */
#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 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_TLSDESC) * ELF_RTYPE_CLASS_PLT) \
| (((type) == R_AARCH64_COPY) * ELF_RTYPE_CLASS_COPY))
#define ELF_MACHINE_JMP_SLOT R_AARCH64_JUMP_SLOT
/* AArch64 uses RELA not REL */
#define ELF_MACHINE_NO_REL 1
static inline ElfW(Addr)
elf_machine_fixup_plt (struct link_map *map, lookup_t t,
const ElfW(Rela) *reloc,
ElfW(Addr) *reloc_addr,
ElfW(Addr) value)
{
return *reloc_addr = value;
}
/* Return the final value of a plt relocation. */
static inline ElfW(Addr)
elf_machine_plt_value (struct link_map *map,
const ElfW(Rela) *reloc,
ElfW(Addr) value)
{
return value;
}
#endif
/* Names of the architecture-specific auditing callback functions. */
#define ARCH_LA_PLTENTER aarch64_gnu_pltenter
#define ARCH_LA_PLTEXIT aarch64_gnu_pltexit
#ifdef RESOLVE_MAP
auto inline void
__attribute__ ((always_inline))
elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
const ElfW(Sym) *sym, const struct r_found_version *version,
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);
if (__builtin_expect (r_type == R_AARCH64_RELATIVE, 0))
*reloc_addr = map->l_addr + reloc->r_addend;
else if (__builtin_expect (r_type == R_AARCH64_NONE, 0))
return;
else
{
const ElfW(Sym) *const refsym = sym;
struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
ElfW(Addr) value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value;
switch (r_type)
{
case R_AARCH64_COPY:
if (sym == NULL)
break;
if (sym->st_size > refsym->st_size
|| (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
{
const char *strtab;
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
_dl_error_printf ("\
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
rtld_progname ?: "<program name unknown>",
strtab + refsym->st_name);
}
memcpy (reloc_addr_arg, (void *) value,
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:
*reloc_addr = value + reloc->r_addend;
break;
case R_AARCH64_TLSDESC:
{
struct tlsdesc volatile *td =
(struct tlsdesc volatile *)reloc_addr;
#ifndef RTLD_BOOTSTRAP
if (! sym)
{
td->arg = (void*)reloc->r_addend;
td->entry = _dl_tlsdesc_undefweak;
}
else
#endif
{
#ifndef RTLD_BOOTSTRAP
# ifndef SHARED
CHECK_STATIC_TLS (map, sym_map);
# else
if (!TRY_STATIC_TLS (map, sym_map))
{
td->arg = _dl_make_tlsdesc_dynamic
(sym_map, sym->st_value + reloc->r_addend);
td->entry = _dl_tlsdesc_dynamic;
}
else
# endif
#endif
{
td->arg = (void*)(sym->st_value + sym_map->l_tls_offset
+ reloc->r_addend);
td->entry = _dl_tlsdesc_return;
}
}
break;
}
case R_AARCH64_TLS_DTPMOD64:
#ifdef RTLD_BOOTSTRAP
*reloc_addr = 1;
#else
if (sym_map != NULL)
{
*reloc_addr = sym_map->l_tls_modid;
}
#endif
break;
case R_AARCH64_TLS_DTPREL64:
if (sym)
{
const char *strtab;
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
*reloc_addr = sym->st_value + reloc->r_addend;
}
break;
case R_AARCH64_TLS_TPREL64:
if (sym)
{
const char *strtab;
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
CHECK_STATIC_TLS (map, sym_map);
*reloc_addr =
sym->st_value + reloc->r_addend + sym_map->l_tls_offset;
}
break;
default:
_dl_reloc_bad_type (map, r_type, 0);
break;
}
}
}
inline void
__attribute__ ((always_inline))
elf_machine_rela_relative (ElfW(Addr) l_addr,
const ElfW(Rela) *reloc,
void *const reloc_addr_arg)
{
ElfW(Addr) *const reloc_addr = reloc_addr_arg;
*reloc_addr = l_addr + reloc->r_addend;
}
inline void
__attribute__ ((always_inline))
elf_machine_lazy_rel (struct link_map *map,
ElfW(Addr) l_addr,
const ElfW(Rela) *reloc,
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);
/* Check for unexpected PLT reloc type. */
if (__builtin_expect (r_type == R_AARCH64_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))
{
struct tlsdesc volatile *td =
(struct tlsdesc volatile *)reloc_addr;
td->arg = (void*)reloc;
td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)])
+ map->l_addr);
}
else
_dl_reloc_bad_type (map, r_type, 1);
}
#endif

View File

@ -0,0 +1,23 @@
/* Copyright (C) 2002-2012 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_next <dl-sysdep.h>
/* _dl_argv cannot be attribute_relro, because _dl_start_user
might write into it after _dl_start returns. */
#define DL_ARGV_NOT_RELRO 1

View File

@ -0,0 +1,30 @@
/* Copyright (C) 2005-2012 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/>. */
/* Type used for the representation of TLS information in the GOT. */
typedef struct
{
unsigned long int ti_module;
unsigned long int ti_offset;
} tls_index;
extern void *__tls_get_addr (tls_index *ti);
/* Value used for dtv entries for which the allocation is delayed. */
#define TLS_DTV_UNALLOCATED ((void *) -1l)

View File

@ -0,0 +1,329 @@
/* Thread-local storage handling in the ELF dynamic linker.
AArch64 version.
Copyright (C) 2011, 2012 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>
#include <tls.h>
#include "tlsdesc.h"
#define NSAVEDQREGPAIRS 16
#define SAVE_Q_REGISTERS \
stp q0, q1, [sp, #-32*NSAVEDQREGPAIRS]!; \
cfi_adjust_cfa_offset (32*NSAVEDQREGPAIRS); \
stp q2, q3, [sp, #32*1]; \
stp q4, q5, [sp, #32*2]; \
stp q6, q7, [sp, #32*3]; \
stp q8, q9, [sp, #32*4]; \
stp q10, q11, [sp, #32*5]; \
stp q12, q13, [sp, #32*6]; \
stp q14, q15, [sp, #32*7]; \
stp q16, q17, [sp, #32*8]; \
stp q18, q19, [sp, #32*9]; \
stp q20, q21, [sp, #32*10]; \
stp q22, q23, [sp, #32*11]; \
stp q24, q25, [sp, #32*12]; \
stp q26, q27, [sp, #32*13]; \
stp q28, q29, [sp, #32*14]; \
stp q30, q31, [sp, #32*15];
#define RESTORE_Q_REGISTERS \
ldp q2, q3, [sp, #32*1]; \
ldp q4, q5, [sp, #32*2]; \
ldp q6, q7, [sp, #32*3]; \
ldp q8, q9, [sp, #32*4]; \
ldp q10, q11, [sp, #32*5]; \
ldp q12, q13, [sp, #32*6]; \
ldp q14, q15, [sp, #32*7]; \
ldp q16, q17, [sp, #32*8]; \
ldp q18, q19, [sp, #32*9]; \
ldp q20, q21, [sp, #32*10]; \
ldp q22, q23, [sp, #32*11]; \
ldp q24, q25, [sp, #32*12]; \
ldp q26, q27, [sp, #32*13]; \
ldp q28, q29, [sp, #32*14]; \
ldp q30, q31, [sp, #32*15]; \
ldp q0, q1, [sp], #32*NSAVEDQREGPAIRS; \
cfi_adjust_cfa_offset (-32*NSAVEDQREGPAIRS);
.text
/* Compute the thread pointer offset for symbols in the static
TLS block. The offset is the same for all threads.
Prototype:
_dl_tlsdesc_return (tlsdesc *) ;
*/
.hidden _dl_tlsdesc_return
.global _dl_tlsdesc_return
.type _dl_tlsdesc_return,%function
cfi_startproc
.align 2
_dl_tlsdesc_return:
ldr x0, [x0, #8]
RET
cfi_endproc
.size _dl_tlsdesc_return, .-_dl_tlsdesc_return
/* Handler for undefined weak TLS symbols.
Prototype:
_dl_tlsdesc_undefweak (tlsdesc *);
The second word of the descriptor contains the addend.
Return the addend minus the thread pointer. This ensures
that when the caller adds on the thread pointer it gets back
the addend. */
.hidden _dl_tlsdesc_undefweak
.global _dl_tlsdesc_undefweak
.type _dl_tlsdesc_undefweak,%function
cfi_startproc
.align 2
_dl_tlsdesc_undefweak:
str x1, [sp, #-16]!
cfi_adjust_cfa_offset(16)
ldr x0, [x0, #8]
mrs x1, tpidr_el0
sub x0, x0, x1
ldr x1, [sp], #16
cfi_adjust_cfa_offset(16)
RET
cfi_endproc
.size _dl_tlsdesc_undefweak, .-_dl_tlsdesc_undefweak
#ifdef SHARED
/* Handler for dynamic TLS symbols.
Prototype:
_dl_tlsdesc_dynamic (tlsdesc *) ;
The second word of the descriptor points to a
tlsdesc_dynamic_arg structure.
Returns the offset between the thread pointer and the
object referenced by the argument.
ptrdiff_t
__attribute__ ((__regparm__ (1)))
_dl_tlsdesc_dynamic (struct tlsdesc *tdp)
{
struct tlsdesc_dynamic_arg *td = tdp->arg;
dtv_t *dtv = *(dtv_t **)((char *)__thread_pointer + DTV_OFFSET);
if (__builtin_expect (td->gen_count <= dtv[0].counter
&& (dtv[td->tlsinfo.ti_module].pointer.val
!= TLS_DTV_UNALLOCATED),
1))
return dtv[td->tlsinfo.ti_module].pointer.val
+ td->tlsinfo.ti_offset
- __thread_pointer;
return ___tls_get_addr (&td->tlsinfo) - __thread_pointer;
}
*/
.hidden _dl_tlsdesc_dynamic
.global _dl_tlsdesc_dynamic
.type _dl_tlsdesc_dynamic,%function
cfi_startproc
.align 2
_dl_tlsdesc_dynamic:
# define NSAVEXREGPAIRS 2
stp x29, x30, [sp,#-(32+16*NSAVEXREGPAIRS)]!
cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)
mov x29, sp
/* Save just enough registers to support fast path, if we fall
into slow path we will save additional registers. */
stp x1, x2, [sp, #32+16*0]
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
b.hi 2f
ldr x2, [x1]
add x0, x0, x2, lsl #4
ldr x0, [x0]
cmn x0, #0x1
b.eq 2f
ldr x1, [x1,#8]
add x0, x0, x1
sub x0, x0, x4
1:
ldp x1, x2, [sp, #32+16*0]
ldp x3, x4, [sp, #32+16*1]
ldp x29, x30, [sp], #(32+16*NSAVEXREGPAIRS)
cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)
# undef NSAVEXREGPAIRS
RET
2:
/* This is the slow path. We need to call __tls_get_addr() which
means we need to save and restore all the register that the
callee will trash. */
/* Save the remaining registers that we must treat as caller save. */
# define NSAVEXREGPAIRS 7
stp x5, x6, [sp, #-16*NSAVEXREGPAIRS]!
cfi_adjust_cfa_offset (16*NSAVEXREGPAIRS)
stp x7, x8, [sp, #16*1]
stp x9, x10, [sp, #16*2]
stp x11, x12, [sp, #16*3]
stp x13, x14, [sp, #16*4]
stp x15, x16, [sp, #16*5]
stp x17, x18, [sp, #16*6]
SAVE_Q_REGISTERS
mov x0, x1
bl __tls_get_addr
mrs x1, tpidr_el0
sub x0, x0, x1
RESTORE_Q_REGISTERS
ldp x7, x8, [sp, #16*1]
ldp x9, x10, [sp, #16*2]
ldp x11, x12, [sp, #16*3]
ldp x13, x14, [sp, #16*4]
ldp x15, x16, [sp, #16*5]
ldp x17, x18, [sp, #16*6]
ldp x5, x6, [sp], #16*NSAVEXREGPAIRS
cfi_adjust_cfa_offset (-16*NSAVEXREGPAIRS)
b 1b
cfi_endproc
.size _dl_tlsdesc_dynamic, .-_dl_tlsdesc_dynamic
# undef NSAVEXREGPAIRS
#endif
/* This function is a wrapper for a lazy resolver for TLS_DESC
RELA relocations.
When the actual resolver returns, it will have adjusted the
TLS descriptor such that we can tail-call it for it to return
the TP offset of the symbol. */
.hidden _dl_tlsdesc_resolve_rela
.global _dl_tlsdesc_resolve_rela
.type _dl_tlsdesc_resolve_rela,%function
cfi_startproc
.align 2
_dl_tlsdesc_resolve_rela:
#define NSAVEXREGPAIRS 9
stp x29, x30, [sp, #-(32+16*NSAVEXREGPAIRS)]!
cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)
mov x29, sp
stp x1, x4, [sp, #32+16*0]
stp x5, x6, [sp, #32+16*1]
stp x7, x8, [sp, #32+16*2]
stp x9, x10, [sp, #32+16*3]
stp x11, x12, [sp, #32+16*4]
stp x13, x14, [sp, #32+16*5]
stp x15, x16, [sp, #32+16*6]
stp x17, x18, [sp, #32+16*7]
str x0, [sp, #32+16*8]
SAVE_Q_REGISTERS
ldr x1, [x3, #8]
bl _dl_tlsdesc_resolve_rela_fixup
RESTORE_Q_REGISTERS
ldr x0, [sp, #32+16*8]
ldr x1, [x0]
blr x1
ldp x1, x4, [sp, #32+16*0]
ldp x5, x6, [sp, #32+16*1]
ldp x7, x8, [sp, #32+16*2]
ldp x9, x10, [sp, #32+16*3]
ldp x11, x12, [sp, #32+16*4]
ldp x13, x14, [sp, #32+16*5]
ldp x15, x16, [sp, #32+16*6]
ldp x17, x18, [sp, #32+16*7]
ldp x29, x30, [sp], #(32+16*NSAVEXREGPAIRS)
cfi_adjust_cfa_offset (-32+16*NSAVEXREGPAIRS)
ldp x2, x3, [sp], #16
cfi_adjust_cfa_offset (-16)
RET
#undef NSAVEXREGPAIRS
cfi_endproc
.size _dl_tlsdesc_resolve_rela, .-_dl_tlsdesc_resolve_rela
/* This function is a placeholder for lazy resolving of TLS
relocations. Once some thread starts resolving a TLS
relocation, it sets up the TLS descriptor to use this
resolver, such that other threads that would attempt to
resolve it concurrently may skip the call to the original lazy
resolver and go straight to a condition wait.
When the actual resolver returns, it will have adjusted the
TLS descriptor such that we can tail-call it for it to return
the TP offset of the symbol. */
.hidden _dl_tlsdesc_resolve_hold
.global _dl_tlsdesc_resolve_hold
.type _dl_tlsdesc_resolve_hold,%function
cfi_startproc
.align 2
_dl_tlsdesc_resolve_hold:
#define NSAVEXREGPAIRS 10
1:
stp x29, x30, [sp, #-(32+16*NSAVEXREGPAIRS)]!
cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)
mov x29, sp
stp x1, x2, [sp, #32+16*0]
stp x3, x4, [sp, #32+16*1]
stp x5, x6, [sp, #32+16*2]
stp x7, x8, [sp, #32+16*3]
stp x9, x10, [sp, #32+16*4]
stp x11, x12, [sp, #32+16*5]
stp x13, x14, [sp, #32+16*6]
stp x15, x16, [sp, #32+16*7]
stp x17, x18, [sp, #32+16*8]
str x0, [sp, #32+16*9]
SAVE_Q_REGISTERS
adr x1, 1b
bl _dl_tlsdesc_resolve_hold_fixup
RESTORE_Q_REGISTERS
ldr x0, [sp, #32+16*9]
ldr x1, [x0]
blr x1
ldp x1, x2, [sp, #32+16*0]
ldp x3, x4, [sp, #32+16*1]
ldp x5, x6, [sp, #32+16*2]
ldp x7, x8, [sp, #32+16*3]
ldp x9, x10, [sp, #32+16*4]
ldp x11, x12, [sp, #32+16*5]
ldp x13, x14, [sp, #32+16*6]
ldp x15, x16, [sp, #32+16*7]
ldp x17, x18, [sp, #32+16*8]
ldp x29, x30, [sp], #(32+16*NSAVEXREGPAIRS)
cfi_adjust_cfa_offset (-32+16*NSAVEXREGPAIRS)
RET
cfi_endproc
.size _dl_tlsdesc_resolve_hold, .-_dl_tlsdesc_resolve_hold
#undef NSAVEXREGPAIRS

View File

@ -0,0 +1,65 @@
/* Thread-local storage descriptor handling in the ELF dynamic linker.
AArch64 version.
Copyright (C) 2011, 2012 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 _AARCH64_DL_TLSDESC_H
#define _AARCH64_DL_TLSDESC_H 1
/* Type used to represent a TLS descriptor in the GOT. */
struct tlsdesc
{
ptrdiff_t (*entry) (struct tlsdesc *);
void *arg;
};
typedef struct dl_tls_index
{
unsigned long int ti_module;
unsigned long int ti_offset;
} tls_index;
/* Type used as the argument in a TLS descriptor for a symbol that
needs dynamic TLS offsets. */
struct tlsdesc_dynamic_arg
{
tls_index tlsinfo;
size_t gen_count;
};
extern ptrdiff_t attribute_hidden
_dl_tlsdesc_return (struct tlsdesc *);
extern ptrdiff_t attribute_hidden
_dl_tlsdesc_undefweak (struct tlsdesc *);
extern ptrdiff_t attribute_hidden
_dl_tlsdesc_resolve_rela (struct tlsdesc *);
extern ptrdiff_t attribute_hidden
_dl_tlsdesc_resolve_hold (struct tlsdesc *);
# ifdef SHARED
extern void *internal_function _dl_make_tlsdesc_dynamic (struct link_map *,
size_t);
extern ptrdiff_t attribute_hidden
_dl_tlsdesc_dynamic (struct tlsdesc *);
#endif
#endif

View File

@ -0,0 +1,276 @@
/* Copyright (C) 2005-2012 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>
#include <libc-symbols.h>
#include "dl-link.h"
#define ip0 x16
#define ip1 x17
#define lr x30
.text
.globl _dl_runtime_resolve
.type _dl_runtime_resolve, #function
cfi_startproc
.align 2
_dl_runtime_resolve:
/* AArch64 we get called with:
ip0 &PLTGOT[2]
ip1 temp(dl resolver entry point)
[sp, #8] lr
[sp, #0] &PLTGOT[n]
*/
cfi_rel_offset (lr, 8)
/* Save arguments. */
stp x8, x9, [sp, #-80]!
cfi_adjust_cfa_offset (80)
cfi_rel_offset (x8, 0)
cfi_rel_offset (x9, 8)
stp x6, x7, [sp, #16]
cfi_rel_offset (x6, 16)
cfi_rel_offset (x7, 24)
stp x4, x5, [sp, #32]
cfi_rel_offset (x4, 32)
cfi_rel_offset (x5, 40)
stp x2, x3, [sp, #48]
cfi_rel_offset (x2, 48)
cfi_rel_offset (x3, 56)
stp x0, x1, [sp, #64]
cfi_rel_offset (x0, 64)
cfi_rel_offset (x1, 72)
/* Get pointer to linker struct. */
ldr x0, [ip0, #-8]
/* Prepare to call _dl_fixup(). */
ldr x1, [sp, 80] /* Recover &PLTGOT[n] */
sub x1, x1, ip0
add x1, x1, x1, lsl #1
lsl x1, x1, #3
sub x1, x1, #192
lsr x1, x1, #3
/* Call fixup routine. */
bl _dl_fixup
/* Save the return. */
mov ip0, x0
/* Get arguments and return address back. */
ldp x0, x1, [sp, #64]
ldp x2, x3, [sp, #48]
ldp x4, x5, [sp, #32]
ldp x6, x7, [sp, #16]
ldp x8, x9, [sp], #80
cfi_adjust_cfa_offset (-80)
ldp ip1, lr, [sp], #16
cfi_adjust_cfa_offset (-16)
/* Jump to the newly found address. */
br ip0
cfi_endproc
.size _dl_runtime_resolve, .-_dl_runtime_resolve
#ifndef PROF
.globl _dl_runtime_profile
.type _dl_runtime_profile, #function
cfi_startproc
.align 2
_dl_runtime_profile:
/* AArch64 we get called with:
ip0 &PLTGOT[2]
ip1 temp(dl resolver entry point)
[sp, #8] lr
[sp, #0] &PLTGOT[n]
Stack frame layout:
[sp, #...] lr
[sp, #...] &PLTGOT[n]
[sp, #96] La_aarch64_regs
[sp, #48] La_aarch64_retval
[sp, #40] frame size return from pltenter
[sp, #32] dl_profile_call saved x1
[sp, #24] dl_profile_call saved x0
[sp, #16] t1
[sp, #0] x29, lr <- x29
*/
# define OFFSET_T1 16
# define OFFSET_SAVED_CALL_X0 OFFSET_T1 + 8
# define OFFSET_FS OFFSET_SAVED_CALL_X0 + 16
# define OFFSET_RV OFFSET_FS + 8
# define OFFSET_RG OFFSET_RV + DL_SIZEOF_RV
# define SF_SIZE OFFSET_RG + DL_SIZEOF_RG
# define OFFSET_PLTGOTN SF_SIZE
# define OFFSET_LR OFFSET_PLTGOTN + 8
/* Save arguments. */
sub sp, sp, #SF_SIZE
cfi_adjust_cfa_offset (SF_SIZE)
stp x29, x30, [SP, #0]
mov x29, sp
cfi_def_cfa_register (x29)
cfi_rel_offset (x29, 0)
cfi_rel_offset (lr, 8)
stp x0, x1, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*0]
cfi_rel_offset (x0, OFFSET_RG + DL_OFFSET_RG_X0 + 16*0 + 0)
cfi_rel_offset (x1, OFFSET_RG + DL_OFFSET_RG_X0 + 16*0 + 8)
stp x2, x3, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*1]
cfi_rel_offset (x2, OFFSET_RG + DL_OFFSET_RG_X0 + 16*1 + 0)
cfi_rel_offset (x3, OFFSET_RG + DL_OFFSET_RG_X0 + 16*1 + 8)
stp x4, x5, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*2]
cfi_rel_offset (x4, OFFSET_RG + DL_OFFSET_RG_X0 + 16*2 + 0)
cfi_rel_offset (x5, OFFSET_RG + DL_OFFSET_RG_X0 + 16*2 + 8)
stp x6, x7, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*3]
cfi_rel_offset (x6, OFFSET_RG + DL_OFFSET_RG_X0 + 16*3 + 0)
cfi_rel_offset (x7, OFFSET_RG + DL_OFFSET_RG_X0 + 16*3 + 8)
stp d0, d1, [X29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*0]
cfi_rel_offset (d0, OFFSET_RG + DL_OFFSET_RG_D0 + 16*0)
cfi_rel_offset (d1, OFFSET_RG + DL_OFFSET_RG_D0 + 16*0 + 8)
stp d2, d3, [X29, #OFFSET_RG+ DL_OFFSET_RG_D0 + 16*1]
cfi_rel_offset (d2, OFFSET_RG + DL_OFFSET_RG_D0 + 16*1 + 0)
cfi_rel_offset (d3, OFFSET_RG + DL_OFFSET_RG_D0 + 16*1 + 8)
stp d4, d5, [X29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*2]
cfi_rel_offset (d4, OFFSET_RG + DL_OFFSET_RG_D0 + 16*2 + 0)
cfi_rel_offset (d5, OFFSET_RG + DL_OFFSET_RG_D0 + 16*2 + 8)
stp d6, d7, [X29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*3]
cfi_rel_offset (d6, OFFSET_RG + DL_OFFSET_RG_D0 + 16*3 + 0)
cfi_rel_offset (d7, OFFSET_RG + DL_OFFSET_RG_D0 + 16*3 + 8)
add x0, x29, #SF_SIZE + 16
ldr x1, [x29, #OFFSET_LR]
stp x0, x1, [x29, #OFFSET_RG + DL_OFFSET_RG_SP]
/* Get pointer to linker struct. */
ldr x0, [ip0, #-8]
/* Prepare to call _dl_profile_fixup(). */
ldr x1, [x29, OFFSET_PLTGOTN] /* Recover &PLTGOT[n] */
sub x1, x1, ip0
add x1, x1, x1, lsl #1
lsl x1, x1, #3
sub x1, x1, #192
lsr x1, x1, #3
stp x0, x1, [x29, #OFFSET_SAVED_CALL_X0]
/* Set up extra args for _dl_profile_fixup */
ldr x2, [x29, #OFFSET_LR] /* load saved LR */
add x3, x29, #OFFSET_RG /* address of La_aarch64_reg */
add x4, x29, #OFFSET_FS /* address of framesize */
bl _dl_profile_fixup
ldr ip0, [x29, #OFFSET_FS] /* framesize == 0 */
cmp ip0, #0
bge 1f
cfi_remember_state
/* Save the return. */
mov ip0, x0
/* Get arguments and return address back. */
ldp x0, x1, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*0]
ldp x2, x3, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*1]
ldp x4, x5, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*2]
ldp x6, x7, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*3]
ldp d0, d1, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*0]
ldp d2, d3, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*1]
ldp d4, d5, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*2]
ldp d6, d7, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*3]
cfi_def_cfa_register (sp)
ldp x29, x30, [x29, #0]
cfi_restore(x29)
cfi_restore(x30)
add sp, sp, SF_SIZE + 16
cfi_adjust_cfa_offset (- SF_SIZE - 16)
/* Jump to the newly found address. */
br ip0
cfi_restore_state
1:
/* The new frame size is in ip0. */
sub x1, x29, ip0
and sp, x1, #0xfffffffffffffff0
str x0, [x29, #OFFSET_T1]
mov x0, sp
add x1, x29, #SF_SIZE + 16
mov x2, ip0
bl memcpy
ldr ip0, [x29, #OFFSET_T1]
/* Call the function. */
ldp x0, x1, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*0]
ldp x2, x3, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*1]
ldp x4, x5, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*2]
ldp x6, x7, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*3]
ldp d0, d1, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*0]
ldp d2, d3, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*1]
ldp d4, d5, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*2]
ldp d6, d7, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*3]
blr ip0
stp x0, x1, [x29, #OFFSET_RV + DL_OFFSET_RV_X0]
stp d0, d1, [x29, #OFFSET_RV + DL_OFFSET_RV_D0 + 16*0]
stp d2, d3, [x29, #OFFSET_RV + DL_OFFSET_RV_D0 + 16*1]
/* Setup call to pltexit */
ldp x0, x1, [x29, #OFFSET_SAVED_CALL_X0]
add x2, x29, #OFFSET_RG
add x3, x29, #OFFSET_RV
bl _dl_call_pltexit
ldp x0, x1, [x29, #OFFSET_RV + DL_OFFSET_RV_X0]
ldp d0, d1, [x29, #OFFSET_RV + DL_OFFSET_RV_D0 + 16*0]
ldp d2, d3, [x29, #OFFSET_RV + DL_OFFSET_RV_D0 + 16*1]
/* LR from within La_aarch64_reg */
ldr lr, [x29, #OFFSET_RG + DL_OFFSET_RG_LR]
cfi_restore(lr)
mov sp, x29
cfi_def_cfa_register (sp)
ldr x29, [x29, #0]
cfi_restore(x29)
add sp, sp, SF_SIZE + 16
cfi_adjust_cfa_offset (- SF_SIZE - 16)
br lr
cfi_endproc
.size _dl_runtime_profile, .-_dl_runtime_profile
#endif
.previous

View File

@ -0,0 +1,36 @@
/* Copyright (C) 1997-2012 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 <fenv.h>
#include <fpu_control.h>
int
feclearexcept (int excepts)
{
fpu_fpsr_t fpsr;
excepts &= FE_ALL_EXCEPT;
_FPU_GETFPSR (fpsr);
fpsr = (fpsr & ~FE_ALL_EXCEPT) | (fpsr & FE_ALL_EXCEPT & ~excepts);
_FPU_SETFPSR (fpsr);
return 0;
}
libm_hidden_def (feclearexcept)

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2001-2012 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 <fenv.h>
#include <fpu_control.h>
int
fedisableexcept (int excepts)
{
fpu_control_t fpcr;
int original_excepts;
_FPU_GETCW (fpcr);
original_excepts = (fpcr >> FE_EXCEPT_SHIFT) & FE_ALL_EXCEPT;
excepts &= FE_ALL_EXCEPT;
fpcr &= ~(excepts << FE_EXCEPT_SHIFT);
_FPU_SETCW (fpcr);
return original_excepts;
}

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2001-2012 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 <fenv.h>
#include <fpu_control.h>
int
feenableexcept (int excepts)
{
fpu_control_t fpcr;
int original_excepts;
_FPU_GETCW (fpcr);
original_excepts = (fpcr >> FE_EXCEPT_SHIFT) & FE_ALL_EXCEPT;
excepts &= FE_ALL_EXCEPT;
fpcr |= (excepts << FE_EXCEPT_SHIFT);
_FPU_SETCW (fpcr);
return original_excepts;
}

View File

@ -0,0 +1,33 @@
/* Copyright (C) 1997-2012 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 <fenv.h>
#include <fpu_control.h>
int
fegetenv (fenv_t *envp)
{
fpu_control_t fpcr;
fpu_fpsr_t fpsr;
_FPU_GETCW (fpcr);
_FPU_GETFPSR (fpsr);
envp->__fpcr = fpcr;
envp->__fpsr = fpsr;
return 0;
}
libm_hidden_def (fegetenv)

View File

@ -0,0 +1,28 @@
/* Copyright (C) 2001-2012 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 <fenv.h>
#include <fpu_control.h>
int
fegetexcept (void)
{
fpu_control_t fpcr;
_FPU_GETCW (fpcr);
return (fpcr >> FE_EXCEPT_SHIFT) & FE_ALL_EXCEPT;
}

View File

@ -0,0 +1,28 @@
/* Copyright (C) 1997-2012 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 <fenv.h>
#include <fpu_control.h>
int
fegetround (void)
{
fpu_control_t fpcr;
_FPU_GETCW (fpcr);
return fpcr & FE_TOWARDZERO;
}

View File

@ -0,0 +1,47 @@
/* Copyright (C) 1997-2012 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 <fenv.h>
#include <fpu_control.h>
int
feholdexcept (fenv_t *envp)
{
fpu_fpsr_t fpsr;
fpu_control_t fpcr;
_FPU_GETCW (fpcr);
envp->__fpcr = fpcr;
_FPU_GETFPSR (fpsr);
envp->__fpsr = fpsr;
/* Now set all exceptions to non-stop. */
fpcr &= ~(FE_ALL_EXCEPT << FE_EXCEPT_SHIFT);
/* And clear all exception flags. */
fpsr &= ~FE_ALL_EXCEPT;
_FPU_SETFPSR (fpsr);
_FPU_SETCW (fpcr);
return 0;
}
libm_hidden_def (feholdexcept)

View File

@ -0,0 +1,57 @@
/* Copyright (C) 1997-2012 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 <fenv.h>
#include <fpu_control.h>
int
fesetenv (const fenv_t *envp)
{
fpu_control_t fpcr;
fpu_fpsr_t fpsr;
_FPU_GETCW (fpcr);
_FPU_GETFPSR (fpsr);
fpcr &= _FPU_RESERVED;
fpsr &= _FPU_FPSR_RESERVED;
if (envp == FE_DFL_ENV)
{
fpcr |= _FPU_DEFAULT;
fpsr |= _FPU_FPSR_DEFAULT;
}
else if (envp == FE_NOMASK_ENV)
{
fpcr |= _FPU_FPCR_IEEE;
fpsr |= _FPU_FPSR_IEEE;
}
else
{
fpcr |= envp->__fpcr & ~_FPU_RESERVED;
fpsr |= envp->__fpsr & ~_FPU_FPSR_RESERVED;
}
_FPU_SETFPSR (fpsr);
_FPU_SETCW (fpcr);
return 0;
}
libm_hidden_def (fesetenv)

View File

@ -0,0 +1,46 @@
/* Copyright (C) 1997-2012 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 <fenv.h>
#include <fpu_control.h>
int
fesetround (int round)
{
fpu_control_t fpcr;
switch (round)
{
case FE_TONEAREST:
case FE_UPWARD:
case FE_DOWNWARD:
case FE_TOWARDZERO:
_FPU_GETCW (fpcr);
fpcr = (fpcr & ~FE_TOWARDZERO) | round;
_FPU_SETCW (fpcr);
return 0;
default:
return 1;
}
return 1;
}
libm_hidden_def (fesetround)

View File

@ -0,0 +1,38 @@
/* Copyright (C) 2009-2012 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 <fenv.h>
#include <fpu_control.h>
int
feupdateenv (const fenv_t *envp)
{
fpu_fpsr_t fpsr;
/* Get the current exception state. */
_FPU_GETFPSR (fpsr);
/* Install new environment. */
fesetenv (envp);
/* Raise the saved exceptions. */
feraiseexcept (fpsr & FE_ALL_EXCEPT);
return 0;
}
libm_hidden_def (feupdateenv)

View File

@ -0,0 +1,33 @@
/* Copyright (C) 2001-2012 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 <fenv.h>
#include <fpu_control.h>
int
fegetexceptflag (fexcept_t *flagp, int excepts)
{
fpu_fpsr_t fpsr;
/* Get the current exceptions. */
_FPU_GETFPSR (fpsr);
*flagp = fpsr & excepts & FE_ALL_EXCEPT;
return 0;
}

View File

@ -0,0 +1,81 @@
/* Copyright (C) 1996-2012 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 _AARCH64_FPU_CONTROL_H
#define _AARCH64_FPU_CONTROL_H
/* Macros for accessing the FPCR and FPSR. */
#define _FPU_GETCW(fpcr) \
__asm__ __volatile__ ("mrs %0, fpcr" : "=r" (fpcr))
#define _FPU_SETCW(fpcr) \
{ \
__asm__ __volatile__ ("msr fpcr, %0" : : "r" (fpcr)); \
__asm__ __volatile__ ("isb"); \
}
#define _FPU_GETFPSR(fpsr) \
__asm__ __volatile__ ("mrs %0, fpsr" : "=r" (fpsr))
#define _FPU_SETFPSR(fpsr) \
__asm__ __volatile__ ("msr fpsr, %0" : : "r" (fpsr))
/* Reserved bits should be preserved when modifying register
contents. These two masks indicate which bits in each of FPCR and
FPSR should not be changed. */
#define _FPU_RESERVED 0xfe0fe0ff
#define _FPU_FPSR_RESERVED 0x0fffffe0
#define _FPU_DEFAULT 0x00000000
#define _FPU_FPSR_DEFAULT 0x00000000
/* Layout of FPCR and FPSR:
| | | | | | | |
0 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0
s s s s s s s s s s s
c c c c c c c c c c c c
N Z C V Q A D F R R S S S L L L I U U I U O D I I U U I U O D I
C H N Z M M T T B E E E D N N X F F Z O D N N X F F Z O
P O O R R Z N N N E K K E E E E E C K K C C C C C
D D I I P
E E D D
E E
*/
#define _FPU_FPCR_MASK_IXE 0x1000
#define _FPU_FPCR_MASK_UFE 0x0800
#define _FPU_FPCR_MASK_OFE 0x0400
#define _FPU_FPCR_MASK_DZE 0x0200
#define _FPU_FPCR_MASK_IOE 0x0100
#define _FPU_FPCR_IEEE \
(_FPU_DEFAULT | _FPU_FPCR_MASK_IXE | \
_FPU_FPCR_MASK_UFE | _FPU_FPCR_MASK_OFE | \
_FPU_FPCR_MASK_DZE | _FPU_FPCR_MASK_IOE)
#define _FPU_FPSR_IEEE 0
typedef unsigned int fpu_control_t;
typedef unsigned int fpu_fpsr_t;
/* Default control word set at startup. */
extern fpu_control_t __fpu_control;
#endif

View File

@ -0,0 +1,92 @@
/* Copyright (C) 1997-2012 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 <fenv.h>
#include <fpu_control.h>
#include <float.h>
int
feraiseexcept (int excepts)
{
int fpsr;
const float fp_zero = 0.0;
const float fp_one = 1.0;
const float fp_max = FLT_MAX;
const float fp_min = FLT_MIN;
const float fp_1e32 = 1.0e32f;
const float fp_two = 2.0;
const float fp_three = 3.0;
/* Raise exceptions represented by EXCEPTS. But we must raise only
one signal at a time. It is important that if the OVERFLOW or
UNDERFLOW exception and the inexact exception are given at the
same time, the OVERFLOW or UNDERFLOW exception precedes the
INEXACT exception.
After each exception we read from the FPSR, to force the
exception to be raised immediately. */
if (FE_INVALID & excepts)
__asm__ __volatile__ (
"ldr s0, %1\n\t"
"fdiv s0, s0, s0\n\t"
"mrs %0, fpsr" : "=r" (fpsr)
: "m" (fp_zero)
: "d0");
if (FE_DIVBYZERO & excepts)
__asm__ __volatile__ (
"ldr s0, %1\n\t"
"ldr s1, %2\n\t"
"fdiv s0, s0, s1\n\t"
"mrs %0, fpsr" : "=r" (fpsr)
: "m" (fp_one), "m" (fp_zero)
: "d0", "d1");
if (FE_OVERFLOW & excepts)
/* There's no way to raise overflow without also raising inexact. */
__asm__ __volatile__ (
"ldr s0, %1\n\t"
"ldr s1, %2\n\t"
"fadd s0, s0, s1\n\t"
"mrs %0, fpsr" : "=r" (fpsr)
: "m" (fp_max), "m" (fp_1e32)
: "d0", "d1");
if (FE_UNDERFLOW & excepts)
__asm__ __volatile__ (
"ldr s0, %1\n\t"
"ldr s1, %2\n\t"
"fdiv s0, s0, s1\n\t"
"mrs %0, fpsr" : "=r" (fpsr)
: "m" (fp_min), "m" (fp_three)
: "d0", "d1");
if (FE_INEXACT & excepts)
__asm__ __volatile__ (
"ldr s0, %1\n\t"
"ldr s1, %2\n\t"
"fdiv s0, s0, s1\n\t"
"mrs %0, fpsr" : "=r" (fpsr)
: "m" (fp_two), "m" (fp_three)
: "d0", "d1");
return 0;
}
libm_hidden_def (feraiseexcept)

View File

@ -0,0 +1,39 @@
/* Copyright (C) 1997-2012 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 <fenv.h>
#include <math.h>
#include <fpu_control.h>
int
fesetexceptflag (const fexcept_t *flagp, int excepts)
{
fpu_fpsr_t fpsr;
/* Get the current environment. */
_FPU_GETFPSR (fpsr);
/* Set the desired exception mask. */
fpsr &= ~(excepts & FE_ALL_EXCEPT);
fpsr |= (*flagp & excepts & FE_ALL_EXCEPT);
/* Save state back to the FPU. */
_FPU_SETFPSR (fpsr);
return 0;
}

View File

@ -0,0 +1,32 @@
/* Copyright (C) 1997-2012 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 <fenv.h>
#include <fpu_control.h>
int
fetestexcept (int excepts)
{
fpu_fpsr_t fpsr;
/* Get current exceptions. */
_FPU_GETFPSR (fpsr);
return fpsr & excepts & FE_ALL_EXCEPT;
}
libm_hidden_def (fetestexcept)

View File

@ -0,0 +1,38 @@
/* Determine floating-point rounding mode within libc. AArch64 version.
Copyright (C) 2012 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 _AARCH64_GET_ROUNDING_MODE_H
#define _AARCH64_GET_ROUNDING_MODE_H 1
#include <fenv.h>
#include <fpu_control.h>
/* Return the floating-point rounding mode. */
static inline int
get_rounding_mode (void)
{
fpu_control_t fpcr;
_FPU_GETCW (fpcr);
return fpcr & FE_TOWARDZERO;
}
#endif /* get-rounding-mode.h */

View File

@ -0,0 +1,2 @@
/* Always use dbl-64 version because long double is emulated in software. */
#include <sysdeps/ieee754/dbl-64/s_fma.c>

View File

@ -0,0 +1,44 @@
/* Copyright (C) 2006-2012 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 JB_X19 0
#define JB_X20 1
#define JB_X21 2
#define JB_X22 3
#define JB_X23 4
#define JB_X24 5
#define JB_X25 6
#define JB_X26 7
#define JB_X27 8
#define JB_X28 9
#define JB_X29 10
#define JB_LR 11
#define JB_SP 13
#define JB_D8 14
#define JB_D9 15
#define JB_D10 16
#define JB_D11 17
#define JB_D12 18
#define JB_D13 19
#define JB_D14 20
#define JB_D15 21
/* Helper for generic ____longjmp_chk(). */
#define JB_FRAME_ADDRESS(buf) \
((void *) (buf[JB_SP]))

View File

@ -0,0 +1,46 @@
/* Copyright (C) 2005-2012 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 <setjmp.h>
#include <jmpbuf-offsets.h>
#include <stdint.h>
#include <unwind.h>
/* Test if longjmp to JMPBUF would unwind the frame
containing a local variable at ADDRESS. */
#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
((void *) (address) < (void *) demangle (jmpbuf[JB_SP]))
#define _JMPBUF_CFA_UNWINDS_ADJ(jmpbuf, context, adj) \
_JMPBUF_UNWINDS_ADJ (jmpbuf, (void *) _Unwind_GetCFA (context), adj)
static inline uintptr_t __attribute__ ((unused))
_jmpbuf_sp (__jmp_buf jmpbuf)
{
uintptr_t sp = jmpbuf[JB_SP];
#ifdef PTR_DEMANGLE
PTR_DEMANGLE (sp);
#endif
return sp;
}
#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
/* We use the normal longjmp for unwinding. */
#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)

View File

@ -0,0 +1,48 @@
/* Copyright (C) 2005-2012 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 _AARCH64_LDSODEFS_H
#define _AARCH64_LDSODEFS_H 1
#include <elf.h>
struct La_aarch64_regs;
struct La_aarch64_retval;
#define ARCH_PLTENTER_MEMBERS \
ElfW(Addr) (*aarch64_gnu_pltenter) (ElfW(Sym) *, \
unsigned int, \
uintptr_t *, \
uintptr_t *, \
struct La_aarch64_regs *, \
unsigned int *, \
const char *, \
long int *)
#define ARCH_PLTEXIT_MEMBERS \
ElfW(Addr) (*aarch64_gnu_pltexit) (ElfW(Sym) *, \
unsigned int, \
uintptr_t *, \
uintptr_t *, \
const struct La_aarch64_regs *, \
struct La_aarch64_retval *, \
const char *)
#include_next <ldsodefs.h>
#endif

View File

@ -0,0 +1,32 @@
/* Copyright (C) 2005-2012 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 <csu/libc-tls.c>
#include <dl-tls.h>
/* On AArch64, linker optimizations are not required, so __tls_get_addr
can be called even in statically linked binaries. In this case module
must be always 1 and PT_TLS segment exist in the binary, otherwise it
would not link. */
void *
__tls_get_addr (tls_index *ti)
{
dtv_t *dtv = THREAD_DTV ();
return (char *) dtv[1].pointer.val + ti->ti_offset;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
/* Copyright (C) 2011-2012 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 _MCOUNT_DECL(from, self) \
void __mcount_internal (u_long from, u_long self)
/* Call __mcount_internal with our the return PC for our caller, and
the return PC our caller will return to. Empty since we use an
assembly stub instead. */
#define MCOUNT

View File

@ -0,0 +1,21 @@
/* Copyright (C) 2000-2012 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 GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; })
#include <sysdeps/generic/memusage.h>

View File

@ -0,0 +1,21 @@
# Copyright (C) 2005-2012 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/>.
ifeq ($(subdir),csu)
gen-as-const-headers += tcb-offsets.sym
endif

View File

@ -0,0 +1,24 @@
/* Copyright (C) 2008-2012 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 SPIN_LOCK_READS_BETWEEN_CMPXCHG 1000
/* We can't use the normal "#include <nptl/pthread_spin_lock.c>" because
it will resolve to this very file. Using "sysdeps/.." as reference to the
top level directory does the job. */
#include <sysdeps/../nptl/pthread_spin_lock.c>

View File

@ -0,0 +1,37 @@
/* Copyright (C) 2002-2012 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/>. */
/* Default stack size. */
#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
/* Minimal stack size after allocating thread descriptor and guard size. */
#define MINIMAL_REST_STACK 2048
/* Alignment requirement for TCB. */
#define TCB_ALIGNMENT 16
/* Location of current stack frame. */
#define CURRENT_STACK_FRAME __builtin_frame_address (0)
/* XXX Until we have a better place keep the definitions here. */
#define __exit_thread_inline(val) \
INLINE_SYSCALL (exit, 1, (val))

View File

@ -0,0 +1,7 @@
#include <sysdep.h>
#include <tls.h>
PTHREAD_MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads)
PTHREAD_PID_OFFSET offsetof (struct pthread, pid)
PTHREAD_TID_OFFSET offsetof (struct pthread, tid)
PTHREAD_SIZEOF sizeof (struct pthread)

View File

@ -0,0 +1,142 @@
/* Copyright (C) 2005-2012 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 _TLS_H
#define _TLS_H 1
#include <dl-sysdep.h>
#ifndef __ASSEMBLER__
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>
#endif /* __ASSEMBLER__ */
#ifndef __ASSEMBLER__
/* Get system call information. */
# include <sysdep.h>
/* The TP points to the start of the thread blocks. */
# define TLS_DTV_AT_TP 1
/* Get the thread descriptor definition. */
# include <nptl/descr.h>
typedef struct
{
dtv_t *dtv;
void *private;
} tcbhead_t;
/* This is the size of the initial TCB. */
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
/* Alignment requirements for the initial TCB. */
# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
/* This is the size of the TCB. */
# define TLS_TCB_SIZE sizeof (tcbhead_t)
/* This is the size we need before TCB. */
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
/* Alignment requirements for the TCB. */
# define TLS_TCB_ALIGN __alignof__ (tcbhead_t)
/* Install the dtv pointer. The pointer passed is to the element with
index -1 which contain the length. */
# define INSTALL_DTV(tcbp, dtvp) \
(((tcbhead_t *) (tcbp))->dtv = (dtvp) + 1)
/* Install new dtv for current thread. */
# define INSTALL_NEW_DTV(dtv) \
(THREAD_DTV() = (dtv))
/* Return dtv of given thread descriptor. */
# define GET_DTV(tcbp) \
(((tcbhead_t *) (tcbp))->dtv)
/* Code to initially initialize the thread pointer. This might need
special attention since 'errno' is not yet available and if the
operation can cause a failure 'errno' must not be touched. */
# define TLS_INIT_TP(tcbp, secondcall) \
({ __asm __volatile ("msr tpidr_el0, %0" : : "r" (tcbp)); NULL; })
/* Return the address of the dtv for the current thread. */
# define THREAD_DTV() \
(((tcbhead_t *) __builtin_thread_pointer ())->dtv)
/* Return the thread descriptor for the current thread. */
# define THREAD_SELF \
((struct pthread *)__builtin_thread_pointer () - 1)
/* Magic for libthread_db to know how to do THREAD_SELF. */
# define DB_THREAD_SELF \
CONST_THREAD_AREA (64, sizeof (struct pthread))
/* Access to data in the thread descriptor is easy. */
# define THREAD_GETMEM(descr, member) \
descr->member
# define THREAD_GETMEM_NC(descr, member, idx) \
descr->member[idx]
# define THREAD_SETMEM(descr, member, value) \
descr->member = (value)
# define THREAD_SETMEM_NC(descr, member, idx, value) \
descr->member[idx] = (value)
/* Get and set the global scope generation counter in struct pthread. */
# define THREAD_GSCOPE_FLAG_UNUSED 0
# define THREAD_GSCOPE_FLAG_USED 1
# define THREAD_GSCOPE_FLAG_WAIT 2
# define THREAD_GSCOPE_RESET_FLAG() \
do \
{ int __res \
= atomic_exchange_rel (&THREAD_SELF->header.gscope_flag, \
THREAD_GSCOPE_FLAG_UNUSED); \
if (__res == THREAD_GSCOPE_FLAG_WAIT) \
lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1, LLL_PRIVATE); \
} \
while (0)
# define THREAD_GSCOPE_SET_FLAG() \
do \
{ \
THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED; \
atomic_write_barrier (); \
} \
while (0)
# define THREAD_GSCOPE_WAIT() \
GL(dl_wait_lookup_done) ()
# endif /* __ASSEMBLER__ */
#endif /* tls.h */

View File

@ -0,0 +1,14 @@
case "$machine" in
aarch64*)
base_machine=aarch64
machine=aarch64
;;
esac
case "$machine" in
aarch64*)
# Parameters to allow auto-detection of -z relro.
libc_commonpagesize=0x1000
libc_relro_required=yes
;;
esac

View File

@ -0,0 +1,51 @@
/* Copyright (C) 1997-2012 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>
#include <jmpbuf-offsets.h>
/* Keep traditional entry points in with sigsetjmp(). */
ENTRY (setjmp)
mov x1, #1
b 1f
END (setjmp)
ENTRY (_setjmp)
mov x1, #0
b 1f
END (_setjmp)
libc_hidden_def (_setjmp)
ENTRY (__sigsetjmp)
1:
stp x19, x20, [x0, #JB_X19<<3]
stp x21, x22, [x0, #JB_X21<<3]
stp x23, x24, [x0, #JB_X23<<3]
stp x25, x26, [x0, #JB_X25<<3]
stp x27, x28, [x0, #JB_X27<<3]
stp x29, x30, [x0, #JB_X29<<3]
stp d8, d9, [x0, #JB_D8<<3]
stp d10, d11, [x0, #JB_D10<<3]
stp d12, d13, [x0, #JB_D12<<3]
stp d14, d15, [x0, #JB_D14<<3]
mov x1, sp
str x1, [x0, #JB_SP<<3]
b C_SYMBOL_NAME(__sigjmp_save)
END (__sigsetjmp)
hidden_def (__sigsetjmp)

View File

@ -0,0 +1,2 @@
aarch64.*-.*-linux.* DEFAULT GLIBC_2.17
aarch64.*-.*-linux.* ld=ld-linux-aarch64.so.1

View File

@ -0,0 +1,3 @@
ifeq ($(subdir),math)
CPPFLAGS += -I../soft-fp
endif

View File

@ -0,0 +1,39 @@
/* long double square root in software floating-point emulation.
Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com) and
Jakub Jelinek (jj@ultra.linux.cz).
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 <stdlib.h>
#include <soft-fp.h>
#include <quad.h>
long double
__ieee754_sqrtl (const long double a)
{
FP_DECL_EX;
FP_DECL_Q(A); FP_DECL_Q(C);
long double c;
FP_INIT_ROUNDMODE;
FP_UNPACK_Q(A, a);
FP_SQRT_Q(C, A);
FP_PACK_Q(c, C);
FP_HANDLE_EXCEPTIONS;
return c;
}
strong_alias (__ieee754_sqrtl, __sqrtl_finite)

View File

@ -0,0 +1,116 @@
#include <fenv.h>
#include <fpu_control.h>
#define _FP_W_TYPE_SIZE 64
#define _FP_W_TYPE unsigned long long
#define _FP_WS_TYPE signed long long
#define _FP_I_TYPE long long
#define _FP_MUL_MEAT_S(R,X,Y) \
_FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y)
#define _FP_MUL_MEAT_D(R,X,Y) \
_FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
#define _FP_MUL_MEAT_Q(R,X,Y) \
_FP_MUL_MEAT_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm)
#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y)
#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y)
#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1)
#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1
#define _FP_NANSIGN_S 0
#define _FP_NANSIGN_D 0
#define _FP_NANSIGN_Q 0
#define _FP_KEEPNANFRACP 1
/* From my experiments it seems X is chosen unless one of the
NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */
#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
do { \
if ((_FP_FRAC_HIGH_RAW_##fs(X) | \
_FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs) \
{ \
R##_s = _FP_NANSIGN_##fs; \
_FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs); \
} \
else \
{ \
R##_s = X##_s; \
_FP_FRAC_COPY_##wc(R,X); \
} \
R##_c = FP_CLS_NAN; \
} while (0)
#define _FP_DECL_EX fpu_control_t _fcw
#define FP_ROUNDMODE (_fcw & 0x3)
#define FP_RND_NEAREST FE_TONEAREST
#define FP_RND_ZERO FE_TOWARDZERO
#define FP_RND_PINF FE_UPWARD
#define FP_RND_MINF FE_DOWNWARD
#define FP_EX_INVALID FE_INVALID
#define FP_EX_OVERFLOW FE_OVERFLOW
#define FP_EX_UNDERFLOW FE_UNDERFLOW
#define FP_EX_DIVZERO FE_DIVBYZERO
#define FP_EX_INEXACT FE_INEXACT
#define FP_INIT_ROUNDMODE \
do { \
_FPU_GETCW (_fcw); \
} while (0)
#define FP_HANDLE_EXCEPTIONS \
do { \
const float fp_max = __FLT_MAX__; \
const float fp_min = __FLT_MIN__; \
const float fp_1e32 = 1.0e32f; \
const float fp_zero = 0.0; \
const float fp_one = 1.0; \
unsigned fpsr; \
if (_fex & FP_EX_INVALID) \
{ \
__asm__ __volatile__ ("fdiv\ts0, %s0, %s0" \
: \
: "w" (fp_zero) \
: "s0"); \
__asm__ __volatile__ ("mrs\t%0, fpsr" : "=r" (fpsr)); \
} \
if (_fex & FP_EX_DIVZERO) \
{ \
__asm__ __volatile__ ("fdiv\ts0, %s0, %s1" \
: \
: "w" (fp_one), "w" (fp_zero) \
: "s0"); \
__asm__ __volatile__ ("mrs\t%0, fpsr" : "=r" (fpsr)); \
} \
if (_fex & FP_EX_OVERFLOW) \
{ \
__asm__ __volatile__ ("fadd\ts0, %s0, %s1" \
: \
: "w" (fp_max), "w" (fp_1e32) \
: "s0"); \
__asm__ __volatile__ ("mrs\t%0, fpsr" : "=r" (fpsr)); \
} \
if (_fex & FP_EX_UNDERFLOW) \
{ \
__asm__ __volatile__ ("fmul\ts0, %s0, %s0" \
: \
: "w" (fp_min) \
: "s0"); \
__asm__ __volatile__ ("mrs\t%0, fpsr" : "=r" (fpsr)); \
} \
if (_fex & FP_EX_INEXACT) \
{ \
__asm__ __volatile__ ("fsub\ts0, %s0, %s1" \
: \
: "w" (fp_max), "w" (fp_one) \
: "s0"); \
__asm__ __volatile__ ("mrs\t%0, fpsr" : "=r" (fpsr)); \
} \
} while (0)
#define FP_TRAPPING_EXCEPTIONS ((_fcw >> FE_EXCEPT_SHIFT) & FE_ALL_EXCEPT)

View File

@ -0,0 +1,51 @@
/* Override generic sotruss-lib.c to define actual functions for AArch64.
Copyright (C) 2012 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 HAVE_ARCH_PLTENTER
#define HAVE_ARCH_PLTEXIT
#include <elf/sotruss-lib.c>
ElfW(Addr)
la_aarch64_gnu_pltenter (ElfW(Sym) *sym __attribute__ ((unused)),
unsigned int ndx __attribute__ ((unused)),
uintptr_t *refcook, uintptr_t *defcook,
La_aarch64_regs *regs, unsigned int *flags,
const char *symname, long int *framesizep)
{
print_enter (refcook, defcook, symname,
regs->lr_xreg[0], regs->lr_xreg[1], regs->lr_xreg[2],
*flags);
/* No need to copy anything, we will not need the parameters in any case. */
*framesizep = 0;
return sym->st_value;
}
unsigned int
la_aarch64_gnu_pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
uintptr_t *defcook,
const struct La_aarch64_regs *inregs,
struct La_aarch64_retval *outregs, const char *symname)
{
print_exit (refcook, defcook, symname, outregs->lrv_xreg[0]);
return 0;
}

View File

@ -0,0 +1,33 @@
/* Copyright (C) 2001-2012 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/>. */
/* This file contains a bit of information about the stack allocation
of the processor. */
#ifndef _STACKINFO_H
#define _STACKINFO_H 1
#include <elf.h>
/* On AArch64 the stack grows down. */
#define _STACK_GROWS_DOWN 1
/* Default to a non-executable stack. */
#define DEFAULT_STACK_PERMS (PF_R|PF_W)
#endif /* stackinfo.h */

View File

@ -0,0 +1,93 @@
/* Copyright (C) 1995-2012 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/>. */
/* This is the canonical entry point, usually the first thing in the text
segment.
Note that the code in the .init section has already been run.
This includes _init and _libc_init
At this entry point, most registers' values are unspecified, except:
x0 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.
sp The stack contains the arguments and environment:
0(sp) argc
8(sp) argv[0]
...
(8*argc)(sp) NULL
(8*(argc+1))(sp) envp[0]
...
NULL
*/
.text
.globl _start
.type _start,#function
_start:
/* Create an initial frame with 0 LR and FP */
mov x29, #0
mov x30, #0
mov x29, sp
/* Setup rtld_fini in argument register */
mov x5, x0
/* Load argc and a pointer to argv */
ldr x1, [sp, #0]
add x2, sp, #8
/* Setup stack limit in argument register */
mov x6, sp
#ifdef SHARED
adrp x0, :got:main
ldr x0, [x0, #:got_lo12:main]
adrp x3, :got:__libc_csu_init
ldr x3, [x3, #:got_lo12:__libc_csu_init]
adrp x4, :got:__libc_csu_fini
ldr x4, [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
#endif
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
stack_end) */
/* Let the libc call main and exit with its return code. */
bl __libc_start_main
/* should never get here....*/
bl abort
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.long 0
.weak data_start
data_start = __data_start

View File

@ -0,0 +1,62 @@
/* Copyright (C) 1997-2012 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 <sysdeps/generic/sysdep.h>
#ifdef __ASSEMBLER__
/* Syntactic details of assembler. */
#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
/* Define an entry point visible from C. */
#define ENTRY(name) \
.globl C_SYMBOL_NAME(name); \
.type C_SYMBOL_NAME(name),%function; \
.align 4; \
C_LABEL(name) \
cfi_startproc; \
CALL_MCOUNT
#undef END
#define END(name) \
cfi_endproc; \
ASM_SIZE_DIRECTIVE(name)
/* If compiled for profiling, call `mcount' at the start of each function. */
#ifdef PROF
# define CALL_MCOUNT \
str x30, [sp, #-16]!; \
bl mcount; \
ldr x30, [sp], #16 ;
#else
# define CALL_MCOUNT /* Do nothing. */
#endif
/* Local label name for asm code. */
#ifndef L
# define L(name) .L##name
#endif
/* Since C identifiers are not normally prefixed with an underscore
on this system, the asm identifier `syscall_error' intrudes on the
C name space. Make sure we use an innocuous name. */
#define syscall_error __syscall_error
#define mcount _mcount
#endif /* __ASSEMBLER__ */

View File

@ -0,0 +1,51 @@
/* Copyright (C) 2009-2012 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 TLS_LD(x) TLS_GD(x)
#define TLS_GD(x) \
({ register unsigned long __result asm ("x0"); \
asm ("adrp %0, :tlsgd:" #x "; " \
"add %0, %0, #:tlsgd_lo12:" #x "; " \
"bl __tls_get_addr;" \
"nop" \
: "=r" (__result) \
: \
: "x1", "x2", "x3", "x4", "x5", "x6", \
"x7", "x8", "x9", "x10", "x11", "x12", \
"x13", "x14", "x15", "x16", "x17", "x18", \
"x30", "memory"); \
(int *) (__result); })
#define TLS_IE(x) \
({ register unsigned long __result asm ("x0"); \
register unsigned long __t; \
asm ("mrs %1, tpidr_el0; " \
"adrp %0, :gottprel:" #x "; " \
"ldr %0, [%0, #:gottprel_lo12:" #x "]; " \
"add %0, %0, %1" \
: "=r" (__result), "=r" (__t)); \
(int *) (__result); })
#define TLS_LE(x) \
({ register unsigned long __result asm ("x0"); \
asm ("mrs %0, tpidr_el0; " \
"add %0, %0, :tprel_hi12:" #x "; " \
"add %0, %0, :tprel_lo12_nc:" #x \
: "=r" (__result)); \
(int *) (__result); })

View File

@ -0,0 +1,154 @@
/* Manage TLS descriptors. AArch64 version.
Copyright (C) 2011, 2012 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 <link.h>
#include <ldsodefs.h>
#include <elf/dynamic-link.h>
#include <tls.h>
#include <dl-tlsdesc.h>
#include <tlsdeschtab.h>
/* The following functions take an entry_check_offset argument. It's
computed by the caller as an offset between its entry point and the
call site, such that by adding the built-in return address that is
implicitly passed to the function with this offset, we can easily
obtain the caller's entry point to compare with the entry point
given in the TLS descriptor. If it's changed, we want to return
immediately. */
/* This function is used to lazily resolve TLS_DESC RELA relocations.
The argument location is used to hold a pointer to the relocation. */
void
attribute_hidden
_dl_tlsdesc_resolve_rela_fixup (struct tlsdesc volatile *td,
struct link_map *l)
{
const ElfW(Rela) *reloc = td->arg;
if (_dl_tlsdesc_resolve_early_return_p
(td, (void*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_PLT)]) + l->l_addr)))
return;
/* The code below was borrowed from _dl_fixup(),
except for checking for STB_LOCAL. */
const ElfW(Sym) *const symtab
= (const void *) D_PTR (l, l_info[DT_SYMTAB]);
const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]);
const ElfW(Sym) *sym = &symtab[ELFW(R_SYM) (reloc->r_info)];
lookup_t result;
/* Look up the target symbol. If the normal lookup rules are not
used don't look in the global scope. */
if (ELFW(ST_BIND) (sym->st_info) != STB_LOCAL
&& __builtin_expect (ELFW(ST_VISIBILITY) (sym->st_other), 0) == 0)
{
const struct r_found_version *version = NULL;
if (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL)
{
const ElfW(Half) *vernum =
(const void *) D_PTR (l, l_info[VERSYMIDX (DT_VERSYM)]);
ElfW(Half) ndx = vernum[ELFW(R_SYM) (reloc->r_info)] & 0x7fff;
version = &l->l_versions[ndx];
if (version->hash == 0)
version = NULL;
}
result = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym,
l->l_scope, version, ELF_RTYPE_CLASS_PLT,
DL_LOOKUP_ADD_DEPENDENCY, NULL);
}
else
{
/* We already found the symbol. The module (and therefore its load
address) is also known. */
result = l;
}
if (!sym)
{
td->arg = (void*) reloc->r_addend;
td->entry = _dl_tlsdesc_undefweak;
}
else
{
# ifndef SHARED
CHECK_STATIC_TLS (l, result);
# else
if (!TRY_STATIC_TLS (l, result))
{
td->arg = _dl_make_tlsdesc_dynamic (result, sym->st_value
+ reloc->r_addend);
td->entry = _dl_tlsdesc_dynamic;
}
else
# endif
{
td->arg = (void*) (sym->st_value + result->l_tls_offset
+ reloc->r_addend);
td->entry = _dl_tlsdesc_return;
}
}
_dl_tlsdesc_wake_up_held_fixups ();
}
/* This function is used to avoid busy waiting for other threads to
complete the lazy relocation. Once another thread wins the race to
relocate a TLS descriptor, it sets the descriptor up such that this
function is called to wait until the resolver releases the
lock. */
void
attribute_hidden
_dl_tlsdesc_resolve_hold_fixup (struct tlsdesc volatile *td,
void *caller)
{
/* Maybe we're lucky and can return early. */
if (caller != td->entry)
return;
/* Locking here will stop execution until the running resolver runs
_dl_tlsdesc_wake_up_held_fixups(), releasing the lock.
FIXME: We'd be better off waiting on a condition variable, such
that we didn't have to hold the lock throughout the relocation
processing. */
__rtld_lock_lock_recursive (GL(dl_load_lock));
__rtld_lock_unlock_recursive (GL(dl_load_lock));
}
/* Unmap the dynamic object, but also release its TLS descriptor table
if there is one. */
void
internal_function
_dl_unmap (struct link_map *map)
{
__munmap ((void *) (map)->l_map_start,
(map)->l_map_end - (map)->l_map_start);
#if SHARED
if (map->l_mach.tlsdesc_table)
htab_delete (map->l_mach.tlsdesc_table);
#endif
}

View File

@ -0,0 +1,15 @@
#include <stddef.h>
#include <sysdep.h>
#include <tls.h>
#include <link.h>
#include <dl-tlsdesc.h>
--
-- Abuse tls.h macros to derive offsets relative to the thread register.
TLSDESC_ARG offsetof(struct tlsdesc, arg)
TLSDESC_GEN_COUNT offsetof(struct tlsdesc_dynamic_arg, gen_count)
TLSDESC_MODID offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_module)
TLSDESC_MODOFF offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_offset)

View File

@ -0,0 +1,25 @@
/* Definitions for testing PLT entry/exit auditing. AArch64 version.
Copyright (C) 2005-2012 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 pltenter la_aarch64_gnu_pltenter
#define pltexit la_aarch64_gnu_pltexit
#define La_regs La_aarch64_regs
#define La_retval La_aarch64_retval
#define int_retval lrv_xreg[0]

View File

@ -0,0 +1,2 @@
unix/sysv/linux/generic
unix/sysv/linux/wordsize-64

View File

@ -0,0 +1,18 @@
ifeq ($(subdir),csu)
sysdep_routines += __read_tp libc-__read_tp
static-only-routines += __read_tp
shared-only-routines += libc-__read_tp
endif
ifeq ($(subdir),elf)
sysdep_routines += dl-vdso
sysdep-rtld-routines += __read_tp
endif
ifeq ($(subdir),misc)
sysdep_headers += sys/elf.h
endif
ifeq ($(subdir),stdlib)
gen-as-const-headers += ucontext_i.sym
endif

View File

@ -0,0 +1,6 @@
libc {
GLIBC_PRIVATE {
__vdso_clock_gettime;
__vdso_clock_getres;
}
}

View File

@ -0,0 +1,25 @@
/* Copyright (C) 2005-2012 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>
.hidden __read_tp
ENTRY (__read_tp)
mrs x0, tpidr_el0
RET
END (__read_tp)

View File

@ -0,0 +1,55 @@
/* O_*, F_*, FD_* bit values for the AArch64 Linux ABI.
Copyright (C) 2011, 2012 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 _FCNTL_H
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
#define __O_DIRECTORY 040000
#define __O_NOFOLLOW 0100000
#define __O_DIRECT 0200000
#define __O_LARGEFILE 0
# define F_GETLK64 5
# define F_SETLK64 6
# define F_SETLKW64 7
struct flock
{
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
__off_t l_start; /* Offset where the lock begins. */
__off_t l_len; /* Size of the locked area; zero means until EOF. */
__pid_t l_pid; /* Process holding the lock. */
};
#ifdef __USE_LARGEFILE64
struct flock64
{
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
__off64_t l_start; /* Offset where the lock begins. */
__off64_t l_len; /* Size of the locked area; zero means until EOF. */
__pid_t l_pid; /* Process holding the lock. */
};
#endif
/* Include generic Linux declarations. */
#include <bits/fcntl-linux.h>

View File

@ -0,0 +1,31 @@
/* Copyright (C) 2009-2012 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 _LIBC_VDSO_H
#define _LIBC_VDSO_H
#ifdef SHARED
extern void (*__vdso_gettimeofday) (struct timeval *, void *)
attribute_hidden;
extern void (*__vdso_clock_gettime) (clockid_t, struct timespec *);
extern void (*__vdso_clock_getres) (clockid_t, struct timespec *);
#endif
#endif /* _LIBC_VDSO_H */

View File

@ -0,0 +1,114 @@
/* Definitions for POSIX memory map interface. Linux/AArch64 version.
Copyright (C) 1997-2012 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 _SYS_MMAN_H
# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
#endif
/* The following definitions basically come from the kernel headers.
But the kernel header is not namespace clean. */
/* Protections are chosen from these bits, OR'd together. The
implementation does not necessarily support PROT_EXEC or PROT_WRITE
without PROT_READ. The only guarantees are that no writing will be
allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
#define PROT_READ 0x1 /* Page can be read. */
#define PROT_WRITE 0x2 /* Page can be written. */
#define PROT_EXEC 0x4 /* Page can be executed. */
#define PROT_NONE 0x0 /* Page can not be accessed. */
#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
growsdown vma (mprotect only). */
#define PROT_GROWSUP 0x02000000 /* Extend change to start of
growsup vma (mprotect only). */
/* Sharing types (must choose one and only one of these). */
#define MAP_SHARED 0x01 /* Share changes. */
#define MAP_PRIVATE 0x02 /* Changes are private. */
#ifdef __USE_MISC
# define MAP_TYPE 0x0f /* Mask for type of mapping. */
#endif
/* Other flags. */
#define MAP_FIXED 0x10 /* Interpret addr exactly. */
#ifdef __USE_MISC
# define MAP_FILE 0
# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
# define MAP_ANON MAP_ANONYMOUS
#endif
#ifdef __USE_MISC
/* These are Linux-specific. */
# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
# define MAP_DENYWRITE 0x00800 /* ETXTBSY */
# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */
# define MAP_LOCKED 0x02000 /* Lock the mapping. */
# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */
# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */
# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
# define MAP_STACK 0x20000 /* Allocation is for a stack. */
# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */
#endif
/* Flags to `msync'. */
#define MS_ASYNC 1 /* Sync memory asynchronously. */
#define MS_SYNC 4 /* Synchronous memory sync. */
#define MS_INVALIDATE 2 /* Invalidate the caches. */
/* Flags for `mlockall'. */
#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
#define MCL_FUTURE 2 /* Lock all additions to address
space. */
/* Flags for `mremap'. */
#ifdef __USE_GNU
# define MREMAP_MAYMOVE 1
# define MREMAP_FIXED 2
#endif
/* Advice to `madvise'. */
#ifdef __USE_BSD
# define MADV_NORMAL 0 /* No further special treatment. */
# define MADV_RANDOM 1 /* Expect random page references. */
# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
# define MADV_WILLNEED 3 /* Will need these pages. */
# define MADV_DONTNEED 4 /* Don't need these pages. */
# define MADV_REMOVE 9 /* Remove these pages and resources. */
# define MADV_DONTFORK 10 /* Do not inherit across fork. */
# define MADV_DOFORK 11 /* Do inherit across fork. */
# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */
# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */
# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
overrides the coredump filter bits. */
# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */
# define MADV_HWPOISON 100 /* Poison a page for testing. */
#endif
/* The POSIX people had to invent similar names for the same things. */
#ifdef __USE_XOPEN2K
# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
#endif

View File

@ -0,0 +1,98 @@
/* Copyright (C) 1996-2012 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/>. */
/* clone() is even more special than fork() as it mucks with stacks
and invokes a function in the right context after its all over. */
#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
#define CLONE_VM_BIT 8
#define CLONE_VM (1 << CLONE_VM_BIT)
#define CLONE_THREAD_BIT 16
#define CLONE_THREAD (1 << CLONE_THREAD_BIT)
/* int clone(int (*fn)(void *arg), x0
void *child_stack, x1
int flags, x2
void *arg, x3
pid_t *ptid, x4
struct user_desc *tls, x5
pid_t *ctid); x6
*/
.text
ENTRY(__clone)
/* Sanity check args. */
cbz x0, 1f
cbz x1, 1f
/* Insert the args onto the new stack. */
stp x0, x3, [x1, #-16]! /* Fn, arg. */
/* Do the system call. */
mov x0, x2 /* flags */
/* New sp is already in x1. */
mov x2, x4 /* ptid */
mov x3, x5 /* tls */
mov x4, x6 /* ctid */
#ifdef RESET_PID
/* We rely on the kernel preserving the argument regsiters across a
each system call so that we can inspect the flags against after
the clone call. */
mov x5, x0
#endif
mov x8, #SYS_ify(clone)
/* X0:flags, x1:newsp, x2:parenttidptr, x3:newtls, x4:childtid. */
svc 0x0
cmp x0, #0
beq 2f
blt C_SYMBOL_NAME(__syscall_error)
RET
1: mov x0, #-EINVAL
b syscall_error
2:
#ifdef RESET_PID
tbnz x5, #CLONE_THREAD_BIT, 3f
mov x0, #-1
tbnz x5, #CLONE_VM_BIT, 2f
mov x8, #SYS_ify(getpid)
svc 0x0
2:
mrs x1, tpidr_el0
sub x1, x1, #PTHREAD_SIZEOF
str w0, [x1, #PTHREAD_PID_OFFSET]
str w0, [x1, #PTHREAD_TID_OFFSET]
3:
#endif
/* Pick the function arg and call address from the stack and
execute. */
ldp x1, x0, [sp], #16
blr x1
/* We are done, pass the return value through x0. */
b HIDDEN_JUMPTARGET(_exit)
PSEUDO_END (__clone)
weak_alias (__clone, clone)

View File

@ -0,0 +1,3 @@
# This file is generated from configure.in by Autoconf. DO NOT EDIT!
arch_minimum_kernel=3.7.0

View File

@ -0,0 +1,4 @@
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

View File

@ -0,0 +1,105 @@
/* Save current context.
Copyright (C) 2009-2012 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>
#include "ucontext_i.h"
#include "ucontext-internal.h"
/* int getcontext (ucontext_t *ucp)
Returns 0 on success -1 and errno on failure.
*/
.text
ENTRY(__getcontext)
/* The saved context will return to the getcontext() call point
with a return value of 0 */
str xzr, [x0, oX0 + 0 * SZREG]
stp x18, x19, [x0, oX0 + 18 * SZREG]
stp x20, x21, [x0, oX0 + 20 * SZREG]
stp x22, x23, [x0, oX0 + 22 * SZREG]
stp x24, x25, [x0, oX0 + 24 * SZREG]
stp x26, x27, [x0, oX0 + 26 * SZREG]
stp x28, x29, [x0, oX0 + 28 * SZREG]
str x30, [x0, oX0 + 30 * SZREG]
/* Place LR into the saved PC, this will ensure that when
switching to this saved context with setcontext() control
will pass back to the caller of getcontext(), we have
already arrange to return the appropriate return value in x0
above. */
str x30, [x0, oPC]
/* Save the current SP */
mov x2, sp
str x2, [x0, oSP]
/* Figure out where to place the first context extension
block. */
add x2, x0, #oEXTENSION
/* Write the context extension fpsimd header. */
mov w3, #(FPSIMD_MAGIC & 0xffff)
movk w3, #(FPSIMD_MAGIC >> 16), lsl #16
str w3, [x2, #oHEAD + oMAGIC]
mov w3, #FPSIMD_CONTEXT_SIZE
str w3, [x2, #oHEAD + oSIZE]
/* Fill in the FP SIMD context. */
add x3, x2, #oV0 + 8 * SZVREG
stp d8, d9, [x3], # 2 * SZVREG
stp d10, d11, [x3], # 2 * SZVREG
stp d12, d13, [x3], # 2 * SZVREG
stp d14, d15, [x3], # 2 * SZVREG
add x3, x2, oFPSR
mrs x4, fpsr
str w4, [x3]
mrs x4, fpcr
str w4, [x3, oFPCR - oFPSR]
/* Write the termination context extension header. */
add x2, x2, #FPSIMD_CONTEXT_SIZE
str xzr, [x2, #oHEAD + oMAGIC]
str xzr, [x2, #oHEAD + oSIZE]
/* Grab the signal mask */
/* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */
add x2, x0, #UCONTEXT_SIGMASK
mov x0, SIG_BLOCK
mov x1, 0
mov x3, _NSIG8
mov x8, SYS_ify (rt_sigprocmask)
svc 0
cbnz x0, 1f
/* Return 0 for success */
mov x0, 0
RET
1:
b C_SYMBOL_NAME(__syscall_error)
PSEUDO_END (__getcontext)
weak_alias (__getcontext, getcontext)

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2005-2012 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 <sys/time.h>
#undef __gettimeofday
#include <bits/libc-vdso.h>
#include <bp-checks.h>
/* Get the current time of day and timezone information,
putting it into *tv and *tz. If tz is null, *tz is not filled.
Returns 0 on success, -1 on errors. */
int
__gettimeofday (tv, tz)
struct timeval *tv;
struct timezone *tz;
{
return INLINE_VSYSCALL (gettimeofday, 2, CHECK_1 (tv), CHECK_1 (tz));
}
libc_hidden_def (__gettimeofday)
weak_alias (__gettimeofday, gettimeofday)
libc_hidden_weak (gettimeofday)

View File

@ -0,0 +1,43 @@
/* Copyright (C) 2007-2012 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/>. */
#ifdef SHARED
# include <dl-vdso.h>
# undef __gettimeofday
# undef __clock_gettime
# undef __clock_getres
# include <bits/libc-vdso.h>
void (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden;
void (*__vdso_clock_gettime) (clockid_t, struct timespec *);
void (*__vdso_clock_getres) (clockid_t, struct timespec *);
static inline void
_libc_vdso_platform_setup (void)
{
PREPARE_VERSION (linux2639, "LINUX_2.6.39", 123718537);
__vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2639);
__vdso_clock_gettime = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2639);
__vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres", &linux2639);
}
# define VDSO_SETUP _libc_vdso_platform_setup
#endif
#include <csu/init-first.c>

View File

@ -0,0 +1,32 @@
/* Copyright (C) 2012 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)
movz x8, #__NR_ioctl
sxtw x0, w0
svc #0x0
cmn x0, #0x1, lsl #12
b.hi C_SYMBOL_NAME(__syscall_error)
ret
PSEUDO_END (__ioctl)
weak_alias (__ioctl, ioctl)

View File

@ -0,0 +1,37 @@
/* Set flags signalling availability of kernel features based on given
kernel version number.
Copyright (C) 2009-2012 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 <linux/version.h>
/* AArch64 support starts with 3.7.0, guaranteeing many kernel
features. */
#define __ASSUME_ACCEPT4 1
#define __ASSUME_DUP3 1
#define __ASSUME_EVENTFD2 1
#define __ASSUME_IN_NONBLOCK 1
#define __ASSUME_O_CLOEXEC 1
#define __ASSUME_PIPE2 1
#define __ASSUME_SIGNALFD4 1
#define __ASSUME_SOCK_CLOEXEC 1
#define __ASSUME_UTIMES 1
#include_next <kernel-features.h>

View File

@ -0,0 +1,25 @@
/* Copyright (C) 2009-2012 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/>. */
/* This structure must have the same shape as the linux kernel
equivalent. */
struct kernel_rt_sigframe
{
siginfo_t info;
struct ucontext uc;
};

View File

@ -0,0 +1,25 @@
/* Copyright (C) 2009-2012 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 <sysdeps/generic/ldconfig.h>
#define SYSDEP_KNOWN_INTERPRETER_NAMES \
{ "/lib/ld-linux-aarch64.so.1", FLAG_ELF_LIBC6 },
#define SYSDEP_KNOWN_LIBRARY_NAMES \
{ "libc.so.6", FLAG_ELF_LIBC6 }, \
{ "libm.so.6", FLAG_ELF_LIBC6 },

View File

@ -0,0 +1,19 @@
/* Copyright (C) 2009-2012 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 <__read_tp.S>

View File

@ -0,0 +1,74 @@
/* Create new context.
Copyright (C) 2002-2012 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>
#include <stdarg.h>
#include <stdint.h>
#include <ucontext.h>
/* makecontext sets up a stack and the registers for the
user context. The stack looks like this:
+-----------------------+
| padding as required |
+-----------------------+
sp -> | parameter 7-n |
+-----------------------+
The registers are set up like this:
%x0 .. %x7: parameter 1 to 8
%x19 : uc_link
%sp : stack pointer.
*/
void
__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
{
extern void __startcontext (void);
unsigned long int *sp;
va_list ap;
int i;
sp = (unsigned long int *)
((uintptr_t) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
/* Allocate stack arguments. */
sp -= argc < 8 ? 0 : argc - 8;
/* Keep the stack aligned. */
sp = (unsigned long int *) (((uintptr_t) sp) & -16L);
ucp->uc_mcontext.regs[19] = (uintptr_t) ucp->uc_link;
ucp->uc_mcontext.sp = (uintptr_t) sp;
ucp->uc_mcontext.pc = (uintptr_t) func;
ucp->uc_mcontext.regs[29] = (uintptr_t) 0;
ucp->uc_mcontext.regs[30] = (uintptr_t) &__startcontext;
va_start (ap, argc);
for (i = 0; i < argc; ++i)
if (i < 8)
ucp->uc_mcontext.regs[i] = va_arg (ap, unsigned long int);
else
sp[i - 8] = va_arg (ap, unsigned long int);
va_end (ap);
}
weak_alias (__makecontext, makecontext)

View File

@ -0,0 +1,34 @@
/* Copyright (C) 2009-2012 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 INLINE_SYSCALL (mmap, 6, addr, len, prot, flags, fd, offset);
}
weak_alias (__mmap, mmap)
weak_alias (__mmap, mmap64)
weak_alias (__mmap, __mmap64)

View File

@ -0,0 +1,101 @@
/* Minimum guaranteed maximum values for system limits. Linux version.
Copyright (C) 1993-2012 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/>. */
/* The kernel header pollutes the namespace with the NR_OPEN symbol
and defines LINK_MAX although filesystems have different maxima. A
similar thing is true for OPEN_MAX: the limit can be changed at
runtime and therefore the macro must not be defined. Remove this
after including the header if necessary. */
#ifndef NR_OPEN
# define __undef_NR_OPEN
#endif
#ifndef LINK_MAX
# define __undef_LINK_MAX
#endif
#ifndef OPEN_MAX
# define __undef_OPEN_MAX
#endif
#ifndef ARG_MAX
# define __undef_ARG_MAX
#endif
/* The kernel sources contain a file with all the needed information. */
#include <linux/limits.h>
/* Have to remove NR_OPEN? */
#ifdef __undef_NR_OPEN
# undef NR_OPEN
# undef __undef_NR_OPEN
#endif
/* Have to remove LINK_MAX? */
#ifdef __undef_LINK_MAX
# undef LINK_MAX
# undef __undef_LINK_MAX
#endif
/* Have to remove OPEN_MAX? */
#ifdef __undef_OPEN_MAX
# undef OPEN_MAX
# undef __undef_OPEN_MAX
#endif
/* Have to remove ARG_MAX? */
#ifdef __undef_ARG_MAX
# undef ARG_MAX
# undef __undef_ARG_MAX
#endif
/* The number of data keys per process. */
#define _POSIX_THREAD_KEYS_MAX 128
/* This is the value this implementation supports. */
#define PTHREAD_KEYS_MAX 1024
/* Controlling the iterations of destructors for thread-specific data. */
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
/* Number of iterations this implementation does. */
#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
/* The number of threads per process. */
#define _POSIX_THREAD_THREADS_MAX 64
/* We have no predefined limit on the number of threads. */
#undef PTHREAD_THREADS_MAX
/* Maximum amount by which a process can descrease its asynchronous I/O
priority level. */
#define AIO_PRIO_DELTA_MAX 20
/* Minimum size for a thread. At least two pages for systems with 64k
pages. */
#define PTHREAD_STACK_MIN 131072
/* Maximum number of timer expiration overruns. */
#define DELAYTIMER_MAX 2147483647
/* Maximum tty name length. */
#define TTY_NAME_MAX 32
/* Maximum login name length. This is arbitrary. */
#define LOGIN_NAME_MAX 256
/* Maximum host name length. */
#define HOST_NAME_MAX 64
/* Maximum message queue priority level. */
#define MQ_PRIO_MAX 32768
/* Maximum value the semaphore can have. */
#define SEM_VALUE_MAX (2147483647)

View File

@ -0,0 +1,169 @@
/* Copyright (C) 2002-2012 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 _BITS_PTHREADTYPES_H
#define _BITS_PTHREADTYPES_H 1
#include <endian.h>
#define __SIZEOF_PTHREAD_ATTR_T 64
#define __SIZEOF_PTHREAD_MUTEX_T 48
#define __SIZEOF_PTHREAD_MUTEXATTR_T 8
#define __SIZEOF_PTHREAD_COND_T 48
#define __SIZEOF_PTHREAD_COND_COMPAT_T 48
#define __SIZEOF_PTHREAD_CONDATTR_T 8
#define __SIZEOF_PTHREAD_RWLOCK_T 56
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
#define __SIZEOF_PTHREAD_BARRIER_T 32
#define __SIZEOF_PTHREAD_BARRIERATTR_T 8
/* Thread identifiers. The structure of the attribute type is not
exposed on purpose. */
typedef unsigned long int pthread_t;
union pthread_attr_t
{
char __size[__SIZEOF_PTHREAD_ATTR_T];
long int __align;
};
#ifndef __have_pthread_attr_t
typedef union pthread_attr_t pthread_attr_t;
# define __have_pthread_attr_t1
#endif
typedef struct __pthread_internal_list
{
struct __pthread_internal_list *__prev;
struct __pthread_internal_list *__next;
} __pthread_list_t;
/* Data structures for mutex handling. The structure of the attribute
type is not exposed on purpose. */
typedef union
{
struct __pthread_mutex_s
{
int __lock;
unsigned int __count;
int __owner;
unsigned int __nusers;
int __kind;
int __spins;
__pthread_list_t __list;
#define __PTHREAD_MUTEX_HAVE_PREV 1
} __data;
char __size[__SIZEOF_PTHREAD_MUTEX_T];
long int __align;
} pthread_mutex_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
long int __align;
} pthread_mutexattr_t;
/* Data structure for conditional variable handling. The structure of
the attribute type is not exposed on purpose. */
typedef union
{
struct
{
int __lock;
unsigned int __futex;
__extension__ unsigned long long int __total_seq;
__extension__ unsigned long long int __wakeup_seq;
__extension__ unsigned long long int __woken_seq;
void *__mutex;
unsigned int __nwaiters;
unsigned int __broadcast_seq;
} __data;
char __size[__SIZEOF_PTHREAD_COND_T];
long int __align;
} pthread_cond_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
int __align;
} pthread_condattr_t;
/* Keys for thread-specific data */
typedef unsigned int pthread_key_t;
/* Once-only execution */
typedef int pthread_once_t;
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Data structure for read-write lock variable handling. The
structure of the attribute type is not exposed on purpose. */
typedef union
{
struct
{
int __lock;
unsigned int __nr_readers;
unsigned int __readers_wakeup;
unsigned int __writer_wakeup;
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
int __writer;
int __shared;
unsigned long int __pad1;
unsigned long int __pad2;
unsigned int __flags;
} __data;
char __size[__SIZEOF_PTHREAD_RWLOCK_T];
long int __align;
} pthread_rwlock_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
long int __align;
} pthread_rwlockattr_t;
#endif
#ifdef __USE_XOPEN2K
/* POSIX spinlock data type. */
typedef volatile int pthread_spinlock_t;
/* POSIX barriers data type. The structure of the type is
deliberately not exposed. */
typedef union
{
char __size[__SIZEOF_PTHREAD_BARRIER_T];
long int __align;
} pthread_barrier_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
int __align;
} pthread_barrierattr_t;
#endif
#endif /* bits/pthreadtypes.h */

View File

@ -0,0 +1,35 @@
/* Copyright (C) 2002-2012 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 _SEMAPHORE_H
# error "Never use <bits/semaphore.h> directly; include <semaphore.h> instead."
#endif
#define __SIZEOF_SEM_T 32
/* Value returned if `sem_open' failed. */
#define SEM_FAILED ((sem_t *) 0)
typedef union
{
char __size[__SIZEOF_SEM_T];
long int __align;
} sem_t;

View File

@ -0,0 +1,67 @@
blkcnt64_t:l
blkcnt_t:l
blksize_t:i
caddr_t:Pc
clockid_t:i
clock_t:l
daddr_t:i
dev_t:m
fd_mask:l
fsblkcnt64_t:m
fsblkcnt_t:m
fsfilcnt64_t:m
fsfilcnt_t:m
fsid_t:8__fsid_t
gid_t:j
id_t:j
ino64_t:m
ino_t:m
int16_t:s
int32_t:i
int64_t:l
int8_t:a
intptr_t:l
key_t:i
loff_t:l
mode_t:j
nlink_t:j
off64_t:l
off_t:l
pid_t:i
pthread_attr_t:14pthread_attr_t
pthread_barrier_t:17pthread_barrier_t
pthread_barrierattr_t:21pthread_barrierattr_t
pthread_cond_t:14pthread_cond_t
pthread_condattr_t:18pthread_condattr_t
pthread_key_t:j
pthread_mutex_t:15pthread_mutex_t
pthread_mutexattr_t:19pthread_mutexattr_t
pthread_once_t:i
pthread_rwlock_t:16pthread_rwlock_t
pthread_rwlockattr_t:20pthread_rwlockattr_t
pthread_spinlock_t:i
pthread_t:m
quad_t:l
register_t:l
rlim64_t:m
rlim_t:m
sigset_t:10__sigset_t
size_t:m
socklen_t:j
ssize_t:l
suseconds_t:l
time_t:l
u_char:h
uid_t:j
uint:j
u_int:j
u_int16_t:t
u_int32_t:j
u_int64_t:m
u_int8_t:h
ulong:m
u_long:m
u_quad_t:m
useconds_t:j
ushort:t
u_short:t

View File

@ -0,0 +1,21 @@
/* Copyright (C) 2009-2012 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 RESET_PID
#include <tcb-offsets.h>
#include "../clone.S"

View File

@ -0,0 +1,23 @@
/* Copyright (C) 2005-2012 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/>. */
/* Value passed to 'clone' for initialization of the thread register. */
#define TLS_VALUE (pd + 1)
/* Get the real implementation. */
#include <sysdeps/pthread/createthread.c>

View File

@ -0,0 +1,30 @@
/* Copyright (C) 2005-2012 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 <sched.h>
#include <signal.h>
#include <sysdep.h>
#include <tls.h>
#define ARCH_FORK() \
INLINE_SYSCALL (clone, 5, \
CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, \
NULL, NULL, NULL, &THREAD_SELF->tid)
#include <sysdeps/unix/sysv/linux/fork.c>

View File

@ -0,0 +1,12 @@
GLIBC_2.17
GLIBC_2.17 A
__libc_memalign F
__libc_stack_end D 0x8
__stack_chk_guard D 0x8
__tls_get_addr F
_dl_mcount F
_r_debug D 0x28
calloc F
free F
malloc F
realloc F

View File

@ -0,0 +1,3 @@
GLIBC_2.17
GLIBC_2.17 A
__ctype_get_mb_cur_max F

View File

@ -0,0 +1,6 @@
GLIBC_2.17
GLIBC_2.17 A
gai_cancel F
gai_error F
gai_suspend F
getaddrinfo_a F

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
GLIBC_2.17
GLIBC_2.17 A
crypt F
crypt_r F
encrypt F
encrypt_r F
fcrypt F
setkey F
setkey_r F

View File

@ -0,0 +1,11 @@
GLIBC_2.17
GLIBC_2.17 A
dladdr F
dladdr1 F
dlclose F
dlerror F
dlinfo F
dlmopen F
dlopen F
dlsym F
dlvsym F

Some files were not shown because too many files have changed in this diff Show More