MicroBlaze Port

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
This commit is contained in:
David Holsgrove 2012-01-10 15:38:42 +10:00
parent 5c5b07da03
commit 7756ba9d6d
101 changed files with 12503 additions and 0 deletions

101
ports/ChangeLog.microblaze Normal file
View File

@ -0,0 +1,101 @@
2013-03-28 David Holsgrove <david.holsgrove@xilinx.com>
* sysdeps/microblaze/Implies: New file.
* sysdeps/microblaze/Makefile: New file.
* sysdeps/microblaze/__longjmp.S: New file.
* sysdeps/microblaze/_mcount.S: New file.
* sysdeps/microblaze/abort-instr.h: New file.
* sysdeps/microblaze/asm-syntax.h: New file.
* sysdeps/microblaze/backtrace.c: New file.
* sysdeps/microblaze/backtrace_linux.c: New file.
* sysdeps/microblaze/bits/atomic.h: New file.
* sysdeps/microblaze/bits/endian.h: New file.
* sysdeps/microblaze/bits/fenv.h: New file.
* sysdeps/microblaze/bits/link.h: New file.
* sysdeps/microblaze/bits/setjmp.h: New file.
* sysdeps/microblaze/bsd-_setjmp.S: New file.
* sysdeps/microblaze/bsd-setjmp.S: New file.
* sysdeps/microblaze/crti.S: New file.
* sysdeps/microblaze/crtn.S: New file.
* sysdeps/microblaze/dl-machine.h: New file.
* sysdeps/microblaze/dl-tls.h: New file.
* sysdeps/microblaze/dl-trampoline.S: New file.
* sysdeps/microblaze/fegetround.c: New file.
* sysdeps/microblaze/fesetround.c: New file.
* sysdeps/microblaze/gccframe.h: New file.
* sysdeps/microblaze/jmpbuf-unwind.h: New file.
* sysdeps/microblaze/ldsodefs.h: New file.
* sysdeps/microblaze/libc-tls.c: New file.
* sysdeps/microblaze/libm-test-ulps: New file.
* sysdeps/microblaze/machine-gmon.h: New file.
* sysdeps/microblaze/math_private.h: New file.
* sysdeps/microblaze/memusage.h: New file.
* sysdeps/microblaze/nptl/Makefile: New file.
* sysdeps/microblaze/nptl/pthread_spin_lock.c: New file.
* sysdeps/microblaze/nptl/pthreaddef.h: New file.
* sysdeps/microblaze/nptl/tcb-offsets.sym: New file.
* sysdeps/microblaze/nptl/tls.h: New file.
* sysdeps/microblaze/preconfigure: New file.
* sysdeps/microblaze/setjmp.S: New file.
* sysdeps/microblaze/shlib-versions: New file.
* sysdeps/microblaze/sotruss-lib.c: New file.
* sysdeps/microblaze/stackinfo.h: New file.
* sysdeps/microblaze/start.S: New file.
* sysdeps/microblaze/sysdep.h: New file.
* sysdeps/microblaze/tls-macros.h: New file.
* sysdeps/microblaze/tst-audit.h: New file.
* sysdeps/unix/sysv/linux/microblaze/Makefile: New file.
* sysdeps/unix/sysv/linux/microblaze/Versions: New file.
* sysdeps/unix/sysv/linux/microblaze/____longjmp_chk.S: New file.
* sysdeps/unix/sysv/linux/microblaze/bits/fcntl.h: New file.
* sysdeps/unix/sysv/linux/microblaze/bits/mman.h: New file.
* sysdeps/unix/sysv/linux/microblaze/bits/stat.h: New file.
* sysdeps/unix/sysv/linux/microblaze/brk.c: New file.
* sysdeps/unix/sysv/linux/microblaze/clone.S: New file.
* sysdeps/unix/sysv/linux/microblaze/configure: New file.
* sysdeps/unix/sysv/linux/microblaze/configure.in: New file.
* sysdeps/unix/sysv/linux/microblaze/fcntl.c: New file.
* sysdeps/unix/sysv/linux/microblaze/fxstat.c: New file.
* sysdeps/unix/sysv/linux/microblaze/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/microblaze/getsysstats.c: New file.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h: New file.
* sysdeps/unix/sysv/linux/microblaze/kernel_stat.h: New file.
* sysdeps/unix/sysv/linux/microblaze/lxstat.c: New file.
* sysdeps/unix/sysv/linux/microblaze/mmap.S: New file.
* sysdeps/unix/sysv/linux/microblaze/msgctl.c: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/bits/pthreadtypes.h: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/bits/semaphore.h: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/c++-types.data: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/createthread.c: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/fork.c: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/ld.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/libBrokenLocale.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/libanl.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/libc.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/libcrypt.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/libdl.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/libm.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/libnsl.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/libpthread.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/libresolv.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/librt.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/libthread_db.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/libutil.abilist: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/localplt.data: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/lowlevellock.h: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/pt-vfork.S: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/pthread_once.c: New file.
* sysdeps/unix/sysv/linux/microblaze/nptl/vfork.S: New file.
* sysdeps/unix/sysv/linux/microblaze/profil-counter.h: New file.
* sysdeps/unix/sysv/linux/microblaze/semctl.c: New file.
* sysdeps/unix/sysv/linux/microblaze/shmctl.c: New file.
* sysdeps/unix/sysv/linux/microblaze/setgroups.c: New file.
* sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h: New file.
* sysdeps/unix/sysv/linux/microblaze/socket.S: New file.
* sysdeps/unix/sysv/linux/microblaze/sys/procfs.h: New file.
* sysdeps/unix/sysv/linux/microblaze/sys/user.h: New file.
* sysdeps/unix/sysv/linux/microblaze/syscall.S: New file.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list: New file.
* sysdeps/unix/sysv/linux/microblaze/sysdep.S: New file.
* sysdeps/unix/sysv/linux/microblaze/sysdep.h: New file.
* sysdeps/unix/sysv/linux/microblaze/xstat.c: New file.

View File

@ -0,0 +1,4 @@
wordsize-32
# MicroBlaze uses IEEE 754 floating point.
ieee754/flt-32
ieee754/dbl-64

View File

@ -0,0 +1,26 @@
ifeq ($(subdir),elf)
CFLAGS-rtld.c += -Wno-uninitialized -Wno-unused
endif
ifeq ($(subdir),gmon)
sysdep_routines += _mcount
endif
ifeq ($(subdir),resource)
sysdep_routines += backtrace_linux
endif
$(objpfx)libm.so: $(elfobjdir)/ld.so
$(objpfx)libcrypt.so: $(elfobjdir)/ld.so
$(objpfx)libresolv.so: $(elfobjdir)/ld.so
$(objpfx)libnss_dns.so: $(elfobjdir)/ld.so
$(objpfx)libnss_files.so: $(elfobjdir)/ld.so
$(objpfx)libnss_db.so: $(elfobjdir)/ld.so
$(objpfx)libnss_nis.so: $(elfobjdir)/ld.so
$(objpfx)libnss_nisplus.so: $(elfobjdir)/ld.so
$(objpfx)libnss_hesiod.so: $(elfobjdir)/ld.so
$(objpfx)libnss_compat.so: $(elfobjdir)/ld.so
$(objpfx)libanl.so: $(elfobjdir)/ld.so
$(objpfx)libnsl.so: $(elfobjdir)/ld.so
$(objpfx)libcidn.so: $(elfobjdir)/ld.so
$(objpfx)libutil.so: $(elfobjdir)/ld.so

View File

@ -0,0 +1,55 @@
/* Copyright (C) 1997-2013 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>
/* Jump to the position specified by ENV, causing the
setjmp call there to return VAL, or 1 if VAL is 0. */
/* void __longjmp (__jmp_buf env, int val) */
ENTRY(__longjmp)
lwi r1,r5,0
lwi r2,r5,4
lwi r13,r5,8
lwi r14,r5,12
lwi r15,r5,16
lwi r16,r5,20
lwi r17,r5,24
lwi r18,r5,28
lwi r19,r5,32
lwi r20,r5,36
lwi r21,r5,40
lwi r22,r5,44
lwi r23,r5,48
lwi r24,r5,52
lwi r25,r5,56
lwi r26,r5,60
lwi r27,r5,64
lwi r28,r5,68
lwi r29,r5,72
lwi r30,r5,76
lwi r31,r5,80
addk r3,r6,r0
beqi r3,L(return_1)
rtsd r15,8
nop
L(return_1):
rtsd r15,8
addik r3,r0,1 /* delay slot. */
END(__longjmp)

View File

@ -0,0 +1,91 @@
/* Copyright (C) 1997-2013 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/>. */
.global _mcount
.type _mcount, @function
_mcount:
# Save regs.
addik r1, r1,-4 * 24
swi r31, r1, 4 * 23
swi r30, r1, 4 * 22
swi r29, r1, 4 * 21
swi r28, r1, 4 * 20
swi r27, r1, 4 * 19
swi r26, r1, 4 * 18
swi r25, r1, 4 * 17
swi r24, r1, 4 * 16
swi r23, r1, 4 * 15
swi r22, r1, 4 * 14
swi r21, r1, 4 * 13
swi r20, r1, 4 * 12
swi r19, r1, 4 * 11
swi r15, r1, 4 * 10
swi r12, r1, 4 * 9
swi r11, r1, 4 * 8
swi r10, r1, 4 * 7
swi r8, r1, 4 * 6
swi r7, r1, 4 * 5
swi r6, r1, 4 * 4
swi r5, r1, 4 * 3
swi r4, r1, 4 * 2
swi r3, r1, 4 * 1
swi r2, r1, 4 * 0
#ifdef SHARED
mfs r20,rpc
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
addk r6, r0, r15 # callee is in r15.
brlid r15, __mcount_internal@PLT
lwi r5, r1, 4 * 24 # caller is on the stack.
#else
# Pass from/to in r5 and r6.
addk r6, r0, r15 # callee is in r15.
bralid r15, __mcount_internal
lwi r5, r1, 4 * 24 # caller is on the stack.
#endif
# Reload regs
lwi r31, r1, 4 * 23
lwi r30, r1, 4 * 22
lwi r29, r1, 4 * 21
lwi r28, r1, 4 * 20
lwi r27, r1, 4 * 19
lwi r26, r1, 4 * 18
lwi r25, r1, 4 * 17
lwi r24, r1, 4 * 16
lwi r23, r1, 4 * 15
lwi r22, r1, 4 * 14
lwi r21, r1, 4 * 13
lwi r20, r1, 4 * 12
lwi r19, r1, 4 * 11
lwi r15, r1, 4 * 10
lwi r12, r1, 4 * 9
lwi r11, r1, 4 * 8
lwi r10, r1, 4 * 7
lwi r8, r1, 4 * 6
lwi r7, r1, 4 * 5
lwi r6, r1, 4 * 4
lwi r5, r1, 4 * 3
lwi r4, r1, 4 * 2
lwi r3, r1, 4 * 1
lwi r2, r1, 4 * 0
rtsd r15, 8
addik r1, r1, 4 * 24
.size _mcount, . - _mcount

View File

@ -0,0 +1,2 @@
/* An instruction which should crash any program is `illegal'. */
#define ABORT_INSTRUCTION asm ("brki r0, -1")

View File

@ -0,0 +1,24 @@
/* Copyright (C) 1997-2013 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/>. */
#undef ALIGN
#define ALIGN(log) .align 1<<log
#define R_(r) %##r
#define R(r) R_(r)
#define L(label) .##label

View File

@ -0,0 +1,139 @@
/* Copyright (C) 2005-2013 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 <stdio.h>
#include <string.h>
#include <sysdep.h>
#include <signal.h>
#include <execinfo.h>
extern int
_identify_sighandler (unsigned long fp, unsigned long pc,
unsigned long *pprev_fp, unsigned long *pprev_pc,
unsigned long *retaddr);
inline long
get_frame_size (unsigned long instr)
{
return abs ((short signed) (instr & 0xFFFF));
}
static unsigned long *
find_frame_creation (unsigned long *pc)
{
int i;
/* NOTE: Distance to search is arbitrary.
250 works well for most things,
750 picks up things like tcp_recvmsg,
1000 needed for fat_fill_super. */
for (i = 0; i < 1000; i++, pc--)
{
unsigned long instr;
unsigned long frame_size;
instr = *pc;
/* Is the instruction of the form
addik r1, r1, foo ? */
if ((instr & 0xFFFF0000) != 0x30210000)
continue;
frame_size = get_frame_size (instr);
if ((frame_size < 8) || (frame_size & 3))
return NULL;
return pc;
}
return NULL;
}
static int
lookup_prev_stack_frame (unsigned long fp, unsigned long pc,
unsigned long *pprev_fp, unsigned long *pprev_pc,
unsigned long *retaddr)
{
unsigned long *prologue = NULL;
int is_signalhandler = _identify_sighandler (fp, pc, pprev_fp,
pprev_pc, retaddr);
if (!is_signalhandler)
{
prologue = find_frame_creation ((unsigned long *) pc);
if (prologue)
{
long frame_size = get_frame_size (*prologue);
*pprev_fp = fp + frame_size;
if (*retaddr != 0)
*pprev_pc = *retaddr;
else
*pprev_pc = *(unsigned long *) fp;
*retaddr = 0;
if (!*pprev_pc || (*pprev_pc & 3))
prologue=0;
}
else
{
*pprev_pc = 0;
*pprev_fp = fp;
*retaddr = 0;
}
}
return (!*pprev_pc || (*pprev_pc & 3)) ? -1 : 0;
}
int
__backtrace (void **array, int size)
{
unsigned long pc, fp;
unsigned long ppc, pfp;
/* Return address(r15) is required in the signal handler case, since the
return address of the function which causes the signal may not be
recorded in the stack. */
unsigned long retaddr;
int count;
int rc = 0;
__asm__ __volatile__ ("mfs %0, rpc"
: "=r"(pc));
__asm__ __volatile__ ("add %0, r1, r0"
: "=r"(fp));
array[0] = (void *) pc;
retaddr = 0;
for (count = 1; count < size; count++)
{
rc = lookup_prev_stack_frame (fp, pc, &pfp, &ppc, &retaddr);
fp = pfp;
pc = ppc;
array[count] = (void *) pc;
if (rc)
return count;
}
return count;
}
weak_alias (__backtrace, backtrace)
libc_hidden_def (__backtrace)

View File

@ -0,0 +1,59 @@
/* Copyright (C) 2005-2013 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 <stddef.h>
#include <asm/sigcontext.h>
#include <linux/signal.h>
#include <asm-generic/ucontext.h>
#include <asm/unistd.h>
int
_identify_sighandler (unsigned long fp, unsigned long pc,
unsigned long *pprev_fp, unsigned long *pprev_pc,
unsigned long *retaddr)
{
unsigned long *tramp = 0;
struct ucontext *uc;
if (*retaddr == 0)
{
/* Kernel inserts the tramp between the signal handler frame and the
caller frame in signal handling. */
tramp = (unsigned long *) pc;
tramp += 2;
if ((*tramp == (0x31800000 | __NR_rt_sigreturn))
&& (*(tramp+1) == 0xb9cc0008))
{
/* Signal handler function argument are:
int sig_num, siginfo_t * info, void * ucontext
therefore ucontext is the 3rd argument. */
unsigned long ucptr = ((unsigned long) tramp
- sizeof (struct ucontext));
uc = (struct ucontext *) ucptr;
*pprev_pc = uc->uc_mcontext.regs.pc;
/* Need to record the return address since the return address of the
function which causes this signal may not be recorded in the
stack. */
*pprev_fp = uc->uc_mcontext.regs.r1;
*retaddr = uc->uc_mcontext.regs.r15;
/* It is a signal handler. */
return 1;
}
}
return 0;
}

View File

@ -0,0 +1,269 @@
/* Copyright (C) 2003-2013 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 <stdint.h>
#include <sysdep.h>
typedef int8_t atomic8_t;
typedef uint8_t uatomic8_t;
typedef int_fast8_t atomic_fast8_t;
typedef uint_fast8_t uatomic_fast8_t;
typedef int32_t atomic32_t;
typedef uint32_t uatomic32_t;
typedef int_fast32_t atomic_fast32_t;
typedef uint_fast32_t uatomic_fast32_t;
typedef intptr_t atomicptr_t;
typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;
/* Microblaze does not have byte and halfword forms of load and reserve and
store conditional. So for microblaze we stub out the 8- and 16-bit forms. */
#define __arch_compare_and_exchange_bool_8_acq(mem, newval, oldval) \
(abort (), 0)
#define __arch_compare_and_exchange_bool_16_acq(mem, newval, oldval) \
(abort (), 0)
#define __arch_compare_and_exchange_bool_8_rel(mem, newval, oldval) \
(abort (), 0)
#define __arch_compare_and_exchange_bool_16_rel(mem, newval, oldval) \
(abort (), 0)
#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
({ \
__typeof (*(mem)) __tmp; \
__typeof (mem) __memp = (mem); \
int test; \
__asm __volatile ( \
" addc r0, r0, r0;" \
"1: lwx %0, %3, r0;" \
" addic %1, r0, 0;" \
" bnei %1, 1b;" \
" cmp %1, %0, %4;" \
" bnei %1, 2f;" \
" swx %5, %3, r0;" \
" addic %1, r0, 0;" \
" bnei %1, 1b;" \
"2:" \
: "=&r" (__tmp), \
"=&r" (test), \
"=m" (*__memp) \
: "r" (__memp), \
"r" (oldval), \
"r" (newval) \
: "cc", "memory"); \
__tmp; \
})
#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
(abort (), (__typeof (*mem)) 0)
#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
({ \
__typeof (*(mem)) __result; \
if (sizeof (*mem) == 4) \
__result = __arch_compare_and_exchange_val_32_acq (mem, newval, oldval); \
else if (sizeof (*mem) == 8) \
__result = __arch_compare_and_exchange_val_64_acq (mem, newval, oldval); \
else \
abort (); \
__result; \
})
#define atomic_compare_and_exchange_val_rel(mem, newval, oldval) \
({ \
__typeof (*(mem)) __result; \
if (sizeof (*mem) == 4) \
__result = __arch_compare_and_exchange_val_32_acq (mem, newval, oldval); \
else if (sizeof (*mem) == 8) \
__result = __arch_compare_and_exchange_val_64_acq (mem, newval, oldval); \
else \
abort (); \
__result; \
})
#define __arch_atomic_exchange_32_acq(mem, value) \
({ \
__typeof (*(mem)) __tmp; \
__typeof (mem) __memp = (mem); \
int test; \
__asm __volatile ( \
" addc r0, r0, r0;" \
"1: lwx %0, %4, r0;" \
" addic %1, r0, 0;" \
" bnei %1, 1b;" \
" swx %3, %4, r0;" \
" addic %1, r0, 0;" \
" bnei %1, 1b;" \
: "=&r" (__tmp), \
"=&r" (test), \
"=m" (*__memp) \
: "r" (value), \
"r" (__memp) \
: "cc", "memory"); \
__tmp; \
})
#define __arch_atomic_exchange_64_acq(mem, newval) \
(abort (), (__typeof (*mem)) 0)
#define atomic_exchange_acq(mem, value) \
({ \
__typeof (*(mem)) __result; \
if (sizeof (*mem) == 4) \
__result = __arch_atomic_exchange_32_acq (mem, value); \
else if (sizeof (*mem) == 8) \
__result = __arch_atomic_exchange_64_acq (mem, value); \
else \
abort (); \
__result; \
})
#define atomic_exchange_rel(mem, value) \
({ \
__typeof (*(mem)) __result; \
if (sizeof (*mem) == 4) \
__result = __arch_atomic_exchange_32_acq (mem, value); \
else if (sizeof (*mem) == 8) \
__result = __arch_atomic_exchange_64_acq (mem, value); \
else \
abort (); \
__result; \
})
#define __arch_atomic_exchange_and_add_32(mem, value) \
({ \
__typeof (*(mem)) __tmp; \
__typeof (mem) __memp = (mem); \
int test; \
__asm __volatile ( \
" addc r0, r0, r0;" \
"1: lwx %0, %4, r0;" \
" addic %1, r0, 0;" \
" bnei %1, 1b;" \
" add %1, %3, %0;" \
" swx %1, %4, r0;" \
" addic %1, r0, 0;" \
" bnei %1, 1b;" \
: "=&r" (__tmp), \
"=&r" (test), \
"=m" (*__memp) \
: "r" (value), \
"r" (__memp) \
: "cc", "memory"); \
__tmp; \
})
#define __arch_atomic_exchange_and_add_64(mem, value) \
(abort (), (__typeof (*mem)) 0)
#define atomic_exchange_and_add(mem, value) \
({ \
__typeof (*(mem)) __result; \
if (sizeof (*mem) == 4) \
__result = __arch_atomic_exchange_and_add_32 (mem, value); \
else if (sizeof (*mem) == 8) \
__result = __arch_atomic_exchange_and_add_64 (mem, value); \
else \
abort (); \
__result; \
})
#define __arch_atomic_increment_val_32(mem) \
({ \
__typeof (*(mem)) __val; \
int test; \
__asm __volatile ( \
" addc r0, r0, r0;" \
"1: lwx %0, %3, r0;" \
" addic %1, r0, 0;" \
" bnei %1, 1b;" \
" addi %0, %0, 1;" \
" swx %0, %3, r0;" \
" addic %1, r0, 0;" \
" bnei %1, 1b;" \
: "=&r" (__val), \
"=&r" (test), \
"=m" (*mem) \
: "r" (mem), \
"m" (*mem) \
: "cc", "memory"); \
__val; \
})
#define __arch_atomic_increment_val_64(mem) \
(abort (), (__typeof (*mem)) 0)
#define atomic_increment_val(mem) \
({ \
__typeof (*(mem)) __result; \
if (sizeof (*(mem)) == 4) \
__result = __arch_atomic_increment_val_32 (mem); \
else if (sizeof (*(mem)) == 8) \
__result = __arch_atomic_increment_val_64 (mem); \
else \
abort (); \
__result; \
})
#define atomic_increment(mem) ({ atomic_increment_val (mem); (void) 0; })
#define __arch_atomic_decrement_val_32(mem) \
({ \
__typeof (*(mem)) __val; \
int test; \
__asm __volatile ( \
" addc r0, r0, r0;" \
"1: lwx %0, %3, r0;" \
" addic %1, r0, 0;" \
" bnei %1, 1b;" \
" rsubi %0, %0, 1;" \
" swx %0, %3, r0;" \
" addic %1, r0, 0;" \
" bnei %1, 1b;" \
: "=&r" (__val), \
"=&r" (test), \
"=m" (*mem) \
: "r" (mem), \
"m" (*mem) \
: "cc", "memory"); \
__val; \
})
#define __arch_atomic_decrement_val_64(mem) \
(abort (), (__typeof (*mem)) 0)
#define atomic_decrement_val(mem) \
({ \
__typeof (*(mem)) __result; \
if (sizeof (*(mem)) == 4) \
__result = __arch_atomic_decrement_val_32 (mem); \
else if (sizeof (*(mem)) == 8) \
__result = __arch_atomic_decrement_val_64 (mem); \
else \
abort (); \
__result; \
})
#define atomic_decrement(mem) ({ atomic_decrement_val (mem); (void) 0; })

View File

@ -0,0 +1,30 @@
/* Copyright (C) 1997-2013 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
/* MicroBlaze can be either big or little endian. */
#ifdef _BIG_ENDIAN
# define __BYTE_ORDER __BIG_ENDIAN
# define __FLOAT_WORD_ORDER __BIG_ENDIAN
#else
# define __BYTE_ORDER __LITTLE_ENDIAN
# define __FLOAT_WORD_ORDER __LITTLE_ENDIAN
#endif

View File

@ -0,0 +1,42 @@
/* Copyright (C) 2011-2013 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
/* MicroBlaze supports only round-to-nearest. The software
floating-point support also acts this way. */
enum
{
__FE_UNDEFINED = 0,
FE_TONEAREST =
#define FE_TONEAREST 0x1
FE_TONEAREST,
};
#define FE_ALL_EXCEPT 0
/* Type representing exception flags (if there were any). */
typedef unsigned int fexcept_t;
/* Type representing floating-point environment. */
typedef unsigned int fenv_t;
/* If the default argument is used we use this value. */
#define FE_DFL_ENV ((const fenv_t *) -1l)

View File

@ -0,0 +1,57 @@
/* Copyright (C) 2005-2013 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 Microblaze. */
typedef struct La_microblaze_regs
{
uint32_t lr_r0;
uint32_t lr_r1;
uint32_t lr_sp;
} La_microblaze_regs;
/* Return values for calls from PLT on Microblaze. */
typedef struct La_microblaze_retval
{
uint32_t lrv_r3;
} La_microblaze_retval;
__BEGIN_DECLS
extern Elf32_Addr la_microblaze_gnu_pltenter (Elf32_Sym *__sym,
unsigned int __ndx,
uintptr_t *__refcook,
uintptr_t *__defcook,
La_microblaze_regs *__regs,
unsigned int *__flags,
const char *__symname,
long int *__framesizep);
extern unsigned int la_microblaze_gnu_pltexit (Elf32_Sym *__sym,
unsigned int __ndx,
uintptr_t *__refcook,
uintptr_t *__defcook,
const La_microblaze_regs *__inregs,
La_microblaze_retval *__outregs,
const char *__symname);
__END_DECLS

View File

@ -0,0 +1,37 @@
/* Copyright (C) 1997-2013 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 the machine-dependent type `jmp_buf'. */
#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
typedef struct
{
/* There are 21 4-byte registers that should be saved:
r1, r2, r13-r31. Actually, there seems no need to save
r14, r16, r17, r18 (return addresses for interrupt/exception/trap). */
int *__sp; /* dedicated name for r1. */
long int __gregs[20];
} __jmp_buf[1];
#endif

View File

@ -0,0 +1,22 @@
/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.
Copyright (C) 1997-2013 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 setjmp_name _setjmp
#define SAVEMASK 0
#include <setjmp.S>

View File

@ -0,0 +1,22 @@
/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.
Copyright (C) 1995-2013 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 setjmp_name setjmp
#define SAVEMASK 1
#include <setjmp.S>

View File

@ -0,0 +1,88 @@
/* Special .init and .fini section support for MicroBlaze.
Copyright (C) 2012-2013 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>
#include <sysdep.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
.section .init,"ax",@progbits
.align 2
.globl _init
.type _init, @function
_init:
addik r1,r1,-32
swi r20,r1,28
mfs r20,rpc
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
lwi r3,r20,PREINIT_FUNCTION@GOT
#if PREINIT_FUNCTION_WEAK
beqid r3,$Lno_weak_fn:
swi r15,r1,0
brlid r15,PREINIT_FUNCTION@PLT
$Lno_weak_fn:
#else
swi r15,r1,0
brald r15,r3
#endif
nop # Unfilled delay slot
.section .fini,"ax",@progbits
.align 2
.globl _fini
.type _fini, @function
_fini:
addik r1,r1,-32
swi r20,r1,28
swi r15,r1,0
mfs r20,rpc
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8

View File

@ -0,0 +1,51 @@
/* Special .init and .fini section support for MicroBlaze.
Copyright (C) 1995-2013 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. */
#include <sysdep.h>
.section .init,"ax",@progbits
lwi r15,r1,0
lwi r20,r1,28
rtsd r15,8
addik r1,r1,32
.section .fini,"ax",@progbits
lwi r15,r1,0
lwi r20,r1,28
rtsd r15,8
addik r1,r1,32

View File

@ -0,0 +1,299 @@
/* Copyright (C) 1995-2013 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 "microblaze"
#include <sys/param.h>
#include <tls.h>
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int
elf_machine_matches_host (const Elf32_Ehdr *ehdr)
{
return (ehdr->e_machine == EM_MICROBLAZE);
}
/* Return the link-time address of _DYNAMIC. Conveniently, this is the
first element of the GOT. This must be inlined in a function which
uses global data. */
static inline Elf32_Addr
elf_machine_dynamic (void)
{
/* This produces a GOTOFF reloc that resolves to zero at link time, so in
fact just loads from the GOT register directly. By doing it without
an asm we can let the compiler choose any register. */
Elf32_Addr got_entry_0;
__asm__ __volatile__(
"lwi %0,r20,0"
:"=r"(got_entry_0)
);
return got_entry_0;
}
/* Return the run-time load address of the shared object. */
static inline Elf32_Addr
elf_machine_load_address (void)
{
/* Compute the difference between the runtime address of _DYNAMIC as seen
by a GOTOFF reference, and the link-time address found in the special
unrelocated first GOT entry. */
Elf32_Addr dyn;
__asm__ __volatile__ (
"addik %0,r20,_DYNAMIC@GOTOFF"
: "=r"(dyn)
);
return dyn - elf_machine_dynamic ();
}
/* 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__ ((always_inline))
elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
{
extern void _dl_runtime_resolve (Elf32_Word);
extern void _dl_runtime_profile (Elf32_Word);
return lazy;
}
/* The PLT uses Elf32_Rela relocs. */
#define elf_machine_relplt elf_machine_rela
/* Mask identifying addresses reserved for the user program,
where the dynamic linker should not map anything. */
#define ELF_MACHINE_USER_ADDRESS_MASK 0x80000000UL
/* Initial entry point code 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\
_start:\n\
addk r5,r0,r1\n\
addk r3,r0,r0\n\
1:\n\
addik r5,r5,4\n\
lw r4,r5,r0\n\
bneid r4,1b\n\
addik r3,r3,1\n\
addik r3,r3,-1\n\
addk r5,r0,r1\n\
sw r3,r5,r0\n\
addik r1,r1,-24\n\
sw r15,r1,r0\n\
brlid r15,_dl_start\n\
nop\n\
/* FALLTHRU. */\n\
\n\
.globl _dl_start_user\n\
.type _dl_start_user,@function\n\
_dl_start_user:\n\
mfs r20,rpc\n\
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8\n\
lwi r4,r20,_dl_skip_args@GOTOFF\n\
lwi r5,r1,24\n\
rsubk r5,r4,r5\n\
addk r4,r4,r4\n\
addk r4,r4,r4\n\
addk r1,r1,r4\n\
swi r5,r1,24\n\
swi r3,r1,20\n\
addk r6,r5,r0\n\
addk r5,r5,r5\n\
addk r5,r5,r5\n\
addik r7,r1,28\n\
addk r8,r7,r5\n\
addik r8,r8,4\n\
lwi r5,r20,_rtld_local@GOTOFF\n\
brlid r15,_dl_init_internal\n\
nop\n\
lwi r5,r1,24\n\
lwi r3,r1,20\n\
addk r4,r5,r5\n\
addk r4,r4,r4\n\
addik r6,r1,28\n\
addk r7,r6,r4\n\
addik r7,r7,4\n\
addik r15,r20,_dl_fini@GOTOFF\n\
addik r15,r15,-8\n\
brad r3\n\
addik r1,r1,24\n\
nop\n\
.size _dl_start_user, . - _dl_start_user\n\
.previous");
/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or
TLS variable, so undefined references should not be allowed to
define the value.
ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
of the main executable's symbols, as for a COPY reloc. */
#ifndef RTLD_BOOTSTRAP
# define elf_machine_type_class(type) \
(((type) == R_MICROBLAZE_JUMP_SLOT || \
(type) == R_MICROBLAZE_TLSDTPREL32 || \
(type) == R_MICROBLAZE_TLSDTPMOD32 || \
(type) == R_MICROBLAZE_TLSTPREL32) \
* ELF_RTYPE_CLASS_PLT \
| ((type) == R_MICROBLAZE_COPY) * ELF_RTYPE_CLASS_COPY)
#else
# define elf_machine_type_class(type) \
(((type) == R_MICROBLAZE_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT \
| ((type) == R_MICROBLAZE_COPY) * ELF_RTYPE_CLASS_COPY)
#endif
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_MICROBLAZE_JUMP_SLOT
/* The microblaze never uses Elf32_Rel relocations. */
#define ELF_MACHINE_NO_REL 1
static inline Elf32_Addr
elf_machine_fixup_plt (struct link_map *map, lookup_t t,
const Elf32_Rela *reloc,
Elf32_Addr *reloc_addr, Elf32_Addr value)
{
return *reloc_addr = value;
}
/* Return the final value of a plt relocation. Ignore the addend. */
static inline Elf32_Addr
elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
Elf32_Addr value)
{
return value;
}
#endif /* !dl_machine_h. */
/* Names of the architecture-specific auditing callback functions. */
#define ARCH_LA_PLTENTER microblaze_gnu_pltenter
#define ARCH_LA_PLTEXIT microblaze_gnu_pltexit
#ifdef RESOLVE_MAP
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
MAP is the object containing the reloc. */
/* Macro to put 32-bit relocation value into 2 words. */
#define PUT_REL_64(rel_addr,val) \
do { \
((unsigned short *)(rel_addr))[1] = (val) >> 16; \
((unsigned short *)(rel_addr))[3] = (val) & 0xffff; \
} while (0)
auto inline void __attribute__ ((always_inline))
elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
const Elf32_Sym *sym, const struct r_found_version *version,
void *const reloc_addr_arg, int skip_ifunc)
{
Elf32_Addr *const reloc_addr = reloc_addr_arg;
const int r_type = ELF32_R_TYPE (reloc->r_info);
if (__builtin_expect (r_type == R_MICROBLAZE_64_PCREL, 0))
PUT_REL_64 (reloc_addr, map->l_addr + reloc->r_addend);
else if (r_type == R_MICROBLAZE_REL)
*reloc_addr = map->l_addr + reloc->r_addend;
else
{
const Elf32_Sym *const refsym = sym;
struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
value += reloc->r_addend;
if (r_type == R_MICROBLAZE_GLOB_DAT ||
r_type == R_MICROBLAZE_JUMP_SLOT ||
r_type == R_MICROBLAZE_32)
{
*reloc_addr = value;
}
else if (r_type == R_MICROBLAZE_COPY)
{
if (sym != NULL && (sym->st_size > refsym->st_size
|| (sym->st_size < refsym->st_size && GLRO (dl_verbose))) )
{
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));
}
else if (r_type == R_MICROBLAZE_NONE)
{
}
#if !defined RTLD_BOOTSTRAP
else if (r_type == R_MICROBLAZE_TLSDTPMOD32)
{
if (sym_map != NULL)
*reloc_addr = sym_map->l_tls_modid;
}
else if (r_type == R_MICROBLAZE_TLSDTPREL32)
{
if (sym != NULL)
*reloc_addr = sym->st_value + reloc->r_addend;
}
else if (r_type == R_MICROBLAZE_TLSTPREL32)
{
if (sym != NULL)
{
CHECK_STATIC_TLS (map, sym_map);
*reloc_addr = sym->st_value + sym_map->l_tls_offset + reloc->r_addend;
}
}
#endif
else
{
_dl_reloc_bad_type (map, r_type, 0);
}
}
}
auto inline void
elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
void *const reloc_addr_arg)
{
Elf32_Addr *const reloc_addr = reloc_addr_arg;
PUT_REL_64 (reloc_addr, l_addr + reloc->r_addend);
}
auto inline void
elf_machine_lazy_rel (struct link_map *map,
Elf32_Addr l_addr, const Elf32_Rela *reloc,
int skip_ifunc)
{
Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
if (ELF32_R_TYPE (reloc->r_info) == R_MICROBLAZE_JUMP_SLOT)
*reloc_addr += l_addr;
else
_dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1);
}
#endif /* RESOLVE_MAP. */

View File

@ -0,0 +1,29 @@
/* Copyright (C) 2005-2013 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,109 @@
/* Copyright (C) 2005-2013 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>
#ifndef PROF
.text
.globl _dl_runtime_resolve
.type _dl_runtime_resolve, @function
.align 4
_dl_runtime_resolve:
addik r1,r1,-40
swi r5,r1,12
swi r6,r1,16
swi r7,r1,20
swi r8,r1,24
swi r9,r1,28
swi r10,r1,32
swi r15,r1,0
addk r5,r0,r4
brlid r15, _dl_fixup
addk r6,r0,r3; /* delay slot. */
lwi r10,r1,32
lwi r9,r1,28
lwi r8,r1,24
lwi r7,r1,20
lwi r6,r1,16
lwi r5,r1,12
lwi r15,r1,0
brad r3
addik r1,r1,40; /* delay slot. */
.size _dl_runtime_resolve, . - _dl_runtime_resolve
.text
.globl _dl_runtime_profile
.type _dl_runtime_profile, @function
.align 4
_dl_runtime_profile:
addik r1,r1,-40
swi r5,r1,12
swi r6,r1,16
swi r7,r1,20
swi r8,r1,24
swi r9,r1,28
swi r10,r1,32
swi r15,r1,0
addk r5,r0,r4
brlid r15, _dl_profile_fixup
addk r6,r0,r3; /* delay slot. */
lwi r10,r1,32
lwi r9,r1,28
lwi r8,r1,24
lwi r7,r1,20
lwi r6,r1,16
lwi r5,r1,12
lwi r15,r1,0
brad r3
addik r1,r1,40; /* delay slot. */
.size _dl_runtime_profile, . - _dl_runtime_profile
#else
.text
.globl _dl_runtime_resolve
.type _dl_runtime_resolve, @function
.align 4
_dl_runtime_resolve:
addik r1,r1,-40
swi r5,r1,12
swi r6,r1,16
swi r7,r1,20
swi r8,r1,24
swi r9,r1,28
swi r10,r1,32
swi r15,r1,0
addk r5,r0,r4
brlid r15, fixup
addk r6,r0,r3; /* delay slot. */
lwi r10,r1,32
lwi r9,r1,28
lwi r8,r1,24
lwi r7,r1,20
lwi r6,r1,16
lwi r5,r1,12
lwi r15,r1,0
brad r3
addik r1,r1,40; /* delay slot. */
.size _dl_runtime_resolve, . - _dl_runtime_resolve
.globl _dl_runtime_profile
.set _dl_runtime_profile, _dl_runtime_resolve
#endif

View File

@ -0,0 +1,24 @@
/* Copyright (C) 2011-2013 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>
int
fegetround (void)
{
return FE_TONEAREST;
}

View File

@ -0,0 +1,25 @@
/* Copyright (C) 2011-2013 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>
int
fesetround (int round)
{
return (round == FE_TONEAREST) ? 0 : 1;
}
libm_hidden_def (fesetround)

View File

@ -0,0 +1,21 @@
/* Copyright (C) 2005-2013 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 FIRST_PSEUDO_REGISTER 78
#include <sysdeps/generic/gccframe.h>

View File

@ -0,0 +1,46 @@
/* Copyright (C) 2005-2013 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 <stdint.h>
#include <unwind.h>
#include <sysdep.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)[0].__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 regs)
{
uintptr_t sp = regs[0].__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,45 @@
/* Copyright (C) 2005-2013 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 _MICROBLAZE_LDSODEFS_H
#define _MICROBLAZE_LDSODEFS_H 1
#include <elf.h>
struct La_microblaze_regs;
struct La_microblaze_retval;
#define ARCH_PLTENTER_MEMBERS \
Elf32_Addr (*microblaze_gnu_pltenter) (Elf32_Sym *, unsigned int, \
uintptr_t *, \
uintptr_t *, \
struct La_microblaze_regs *, \
unsigned int *, const char *name, \
long int *framesizep);
#define ARCH_PLTEXIT_MEMBERS \
unsigned int (*microblaze_gnu_pltexit) (Elf32_Sym *, unsigned int, \
uintptr_t *, \
uintptr_t *, \
const struct La_microblaze_regs *, \
struct La_microblaze_retval *, \
const char *);
#include_next <ldsodefs.h>
#endif

View File

@ -0,0 +1,32 @@
/* Copyright (C) 2005-2013 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 Microblaze, 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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
/* Copyright (C) 2011-2013 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/>. */
/* We need a special version of the `mcount' function because it has
to preserve more registers than your usual function. */
void __mcount_internal (unsigned long frompc, unsigned long selfpc);
#define _MCOUNT_DECL(frompc, selfpc) \
void __mcount_internal (unsigned long frompc, unsigned long selfpc)
/* Define MCOUNT as empty since we have the implementation in another
file. */
#define MCOUNT

View File

@ -0,0 +1,33 @@
#ifndef _MATH_PRIVATE_H
/* Suppress use of exceptions here to avoid build errors if the FE_*
macros aren't definied. Only allow rounding modes implemented for
MicroBlaze.
This does mean that some code will silently fail to report exceptions,
set rounding mode as expected, etc., but it allows math code to compile
that otherwise wouldn't (such as math/s_fma.c) and so is valuable.
We intentionally ignore the "exception" arguments of functions that
take an exception, since we can't even evaluate the argument
without causing a build failure. The extra level of statement
expression wrapping avoids "statement with no effect" warnings.
Since the callers don't check for errors anyway, we just claim
success in every case.
The overrides for libc_ functions must happen before we include
the generic math_private.h, and the overrides for regular
<fenv.h> functions must happen afterwards, to avoid clashing with
the declarations of those functions. */
#define libc_fesetround(rnd) ({ 0; })
#define libc_fetestexcept(exc) ({ 0; })
#define libc_feholdexcept_setround(env, exc) ({ (void) (env); 0; })
#define libc_feupdateenv_test(env, exc) ({ (void) (env); 0; })
#include_next <math_private.h>
#define feraiseexcept(excepts) ({ 0; })
#define feclearexcept(exc) ({ 0; })
#endif

View File

@ -0,0 +1,21 @@
/* Copyright (C) 2000-2013 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 ("r1"); stack_ptr; })
#include <sysdeps/generic/memusage.h>

View File

@ -0,0 +1,21 @@
# Copyright (C) 2005-2013 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-2013 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,40 @@
/* Copyright (C) 2002-2013 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 <stdlib.h>
#include <string.h>
/* 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,11 @@
#include <sysdep.h>
#include <tls.h>
--
-- Abuse tls.h macros to derive offsets relative to the thread register.
#define thread_offsetof(mem) (long)(offsetof (struct pthread, mem) - sizeof (struct pthread))
MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
PID_OFFSET thread_offsetof (pid)
TID_OFFSET thread_offsetof (tid)

View File

@ -0,0 +1,155 @@
/* Copyright (C) 2005-2013 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;
static inline void *__microblaze_get_thread_area (void)
{
register void * volatile __microblaze_thread_area asm ("r21");
return (void *) __microblaze_thread_area;
}
# define READ_THREAD_POINTER() \
({ __microblaze_get_thread_area(); })
/* 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__ (struct pthread)
/* 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.
r21 is reserved for thread pointer. */
# define TLS_INIT_TP(tcbp, secondcall) \
({ __asm __volatile ("or r21,r0,%0" : : "r" ((void *)tcbp)); 0; })
/* Return the address of the dtv for the current thread. */
# define THREAD_DTV() \
(((tcbhead_t *) READ_THREAD_POINTER())->dtv)
/* Return the thread descriptor for the current thread. */
# define THREAD_SELF \
(((struct pthread *) READ_THREAD_POINTER()) - 1)
/* Magic for libthread_db to know how to do THREAD_SELF. */
# define DB_THREAD_SELF \
CONST_THREAD_AREA (32, sizeof (struct pthread))
/* Read member of the thread descriptor directly. */
# define THREAD_GETMEM(descr, member) (descr->member)
/* Same as THREAD_GETMEM, but the member offset can be non-constant. */
# define THREAD_GETMEM_NC(descr, member, idx) \
(descr->member[idx])
/* Set member of the thread descriptor directly. */
# define THREAD_SETMEM(descr, member, value) \
(descr->member = (value))
/* Same as THREAD_SETMEM, but the member offset can be non-constant. */
# 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,3 @@
case "$machine" in
microblaze*) base_machine=microblaze machine=microblaze ;;
esac

View File

@ -0,0 +1,75 @@
/* Copyright (C) 1997-2013 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>
/* This source produces 3 functions:
__sigsetjmp (jmpbuf,savemask)
setjmp (jmpbuf) - equivalent to __sigsetjump (jmpbuf, 1)
_setjmp (jmpbuf) - equivalent to __sigsetjump (jmpbuf, 0)
*/
#ifndef setjmp_name
# define setjmp_name __sigsetjmp
# define SET_MASK_ARG
#else
# define SET_MASK_ARG addik r6,r0,SAVEMASK
#endif
ENTRY (setjmp_name)
swi r1,r5,0
swi r2,r5,4
swi r13,r5,8
swi r14,r5,12
swi r15,r5,16
swi r16,r5,20
swi r17,r5,24
swi r18,r5,28
swi r19,r5,32
swi r20,r5,36
swi r21,r5,40
swi r22,r5,44
swi r23,r5,48
swi r24,r5,52
swi r25,r5,56
swi r26,r5,60
swi r27,r5,64
swi r28,r5,68
swi r29,r5,72
swi r30,r5,76
swi r31,r5,80
SET_MASK_ARG
/* Make a tail call to __sigjmp_save; it takes the same args. */
#ifdef PIC
/* We cannot use the PLT, because it requires that r20 be set, but
we can't save and restore our caller's value. Instead, we do an
indirect jump through the GOT, using the temporary register
%ecx, which is call-clobbered. */
mfs r12,rpc
addik r12,r12,_GLOBAL_OFFSET_TABLE_+8
lwi r12,r12,__sigjmp_save@GOT
brad r12
#else
brid __sigjmp_save
#endif
nop
END (setjmp_name)
libc_hidden_def (setjmp_name)

View File

@ -0,0 +1 @@
microblaze.*-.*-linux.* DEFAULT GLIBC_2.18

View File

@ -0,0 +1,52 @@
/* Override generic sotruss-lib.c to define actual functions for MicroBlaze.
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_microblaze_gnu_pltenter (ElfW(Sym) *sym __attribute__ ((unused)),
unsigned int ndx __attribute__ ((unused)),
uintptr_t *refcook, uintptr_t *defcook,
La_microblaze_regs *regs, unsigned int *flags,
const char *symname, long int *framesizep)
{
print_enter (refcook, defcook, symname,
regs->lr_r0, regs->lr_r1, regs->lr_sp,
*flags);
/* No need to copy anything, we will not need the parameters in any case. */
*framesizep = 0;
return sym->st_value;
}
unsigned int
la_microblaze_gnu_pltexit (ElfW(Sym) *sym, unsigned int ndx,
uintptr_t *refcook,
uintptr_t *defcook,
const struct La_microblaze_regs *inregs,
struct La_microblaze_retval *outregs,
const char *symname)
{
print_exit (refcook, defcook, symname, outregs->lrv_r3);
return 0;
}

View File

@ -0,0 +1,34 @@
/* 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 MicroBlaze the stack grows down. */
# define _STACK_GROWS_DOWN 1
/* Default to an executable stack. PF_X can be overridden if PT_GNU_STACK is
* present, but it is presumed absent. */
# define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)
#endif /* stackinfo.h. */

View File

@ -0,0 +1,84 @@
/* 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/>. */
.text
.globl _start
.type _start,@function
_start:
/* On entry the stack contains the following args:
r1+0 - argc
r1+4 - argv[0]
...
r1+4*(argc-1) - argv[argc-1]
r1+4*argc - NULL
r1+4*argc + 4 - envp[0]
...
NULL
*/
addk r3,r0,r0
addk r5,r1,r0
1:
addik r5,r5,4
lw r4,r5,r0
bneid r4,1b
addik r3,r3,1
addik r6,r3,-1
sw r6,r1,r0
addik r7,r1,4
addik r1,r1,-24
#ifdef SHARED
/* Setup PIC. */
mfs r20,rpc
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
lwi r5,r20,main@GOT
lwi r8,r20,__libc_csu_init@GOT
lwi r9,r20,__libc_csu_fini@GOT
brid __libc_start_main@PLT
addk r10,r0,r0
#else
addik r5,r0,main
addik r8,r0,__libc_csu_init
addik r9,r0,__libc_csu_fini
brid __libc_start_main
addk r10,r0,r0
#endif
/* 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,85 @@
/* 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 ALIGNARG(log2) log2
# 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 ALIGNARG(2); \
C_LABEL(name) \
CALL_MCOUNT
# undef END
# define END(name) ASM_SIZE_DIRECTIVE(name)
/* If compiled for profiling, call `_mcount' at the start of each function. */
# ifdef PROF
/* The mcount code relies on a normal frame pointer being on the stack
to locate our caller, so push one just for its benefit. */
# define CALL_MCOUNT \
addik r1,r1,-4; \
swi r15,r1,0; \
brlid r15,JUMPTARGET(mcount); \
nop; \
lwi r15,r1,0; \
addik r1,r1,4;
# else
# define CALL_MCOUNT /* Do nothing. */
# 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
# define PSEUDO(name, syscall_name, args) \
.globl syscall_error; \
ENTRY (name) \
DO_CALL (syscall_name, args);
# define ret \
rtsd r15,8; nop;
# undef PSEUDO_END
# define PSEUDO_END(name) \
END (name)
# undef JUMPTARGET
# ifdef PIC
# define JUMPTARGET(name) name##@PLTPC
# else
# define JUMPTARGET(name) name
# endif
/* Local label name for asm code. */
# ifndef L
# define L(name) $L##name
# endif
# endif /* __ASSEMBLER__ */

View File

@ -0,0 +1,46 @@
/* 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) \
({ \
char *__result; \
int __offset; \
extern void *__tls_get_addr (void *); \
asm ("mfs r20,rpc \n" \
"addik r20,r20,_GLOBAL_OFFSET_TABLE_+8\n" \
"addik %0,r20," #x "@TLSLDM" \
: "=r" (__result)); \
__result = (char *) __tls_get_addr (__result); \
asm ("addik %0,r0,"#x"@TLSDTPREL" \
: "=r" (__offset)); \
(int *) (__result + __offset); })
#define TLS_GD(x) \
({ \
int *__result; \
extern void *__tls_get_addr (void *); \
asm ("mfs r20,rpc\n" \
"addik r20,r20,_GLOBAL_OFFSET_TABLE_+8\n" \
"addik %0,r20," #x "@TLSGD" \
: "=r" (__result)); \
(int *) __tls_get_addr (__result); })
#define TLS_LE(x) TLS_LD(x)
#define TLS_IE(x) TLS_GD(x)

View File

@ -0,0 +1,25 @@
/* Definitions for testing PLT entry/exit auditing. MicroBlaze 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/>. */
#define pltenter la_microblaze_gnu_pltenter
#define pltexit la_microblaze_gnu_pltexit
#define La_regs La_microblaze_regs
#define La_retval La_microblaze_retval
#define int_retval lrv_r3

View File

@ -0,0 +1,3 @@
ifeq ($(subdir),resource)
sysdep_routines += backtrace_linux
endif

View File

@ -0,0 +1,5 @@
libc {
GLIBC_2.18 {
fallocate64;
}
}

View File

@ -0,0 +1,29 @@
/* Copyright (C) 1997-2013 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 (__revisit_longjmp_chk)
rtsd r15,0
nop
PSEUDO_END (__revisit_longjmp_chk)
ENTRY (____longjmp_chk)
rtsd r15,0
nop
PSEUDO_END (____longjmp_chk)

View File

@ -0,0 +1,86 @@
/* O_*, F_*, FD_* bit values for Linux.
Copyright (C) 1995-2013 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_CREAT 00000100 /* not fcntl. */
#define O_TRUNC 00001000 /* not fcntl. */
#define O_EXCL 00000200 /* not fcntl. */
#define O_NOCTTY 00000400 /* not fcntl. */
#define O_NONBLOCK 00004000
#define O_APPEND 00002000
#define O_SYNC 04000000
#define __O_DIRECTORY 00200000 /* Must be a directory. */
#define __O_NOFOLLOW 00400000 /* Do not follow links. */
#define __O_CLOEXEC 02000000 /* Set close_on_exec. */
#define __O_DIRECT 00040000 /* Direct disk access. */
#define __O_NOATIME 01000000 /* Do not set atime. */
#define __O_PATH 010000000 /* Resolve pathname but do not open file. */
/* Not necessary, files are always with 64bit off_t. */
#define __O_LARGEFILE 00100000
#define __O_DSYNC 00010000 /* Synchronize data. */
#define F_GETLK 5 /* Get record locking info. */
#define F_SETLK 6 /* Set record locking info (non-blocking). */
#define F_SETLKW 7 /* Set record locking info (blocking). */
#define F_GETLK64 12 /* Get record locking info. */
#define F_SETLK64 13 /* Set record locking info (non-blocking). */
#define F_SETLKW64 14 /* Set record locking info (blocking). */
#define __F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
#define __F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
#define F_RDLCK 0 /* Read lock. */
#define F_WRLCK 1 /* Write lock. */
#define F_UNLCK 2 /* Remove lock. */
/* for old implementation of bsd flock (). */
#define F_EXLCK 4 /* or 3. */
#define F_SHLCK 8 /* or 4. */
/* We don't need to support __USE_FILE_OFFSET64. */
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,42 @@
/* Definitions for POSIX memory map interface. Linux/MicroBlaze version.
Copyright (C) 1997-2013 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. */
#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
/* Include generic Linux declarations. */
#include <bits/mman-linux.h>

View File

@ -0,0 +1,203 @@
/* Copyright (C) 1997-2013 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 _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
#ifndef _BITS_STAT_H
#define _BITS_STAT_H 1
/* Versions of the `struct stat' data structure. */
#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_KERNEL 1
#define _STAT_VER_SVR4 2
#define _STAT_VER_LINUX 3
#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
/* Versions of the `xmknod' interface. */
#define _MKNOD_VER_LINUX 1
#define _MKNOD_VER_SVR4 2
#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
#ifndef __USE_FILE_OFFSET64
struct stat
{
__dev_t st_dev; /* Device. */
__ino_t st_ino; /* File serial number. */
__mode_t st_mode; /* File mode. */
__nlink_t st_nlink; /* Link count. */
__uid_t st_uid; /* User ID of the file's owner. */
__gid_t st_gid; /* Group ID of the file's group. */
__dev_t st_rdev; /* Device number, if device. */
unsigned long __pad2;
__off_t st_size; /* Size of file, in bytes. */
__blksize_t st_blksize; /* Optimal block size for I/O. */
int __pad3;
__blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
#ifdef __USE_MISC
/* Nanosecond resolution timestamps are stored in a format
* equivalent to 'struct timespec'. This is the type used
* whenever possible but the Unix namespace rules do not allow the
* identifier 'timespec' to appear in the <sys/stat.h> header.
* Therefore we have to handle the use of this header in strictly
* standard-compliant sources special. */
struct timespec st_atim; /* Time of last access. */
struct timespec st_mtim; /* Time of last modification. */
struct timespec st_ctim; /* Time of last status change. */
# define st_atime st_atim.tv_sec /* Backward compatibility. */
# define st_mtime st_mtim.tv_sec
# define st_ctime st_ctim.tv_sec
#else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
#endif
unsigned int __unused4;
unsigned int __unused5;
};
#else /* __USE_FILE_OFFSET64 */
/* MS: If __USE_FILE_OFFSET64 is setup then struct stat should match stat64
* structure. Glibc has no type __dev64_t that's why I had to use standard
* type for st_dev and st_rdev. Several architectures uses pads after st_dev
* but this approach covers BIG and LITTLE endian. I think it is better to
* create one ifdef to separate stats structures. */
struct stat
{
unsigned long long st_dev; /* Device. */
__ino64_t st_ino; /* 32bit file serial number. */
__mode_t st_mode; /* File mode. */
__nlink_t st_nlink; /* Link count. */
__uid_t st_uid; /* User ID of the file's owner. */
__gid_t st_gid; /* Group ID of the file's group. */
unsigned long long st_rdev; /* Device number, if device. */
unsigned long long __pad2;
__off64_t st_size; /* Size of file, in bytes. */
__blksize_t st_blksize; /* Optimal block size for I/O. */
int __pad3;
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#ifdef __USE_MISC
/* Nanosecond resolution timestamps are stored in a format
* equivalent to 'struct timespec'. This is the type used
* whenever possible but the Unix namespace rules do not allow the
* identifier 'timespec' to appear in the <sys/stat.h> header.
* Therefore we have to handle the use of this header in strictly
* standard-compliant sources special. */
struct timespec st_atim; /* Time of last access. */
struct timespec st_mtim; /* Time of last modification. */
struct timespec st_ctim; /* Time of last status change. */
# define st_atime st_atim.tv_sec /* Backward compatibility. */
# define st_mtime st_mtim.tv_sec
# define st_ctime st_ctim.tv_sec
#else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
#endif
unsigned int __unused4;
unsigned int __unused5;
};
#endif /* __USE_FILE_OFFSET64 */
#ifdef __USE_LARGEFILE64
struct stat64
{
unsigned long long st_dev; /* Device. */
__ino64_t st_ino; /* 32bit file serial number. */
__mode_t st_mode; /* File mode. */
__nlink_t st_nlink; /* Link count. */
__uid_t st_uid; /* User ID of the file's owner. */
__gid_t st_gid; /* Group ID of the file's group. */
unsigned long long st_rdev; /* Device number, if device. */
unsigned long long __pad2;
__off64_t st_size; /* Size of file, in bytes. */
__blksize_t st_blksize; /* Optimal block size for I/O. */
int __pad3;
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#ifdef __USE_MISC
/* Nanosecond resolution timestamps are stored in a format
* equivalent to 'struct timespec'. This is the type used
* whenever possible but the Unix namespace rules do not allow the
* identifier 'timespec' to appear in the <sys/stat.h> header.
* Therefore we have to handle the use of this header in strictly
* standard-compliant sources special. */
struct timespec st_atim; /* Time of last access. */
struct timespec st_mtim; /* Time of last modification. */
struct timespec st_ctim; /* Time of last status change. */
# define st_atime st_atim.tv_sec /* Backward compatibility. */
# define st_mtime st_mtim.tv_sec
# define st_ctime st_ctim.tv_sec
#else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
#endif
unsigned int __unused4;
unsigned int __unused5;
};
#endif
/* Tell code we have these members. */
#define _STATBUF_ST_BLKSIZE
#define _STATBUF_ST_RDEV
/* Nanosecond resolution time values are supported. */
#define _STATBUF_ST_NSEC
/* Encoding of the file mode. */
#define __S_IFMT 0170000 /* These bits determine file type. */
/* File types. */
#define __S_IFDIR 0040000 /* Directory. */
#define __S_IFCHR 0020000 /* Character device. */
#define __S_IFBLK 0060000 /* Block device. */
#define __S_IFREG 0100000 /* Regular file. */
#define __S_IFIFO 0010000 /* FIFO. */
#define __S_IFLNK 0120000 /* Symbolic link. */
#define __S_IFSOCK 0140000 /* Socket. */
/* POSIX.1b objects. Note that these macros always evaluate to zero. But
they do it by enforcing the correct use of the macros. */
#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
/* Protection bits. */
#define __S_ISUID 04000 /* Set user ID on execution. */
#define __S_ISGID 02000 /* Set group ID on execution. */
#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
#define __S_IREAD 0400 /* Read by owner. */
#define __S_IWRITE 0200 /* Write by owner. */
#define __S_IEXEC 0100 /* Execute by owner. */
#ifdef __USE_ATFILE
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
#endif
#endif /* bits/stat.h. */

View File

@ -0,0 +1,44 @@
/* Copyright (C) 2011-2013 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 <unistd.h>
#include <sysdep.h>
/* This must be initialized data because commons can't have aliases. */
void *__curbrk = 0;
/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
to work around different old braindamage in the old Linux ELF dynamic
linker. */
weak_alias (__curbrk, ___brk_addr)
int
__brk (void *addr)
{
INTERNAL_SYSCALL_DECL (err);
__curbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
if (__curbrk < addr)
{
__set_errno (ENOMEM);
return -1;
}
return 0;
}
weak_alias (__brk, brk)

View File

@ -0,0 +1,72 @@
/* Copyright (C) 1996-2013 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>
/* int clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg,
pid_t *ptid, struct user_desc *tls, pid_t *ctid);
INCOMING: r5 (fn), r6 (child_stack), r7 (flags), r8 (arg), r9 (ptid)
r10 (tls), 28 (r1) ctid
OUTGOING:
linux: arch/microblaze/entry.S: sys_clone expects
r5 (flags) r6 (child stack) r7 (stack_size) r8 (ptid)r9 (ctid)
r10 (tls)
*/
.text
ENTRY (__clone)
addik r3,r0,-EINVAL
beqi r5,SYSCALL_ERROR_LABEL ; // Invalid func
beqi r6,SYSCALL_ERROR_LABEL ; // Invalid stack
addik r6,r6,-8
swi r5,r6,0 ; // Push fn onto child's stack
swi r8,r6,4 ; // Push arg for child
addk r5,r0,r7 ; // flags for clone() syscall
addk r7,r0,r0
addk r8,r0,r9 ; // parent tid ptr
lwi r9,r1,28 ; // child tid ptr
addik r12,r0,SYS_ify(clone)
brki r14,8
addk r0,r0,r0
addik r4,r0,-4095
cmpu r4,r4,r3
bgei r4,SYSCALL_ERROR_LABEL
beqi r3,L(thread_start)
rtsd r15,8
nop
L(thread_start):
lwi r12,r1,0 ; // fn
lwi r5,r1,4 ; // arg
brald r15,r12
nop
addk r5,r0,r3
addik r12,r0,SYS_ify(exit)
brki r14,8
nop
PSEUDO_END(__clone)
weak_alias (__clone,clone)

View File

@ -0,0 +1,4 @@
# This file is generated from configure.in by Autoconf. DO NOT EDIT!
# Local configure fragment for sysdeps/unix/sysv/linux/microblaze.
arch_minimum_kernel=2.6.30

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/microblaze.
arch_minimum_kernel=2.6.30

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/fcntl.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/fxstat.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>

View File

@ -0,0 +1,34 @@
/* Copyright (C) 1997-2013 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/>. */
/* We need to define a special parser for /proc/cpuinfo. */
#define GET_NPROCS_PARSER(FD, BUFFER, CP, RE, BUFFER_END, RESULT) \
do \
{ \
(RESULT) = 0; \
/* Read all lines and count the lines starting with the string \
"CPU-Family:". We don't have to fear extremely long lines since \
the kernel will not generate them. 8192 bytes are really enough. */ \
char *l; \
while ((l = next_line (FD, BUFFER, &CP, &RE, BUFFER_END)) != NULL) \
if (strncmp (l, "CPU-Family:", 11) == 0) \
++(RESULT); \
} \
while (0)
#include <sysdeps/unix/sysv/linux/getsysstats.c>

View File

@ -0,0 +1,30 @@
/* Copyright (C) 2011-2013 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/>. */
/* MicroBlaze glibc support starts with 2.6.30, guaranteeing many kernel features. */
#define __ASSUME_UTIMES 1
#define __ASSUME_O_CLOEXEC 1
#define __ASSUME_SOCK_CLOEXEC 1
#define __ASSUME_IN_NONBLOCK 1
#define __ASSUME_PIPE2 1
#define __ASSUME_EVENTFD2 1
#define __ASSUME_SIGNALFD4 1
#define __ASSUME_ACCEPT4 1
#define __ASSUME_DUP3 1
#include_next <kernel-features.h>

View File

@ -0,0 +1,49 @@
/* Definition of `struct stat' used in the kernel
Copyright (C) 2013 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 kernel_stat
{
unsigned long st_dev; /* Device. */
unsigned long st_ino; /* File serial number. */
unsigned int st_mode; /* File mode. */
unsigned int st_nlink; /* Link count. */
unsigned int st_uid; /* User ID of the file's owner. */
unsigned int st_gid; /* Group ID of the file's group. */
unsigned long st_rdev; /* Device number, if device. */
unsigned long __pad2;
#define _HAVE_STAT___PAD2
#define _HAVE_STAT64___PAD2
long st_size; /* Size of file, in bytes. */
int st_blksize; /* Optimal block size for I/O. */
int __pad3;
#define _HAVE_STAT___PAD3
#define _HAVE_STAT64___PAD3
long st_blocks; /* Number 512-byte blocks allocated. */
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
#define _HAVE_STAT_NSEC
#define _HAVE_STAT64_NSEC
unsigned int __unused4;
#define _HAVE_STAT___UNUSED4
#define _HAVE_STAT64___UNUSED4
unsigned int __unused5;
#define _HAVE_STAT___UNUSED5
#define _HAVE_STAT64___UNUSED5
};

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/lxstat.c>

View File

@ -0,0 +1,50 @@
/* Copyright (C) 2009-2013 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>
#define EINVAL 22
.text
ENTRY (__mmap)
addik r3,r0,-EINVAL
andi r4,r10,0xfff
bnei r4,L(skip)
addik r12,r0,SYS_ify(mmap2)
sra r10,r10
sra r10,r10
sra r10,r10
sra r10,r10
sra r10,r10
sra r10,r10
sra r10,r10
sra r10,r10
sra r10,r10
sra r10,r10
sra r10,r10
sra r10,r10 ; /* mmap2 takes the offset in pages. */
brki r14,8
nop
L(skip):
addik r4,r0,-4095
cmpu r4,r4,r3
bgei r4,SYSCALL_ERROR_LABEL
rtsd r15,8
nop
PSEUDO_END (__mmap)
weak_alias (__mmap, mmap)

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/alpha/msgctl.c>

View File

@ -0,0 +1,176 @@
/* Copyright (C) 2002-2013 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 36
# define __SIZEOF_PTHREAD_MUTEX_T 24
# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
# define __SIZEOF_PTHREAD_COND_T 48
# define __SIZEOF_PTHREAD_COND_COMPAT_T 12
# define __SIZEOF_PTHREAD_CONDATTR_T 4
# define __SIZEOF_PTHREAD_RWLOCK_T 32
# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
# define __SIZEOF_PTHREAD_BARRIER_T 20
# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
/* 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_t 1
# endif
typedef struct __pthread_internal_slist
{
struct __pthread_internal_slist *__next;
} __pthread_slist_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;
/* KIND must stay at this position in the structure to maintain
binary compatibility. */
int __kind;
unsigned int __nusers;
__extension__ union
{
int __spins;
__pthread_slist_t __list;
};
} __data;
char __size[__SIZEOF_PTHREAD_MUTEX_T];
long int __align;
} pthread_mutex_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
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];
__extension__ long 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;
# if __BYTE_ORDER == __BIG_ENDIAN
unsigned char __pad1;
unsigned char __pad2;
unsigned char __shared;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
unsigned char __flags;
# else
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
unsigned char __flags;
unsigned char __shared;
unsigned char __pad1;
unsigned char __pad2;
# endif
int __writer;
} __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,32 @@
/* Copyright (C) 2002-2013 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 16
/* 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:x
blkcnt_t:l
blksize_t:l
caddr_t:Pc
clockid_t:i
clock_t:l
daddr_t:i
dev_t:y
fd_mask:l
fsblkcnt64_t:y
fsblkcnt_t:m
fsfilcnt64_t:y
fsfilcnt_t:m
fsid_t:8__fsid_t
gid_t:j
id_t:j
ino64_t:y
ino_t:m
int16_t:s
int32_t:i
int64_t:x
int8_t:a
intptr_t:i
key_t:i
loff_t:x
mode_t:j
nlink_t:j
off64_t:x
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:x
register_t:i
rlim64_t:y
rlim_t:m
sigset_t:10__sigset_t
size_t:j
socklen_t:j
ssize_t:i
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:y
u_int8_t:h
ulong:m
u_long:m
u_quad_t:y
useconds_t:j
ushort:t
u_short:t

View File

@ -0,0 +1,23 @@
/* Copyright (C) 2005-2013 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 <nptl/sysdeps/pthread/createthread.c>

View File

@ -0,0 +1,29 @@
/* Copyright (C) 2005-2013 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, 0, \
NULL, NULL, &THREAD_SELF->tid)
#include <nptl/sysdeps/unix/sysv/linux/fork.c>

View File

@ -0,0 +1,12 @@
GLIBC_2.18
GLIBC_2.18 A
__libc_memalign F
__libc_stack_end D 0x4
__stack_chk_guard D 0x4
__tls_get_addr F
_dl_mcount F
_r_debug D 0x14
calloc F
free F
malloc F
realloc F

View File

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

View File

@ -0,0 +1,6 @@
GLIBC_2.18
GLIBC_2.18 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.18
GLIBC_2.18 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.18
GLIBC_2.18 A
dladdr F
dladdr1 F
dlclose F
dlerror F
dlinfo F
dlmopen F
dlopen F
dlsym F
dlvsym F

View File

@ -0,0 +1,370 @@
GLIBC_2.18
GLIBC_2.18 A
_LIB_VERSION D 0x4
__acos_finite F
__acosf_finite F
__acosh_finite F
__acoshf_finite F
__asin_finite F
__asinf_finite F
__atan2_finite F
__atan2f_finite F
__atanh_finite F
__atanhf_finite F
__clog10 F
__clog10f F
__clog10l F
__cosh_finite F
__coshf_finite F
__exp10_finite F
__exp10f_finite F
__exp2_finite F
__exp2f_finite F
__exp_finite F
__expf_finite F
__finite F
__finitef F
__finitel F
__fmod_finite F
__fmodf_finite F
__fpclassify F
__fpclassifyf F
__gamma_r_finite F
__gammaf_r_finite F
__hypot_finite F
__hypotf_finite F
__issignaling F
__issignalingf F
__j0_finite F
__j0f_finite F
__j1_finite F
__j1f_finite F
__jn_finite F
__jnf_finite F
__lgamma_r_finite F
__lgammaf_r_finite F
__log10_finite F
__log10f_finite F
__log2_finite F
__log2f_finite F
__log_finite F
__logf_finite F
__pow_finite F
__powf_finite F
__remainder_finite F
__remainderf_finite F
__scalb_finite F
__scalbf_finite F
__signbit F
__signbitf F
__sinh_finite F
__sinhf_finite F
__sqrt_finite F
__sqrtf_finite F
__y0_finite F
__y0f_finite F
__y1_finite F
__y1f_finite F
__yn_finite F
__ynf_finite F
acos F
acosf F
acosh F
acoshf F
acoshl F
acosl F
asin F
asinf F
asinh F
asinhf F
asinhl F
asinl F
atan F
atan2 F
atan2f F
atan2l F
atanf F
atanh F
atanhf F
atanhl F
atanl F
cabs F
cabsf F
cabsl F
cacos F
cacosf F
cacosh F
cacoshf F
cacoshl F
cacosl F
carg F
cargf F
cargl F
casin F
casinf F
casinh F
casinhf F
casinhl F
casinl F
catan F
catanf F
catanh F
catanhf F
catanhl F
catanl F
cbrt F
cbrtf F
cbrtl F
ccos F
ccosf F
ccosh F
ccoshf F
ccoshl F
ccosl F
ceil F
ceilf F
ceill F
cexp F
cexpf F
cexpl F
cimag F
cimagf F
cimagl F
clog F
clog10 F
clog10f F
clog10l F
clogf F
clogl F
conj F
conjf F
conjl F
copysign F
copysignf F
copysignl F
cos F
cosf F
cosh F
coshf F
coshl F
cosl F
cpow F
cpowf F
cpowl F
cproj F
cprojf F
cprojl F
creal F
crealf F
creall F
csin F
csinf F
csinh F
csinhf F
csinhl F
csinl F
csqrt F
csqrtf F
csqrtl F
ctan F
ctanf F
ctanh F
ctanhf F
ctanhl F
ctanl F
drem F
dremf F
dreml F
erf F
erfc F
erfcf F
erfcl F
erff F
erfl F
exp F
exp10 F
exp10f F
exp10l F
exp2 F
exp2f F
exp2l F
expf F
expl F
expm1 F
expm1f F
expm1l F
fabs F
fabsf F
fabsl F
fdim F
fdimf F
fdiml F
feclearexcept F
fedisableexcept F
feenableexcept F
fegetenv F
fegetexcept F
fegetexceptflag F
fegetround F
feholdexcept F
feraiseexcept F
fesetenv F
fesetexceptflag F
fesetround F
fetestexcept F
feupdateenv F
finite F
finitef F
finitel F
floor F
floorf F
floorl F
fma F
fmaf F
fmal F
fmax F
fmaxf F
fmaxl F
fmin F
fminf F
fminl F
fmod F
fmodf F
fmodl F
frexp F
frexpf F
frexpl F
gamma F
gammaf F
gammal F
hypot F
hypotf F
hypotl F
ilogb F
ilogbf F
ilogbl F
j0 F
j0f F
j0l F
j1 F
j1f F
j1l F
jn F
jnf F
jnl F
ldexp F
ldexpf F
ldexpl F
lgamma F
lgamma_r F
lgammaf F
lgammaf_r F
lgammal F
lgammal_r F
llrint F
llrintf F
llrintl F
llround F
llroundf F
llroundl F
log F
log10 F
log10f F
log10l F
log1p F
log1pf F
log1pl F
log2 F
log2f F
log2l F
logb F
logbf F
logbl F
logf F
logl F
lrint F
lrintf F
lrintl F
lround F
lroundf F
lroundl F
matherr F
modf F
modff F
modfl F
nan F
nanf F
nanl F
nearbyint F
nearbyintf F
nearbyintl F
nextafter F
nextafterf F
nextafterl F
nexttoward F
nexttowardf F
nexttowardl F
pow F
pow10 F
pow10f F
pow10l F
powf F
powl F
remainder F
remainderf F
remainderl F
remquo F
remquof F
remquol F
rint F
rintf F
rintl F
round F
roundf F
roundl F
scalb F
scalbf F
scalbl F
scalbln F
scalblnf F
scalblnl F
scalbn F
scalbnf F
scalbnl F
signgam D 0x4
significand F
significandf F
significandl F
sin F
sincos F
sincosf F
sincosl F
sinf F
sinh F
sinhf F
sinhl F
sinl F
sqrt F
sqrtf F
sqrtl F
tan F
tanf F
tanh F
tanhf F
tanhl F
tanl F
tgamma F
tgammaf F
tgammal F
trunc F
truncf F
truncl F
y0 F
y0f F
y0l F
y1 F
y1f F
y1l F
yn F
ynf F
ynl F

View File

@ -0,0 +1,123 @@
GLIBC_2.18
GLIBC_2.18 A
__free_fdresult F
__nis_default_access F
__nis_default_group F
__nis_default_owner F
__nis_default_ttl F
__nis_finddirectory F
__nis_hash F
__nisbind_connect F
__nisbind_create F
__nisbind_destroy F
__nisbind_next F
__yp_check F
nis_add F
nis_add_entry F
nis_addmember F
nis_checkpoint F
nis_clone_directory F
nis_clone_object F
nis_clone_result F
nis_creategroup F
nis_destroy_object F
nis_destroygroup F
nis_dir_cmp F
nis_domain_of F
nis_domain_of_r F
nis_first_entry F
nis_free_directory F
nis_free_object F
nis_free_request F
nis_freenames F
nis_freeresult F
nis_freeservlist F
nis_freetags F
nis_getnames F
nis_getservlist F
nis_ismember F
nis_leaf_of F
nis_leaf_of_r F
nis_lerror F
nis_list F
nis_local_directory F
nis_local_group F
nis_local_host F
nis_local_principal F
nis_lookup F
nis_mkdir F
nis_modify F
nis_modify_entry F
nis_name_of F
nis_name_of_r F
nis_next_entry F
nis_perror F
nis_ping F
nis_print_directory F
nis_print_entry F
nis_print_group F
nis_print_group_entry F
nis_print_link F
nis_print_object F
nis_print_result F
nis_print_rights F
nis_print_table F
nis_read_obj F
nis_remove F
nis_remove_entry F
nis_removemember F
nis_rmdir F
nis_servstate F
nis_sperrno F
nis_sperror F
nis_sperror_r F
nis_stats F
nis_verifygroup F
nis_write_obj F
readColdStartFile F
writeColdStartFile F
xdr_cback_data F
xdr_domainname F
xdr_keydat F
xdr_mapname F
xdr_obj_p F
xdr_peername F
xdr_valdat F
xdr_yp_buf F
xdr_ypall F
xdr_ypbind_binding F
xdr_ypbind_resp F
xdr_ypbind_resptype F
xdr_ypbind_setdom F
xdr_ypdelete_args F
xdr_ypmap_parms F
xdr_ypmaplist F
xdr_yppush_status F
xdr_yppushresp_xfr F
xdr_ypreq_key F
xdr_ypreq_nokey F
xdr_ypreq_xfr F
xdr_ypresp_all F
xdr_ypresp_key_val F
xdr_ypresp_maplist F
xdr_ypresp_master F
xdr_ypresp_order F
xdr_ypresp_val F
xdr_ypresp_xfr F
xdr_ypstat F
xdr_ypupdate_args F
xdr_ypxfrstat F
yp_all F
yp_bind F
yp_first F
yp_get_default_domain F
yp_maplist F
yp_master F
yp_match F
yp_next F
yp_order F
yp_unbind F
yp_update F
ypbinderr_string F
yperr_string F
ypprot_err F

View File

@ -0,0 +1,224 @@
GLIBC_2.18
GLIBC_2.18 A
_IO_flockfile F
_IO_ftrylockfile F
_IO_funlockfile F
__close F
__connect F
__errno_location F
__fcntl F
__fork F
__h_errno_location F
__libc_allocate_rtsig F
__libc_current_sigrtmax F
__libc_current_sigrtmin F
__lseek F
__nanosleep F
__open F
__open64 F
__pread64 F
__pthread_cleanup_routine F
__pthread_getspecific F
__pthread_key_create F
__pthread_mutex_destroy F
__pthread_mutex_init F
__pthread_mutex_lock F
__pthread_mutex_trylock F
__pthread_mutex_unlock F
__pthread_mutexattr_destroy F
__pthread_mutexattr_init F
__pthread_mutexattr_settype F
__pthread_once F
__pthread_register_cancel F
__pthread_register_cancel_defer F
__pthread_rwlock_destroy F
__pthread_rwlock_init F
__pthread_rwlock_rdlock F
__pthread_rwlock_tryrdlock F
__pthread_rwlock_trywrlock F
__pthread_rwlock_unlock F
__pthread_rwlock_wrlock F
__pthread_setspecific F
__pthread_unregister_cancel F
__pthread_unregister_cancel_restore F
__pthread_unwind_next F
__pwrite64 F
__read F
__res_state F
__send F
__sigaction F
__vfork F
__wait F
__write F
_pthread_cleanup_pop F
_pthread_cleanup_pop_restore F
_pthread_cleanup_push F
_pthread_cleanup_push_defer F
accept F
close F
connect F
fcntl F
flockfile F
fork F
fsync F
ftrylockfile F
funlockfile F
longjmp F
lseek F
lseek64 F
msync F
nanosleep F
open F
open64 F
pause F
pread F
pread64 F
pthread_attr_destroy F
pthread_attr_getaffinity_np F
pthread_attr_getdetachstate F
pthread_attr_getguardsize F
pthread_attr_getinheritsched F
pthread_attr_getschedparam F
pthread_attr_getschedpolicy F
pthread_attr_getscope F
pthread_attr_getstack F
pthread_attr_getstackaddr F
pthread_attr_getstacksize F
pthread_attr_init F
pthread_attr_setaffinity_np F
pthread_attr_setdetachstate F
pthread_attr_setguardsize F
pthread_attr_setinheritsched F
pthread_attr_setschedparam F
pthread_attr_setschedpolicy F
pthread_attr_setscope F
pthread_attr_setstack F
pthread_attr_setstackaddr F
pthread_attr_setstacksize F
pthread_barrier_destroy F
pthread_barrier_init F
pthread_barrier_wait F
pthread_barrierattr_destroy F
pthread_barrierattr_getpshared F
pthread_barrierattr_init F
pthread_barrierattr_setpshared F
pthread_cancel F
pthread_cond_broadcast F
pthread_cond_destroy F
pthread_cond_init F
pthread_cond_signal F
pthread_cond_timedwait F
pthread_cond_wait F
pthread_condattr_destroy F
pthread_condattr_getclock F
pthread_condattr_getpshared F
pthread_condattr_init F
pthread_condattr_setclock F
pthread_condattr_setpshared F
pthread_create F
pthread_detach F
pthread_equal F
pthread_exit F
pthread_getaffinity_np F
pthread_getattr_np F
pthread_getconcurrency F
pthread_getcpuclockid F
pthread_getname_np F
pthread_getschedparam F
pthread_getspecific F
pthread_join F
pthread_key_create F
pthread_key_delete F
pthread_kill F
pthread_kill_other_threads_np F
pthread_mutex_consistent F
pthread_mutex_consistent_np F
pthread_mutex_destroy F
pthread_mutex_getprioceiling F
pthread_mutex_init F
pthread_mutex_lock F
pthread_mutex_setprioceiling F
pthread_mutex_timedlock F
pthread_mutex_trylock F
pthread_mutex_unlock F
pthread_mutexattr_destroy F
pthread_mutexattr_getkind_np F
pthread_mutexattr_getprioceiling F
pthread_mutexattr_getprotocol F
pthread_mutexattr_getpshared F
pthread_mutexattr_getrobust F
pthread_mutexattr_getrobust_np F
pthread_mutexattr_gettype F
pthread_mutexattr_init F
pthread_mutexattr_setkind_np F
pthread_mutexattr_setprioceiling F
pthread_mutexattr_setprotocol F
pthread_mutexattr_setpshared F
pthread_mutexattr_setrobust F
pthread_mutexattr_setrobust_np F
pthread_mutexattr_settype F
pthread_once F
pthread_rwlock_destroy F
pthread_rwlock_init F
pthread_rwlock_rdlock F
pthread_rwlock_timedrdlock F
pthread_rwlock_timedwrlock F
pthread_rwlock_tryrdlock F
pthread_rwlock_trywrlock F
pthread_rwlock_unlock F
pthread_rwlock_wrlock F
pthread_rwlockattr_destroy F
pthread_rwlockattr_getkind_np F
pthread_rwlockattr_getpshared F
pthread_rwlockattr_init F
pthread_rwlockattr_setkind_np F
pthread_rwlockattr_setpshared F
pthread_self F
pthread_setaffinity_np F
pthread_setcancelstate F
pthread_setcanceltype F
pthread_setconcurrency F
pthread_setname_np F
pthread_setschedparam F
pthread_setschedprio F
pthread_setspecific F
pthread_sigmask F
pthread_sigqueue F
pthread_spin_destroy F
pthread_spin_init F
pthread_spin_lock F
pthread_spin_trylock F
pthread_spin_unlock F
pthread_testcancel F
pthread_timedjoin_np F
pthread_tryjoin_np F
pthread_yield F
pwrite F
pwrite64 F
raise F
read F
recv F
recvfrom F
recvmsg F
sem_close F
sem_destroy F
sem_getvalue F
sem_init F
sem_open F
sem_post F
sem_timedwait F
sem_trywait F
sem_unlink F
sem_wait F
send F
sendmsg F
sendto F
sigaction F
siglongjmp F
sigwait F
system F
tcdrain F
vfork F
wait F
waitpid F
write F

View File

@ -0,0 +1,93 @@
GLIBC_2.18
GLIBC_2.18 A
__b64_ntop F
__b64_pton F
__dn_comp F
__dn_count_labels F
__dn_expand F
__dn_skipname F
__fp_nquery F
__fp_query F
__fp_resstat F
__hostalias F
__loc_aton F
__loc_ntoa F
__p_cdname F
__p_cdnname F
__p_class F
__p_class_syms D 0x54
__p_fqname F
__p_fqnname F
__p_option F
__p_query F
__p_rcode F
__p_secstodate F
__p_time F
__p_type F
__p_type_syms D 0x228
__putlong F
__putshort F
__res_close F
__res_dnok F
__res_hnok F
__res_hostalias F
__res_isourserver F
__res_mailok F
__res_mkquery F
__res_nameinquery F
__res_nmkquery F
__res_nquery F
__res_nquerydomain F
__res_nsearch F
__res_nsend F
__res_ownok F
__res_queriesmatch F
__res_query F
__res_querydomain F
__res_search F
__res_send F
__sym_ntop F
__sym_ntos F
__sym_ston F
_gethtbyaddr F
_gethtbyname F
_gethtbyname2 F
_gethtent F
_getlong F
_getshort F
_res_opcodes D 0x40
_sethtent F
inet_net_ntop F
inet_net_pton F
inet_neta F
ns_datetosecs F
ns_format_ttl F
ns_get16 F
ns_get32 F
ns_initparse F
ns_makecanon F
ns_msg_getflag F
ns_name_compress F
ns_name_ntol F
ns_name_ntop F
ns_name_pack F
ns_name_pton F
ns_name_rollback F
ns_name_skip F
ns_name_uncompress F
ns_name_unpack F
ns_parse_ttl F
ns_parserr F
ns_put16 F
ns_put32 F
ns_samedomain F
ns_samename F
ns_skiprr F
ns_sprintrr F
ns_sprintrrf F
ns_subdomain F
res_gethostbyaddr F
res_gethostbyname F
res_gethostbyname2 F
res_send_setqhook F
res_send_setrhook F

View File

@ -0,0 +1,42 @@
GLIBC_2.18
GLIBC_2.18 A
__mq_open_2 F
aio_cancel F
aio_cancel64 F
aio_error F
aio_error64 F
aio_fsync F
aio_fsync64 F
aio_init F
aio_read F
aio_read64 F
aio_return F
aio_return64 F
aio_suspend F
aio_suspend64 F
aio_write F
aio_write64 F
clock_getcpuclockid F
clock_getres F
clock_gettime F
clock_nanosleep F
clock_settime F
lio_listio F
lio_listio64 F
mq_close F
mq_getattr F
mq_notify F
mq_open F
mq_receive F
mq_send F
mq_setattr F
mq_timedreceive F
mq_timedsend F
mq_unlink F
shm_open F
shm_unlink F
timer_create F
timer_delete F
timer_getoverrun F
timer_gettime F
timer_settime F

View File

@ -0,0 +1,42 @@
GLIBC_2.18
GLIBC_2.18 A
td_init F
td_log F
td_symbol_list F
td_ta_clear_event F
td_ta_delete F
td_ta_enable_stats F
td_ta_event_addr F
td_ta_event_getmsg F
td_ta_get_nthreads F
td_ta_get_ph F
td_ta_get_stats F
td_ta_map_id2thr F
td_ta_map_lwp2thr F
td_ta_new F
td_ta_reset_stats F
td_ta_set_event F
td_ta_setconcurrency F
td_ta_thr_iter F
td_ta_tsd_iter F
td_thr_clear_event F
td_thr_dbresume F
td_thr_dbsuspend F
td_thr_event_enable F
td_thr_event_getmsg F
td_thr_get_info F
td_thr_getfpregs F
td_thr_getgregs F
td_thr_getxregs F
td_thr_getxregsize F
td_thr_set_event F
td_thr_setfpregs F
td_thr_setgregs F
td_thr_setprio F
td_thr_setsigpending F
td_thr_setxregs F
td_thr_sigsetmask F
td_thr_tls_get_addr F
td_thr_tlsbase F
td_thr_tsd F
td_thr_validate F

View File

@ -0,0 +1,8 @@
GLIBC_2.18
GLIBC_2.18 A
forkpty F
login F
login_tty F
logout F
logwtmp F
openpty F

View File

@ -0,0 +1,11 @@
libc.so: __errno_location
libc.so: __signbit
libc.so: calloc
libc.so: free
libc.so: malloc
libc.so: memalign
libc.so: realloc
libm.so: __signbit
libm.so: __signbitf
libm.so: matherr
libpthread.so: __errno_location

View File

@ -0,0 +1,317 @@
/* Copyright (C) 2005-2013 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 _LOWLEVELLOCK_H
#define _LOWLEVELLOCK_H 1
#include <time.h>
#include <sys/param.h>
#include <bits/pthreadtypes.h>
#include <atomic.h>
#include <sysdep.h>
#include <kernel-features.h>
#include <tls.h> /* Need THREAD_*, and header.*. */
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#define FUTEX_REQUEUE 3
#define FUTEX_CMP_REQUEUE 4
#define FUTEX_WAKE_OP 5
#define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE ((4 << 24) | 1)
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_WAIT_BITSET 9
#define FUTEX_WAKE_BITSET 10
#define FUTEX_WAIT_REQUEUE_PI 11
#define FUTEX_CMP_REQUEUE_PI 12
#define FUTEX_PRIVATE_FLAG 128
#define FUTEX_CLOCK_REALTIME 256
#define FUTEX_BITSET_MATCH_ANY 0xffffffff
/* Values for 'private' parameter of locking macros. Yes, the
definition seems to be backwards. But it is not. The bit will be
reversed before passing to the system call. */
#define LLL_PRIVATE 0
#define LLL_SHARED FUTEX_PRIVATE_FLAG
#if !defined NOT_IN_libc || defined IS_IN_rtld
/* In libc.so or ld.so all futexes are private. */
# ifdef __ASSUME_PRIVATE_FUTEX
# define __lll_private_flag(fl, private) \
((fl) | FUTEX_PRIVATE_FLAG)
# else
# define __lll_private_flag(fl, private) \
((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex))
# endif
#else
# ifdef __ASSUME_PRIVATE_FUTEX
# define __lll_private_flag(fl, private) \
(((fl) | FUTEX_PRIVATE_FLAG) ^ (private))
# else
# define __lll_private_flag(fl, private) \
(__builtin_constant_p (private) \
? ((private) == 0 \
? ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex)) \
: (fl)) \
: ((fl) | (((private) ^ FUTEX_PRIVATE_FLAG) \
& THREAD_GETMEM (THREAD_SELF, header.private_futex))))
# endif
#endif
#define lll_futex_wait(futexp, val, private) \
lll_futex_timed_wait (futexp, val, NULL, private)
#define lll_futex_timed_wait(futexp, val, timespec, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
__ret = INTERNAL_SYSCALL (futex, __err, 4, (long) (futexp), \
__lll_private_flag (FUTEX_WAIT, private), \
(val), (timespec)); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
})
#define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
int __op = FUTEX_WAIT_BITSET | clockbit; \
__ret = INTERNAL_SYSCALL (futex, __err, 6, (long) (futexp), \
__lll_private_flag (__op, private), \
(val), (timespec), NULL /* Unused. */, \
FUTEX_BITSET_MATCH_ANY); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
})
#define lll_futex_wake(futexp, nr, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
__ret = INTERNAL_SYSCALL (futex, __err, 4, (long) (futexp), \
__lll_private_flag (FUTEX_WAKE, private), \
(nr), 0); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
})
#define lll_robust_dead(futexv, private) \
do \
{ \
int *__futexp = &(futexv); \
atomic_or (__futexp, FUTEX_OWNER_DIED); \
lll_futex_wake (__futexp, 1, private); \
} \
while (0)
/* Returns non-zero if error happened, zero if success. */
#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
__ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
__lll_private_flag (FUTEX_CMP_REQUEUE, private), \
(nr_wake), (nr_move), (mutex), (val)); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
/* Returns non-zero if error happened, zero if success. */
#define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
\
__ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
__lll_private_flag (FUTEX_WAKE_OP, private), \
(nr_wake), (nr_wake2), (futexp2), \
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
/* Priority Inheritance support. */
#define lll_futex_wait_requeue_pi(futexp, val, mutex, private) \
lll_futex_timed_wait_requeue_pi (futexp, val, NULL, 0, mutex, private)
#define lll_futex_timed_wait_requeue_pi(futexp, val, timespec, clockbit, \
mutex, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
int __op = FUTEX_WAIT_REQUEUE_PI | clockbit; \
\
__ret = INTERNAL_SYSCALL (futex, __err, 5, (futexp), \
__lll_private_flag (__op, private), \
(val), (timespec), mutex); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
})
#define lll_futex_cmp_requeue_pi(futexp, nr_wake, nr_move, mutex, val, priv) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
\
__ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
__lll_private_flag (FUTEX_CMP_REQUEUE_PI, priv), \
(nr_wake), (nr_move), (mutex), (val)); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
#define lll_trylock(lock) \
atomic_compare_and_exchange_val_acq(&(lock), 1, 0)
#define lll_cond_trylock(lock) \
atomic_compare_and_exchange_val_acq(&(lock), 2, 0)
#define __lll_robust_trylock(futex, id) \
(atomic_compare_and_exchange_val_acq (futex, id, 0) != 0)
#define lll_robust_trylock(lock, id) \
__lll_robust_trylock (&(lock), id)
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden;
#define __lll_lock(futex, private) \
((void) ({ \
int *__futex = (futex); \
if (__builtin_expect (atomic_compare_and_exchange_val_acq (__futex, 1, 0), \
0) != 0) \
{ \
if (__builtin_constant_p (private) && (private) == LLL_PRIVATE) \
__lll_lock_wait_private (__futex); \
else \
__lll_lock_wait (__futex, private); \
} \
}))
#define lll_lock(futex, private) __lll_lock (&(futex), private)
#define __lll_robust_lock(futex, id, private) \
({ \
int *__futex = (futex); \
int __val = 0; \
\
if (__builtin_expect (atomic_compare_and_exchange_bool_acq (__futex, id, \
0), 0)) \
__val = __lll_robust_lock_wait (__futex, private); \
__val; \
})
#define lll_robust_lock(futex, id, private) \
__lll_robust_lock (&(futex), id, private)
static inline void __attribute__ ((always_inline))
__lll_cond_lock (int *futex, int private)
{
if (__builtin_expect (atomic_exchange_acq (futex, 2), 0))
__lll_lock_wait (futex, private);
}
#define lll_cond_lock(futex, private) __lll_cond_lock (&(futex), private)
#define lll_robust_cond_lock(futex, id, private) \
__lll_robust_lock (&(futex), (id) | FUTEX_WAITERS, private)
extern int __lll_timedlock_wait (int *futex, const struct timespec *,
int private) attribute_hidden;
extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *,
int private) attribute_hidden;
static inline int __attribute__ ((always_inline))
__lll_timedlock (int *futex, const struct timespec *abstime, int private)
{
int result = 0;
if (__builtin_expect (atomic_compare_and_exchange_val_acq (futex, 1, 0), 0) != 0)
result = __lll_timedlock_wait (futex, abstime, private);
return result;
}
#define lll_timedlock(futex, abstime, private) \
__lll_timedlock (&(futex), abstime, private)
static inline int __attribute__ ((always_inline))
__lll_robust_timedlock (int *futex, const struct timespec *abstime,
int id, int private)
{
int result = 0;
if (__builtin_expect (atomic_compare_and_exchange_bool_acq (futex, id, 0), 0))
result = __lll_robust_timedlock_wait (futex, abstime, private);
return result;
}
#define lll_robust_timedlock(futex, abstime, id, private) \
__lll_robust_timedlock (&(futex), abstime, id, private)
#define __lll_unlock(futex, private) \
((void) ({ \
int *__futex = (futex); \
int __val = atomic_exchange_rel (__futex, 0); \
\
if (__builtin_expect (__val > 1, 0)) \
lll_futex_wake (__futex, 1, private); \
}))
#define lll_unlock(futex, private) __lll_unlock(&(futex), private)
#define __lll_robust_unlock(futex, private) \
((void) ({ \
int *__futex = (futex); \
int __val = atomic_exchange_rel (__futex, 0); \
\
if (__builtin_expect (__val & FUTEX_WAITERS, 0)) \
lll_futex_wake (__futex, 1, private); \
}))
#define lll_robust_unlock(futex, private) \
__lll_robust_unlock(&(futex), private)
#define lll_islocked(futex) \
(futex != 0)
/* Our internal lock implementation is identical to the binary-compatible
mutex implementation. */
/* Initializers for lock. */
#define LLL_LOCK_INITIALIZER (0)
#define LLL_LOCK_INITIALIZER_LOCKED (1)
/* The states of a lock are:
0 - untaken
1 - taken by one user
>1 - taken by more users. */
/* The kernel notifies a process which uses CLONE_CHILD_CLEARTID via futex
wakeup when the clone terminates. The memory location contains the
thread ID while the clone is running and is reset to zero
afterwards. */
#define lll_wait_tid(tid) \
do { \
__typeof (tid) __tid; \
while ((__tid = (tid)) != 0) \
lll_futex_wait (&(tid), __tid, LLL_SHARED); \
} while (0)
extern int __lll_timedwait_tid (int *, const struct timespec *)
attribute_hidden;
#define lll_timedwait_tid(tid, abstime) \
({ \
int __res = 0; \
if ((tid) != 0) \
__res = __lll_timedwait_tid (&(tid), (abstime)); \
__res; \
})
#endif /* lowlevellock.h. */

View File

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

View File

@ -0,0 +1,89 @@
/* Copyright (C) 2004-2013 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 "pthreadP.h"
#include <lowlevellock.h>
unsigned long int __fork_generation attribute_hidden;
static void
clear_once_control (void *arg)
{
pthread_once_t *once_control = (pthread_once_t *) arg;
*once_control = 0;
lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
}
int
__pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
{
for (;;)
{
int oldval;
int newval;
/* Pseudo code:
newval = __fork_generation | 1;
oldval = *once_control;
if ((oldval & 2) == 0)
*once_control = newval;
Do this atomically. */
do
{
newval = __fork_generation | 1;
oldval = *once_control;
if (oldval & 2)
break;
} while (atomic_compare_and_exchange_val_acq (once_control, newval, oldval) != oldval);
/* Check if the initializer has already been done. */
if ((oldval & 2) != 0)
return 0;
/* Check if another thread already runs the initializer. */
if ((oldval & 1) == 0)
break;
/* Check whether the initializer execution was interrupted by a fork. */
if (oldval != newval)
break;
/* Same generation, some other thread was faster. Wait. */
lll_futex_wait (once_control, oldval, LLL_PRIVATE);
}
/* This thread is the first here. Do the initialization.
Register a cleanup handler so that in case the thread gets
interrupted the initialization can be restarted. */
pthread_cleanup_push (clear_once_control, once_control);
init_routine ();
pthread_cleanup_pop (0);
/* Say that the initialisation is done. */
*once_control = __fork_generation | 2;
/* Wake up all other threads. */
lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
return 0;
}
weak_alias (__pthread_once, pthread_once)
hidden_def (__pthread_once)

View File

@ -0,0 +1,46 @@
/* Copyright (C) 2005-2013 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>
#define _ERRNO_H 1
#include <bits/errno.h>
#include <kernel-features.h>
#include <tcb-offsets.h>
/* Clone the calling process, but without copying the whole address space.
The calling process is suspended until the new process exits or is
replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
and the process ID of the new process to the old process. */
ENTRY (__vfork)
#ifdef __NR_vfork
DO_CALL (vfork, 0)
#else
DO_CALL (fork, 0)
#endif
addik r12,r0,-4095
cmpu r12,r12,r3
bgei r12,SYSCALL_ERROR_LABEL
rtsd r15,8
nop
PSEUDO_END (__vfork)
libc_hidden_def (__vfork)
weak_alias (__vfork, vfork)

View File

@ -0,0 +1,2 @@
/* We can use the ix86 version. */
#include <sysdeps/unix/sysv/linux/i386/profil-counter.h>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/alpha/semctl.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setgroups.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/alpha/shmctl.c>

View File

@ -0,0 +1,25 @@
/* Copyright (C) 2009-2013 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 SIGCONTEXT int _code, struct ucontext *
#define SIGCONTEXT_EXTRA_ARGS _code,
#define GET_PC(ctx) ((void *) (ctx)->uc_mcontext.regs.pc)
#define GET_FRAME(ctx) ((void *) (ctx)->uc_mcontext.regs.sp)
#define GET_STACK(ctx) ((void *) (ctx)->uc_mcontext.regs.sp)
#define CALL_SIGHANDLER(handler, signo, ctx) \
(handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))

View File

@ -0,0 +1,126 @@
/* Copyright (C) 2009-2013 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-cancel.h>
#include <socketcall.h>
#define P(a, b) P2(a, b)
#define P2(a, b) a##b
/* The socket-oriented system calls are handled unusally in Linux.
They are all gated through the single `socketcall' system call number.
`socketcall' takes two arguments: the first is the subcode, specifying
which socket function is being called; and the second is a pointer to
the arguments to the specific function.
The .S files for the other calls just #define socket and #include this.
They also #define a 'number-of-arguments' word in NARGS, which
defaults to 3. */
#ifndef NARGS
# ifdef socket
# error NARGS not defined
# endif
# define NARGS 3
#endif
/* Stack usage:
0 - r15 (return address)
4 - 12 args to syscall
16 - scratch for cancellation state
20 - scratch for return value
*/
#define stackadjust 24
#ifndef __socket
# ifndef NO_WEAK_ALIAS
# define __socket P(__,socket)
# else
# define __socket socket
# endif
#endif
.text
ENTRY(__socket)
addik r1,r1,-stackadjust
swi r15,r1,0
#if NARGS >= 1
swi r5,r1,stackadjust+4
#endif
#if NARGS >= 2
swi r6,r1,stackadjust+8
#endif
#if NARGS >= 3
swi r7,r1,stackadjust+12
#endif
#if NARGS >= 4
swi r8,r1,stackadjust+16
#endif
#if NARGS >= 5
swi r9,r1,stackadjust+20
#endif
#if NARGS >= 6
swi r10,r1,stackadjust+24
#endif
/* The rest of the args (if any) are on the caller's stack already. */
#if defined NEED_CANCELLATION && defined CENABLE
SINGLE_THREAD_P
bnei r12,L(socket_cancel)
#endif
addik r12,r0,SYS_ify(socketcall)
addik r5,r0,P(SOCKOP_,socket)
addik r6,r1,stackadjust+4
brki r14,8
addk r0,r0,r0
lwi r15,r1,0
addik r1,r1,stackadjust
addik r4,r0,-4095
cmpu r4,r4,r3
bgei r4,SYSCALL_ERROR_LABEL
rtsd r15,8
addk r0,r0,r0
#if defined NEED_CANCELLATION && defined CENABLE
L(socket_cancel):
CENABLE
swi r3,r1,16
addik r12,r0,SYS_ify(socketcall)
addik r5,r0,P(SOCKOP_,socket)
addik r6,r1,stackadjust+4
brki r14,8
addk r0,r0,r0
swi r3,r1,20
lwi r5,r1,16
CDISABLE
lwi r3,r1,20
lwi r15,r1,0
addik r1,r1,stackadjust
addik r4,r0,-4095
cmpu r4,r4,r3
bgei r4,SYSCALL_ERROR_LABEL
rtsd r15,8
addk r0,r0,r0
#endif
PSEUDO_END (__socket)
#ifndef NO_WEAK_ALIAS
weak_alias (__socket, socket)
#endif

View File

@ -0,0 +1,123 @@
/* Copyright (C) 1996-2013 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_PROCFS_H
#define _SYS_PROCFS_H 1
/* This is somewhat modelled after the file of the same name on SVR4
systems. It provides a definition of the core file format for ELF
used on Linux. It doesn't have anything to do with the /proc file
system, even though Linux has one.
Anyway, the whole purpose of this file is for GDB and GDB only.
Don't read too much into it. Don't use it for anything other than
GDB unless you know what you are doing. */
#include <sys/time.h>
#include <sys/types.h>
#include <sys/user.h>
__BEGIN_DECLS
/* Type for a general-purpose register. */
typedef unsigned long elf_greg_t;
/* And the whole bunch of them. We could have used `struct
user_regs_struct' directly in the typedef, but tradition says that
the register set is an array, which does have some peculiar
semantics, so leave it that way. */
#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof (elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
/* Register set for the floating-point registers. */
typedef struct user_fpregs_struct elf_fpregset_t;
/* Signal info. */
struct elf_siginfo
{
int si_signo; /* Signal number. */
int si_code; /* Extra code. */
int si_errno; /* Errno. */
};
/* Definitions to generate Intel SVR4-like core files. These mostly
have the same names as the SVR4 types with "elf_" tacked on the
front to prevent clashes with Linux definitions, and the typedef
forms have been avoided. This is mostly like the SVR4 structure,
but more Linuxy, with things that Linux does not support and which
GDB doesn't really use excluded. */
struct elf_prstatus
{
struct elf_siginfo pr_info; /* Info associated with signal. */
short int pr_cursig; /* Current signal. */
unsigned long int pr_sigpend; /* Set of pending signals. */
unsigned long int pr_sighold; /* Set of held signals. */
__pid_t pr_pid;
__pid_t pr_ppid;
__pid_t pr_pgrp;
__pid_t pr_sid;
struct timeval pr_utime; /* User time. */
struct timeval pr_stime; /* System time. */
struct timeval pr_cutime; /* Cumulative user time. */
struct timeval pr_cstime; /* Cumulative system time. */
elf_gregset_t pr_reg; /* GP registers. */
int pr_fpvalid; /* True if math copro being used. */
};
#define ELF_PRARGSZ (80) /* Number of chars for args. */
struct elf_prpsinfo
{
char pr_state; /* Numeric process state. */
char pr_sname; /* Char for pr_state. */
char pr_zomb; /* Zombie. */
char pr_nice; /* Nice val. */
unsigned long int pr_flag; /* Flags. */
unsigned short int pr_uid;
unsigned short int pr_gid;
int pr_pid, pr_ppid, pr_pgrp, pr_sid;
/* Lots missing. */
char pr_fname[16]; /* Filename of executable. */
char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
};
/* The rest of this file provides the types for emulation of the
Solaris <proc_service.h> interfaces that should be implemented by
users of libthread_db. */
/* Addresses. */
typedef void *psaddr_t;
/* Register sets. Linux has different names. */
typedef elf_gregset_t prgregset_t;
typedef elf_fpregset_t prfpregset_t;
/* We don't have any differences between processes and threads,
therefore have only one PID type. */
typedef __pid_t lwpid_t;
/* Process status and info. In the end we do provide typedefs for them. */
typedef struct elf_prstatus prstatus_t;
typedef struct elf_prpsinfo prpsinfo_t;
__END_DECLS
#endif /* sys/procfs.h. */

View File

@ -0,0 +1,77 @@
/* Copyright (C) 2009-2013 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_USER_H
# define _SYS_USER_H 1
/* The whole purpose of this file is for GDB and GDB only. Don't read
too much into it. Don't use it for anything other than GDB unless
you know what you are doing. */
struct user_fpregs_struct
{
long int cwd;
long int swd;
long int twd;
long int fip;
long int fcs;
long int foo;
long int fos;
long int st_space [20];
};
struct user_regs_struct
{
unsigned int gpr[32];
unsigned int pc;
unsigned int msr;
unsigned int ear;
unsigned int esr;
unsigned int fsr;
unsigned int btr;
unsigned int pvr[12];
};
struct user
{
struct user_regs_struct regs;
int u_fpvalid;
struct user_fpregs_struct elf_fpregset_t;
unsigned long int u_tsize;
unsigned long int u_dsize;
unsigned long int u_ssize;
unsigned long start_code;
unsigned long start_stack;
long int signal;
int reserved;
struct user_regs_struct* u_ar0;
struct user_fpregs_struct* u_fpstate;
unsigned long int magic;
char u_comm [32];
int u_debugreg [8];
};
# define PAGE_SHIFT 12
# define PAGE_SIZE (1UL << PAGE_SHIFT)
# define PAGE_MASK (~(PAGE_SIZE-1))
# define NBPG PAGE_SIZE
# define UPAGES 1
# define HOST_TEXT_START_ADDR (u.start_code)
# define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
#endif /* _SYS_USER_H */

View File

@ -0,0 +1,37 @@
/* Copyright (C) 2005-2013 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 (syscall)
addk r12,r0,r5
addk r5,r0,r6
addk r6,r0,r7
addk r7,r0,r8
addk r8,r0,r9
addk r9,r0,r10
lwi r10,r1,28
brki r14,8
addk r0,r0,r0
addik r4,r0,-4095
cmpu r4,r4,r3
bgei r4,SYSCALL_ERROR_LABEL
rtsd r15,8
nop
PSEUDO_END (syscall)

View File

@ -0,0 +1,18 @@
# File name Caller Syscall name Args Strong name Weak names
cacheflush EXTRA cacheflush i:iiii __cacheflush cacheflush
prlimit64 EXTRA prlimit64 i:iipp prlimit64
fanotify_mark EXTRA fanotify_mark i:iiiiis fanotify_mark
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
semget - semget i:iii __semget semget

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2009-2013 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>
/* The following code is only used in the shared library when we
compile the reentrant version. Otherwise each system call defines
each own version. */
#ifndef PIC
/* The syscall stubs jump here when they detect an error. */
# undef CALL_MCOUNT
# define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %d0. */
.text
ENTRY (__syscall_error)
rsubk r3,r3,r0
rtsd r15,8
addik r3,r0,-1 /* delay slot. */
END (__syscall_error)
#endif /* PIC. */

View File

@ -0,0 +1,307 @@
/* Copyright (C) 2000-2013 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/microblaze/sysdep.h>
#include <sys/syscall.h>
/* Defines RTLD_PRIVATE_ERRNO. */
#include <dl-sysdep.h>
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
#ifndef __ASSEMBLER__
# include <errno.h>
#endif
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
so we have to redefine the `SYS_ify' macro here. */
#undef SYS_ify
#define SYS_ify(syscall_name) __NR_##syscall_name
#ifdef __ASSEMBLER__
/* In microblaze ABI function call arguments are passed in registers
r5...r10. The return value is stored in r3 (or r3:r4 regiters pair).
Linux syscall uses the same convention with the addition that the
syscall number is passed in r12. To enter the kernel "brki r14,8"
instruction is used.
None of the abovementioned registers are presumed across function call
or syscall.
*/
/* Linux uses a negative return value to indicate syscall errors, unlike
most Unices, which use the condition codes' carry flag.
Since version 2.1 the return value of a system call might be negative
even if the call succeeded. E.g., the `lseek' system call might return
a large offset. Therefore we must not anymore test for < 0, but test
for a real error by making sure the value in %d0 is a real error
number. Linus said he will make sure the no syscall returns a value
in -1 .. -4095 as a valid result so we can savely test with -4095. */
/* We don't want the label for the error handler to be visible in the symbol
table when we define it here. */
# ifdef PIC
# define SYSCALL_ERROR_LABEL 0f
# else
# define SYSCALL_ERROR_LABEL __syscall_error
# endif
# undef PSEUDO
# define PSEUDO(name, syscall_name, args) \
.text; \
ENTRY (name) \
DO_CALL (syscall_name, args); \
addik r12,r0,-4095; \
cmpu r12,r12,r3; \
bgei r12,SYSCALL_ERROR_LABEL;
# undef PSEUDO_END
# define PSEUDO_END(name) \
SYSCALL_ERROR_HANDLER; \
END (name)
# undef PSEUDO_NOERRNO
# define PSEUDO_NOERRNO(name, syscall_name, args) \
.text; \
ENTRY (name) \
DO_CALL (syscall_name, args);
# undef PSEUDO_END_NOERRNO
# define PSEUDO_END_NOERRNO(name) \
END (name)
/* The function has to return the error code. */
# undef PSEUDO_ERRVAL
# define PSEUDO_ERRVAL(name, syscall_name, args) \
.text; \
ENTRY (name) \
DO_CALL (syscall_name, args); \
# undef PSEUDO_END_ERRVAL
# define PSEUDO_END_ERRVAL(name) \
END (name)
# define ret_NOERRNO \
rtsd r15,8; addk r0,r0,r0;
# define ret_ERRVAL \
rtsd r15,8; rsubk r3,r3,r0;
# ifdef PIC
# define SYSCALL_ERROR_LABEL_DCL 0
# if RTLD_PRIVATE_ERRNO
# define SYSCALL_ERROR_HANDLER \
SYSCALL_ERROR_LABEL_DCL: \
mfs r12,rpc; \
addik r12,r12,_GLOBAL_OFFSET_TABLE_+8; \
lwi r12,r12,rtld_errno@GOT; \
rsubk r3,r3,r0; \
swi r3,r12,0; \
rtsd r15,8; \
addik r3,r0,-1;
# else /* !RTLD_PRIVATE_ERRNO. */
/* Store (-r3) into errno through the GOT. */
# if defined _LIBC_REENTRANT
# define SYSCALL_ERROR_HANDLER \
SYSCALL_ERROR_LABEL_DCL: \
addik r1,r1,-16; \
swi r15,r1,0; \
swi r20,r1,8; \
rsubk r3,r3,r0; \
swi r3,r1,12; \
mfs r20,rpc; \
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8; \
brlid r15,__errno_location@PLT; \
nop; \
lwi r4,r1,12; \
swi r4,r3,0; \
lwi r20,r1,8; \
lwi r15,r1,0; \
addik r1,r1,16; \
rtsd r15,8; \
addik r3,r0,-1;
# else /* !_LIBC_REENTRANT. */
# define SYSCALL_ERROR_HANDLER \
SYSCALL_ERROR_LABEL_DCL: \
mfs r12,rpc; \
addik r12,r12,_GLOBAL_OFFSET_TABLE_+8; \
lwi r12,r12,errno@GOT; \
rsubk r3,r3,r0; \
swi r3,r12,0; \
rtsd r15,8; \
addik r3,r0,-1;
# endif /* _LIBC_REENTRANT. */
# endif /* RTLD_PRIVATE_ERRNO. */
# else
# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
# endif /* PIC. */
# define DO_CALL(syscall_name, args) \
addik r12,r0,SYS_ify (syscall_name); \
brki r14,8; \
addk r0,r0,r0;
#else /* not __ASSEMBLER__ */
/* Define a macro which expands into the inline wrapper code for a system
call. */
# undef INLINE_SYSCALL
# define INLINE_SYSCALL(name, nr, args...) \
({ INTERNAL_SYSCALL_DECL(err); \
unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args); \
if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \
{ \
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \
resultvar = (unsigned long) -1; \
} \
(long) resultvar; \
})
# undef INTERNAL_SYSCALL_DECL
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
/* Define a macro which expands inline into the wrapper code for a system
call. This use is for internal calls that do not need to handle errors
normally. It will never touch errno. This returns just what the kernel
gave back. */
# undef INTERNAL_SYSCALL
# define INTERNAL_SYSCALL(name, err, nr, args...) \
inline_syscall##nr(SYS_ify(name), args)
# undef INTERNAL_SYSCALL_NCS
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
inline_syscall##nr(name, args)
# undef INTERNAL_SYSCALL_ERROR_P
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int) (val) >= -4095U)
# undef INTERNAL_SYSCALL_ERRNO
# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
# define SYSCALL_CLOBBERS_6 "r11", "r4", "memory"
# define SYSCALL_CLOBBERS_5 "r10", SYSCALL_CLOBBERS_6
# define SYSCALL_CLOBBERS_4 "r9", SYSCALL_CLOBBERS_5
# define SYSCALL_CLOBBERS_3 "r8", SYSCALL_CLOBBERS_4
# define SYSCALL_CLOBBERS_2 "r7", SYSCALL_CLOBBERS_3
# define SYSCALL_CLOBBERS_1 "r6", SYSCALL_CLOBBERS_2
# define SYSCALL_CLOBBERS_0 "r5", SYSCALL_CLOBBERS_1
# define inline_syscall0(name,dummy) \
({ \
register long ret __asm__("r3"); \
register long __r12 __asm__("r12") = name; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(ret) \
: "r"(__r12) \
: SYSCALL_CLOBBERS_0 ); ret; \
})
# define inline_syscall1(name,arg1) \
({ \
register long ret __asm__("r3"); \
register long __r12 __asm__("r12") = name; \
register long __r5 __asm__("r5") = (long)(arg1); \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(ret) \
: "r"(__r5), "r"(__r12) \
: SYSCALL_CLOBBERS_1 ); ret; \
})
# define inline_syscall2(name,arg1,arg2) \
({ \
register long ret __asm__("r3"); \
register long __r12 __asm__("r12") = name; \
register long __r5 __asm__("r5") = (long)(arg1); \
register long __r6 __asm__("r6") = (long)(arg2); \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(ret) \
: "r"(__r5), "r"(__r6), "r"(__r12) \
: SYSCALL_CLOBBERS_2 ); ret; \
})
# define inline_syscall3(name,arg1,arg2,arg3) \
({ \
register long ret __asm__("r3"); \
register long __r12 __asm__("r12") = name; \
register long __r5 __asm__("r5") = (long)(arg1); \
register long __r6 __asm__("r6") = (long)(arg2); \
register long __r7 __asm__("r7") = (long)(arg3); \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(ret) \
: "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r12) \
: SYSCALL_CLOBBERS_3 ); ret; \
})
# define inline_syscall4(name,arg1,arg2,arg3,arg4) \
({ \
register long ret __asm__("r3"); \
register long __r12 __asm__("r12") = name; \
register long __r5 __asm__("r5") = (long)(arg1); \
register long __r6 __asm__("r6") = (long)(arg2); \
register long __r7 __asm__("r7") = (long)(arg3); \
register long __r8 __asm__("r8") = (long)(arg4); \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(ret) \
: "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r12) \
: SYSCALL_CLOBBERS_4 ); ret; \
})
# define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \
({ \
register long ret __asm__("r3"); \
register long __r12 __asm__("r12") = name; \
register long __r5 __asm__("r5") = (long)(arg1); \
register long __r6 __asm__("r6") = (long)(arg2); \
register long __r7 __asm__("r7") = (long)(arg3); \
register long __r8 __asm__("r8") = (long)(arg4); \
register long __r9 __asm__("r9") = (long)(arg5); \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(ret) \
: "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r12) \
: SYSCALL_CLOBBERS_5 ); ret; \
})
# define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
({ \
register long ret __asm__("r3"); \
register long __r12 __asm__("r12") = name; \
register long __r5 __asm__("r5") = (long)(arg1); \
register long __r6 __asm__("r6") = (long)(arg2); \
register long __r7 __asm__("r7") = (long)(arg3); \
register long __r8 __asm__("r8") = (long)(arg4); \
register long __r9 __asm__("r9") = (long)(arg5); \
register long __r10 __asm__("r10") = (long)(arg6); \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(ret) \
: "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r10), \
"r"(__r12) \
: SYSCALL_CLOBBERS_6 ); ret; \
})
/* Pointer mangling is not yet supported for Microblaze. */
# define PTR_MANGLE(var) (void) (var)
# define PTR_DEMANGLE(var) (void) (var)
#endif /* not __ASSEMBLER__ */

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