diff options
Diffstat (limited to 'libc')
249 files changed, 5346 insertions, 2262 deletions
diff --git a/libc/sysdeps/linux/alpha/Makefile.arch b/libc/sysdeps/linux/alpha/Makefile.arch index 91636c71a..2a66bc1a4 100644 --- a/libc/sysdeps/linux/alpha/Makefile.arch +++ b/libc/sysdeps/linux/alpha/Makefile.arch @@ -5,10 +5,10 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CSRC := sysdep.c #brk.c +CSRC := __syscall_error.c SSRC := \ __longjmp.S brk.S bsd-_setjmp.S bsd-setjmp.S clone.S \ - divl.S divq.S reml.S remq.S setjmp.S + divl.S divq.S reml.S remq.S setjmp.S syscall.S include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch diff --git a/libc/sysdeps/linux/alpha/__longjmp.S b/libc/sysdeps/linux/alpha/__longjmp.S index b78489f53..910ec0781 100644 --- a/libc/sysdeps/linux/alpha/__longjmp.S +++ b/libc/sysdeps/linux/alpha/__longjmp.S @@ -54,3 +54,4 @@ __longjmp: ret .end __longjmp +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/alpha/__syscall_error.c b/libc/sysdeps/linux/alpha/__syscall_error.c new file mode 100644 index 000000000..7c081f3b5 --- /dev/null +++ b/libc/sysdeps/linux/alpha/__syscall_error.c @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <errno.h> + +/* This routine is jumped to by all the syscall handlers, to stash + an error number into errno. */ +int attribute_hidden __syscall_error (void) +{ + register int err_no __asm__("$0"); + __set_errno (err_no); + return -1; +} diff --git a/libc/sysdeps/linux/alpha/bits/fcntl.h b/libc/sysdeps/linux/alpha/bits/fcntl.h index c85bb1f9d..c4a9b77e2 100644 --- a/libc/sysdeps/linux/alpha/bits/fcntl.h +++ b/libc/sysdeps/linux/alpha/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000, 2004, 2005 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 @@ -44,10 +44,10 @@ #define O_ASYNC 020000 /* fcntl, for BSD compatibility */ #ifdef __USE_GNU -# define O_DIRECT 040000 /* Direct disk access. */ # define O_DIRECTORY 0100000 /* Must be a directory. */ # define O_NOFOLLOW 0200000 /* Do not follow links. */ -# define O_STREAMING 04000000/* streaming access */ +# define O_DIRECT 02000000 /* Direct disk access. */ +# define O_NOATIME 04000000 /* Do not set atime. */ #endif #ifdef __USE_LARGEFILE64 @@ -76,7 +76,7 @@ #define F_SETLK64 F_SETLK /* Set record locking info (non-blocking). */ #define F_SETLKW64 F_SETLKW /* Set record locking info (blocking). */ -#if defined __USE_BSD || defined __USE_XOPEN2K +#if defined __USE_BSD || defined __USE_UNIX98 # define F_SETOWN 5 /* Get owner of socket (receiver of SIGIO). */ # define F_GETOWN 6 /* Set owner of socket (receiver of SIGIO). */ #endif @@ -169,6 +169,14 @@ struct flock64 # define POSIX_FADV_RANDOM 1 /* Expect random page references. */ # define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ # define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ -# define POSIX_FADV_DONTNEED 6 /* Don't need these pages. */ -# define POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */ +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif + +__BEGIN_DECLS + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + +__END_DECLS diff --git a/libc/sysdeps/linux/alpha/bits/fenv.h b/libc/sysdeps/linux/alpha/bits/fenv.h new file mode 100644 index 000000000..a9e89b498 --- /dev/null +++ b/libc/sysdeps/linux/alpha/bits/fenv.h @@ -0,0 +1,123 @@ +/* Copyright (C) 1997, 1998, 1999, 2000 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FENV_H +# error "Never use <bits/fenv.h> directly; include <fenv.h> instead." +#endif + + +/* Define the bits representing the exception. + + Note that these are the bit positions as defined by the OSF/1 + ieee_{get,set}_control_word interface and not by the hardware fpcr. + + See the Alpha Architecture Handbook section 4.7.7.3 for details, + but in summary, trap shadows mean the hardware register can acquire + extra exception bits so for proper IEEE support the tracking has to + be done in software -- in this case with kernel support. + + As to why the system call interface isn't in the same format as + the hardware register, only those crazy folks at DEC can tell you. */ + +enum + { +#ifdef __USE_GNU + FE_DENORMAL = 1UL << 22, +#define FE_DENORMAL FE_DENORMAL +#endif + + FE_INEXACT = 1UL << 21, +#define FE_INEXACT FE_INEXACT + + FE_UNDERFLOW = 1UL << 20, +#define FE_UNDERFLOW FE_UNDERFLOW + + FE_OVERFLOW = 1UL << 19, +#define FE_OVERFLOW FE_OVERFLOW + + FE_DIVBYZERO = 1UL << 18, +#define FE_DIVBYZERO FE_DIVBYZERO + + FE_INVALID = 1UL << 17, +#define FE_INVALID FE_INVALID + + FE_ALL_EXCEPT = 0x3f << 17 +#define FE_ALL_EXCEPT FE_ALL_EXCEPT + }; + +/* Alpha chips support all four defined rouding modes. + + Note that code must be compiled to use dynamic rounding (/d) instructions + to see these changes. For gcc this is -mfp-rounding-mode=d; for DEC cc + this is -fprm d. The default for both is static rounding to nearest. + + These are shifted down 58 bits from the hardware fpcr because the + functions are declared to take integers. */ + +enum + { + FE_TOWARDZERO = 0, +#define FE_TOWARDZERO FE_TOWARDZERO + + FE_DOWNWARD = 1, +#define FE_DOWNWARD FE_DOWNWARD + + FE_TONEAREST = 2, +#define FE_TONEAREST FE_TONEAREST + + FE_UPWARD = 3, +#define FE_UPWARD FE_UPWARD + }; + +#ifdef __USE_GNU +/* On later hardware, and later kernels for earlier hardware, we can forcibly + underflow denormal inputs and outputs. This can speed up certain programs + significantly, usually without affecting accuracy. */ +enum + { + FE_MAP_DMZ = 1UL << 12, /* Map denorm inputs to zero */ +#define FE_MAP_DMZ FE_MAP_DMZ + + FE_MAP_UMZ = 1UL << 13, /* Map underflowed outputs to zero */ +#define FE_MAP_UMZ FE_MAP_UMZ + }; +#endif + +/* Type representing exception flags. */ +typedef unsigned long int fexcept_t; + +/* Type representing floating-point environment. */ +typedef unsigned long int fenv_t; + +/* If the default argument is used we use this value. Note that due to + architecture-specified page mappings, no user-space pointer will ever + have its two high bits set. Co-opt one. */ +#define FE_DFL_ENV ((__const fenv_t *) 0x8800000000000000UL) + +#ifdef __USE_GNU +/* Floating-point environment where none of the exceptions are masked. */ +# define FE_NOMASK_ENV ((__const fenv_t *) 0x880000000000003eUL) + +/* Floating-point environment with (processor-dependent) non-IEEE floating + point. In this case, mapping denormals to zero. */ +# define FE_NONIEEE_ENV ((__const fenv_t *) 0x8800000000003000UL) +#endif + +/* The system calls to talk to the kernel's FP code. */ +extern unsigned long int __ieee_get_fp_control (void) __THROW; +extern void __ieee_set_fp_control (unsigned long int __value) __THROW; diff --git a/libc/sysdeps/linux/alpha/bits/kernel_sigaction.h b/libc/sysdeps/linux/alpha/bits/kernel_sigaction.h index 4c35d969c..66b420087 100644 --- a/libc/sysdeps/linux/alpha/bits/kernel_sigaction.h +++ b/libc/sysdeps/linux/alpha/bits/kernel_sigaction.h @@ -13,3 +13,6 @@ struct kernel_sigaction { unsigned int sa_flags; sigset_t sa_mask; }; + +extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded, + struct kernel_sigaction *__unbounded, size_t); diff --git a/libc/sysdeps/linux/alpha/bits/mman.h b/libc/sysdeps/linux/alpha/bits/mman.h new file mode 100644 index 000000000..2a84709d2 --- /dev/null +++ b/libc/sysdeps/linux/alpha/bits/mman.h @@ -0,0 +1,118 @@ +/* Definitions for POSIX memory map interface. Linux/Alpha version. + Copyright (C) 1997, 1998, 2000, 2003, 2006 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_MMAN_H +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + + +/* Protections are chosen from these bits, OR'd together. The + implementation does not necessarily support PROT_EXEC or PROT_WRITE + without PROT_READ. The only guarantees are that no writing will be + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ + +#define PROT_READ 0x1 /* Page can be read. */ +#define PROT_WRITE 0x2 /* Page can be written. */ +#define PROT_EXEC 0x4 /* Page can be executed. */ +#define PROT_NONE 0x0 /* Page can not be accessed. */ +#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of + growsdown vma (mprotect only). */ +#define PROT_GROWSUP 0x02000000 /* Extend change to start of + growsup vma (mprotect only). */ + +/* Sharing types (must choose one and only one of these). */ +#define MAP_SHARED 0x01 /* Share changes. */ +#define MAP_PRIVATE 0x02 /* Changes are private. */ +#ifdef __USE_MISC +# define MAP_TYPE 0x0f /* Mask for type of mapping. */ +#endif + +/* Other flags. */ +#define MAP_FIXED 0x100 /* Interpret addr exactly. */ +#ifdef __USE_MISC +# define MAP_FILE 0 +# define MAP_ANONYMOUS 0x10 /* Don't use a file. */ +# define MAP_ANON MAP_ANONYMOUS +#endif + +/* Not used by Linux, but here to make sure we don't clash with + OSF/1 defines. */ +#if 0 && defined __USE_BSD +# define MAP_HASSEMAPHORE 0x0200 +# define MAP_INHERIT 0x0400 +# define MAP_UNALIGNED 0x0800 +#endif + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_GROWSDOWN 0x01000 /* Stack-like segment. */ +# define MAP_DENYWRITE 0x02000 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x04000 /* Mark it as an executable. */ +# define MAP_LOCKED 0x08000 /* Lock the mapping. */ +# define MAP_NORESERVE 0x10000 /* Don't check for reservations. */ +# define MAP_POPULATE 0x20000 /* Populate (prefault) pagetables. */ +# define MAP_NONBLOCK 0x40000 /* Do not block on IO. */ +#endif + +/* Flags to `msync'. */ +#define MS_ASYNC 1 /* Sync memory asynchronously. */ +#define MS_SYNC 2 /* Synchronous memory sync. */ +#define MS_INVALIDATE 4 /* Invalidate the caches. */ + +/* Flags for `mlockall'. */ +#define MCL_CURRENT 8192 /* Lock all currently mapped pages. */ +#define MCL_FUTURE 16384 /* Lock all additions to address + space. */ + +/* Flags for `mremap'. */ +#ifdef __USE_GNU +# define MREMAP_MAYMOVE 1 +# define MREMAP_FIXED 2 +#endif + +/* Advice to `madvise'. */ +#ifdef __USE_BSD +# define MADV_NORMAL 0 /* No further special treatment. */ +# define MADV_RANDOM 1 /* Expect random page references. */ +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define MADV_WILLNEED 3 /* Will need these pages. */ +# define MADV_DONTNEED 6 /* Don't need these pages. */ +# define MADV_REMOVE 7 /* Remove these pages and resources. */ +# define MADV_DONTFORK 10 /* Do not inherit across fork. */ +# define MADV_DOFORK 11 /* Do inherit across fork. */ +#endif + +/* The POSIX people had to invent similar names for the same things. */ +#ifdef __USE_XOPEN2K +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_MADV_DONTNEED 6 /* Don't need these pages. */ +#endif + +/* Not used by Linux, but here to make sure we don't clash with + OSF/1 defines. */ +#if 0 && defined __USE_BSD +# define MADV_DONTNEED_COMPAT 4 /* Old version? */ +# define MADV_SPACEAVAIL 5 /* Ensure resources are available. */ +#endif diff --git a/libc/sysdeps/linux/alpha/bits/resource.h b/libc/sysdeps/linux/alpha/bits/resource.h index 3f4e72ccb..216374584 100644 --- a/libc/sysdeps/linux/alpha/bits/resource.h +++ b/libc/sysdeps/linux/alpha/bits/resource.h @@ -1,5 +1,6 @@ /* Bit values & structures for resource limits. Alpha/Linux version. - Copyright (C) 1994,96,97,98,99,2000 Free Software Foundation, Inc. + Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005 + 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 @@ -55,34 +56,54 @@ enum __rlimit_resource This affects swapping; processes that are exceeding their resident set size will be more likely to have physical memory taken from them. */ - RLIMIT_RSS = 5, -#define RLIMIT_RSS RLIMIT_RSS + __RLIMIT_RSS = 5, +#define RLIMIT_RSS __RLIMIT_RSS /* Number of open files. */ RLIMIT_NOFILE = 6, - RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ + __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ #define RLIMIT_NOFILE RLIMIT_NOFILE -#define RLIMIT_OFILE RLIMIT_OFILE +#define RLIMIT_OFILE __RLIMIT_OFILE /* Address space limit (?) */ RLIMIT_AS = 7, #define RLIMIT_AS RLIMIT_AS /* Number of processes. */ - RLIMIT_NPROC = 8, -#define RLIMIT_NPROC RLIMIT_NPROC + __RLIMIT_NPROC = 8, +#define RLIMIT_NPROC __RLIMIT_NPROC /* Locked-in-memory address space. */ - RLIMIT_MEMLOCK = 9, -#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK + __RLIMIT_MEMLOCK = 9, +#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK /* Maximum number of file locks. */ - RLIMIT_LOCKS = 10, -#define RLIMIT_LOCKS RLIMIT_LOCKS - - RLIM_NLIMITS = 11 -#define RLIMIT_NLIMITS RLIMIT_NLIMITS -#define RLIM_NLIMITS RLIM_NLIMITS + __RLIMIT_LOCKS = 10, +#define RLIMIT_LOCKS __RLIMIT_LOCKS + + /* Maximum number of pending signals. */ + __RLIMIT_SIGPENDING = 11, +#define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING + + /* Maximum bytes in POSIX message queues. */ + __RLIMIT_MSGQUEUE = 12, +#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE + + /* Maximum nice priority allowed to raise to. + Nice levels 19 .. -20 correspond to 0 .. 39 + values of this resource limit. */ + __RLIMIT_NICE = 13, +#define RLIMIT_NICE __RLIMIT_NICE + + /* Maximum realtime priority allowed for non-priviledged + processes. */ + __RLIMIT_RTPRIO = 14, +#define RLIMIT_RTPRIO __RLIMIT_RTPRIO + + __RLIMIT_NLIMITS = 15, + __RLIM_NLIMITS = __RLIMIT_NLIMITS +#define RLIMIT_NLIMITS __RLIMIT_NLIMITS +#define RLIM_NLIMITS __RLIM_NLIMITS }; /* Value to indicate that there is no limit. */ @@ -137,12 +158,8 @@ enum __rusage_who #define RUSAGE_SELF RUSAGE_SELF /* All of its terminated child processes. */ - RUSAGE_CHILDREN = -1, + RUSAGE_CHILDREN = -1 #define RUSAGE_CHILDREN RUSAGE_CHILDREN - - /* Both. */ - RUSAGE_BOTH = -2 -#define RUSAGE_BOTH RUSAGE_BOTH }; #define __need_timeval diff --git a/libc/sysdeps/linux/alpha/bits/shm.h b/libc/sysdeps/linux/alpha/bits/shm.h index bbee434ea..35226c16c 100644 --- a/libc/sysdeps/linux/alpha/bits/shm.h +++ b/libc/sysdeps/linux/alpha/bits/shm.h @@ -71,6 +71,7 @@ struct shmid_ds # define SHM_DEST 01000 /* segment will be destroyed on last detach */ # define SHM_LOCKED 02000 /* segment will not be swapped */ # define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ +# define SHM_NORESERVE 010000 /* don't check for reservations */ struct shminfo { diff --git a/libc/sysdeps/linux/alpha/bits/siginfo.h b/libc/sysdeps/linux/alpha/bits/siginfo.h index 2cc92babb..a2aacc04b 100644 --- a/libc/sysdeps/linux/alpha/bits/siginfo.h +++ b/libc/sysdeps/linux/alpha/bits/siginfo.h @@ -1,5 +1,5 @@ /* siginfo_t, sigevent and constants. Linux/Alpha version. - Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1997-2002, 2003 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 @@ -22,8 +22,6 @@ # error "Never include this file directly. Use <signal.h> instead" #endif -#include <bits/wordsize.h> - #if (!defined __have_sigval_t \ && (defined _SIGNAL_H || defined __need_siginfo_t \ || defined __need_sigevent_t)) @@ -42,11 +40,7 @@ typedef union sigval # define __have_siginfo_t 1 # define __SI_MAX_SIZE 128 -# if __WORDSIZE == 64 -# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) -# else -# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) -# endif +# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) typedef struct siginfo { @@ -69,8 +63,9 @@ typedef struct siginfo /* POSIX.1b timers. */ struct { - unsigned int _timer1; - unsigned int _timer2; + int si_tid; /* Timer ID. */ + int si_overrun; /* Overrun count. */ + sigval_t si_sigval; /* Signal value. */ } _timer; /* POSIX.1b signals. */ @@ -110,8 +105,8 @@ typedef struct siginfo /* X/Open requires some more fields with fixed names. */ # define si_pid _sifields._kill.si_pid # define si_uid _sifields._kill.si_uid -# define si_timer1 _sifields._timer._timer1 -# define si_timer2 _sifields._timer._timer2 +# define si_timerid _sifields._timer.si_tid +# define si_overrun _sifields._timer.si_overrun # define si_status _sifields._sigchld.si_status # define si_utime _sifields._sigchld.si_utime # define si_stime _sifields._sigchld.si_stime @@ -127,8 +122,10 @@ typedef struct siginfo signals. */ enum { - SI_ASYNCNL = -6, /* Sent by asynch name lookup completion. */ + SI_ASYNCNL = -60, /* Sent by asynch name lookup completion. */ # define SI_ASYNCNL SI_ASYNCNL + SI_TKILL = -6, /* Sent by tkill. */ +# define SI_TKILL SI_TKILL SI_SIGIO, /* Sent by queued SIGIO. */ # define SI_SIGIO SI_SIGIO SI_ASYNCIO, /* Sent by AIO completion. */ @@ -261,14 +258,7 @@ enum /* Structure to transport application-defined values with signals. */ # define __SIGEV_MAX_SIZE 64 -# if __WORDSIZE == 64 -# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4) -# else -# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3) -# endif - -/* Forward declaration of the `pthread_attr_t' type. */ -struct __pthread_attr_s; +# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4) typedef struct sigevent { @@ -280,10 +270,14 @@ typedef struct sigevent { int _pad[__SIGEV_PAD_SIZE]; + /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the + thread to receive the signal. */ + __pid_t _tid; + struct { - void (*_function) (sigval_t); /* Function to start. */ - struct __pthread_attr_s *_attribute; /* Really pthread_attr_t. */ + void (*_function) (sigval_t); /* Function to start. */ + void *_attribute; /* Really pthread_attr_t. */ } _sigev_thread; } _sigev_un; } sigevent_t; @@ -299,8 +293,11 @@ enum # define SIGEV_SIGNAL SIGEV_SIGNAL SIGEV_NONE, /* Other notification: meaningless. */ # define SIGEV_NONE SIGEV_NONE - SIGEV_THREAD /* Deliver via thread creation. */ + SIGEV_THREAD, /* Deliver via thread creation. */ # define SIGEV_THREAD SIGEV_THREAD + + SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */ +#define SIGEV_THREAD_ID SIGEV_THREAD_ID }; #endif /* have _SIGNAL_H. */ diff --git a/libc/sysdeps/linux/alpha/bits/signum.h b/libc/sysdeps/linux/alpha/bits/signum.h index 44c96a204..477c13175 100644 --- a/libc/sysdeps/linux/alpha/bits/signum.h +++ b/libc/sysdeps/linux/alpha/bits/signum.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux/Alpha version. - Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999, 2003 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 @@ -69,7 +69,7 @@ #define SIGPWR SIGINFO #define SIGIOT SIGABRT -#define _NSIG 64 /* Biggest signal number + 1. */ +#define _NSIG 65 /* Biggest signal number + 1. */ #define SIGRTMIN (__libc_current_sigrtmin ()) #define SIGRTMAX (__libc_current_sigrtmax ()) diff --git a/libc/sysdeps/linux/sparc/bits/statfs.h b/libc/sysdeps/linux/alpha/bits/statfs.h index 6390f1c85..d838e6bf4 100644 --- a/libc/sysdeps/linux/sparc/bits/statfs.h +++ b/libc/sysdeps/linux/alpha/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2003 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 @@ -20,12 +20,12 @@ # error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead." #endif -#include <bits/types.h> /* for __fsid_t and __fsblkcnt_t*/ +#include <bits/types.h> /* for __fsid_t and __fsblkcnt_t. */ struct statfs { - long int f_type; - long int f_bsize; + int f_type; + int f_bsize; #ifndef __USE_FILE_OFFSET64 __fsblkcnt_t f_blocks; __fsblkcnt_t f_bfree; @@ -40,25 +40,28 @@ struct statfs __fsfilcnt64_t f_ffree; #endif __fsid_t f_fsid; - long int f_namelen; - long int f_spare[6]; + int f_namelen; + int f_frsize; + int f_spare[5]; }; #ifdef __USE_LARGEFILE64 struct statfs64 { - long int f_type; - long int f_bsize; + int f_type; + int f_bsize; __fsblkcnt64_t f_blocks; __fsblkcnt64_t f_bfree; __fsblkcnt64_t f_bavail; __fsfilcnt64_t f_files; __fsfilcnt64_t f_ffree; __fsid_t f_fsid; - long int f_namelen; - long int f_spare[6]; + int f_namelen; + int f_frsize; + int f_spare[5]; }; #endif -/* Tell code we have these members. */ +/* Tell code we have this member. */ #define _STATFS_F_NAMELEN +#define _STATFS_F_FRSIZE diff --git a/libc/sysdeps/linux/alpha/bits/syscalls.h b/libc/sysdeps/linux/alpha/bits/syscalls.h index 62541b873..3c227e643 100644 --- a/libc/sysdeps/linux/alpha/bits/syscalls.h +++ b/libc/sysdeps/linux/alpha/bits/syscalls.h @@ -4,16 +4,194 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -#include <features.h> - -/* Do something very evil for now. Until we create our own syscall - * macros, short circuit bits/sysnum.h and use asm/unistd.h instead */ -#include <asm/unistd.h> - /* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel * header files. It also defines the traditional `SYS_<name>' macros for older * programs. */ #include <bits/sysnum.h> -#endif /* _BITS_SYSCALLS_H */ +#ifndef __set_errno +# define __set_errno(val) (*__errno_location ()) = (val) +#endif + +#ifndef __ASSEMBLER__ + +#define _syscall_return(type) \ + return (_sc_err ? __set_errno(_sc_ret), _sc_ret = -1L : 0), (type) _sc_ret + +#define _syscall_clobbers \ + "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ + "$22", "$23", "$24", "$25", "$27", "$28" \ + +#define _syscall0(type, name) \ +type name(void) \ +{ \ + long _sc_ret, _sc_err; \ + { \ + register long _sc_0 __asm__("$0"); \ + register long _sc_19 __asm__("$19"); \ + \ + _sc_0 = __NR_##name; \ + __asm__("callsys # %0 %1 %2" \ + : "=r"(_sc_0), "=r"(_sc_19) \ + : "0"(_sc_0) \ + : _syscall_clobbers); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ + } \ + _syscall_return(type); \ +} +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) \ +{ \ + long _sc_ret, _sc_err; \ + { \ + register long _sc_0 __asm__("$0"); \ + register long _sc_16 __asm__("$16"); \ + register long _sc_19 __asm__("$19"); \ + \ + _sc_0 = __NR_##name; \ + _sc_16 = (long) (arg1); \ + __asm__("callsys # %0 %1 %2 %3" \ + : "=r"(_sc_0), "=r"(_sc_19) \ + : "0"(_sc_0), "r"(_sc_16) \ + : _syscall_clobbers); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ + } \ + _syscall_return(type); \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) \ +{ \ + long _sc_ret, _sc_err; \ + { \ + register long _sc_0 __asm__("$0"); \ + register long _sc_16 __asm__("$16"); \ + register long _sc_17 __asm__("$17"); \ + register long _sc_19 __asm__("$19"); \ + \ + _sc_0 = __NR_##name; \ + _sc_16 = (long) (arg1); \ + _sc_17 = (long) (arg2); \ + __asm__("callsys # %0 %1 %2 %3 %4" \ + : "=r"(_sc_0), "=r"(_sc_19) \ + : "0"(_sc_0), "r"(_sc_16), "r"(_sc_17) \ + : _syscall_clobbers); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ + } \ + _syscall_return(type); \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) \ +{ \ + long _sc_ret, _sc_err; \ + { \ + register long _sc_0 __asm__("$0"); \ + register long _sc_16 __asm__("$16"); \ + register long _sc_17 __asm__("$17"); \ + register long _sc_18 __asm__("$18"); \ + register long _sc_19 __asm__("$19"); \ + \ + _sc_0 = __NR_##name; \ + _sc_16 = (long) (arg1); \ + _sc_17 = (long) (arg2); \ + _sc_18 = (long) (arg3); \ + __asm__("callsys # %0 %1 %2 %3 %4 %5" \ + : "=r"(_sc_0), "=r"(_sc_19) \ + : "0"(_sc_0), "r"(_sc_16), "r"(_sc_17), \ + "r"(_sc_18) \ + : _syscall_clobbers); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ + } \ + _syscall_return(type); \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ + long _sc_ret, _sc_err; \ + { \ + register long _sc_0 __asm__("$0"); \ + register long _sc_16 __asm__("$16"); \ + register long _sc_17 __asm__("$17"); \ + register long _sc_18 __asm__("$18"); \ + register long _sc_19 __asm__("$19"); \ + \ + _sc_0 = __NR_##name; \ + _sc_16 = (long) (arg1); \ + _sc_17 = (long) (arg2); \ + _sc_18 = (long) (arg3); \ + _sc_19 = (long) (arg4); \ + __asm__("callsys # %0 %1 %2 %3 %4 %5 %6" \ + : "=r"(_sc_0), "=r"(_sc_19) \ + : "0"(_sc_0), "r"(_sc_16), "r"(_sc_17), \ + "r"(_sc_18), "1"(_sc_19) \ + : _syscall_clobbers); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ + } \ + _syscall_return(type); \ +} + +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ + long _sc_ret, _sc_err; \ + { \ + register long _sc_0 __asm__("$0"); \ + register long _sc_16 __asm__("$16"); \ + register long _sc_17 __asm__("$17"); \ + register long _sc_18 __asm__("$18"); \ + register long _sc_19 __asm__("$19"); \ + register long _sc_20 __asm__("$20"); \ + \ + _sc_0 = __NR_##name; \ + _sc_16 = (long) (arg1); \ + _sc_17 = (long) (arg2); \ + _sc_18 = (long) (arg3); \ + _sc_19 = (long) (arg4); \ + _sc_20 = (long) (arg5); \ + __asm__("callsys # %0 %1 %2 %3 %4 %5 %6 %7" \ + : "=r"(_sc_0), "=r"(_sc_19) \ + : "0"(_sc_0), "r"(_sc_16), "r"(_sc_17), \ + "r"(_sc_18), "1"(_sc_19), "r"(_sc_20) \ + : _syscall_clobbers); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ + } \ + _syscall_return(type); \ +} + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6)\ +{ \ + long _sc_ret, _sc_err; \ + { \ + register long _sc_0 __asm__("$0"); \ + register long _sc_16 __asm__("$16"); \ + register long _sc_17 __asm__("$17"); \ + register long _sc_18 __asm__("$18"); \ + register long _sc_19 __asm__("$19"); \ + register long _sc_20 __asm__("$20"); \ + register long _sc_21 __asm__("$21"); \ + \ + _sc_0 = __NR_##name; \ + _sc_16 = (long) (arg1); \ + _sc_17 = (long) (arg2); \ + _sc_18 = (long) (arg3); \ + _sc_19 = (long) (arg4); \ + _sc_20 = (long) (arg5); \ + _sc_21 = (long) (arg6); \ + __asm__("callsys # %0 %1 %2 %3 %4 %5 %6 %7 %8" \ + : "=r"(_sc_0), "=r"(_sc_19) \ + : "0"(_sc_0), "r"(_sc_16), "r"(_sc_17), \ + "r"(_sc_18), "1"(_sc_19), "r"(_sc_20), "r"(_sc_21) \ + : _syscall_clobbers); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ + } \ + _syscall_return(type); \ +} + +#endif /* __ASSEMBLER__ */ +#endif /* _BITS_SYSCALLS_H */ diff --git a/libc/sysdeps/linux/alpha/bits/termios.h b/libc/sysdeps/linux/alpha/bits/termios.h index 079073dd5..966ccf94d 100644 --- a/libc/sysdeps/linux/alpha/bits/termios.h +++ b/libc/sysdeps/linux/alpha/bits/termios.h @@ -1,5 +1,6 @@ /* termios type and macro definitions. Linux version. - Copyright (C) 1993, 94, 95, 96, 97, 99 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2003, 2005 + 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 @@ -36,6 +37,8 @@ struct termios cc_t c_line; /* line discipline (== c_cc[33]) */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 }; /* c_cc characters */ @@ -74,6 +77,7 @@ struct termios # define IXANY 0004000 # define IUCLC 0010000 # define IMAXBEL 0020000 +# define IUTF8 0040000 #endif /* c_oflag bits */ @@ -87,34 +91,42 @@ struct termios #define OFILL 00000100 #define OFDEL 00000200 -#define NLDLY 00001400 -#define NL0 00000000 -#define NL1 00000400 -#define NL2 00001000 -#define NL3 00001400 -#define TABDLY 00006000 -#define TAB0 00000000 -#define TAB1 00002000 -#define TAB2 00004000 -#define TAB3 00006000 -#define CRDLY 00030000 -#define CR0 00000000 -#define CR1 00010000 -#define CR2 00020000 -#define CR3 00030000 -#define FFDLY 00040000 -#define FF0 00000000 -#define FF1 00040000 -#define BSDLY 00100000 -#define BS0 00000000 -#define BS1 00100000 +#if defined __USE_MISC || defined __USE_XOPEN +# define NLDLY 00001400 +# define NL0 00000000 +# define NL1 00000400 +# define NL2 00001000 +# define NL3 00001400 +# define TABDLY 00006000 +# define TAB0 00000000 +# define TAB1 00002000 +# define TAB2 00004000 +# define TAB3 00006000 +# define CRDLY 00030000 +# define CR0 00000000 +# define CR1 00010000 +# define CR2 00020000 +# define CR3 00030000 +# define FFDLY 00040000 +# define FF0 00000000 +# define FF1 00040000 +# define BSDLY 00100000 +# define BS0 00000000 +# define BS1 00100000 +#endif + #define VTDLY 00200000 #define VT0 00000000 #define VT1 00200000 -#define XTABS 01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */ + +#ifdef __USE_MISC +# define XTABS 01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */ +#endif /* c_cflag bit meaning */ -#define CBAUD 0000037 +#ifdef __USE_MISC +# define CBAUD 0000037 +#endif #define B0 0000000 /* hang up */ #define B50 0000001 #define B75 0000002 @@ -131,9 +143,11 @@ struct termios #define B9600 0000015 #define B19200 0000016 #define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CBAUDEX 0000000 +#ifdef __USE_MISC +# define EXTA B19200 +# define EXTB B38400 +# define CBAUDEX 0000000 +#endif #define B57600 00020 #define B115200 00021 #define B230400 00022 @@ -165,23 +179,30 @@ struct termios #define HUPCL 00040000 #define CLOCAL 00100000 -#define CRTSCTS 020000000000 /* flow control */ +#ifdef __USE_MISC +# define CMSPAR 010000000000 /* mark or space (stick) parity */ +# define CRTSCTS 020000000000 /* flow control */ +#endif /* c_lflag bits */ #define ISIG 0x00000080 #define ICANON 0x00000100 -#define XCASE 0x00004000 +#if defined __USE_MISC || defined __USE_XOPEN +# define XCASE 0x00004000 +#endif #define ECHO 0x00000008 #define ECHOE 0x00000002 #define ECHOK 0x00000004 #define ECHONL 0x00000010 #define NOFLSH 0x80000000 #define TOSTOP 0x00400000 -#define ECHOCTL 0x00000040 -#define ECHOPRT 0x00000020 -#define ECHOKE 0x00000001 -#define FLUSHO 0x00800000 -#define PENDIN 0x20000000 +#ifdef __USE_MISC +# define ECHOCTL 0x00000040 +# define ECHOPRT 0x00000020 +# define ECHOKE 0x00000001 +# define FLUSHO 0x00800000 +# define PENDIN 0x20000000 +#endif #define IEXTEN 0x00000400 /* Values for the ACTION argument to `tcflow'. */ diff --git a/libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h b/libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h new file mode 100644 index 000000000..c48bd574d --- /dev/null +++ b/libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h @@ -0,0 +1,41 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +#define __UCLIBC_ABORT_INSTRUCTION__ "call_pal 0" + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#define __UCLIBC_SLIGHTLY_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#undef __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/alpha/bits/wordsize.h b/libc/sysdeps/linux/alpha/bits/wordsize.h index dd698fa97..22fc64109 100644 --- a/libc/sysdeps/linux/alpha/bits/wordsize.h +++ b/libc/sysdeps/linux/alpha/bits/wordsize.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2006 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 @@ -17,3 +17,14 @@ 02111-1307 USA. */ #define __WORDSIZE 64 + +#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL + +/* Signal that we didn't used to have a `long double'. The changes all + the `long double' function variants to be redirects to the double + functions. */ +# define __LONG_DOUBLE_MATH_OPTIONAL 1 +# ifndef __LONG_DOUBLE_128__ +# define __NO_LONG_DOUBLE_MATH 1 +# endif +#endif diff --git a/libc/sysdeps/linux/alpha/brk.S b/libc/sysdeps/linux/alpha/brk.S index a3f2edfe7..05c3b2c43 100644 --- a/libc/sysdeps/linux/alpha/brk.S +++ b/libc/sysdeps/linux/alpha/brk.S @@ -36,14 +36,14 @@ __curbrk: .skip 8 #else .comm __curbrk, 8 #endif +libc_hidden_data_def(__curbrk) .text -.globl __brk; -.hidden __brk; +.globl brk; .align 3; -.ent __brk , 0; +.ent brk , 0; -__brk: +brk: .frame $30 , 8 , $26 ldgp $29, 0($27) subq $30, 8, $30 @@ -77,7 +77,6 @@ $err0: ldi $0, ENOMEM $err1: addq $30, 8, $30 jmp $31, __syscall_error - .end __brk + .end brk -.weak brk; - brk = __brk +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/alpha/clone.S b/libc/sysdeps/linux/alpha/clone.S index ed5a4f487..9db118afd 100644 --- a/libc/sysdeps/linux/alpha/clone.S +++ b/libc/sysdeps/linux/alpha/clone.S @@ -29,11 +29,11 @@ /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ .text -.globl __clone; +.globl clone; .align 3; -.ent __clone , 0; +.ent clone , 0; -__clone: +clone: .frame $30 , 0, $26 .prologue 0 @@ -64,7 +64,7 @@ $error: 1: ldgp gp,0(gp) jmp zero,__syscall_error -.end __clone +.end clone /* Load up the arguments to the function. Put this block of code in its own function so that we can terminate the stack trace with our @@ -87,13 +87,9 @@ thread_start: /* Call _exit rather than doing it inline for breakpoint purposes */ mov v0,a0 - jsr ra,_exit_internal + jsr ra,HIDDEN_JUMPTARGET(_exit) /* Die horribly. */ halt .end thread_start - -.weak clone; - clone = __clone - diff --git a/libc/sysdeps/linux/alpha/divrem.h b/libc/sysdeps/linux/alpha/divrem.h index ca3db4b49..3a0ca1ca0 100644 --- a/libc/sysdeps/linux/alpha/divrem.h +++ b/libc/sysdeps/linux/alpha/divrem.h @@ -125,6 +125,7 @@ .ent UFUNC_NAME .globl UFUNC_NAME + .hidden UFUNC_NAME .align 3 UFUNC_NAME: diff --git a/libc/sysdeps/linux/alpha/syscall.S b/libc/sysdeps/linux/alpha/syscall.S new file mode 100644 index 000000000..1ccb5815f --- /dev/null +++ b/libc/sysdeps/linux/alpha/syscall.S @@ -0,0 +1,71 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger <davidm@azstarnet.com>, 1996. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <features.h> +#include <asm/regdef.h> +#include <asm/pal.h> + +/* + * This is for COMPATIBILITY with Linux/x86 only. Linux/Alpha system + * calls return an error indication in a3. This allows arbitrary 64bit + * values to be returned in v0 (because negative values are not + * mistaken as error numbers). However, C allows only one value to + * be returned, so the interface below folds the error indication passed in + * a3 back into v0: it sets v0 to -errno if an error occurs. Thus, + * no negative 64bit numbers can be returned. To avoid this problem, + * use assembly stubs wherever possible/convenient. + * + * Usage: + * + * long syscall(syscall_number, arg1, arg2, arg3, arg4, arg5) + * + * syscall_number = the index of the system call we're invoking + * arg1-arg5 = up to 5 integer arguments to the system call + * + * We need to do some arg shifting: the kernel expects the + * syscall number in v0 and the first five args in a0-a4. + * + */ + +.globl __syscall; +.align 4; +.ent __syscall, 0; +__syscall: +.frame sp, 0, ra + .prologue 0 + + mov a0, v0 /* Syscall number -> v0 */ + mov a1, a0 /* arg1-arg5 -> a0-a4 */ + mov a2, a1 + mov a3, a2 + mov a4, a3 + mov a5, a4 + + call_pal PAL_callsys /* Invoke system call */ + bne a3, $error + ret + +$error: + br gp, 2f +2: ldgp gp, 0(gp) + jmp zero,__syscall_error + +.end __syscall + +weak_alias (__syscall, syscall) diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch index 1ed4b6a6e..eef7a9d1a 100644 --- a/libc/sysdeps/linux/arm/Makefile.arch +++ b/libc/sysdeps/linux/arm/Makefile.arch @@ -5,10 +5,30 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CSRC := brk.c syscall.c ioperm.c iopl.c sigaction.c __syscall_error.c +CSRC := brk.c ioperm.c iopl.c sigaction.c __syscall_error.c SSRC := \ __longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S \ bsd-_setjmp.S sigrestorer.S mmap64.S +ifeq ($(CONFIG_ARM_EABI),y) +CSRC += aeabi_assert.c aeabi_atexit.c aeabi_errno_addr.c \ + aeabi_localeconv.c aeabi_memclr.c aeabi_memcpy.c \ + aeabi_memmove.c aeabi_memset.c find_exidx.c +SSRC += syscall-eabi.S +ifeq ($(UCLIBC_HAS_WCHAR),y) +CSRC += aeabi_mb_cur_max.c +endif +else +CSRC += syscall.c +endif + include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch + +ifeq ($(CONFIG_ARM_EABI),y) +libc-static-y += $(ARCH_OUT)/aeabi_lcsts.o $(ARCH_OUT)/aeabi_math.o \ + $(ARCH_OUT)/aeabi_sighandlers.o +libc-nonshared-y += $(ARCH_OUT)/aeabi_lcsts.os $(ARCH_OUT)/aeabi_math.os \ + $(ARCH_OUT)/aeabi_sighandlers.os +libc-shared-y += $(ARCH_OUT)/aeabi_unwind_cpp_pr1.os +endif diff --git a/libc/sysdeps/linux/arm/__longjmp.S b/libc/sysdeps/linux/arm/__longjmp.S index 822e15a69..27f127122 100644 --- a/libc/sysdeps/linux/arm/__longjmp.S +++ b/libc/sysdeps/linux/arm/__longjmp.S @@ -25,15 +25,25 @@ .global __longjmp .type __longjmp,%function -.align 4 +.align 2 __longjmp: mov ip, r0 /* save jmp_buf pointer */ movs r0, r1 /* get the return value in place */ moveq r0, #1 /* can't let setjmp() return zero! */ + ldmia ip!, {v1-v6, sl, fp, sp, lr} + #if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__ -# ifdef __MAVERICK__ +#ifdef __VFP_FP__ + /* Restore the VFP registers. */ + /* Following instruction is fldmiax ip!, {d8-d15}. */ + ldc p11, cr8, [r12], #68 + /* Restore the floating-point status register. */ + ldr r1, [ip], #4 + /* Following instruction is fmxr fpscr, r1. */ + mcr p10, 7, r1, cr1, cr0, 0 +# elif defined __MAVERICK__ cfldrd mvd4, [ip], #8 ; nop cfldrd mvd5, [ip], #8 ; nop cfldrd mvd6, [ip], #8 ; nop @@ -49,14 +59,13 @@ __longjmp: # else lfmfd f4, 4, [ip] ! /* load the floating point regs */ # endif -#else -# ifdef __MAVERICK__ - add ip, ip, #96 /* skip the FP registers */ -# else - add ip, ip, #48 /* skip the FP registers */ -# endif #endif - ldmia ip , {v1-v6, sl, fp, sp, pc} +#if defined(__USE_BX__) + bx lr +#else + mov pc, lr +#endif .size __longjmp,.-__longjmp +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/arm/__syscall_error.c b/libc/sysdeps/linux/arm/__syscall_error.c index 40b6b10dc..2b642e816 100644 --- a/libc/sysdeps/linux/arm/__syscall_error.c +++ b/libc/sysdeps/linux/arm/__syscall_error.c @@ -1,28 +1,17 @@ /* Wrapper for setting errno. - Copyright (C) 1997, 1998, 1999, 2000 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + * + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <errno.h> #include <features.h> /* This routine is jumped to by all the syscall handlers, to stash * an error number into errno. */ -int attribute_hidden __syscall_error(int err_no) +int __syscall_error(int err_no) attribute_hidden; +int __syscall_error(int err_no) { __set_errno(-err_no); return -1; diff --git a/libc/sysdeps/linux/arm/aeabi_assert.c b/libc/sysdeps/linux/arm/aeabi_assert.c new file mode 100644 index 000000000..e0985b446 --- /dev/null +++ b/libc/sysdeps/linux/arm/aeabi_assert.c @@ -0,0 +1,30 @@ +/* Copyright (C) 2004, 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#undef NDEBUG +#include <assert.h> +#include <stdlib.h> + +libc_hidden_proto(__assert) + +void +__aeabi_assert (const char *assertion, const char *file, + unsigned int line) +{ + __assert (assertion, file, line, NULL); +} diff --git a/libc/sysdeps/linux/arm/aeabi_atexit.c b/libc/sysdeps/linux/arm/aeabi_atexit.c new file mode 100644 index 000000000..4a7a6f1dc --- /dev/null +++ b/libc/sysdeps/linux/arm/aeabi_atexit.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdlib.h> + +extern int __cxa_atexit (void (*func) (void *), void *arg, void *dso_handle); +libc_hidden_proto(__cxa_atexit) + +/* Register a function to be called by exit or when a shared library + is unloaded. This routine is like __cxa_atexit, but uses the + calling sequence required by the ARM EABI. */ +int +__aeabi_atexit (void *arg, void (*func) (void *), void *d) +{ + return __cxa_atexit (func, arg, d); +} diff --git a/libc/sysdeps/linux/alpha/sysdep.c b/libc/sysdeps/linux/arm/aeabi_errno_addr.c index 17260f72f..09bdc1efe 100644 --- a/libc/sysdeps/linux/alpha/sysdep.c +++ b/libc/sysdeps/linux/arm/aeabi_errno_addr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005 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 @@ -18,10 +18,8 @@ #include <errno.h> -/* This routine is jumped to by all the syscall handlers, to stash - an error number into errno. */ -int __syscall_error (int err_no) +volatile int * +__aeabi_errno_addr (void) { - __set_errno (err_no); - return -1; + return &errno; } diff --git a/libc/sysdeps/linux/arm/aeabi_lcsts.c b/libc/sysdeps/linux/arm/aeabi_lcsts.c new file mode 100644 index 000000000..99c79851e --- /dev/null +++ b/libc/sysdeps/linux/arm/aeabi_lcsts.c @@ -0,0 +1,84 @@ +/* Link-time constants for ARM EABI. + Copyright (C) 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* The ARM EABI requires that we provide ISO compile-time constants as + link-time constants. Some portable applications may reference these. */ + +#include <errno.h> +#include <limits.h> +#include <locale.h> +#include <setjmp.h> +#include <signal.h> +#include <stdio.h> +#include <time.h> + +#define eabi_constant2(X,Y) const int __aeabi_##X attribute_hidden = Y +#define eabi_constant(X) const int __aeabi_##X attribute_hidden = X + +eabi_constant (EDOM); +eabi_constant (ERANGE); +eabi_constant (EILSEQ); + +eabi_constant (MB_LEN_MAX); + +eabi_constant (LC_COLLATE); +eabi_constant (LC_CTYPE); +eabi_constant (LC_MONETARY); +eabi_constant (LC_NUMERIC); +eabi_constant (LC_TIME); +eabi_constant (LC_ALL); + +/* The value of __aeabi_JMP_BUF_SIZE is the number of doublewords in a + jmp_buf. */ +eabi_constant2 (JMP_BUF_SIZE, sizeof (jmp_buf) / 8); + +eabi_constant (SIGABRT); +eabi_constant (SIGFPE); +eabi_constant (SIGILL); +eabi_constant (SIGINT); +eabi_constant (SIGSEGV); +eabi_constant (SIGTERM); + +eabi_constant2 (IOFBF, _IOFBF); +eabi_constant2 (IOLBF, _IOLBF); +eabi_constant2 (IONBF, _IONBF); +eabi_constant (BUFSIZ); +eabi_constant (FOPEN_MAX); +eabi_constant (TMP_MAX); +eabi_constant (FILENAME_MAX); +eabi_constant (L_tmpnam); + +eabi_constant (CLOCKS_PER_SEC); diff --git a/libc/sysdeps/linux/arm/aeabi_localeconv.c b/libc/sysdeps/linux/arm/aeabi_localeconv.c new file mode 100644 index 000000000..c9e9dd23f --- /dev/null +++ b/libc/sysdeps/linux/arm/aeabi_localeconv.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2004, 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <locale.h> + +libc_hidden_proto(localeconv) + +struct lconv * +__aeabi_localeconv (void) +{ + return localeconv (); +} diff --git a/libc/sysdeps/linux/arm/aeabi_math.c b/libc/sysdeps/linux/arm/aeabi_math.c new file mode 100644 index 000000000..e7f1dbf5f --- /dev/null +++ b/libc/sysdeps/linux/arm/aeabi_math.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2004, 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <math.h> + +const double __aeabi_HUGE_VAL attribute_hidden = HUGE_VAL; +const long double __aeabi_HUGE_VALL attribute_hidden = HUGE_VALL; +const float __aeabi_HUGE_VALF attribute_hidden = HUGE_VALF; +const float __aeabi_INFINITY attribute_hidden = INFINITY; +const float __aeabi_NAN attribute_hidden = NAN; diff --git a/libc/sysdeps/linux/arm/aeabi_mb_cur_max.c b/libc/sysdeps/linux/arm/aeabi_mb_cur_max.c new file mode 100644 index 000000000..937a7fffb --- /dev/null +++ b/libc/sysdeps/linux/arm/aeabi_mb_cur_max.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2004, 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <langinfo.h> +#include <locale.h> +#include <stdlib.h> + +#ifdef __UCLIBC_HAS_WCHAR__ +libc_hidden_proto(_stdlib_mb_cur_max) +#endif + +int +__aeabi_MB_CUR_MAX (void) +{ +#ifdef __UCLIBC_HAS_WCHAR__ + return MB_CUR_MAX; +#else + return 1; +#endif +} diff --git a/libc/sysdeps/linux/arm/aeabi_memclr.c b/libc/sysdeps/linux/arm/aeabi_memclr.c new file mode 100644 index 000000000..ed335c0ac --- /dev/null +++ b/libc/sysdeps/linux/arm/aeabi_memclr.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <string.h> + +libc_hidden_proto(memset) + +/* Clear memory. Can't alias to bzero because it's not defined in the + same translation unit. */ +void +__aeabi_memclr (void *dest, size_t n) +{ + memset (dest, 0, n); +} + +/* Versions of the above which may assume memory alignment. */ +strong_alias (__aeabi_memclr, __aeabi_memclr4) +strong_alias (__aeabi_memclr, __aeabi_memclr8) diff --git a/libc/sysdeps/linux/arm/aeabi_memcpy.c b/libc/sysdeps/linux/arm/aeabi_memcpy.c new file mode 100644 index 000000000..18c7a38ea --- /dev/null +++ b/libc/sysdeps/linux/arm/aeabi_memcpy.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <string.h> + +libc_hidden_proto(memcpy) + +/* Copy memory like memcpy, but no return value required. Can't alias + to memcpy because it's not defined in the same translation + unit. */ +void +__aeabi_memcpy (void *dest, const void *src, size_t n) +{ + memcpy (dest, src, n); +} + +/* Versions of the above which may assume memory alignment. */ +strong_alias (__aeabi_memcpy, __aeabi_memcpy4) +strong_alias (__aeabi_memcpy, __aeabi_memcpy8) diff --git a/libc/sysdeps/linux/arm/aeabi_memmove.c b/libc/sysdeps/linux/arm/aeabi_memmove.c new file mode 100644 index 000000000..70746ece4 --- /dev/null +++ b/libc/sysdeps/linux/arm/aeabi_memmove.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <string.h> + +libc_hidden_proto(memmove) + +/* Copy memory like memmove, but no return value required. Can't + alias to memmove because it's not defined in the same translation + unit. */ +void +__aeabi_memmove (void *dest, const void *src, size_t n) +{ + memmove (dest, src, n); +} + +/* Versions of the above which may assume memory alignment. */ +strong_alias (__aeabi_memmove, __aeabi_memmove4) +strong_alias (__aeabi_memmove, __aeabi_memmove8) diff --git a/libc/sysdeps/linux/arm/aeabi_memset.c b/libc/sysdeps/linux/arm/aeabi_memset.c new file mode 100644 index 000000000..8bf980b8b --- /dev/null +++ b/libc/sysdeps/linux/arm/aeabi_memset.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <string.h> + +libc_hidden_proto(memset) + +/* Set memory like memset, but different argument order and no return + value required. */ +void +__aeabi_memset (void *dest, size_t n, int c) +{ + memset (dest, c, n); +} + +/* Versions of the above which may assume memory alignment. */ +strong_alias (__aeabi_memset, __aeabi_memset4) +strong_alias (__aeabi_memset, __aeabi_memset8) diff --git a/libc/sysdeps/linux/arm/aeabi_sighandlers.S b/libc/sysdeps/linux/arm/aeabi_sighandlers.S new file mode 100644 index 000000000..ba9769fd0 --- /dev/null +++ b/libc/sysdeps/linux/arm/aeabi_sighandlers.S @@ -0,0 +1,52 @@ +/* Link-time constants for ARM EABI - signal handlers. + Copyright (C) 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* The ARM EABI defines these as "functions". */ + + .global __aeabi_SIG_DFL + .hidden __aeabi_SIG_DFL + .type __aeabi_SIG_DFL, %function + .set __aeabi_SIG_DFL, 0 + + .global __aeabi_SIG_IGN + .hidden __aeabi_SIG_IGN + .type __aeabi_SIG_IGN, %function + .set __aeabi_SIG_IGN, 1 + + .global __aeabi_SIG_ERR + .hidden __aeabi_SIG_ERR + .type __aeabi_SIG_ERR, %function + .set __aeabi_SIG_ERR, -1 diff --git a/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c b/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c new file mode 100644 index 000000000..e657d3836 --- /dev/null +++ b/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c @@ -0,0 +1,43 @@ +/* Copyright (C) 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Because some objects in ld.so and libc.so are built with + -fexceptions, we end up with references to this personality + routine. However, these libraries are not linked against + libgcc_eh.a, so we need a dummy definition. This routine will + never actually be called. */ + +#include <stdlib.h> + +attribute_hidden +void +__aeabi_unwind_cpp_pr0 (void) +{ +} + +attribute_hidden +void +__aeabi_unwind_cpp_pr1 (void) +{ +} + +attribute_hidden +void +__aeabi_unwind_cpp_pr2 (void) +{ +} diff --git a/libc/sysdeps/linux/arm/bits/setjmp.h b/libc/sysdeps/linux/arm/bits/setjmp.h index ad42f96cd..745cdb8f7 100644 --- a/libc/sysdeps/linux/arm/bits/setjmp.h +++ b/libc/sysdeps/linux/arm/bits/setjmp.h @@ -27,14 +27,22 @@ #ifndef _ASM /* Jump buffer contains v1-v6, sl, fp, sp and pc. Other registers are not saved. */ -#ifdef __MAVERICK__ +#ifdef __ARM_EABI__ +/* The exact set of registers saved may depend on the particular core + in use, as some coprocessor registers may need to be saved. The C + Library ABI requires that the buffer be 8-byte aligned, and + recommends that the buffer contain 64 words. The first 28 words + are occupied by v1-v6, sl, fp, sp, pc, d8-d15, and fpscr. (Note + that d8-15 require 17 words, due to the use of fstmx.) */ +typedef int __jmp_buf[64] __attribute__((aligned (8))); +#elif defined __MAVERICK__ typedef int __jmp_buf[34]; #else typedef int __jmp_buf[22]; #endif #endif -#define __JMP_BUF_SP 20 +#define __JMP_BUF_SP 8 /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ diff --git a/libc/sysdeps/linux/arm/bits/syscalls.h b/libc/sysdeps/linux/arm/bits/syscalls.h index 21e5b8146..d25d1824e 100644 --- a/libc/sysdeps/linux/arm/bits/syscalls.h +++ b/libc/sysdeps/linux/arm/bits/syscalls.h @@ -21,7 +21,22 @@ glibc-2.3.2/sysdeps/unix/sysv/linux/arm/sysdep.h */ -#ifndef __ASSEMBLER__ +#ifdef __ASSEMBLER__ +/* Call a given syscall, with arguments loaded. For EABI, we must + save and restore r7 for the syscall number. Unlike the DO_CALL + macro in glibc, this macro does not load syscall arguments. */ +#undef DO_CALL +#if defined(__ARM_EABI__) +#define DO_CALL(syscall_name) \ + mov ip, r7; \ + ldr r7, =SYS_ify (syscall_name); \ + swi 0x0; \ + mov r7, ip; +#else +#define DO_CALL(syscall_name) \ + swi SYS_ify (syscall_name); +#endif +#else #undef _syscall0 #define _syscall0(type,name) \ @@ -85,18 +100,33 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7) #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0)) \ + ({ unsigned int __sys_result = INTERNAL_SYSCALL (name, , nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (__sys_result, ), 0)) \ { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned int) -1; \ + __set_errno (INTERNAL_SYSCALL_ERRNO (__sys_result, )); \ + __sys_result = (unsigned int) -1; \ } \ - (int) _sys_result; }) + (int) __sys_result; }) #undef INTERNAL_SYSCALL_DECL #define INTERNAL_SYSCALL_DECL(err) do { } while (0) #undef INTERNAL_SYSCALL +#if defined(__ARM_EABI__) +#define INTERNAL_SYSCALL(name, err, nr, args...) \ + ({unsigned int _sys_result; \ + { \ + register int _a1 asm ("r0"), _nr asm ("r7"); \ + LOAD_ARGS_##nr (args) \ + _nr = SYS_ify(name); \ + asm volatile ("swi 0x0 @ syscall " #name \ + : "=r" (_a1) \ + : "r" (_nr) ASM_ARGS_##nr \ + : "memory"); \ + _sys_result = _a1; \ + } \ + (int) _sys_result; }) +#else /* !defined(__ARM_EABI__) */ #if !defined(__thumb__) #define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ unsigned int _sys_result; \ @@ -111,6 +141,11 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } \ (int) _sys_result; }) #else +#if 0 +/* This doesn't work because GCC uses r7 as a frame pointer in + * some cases and doesn't notice that the _r7 value changes + * it, resulting in mysterious crashes after the SWI. + */ #define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ unsigned int _sys_result; \ { \ @@ -124,7 +159,30 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7) _sys_result = _a1; \ } \ (int) _sys_result; }) +#else +/* So hide the use of r7 from the compiler, this would be a lot + * easier but for the fact that the syscalls can exceed 255. + * For the moment the LOAD_ARG_7 is sacrificed. + */ +#define INTERNAL_SYSCALL(name, err, nr, args...) \ + ({ unsigned int _sys_result; \ + { \ + register int _a1 asm ("a1"); \ + LOAD_ARGS_##nr (args) \ + register int _v3 asm ("v3") = (int) (SYS_ify(name)); \ + asm volatile ("push {r7}\n" \ + "\tmov r7, v3\n" \ + "\tswi 0 @ syscall " #name "\n" \ + "\tpop {r7}" \ + : "=r" (_a1) \ + : "r" (_v3) ASM_ARGS_##nr \ + : "memory"); \ + _sys_result = _a1; \ + } \ + (int) _sys_result; }) +#endif #endif +#endif /* !defined(__ARM_EABI__) */ #undef INTERNAL_SYSCALL_ERROR_P #define INTERNAL_SYSCALL_ERROR_P(val, err) \ diff --git a/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h b/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h new file mode 100644 index 000000000..93b523f0d --- /dev/null +++ b/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h @@ -0,0 +1,41 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +#define __UCLIBC_ABORT_INSTRUCTION__ "bl abort" + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#define __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/arm/brk.c b/libc/sysdeps/linux/arm/brk.c index e711db3b1..185d9b4dc 100644 --- a/libc/sysdeps/linux/arm/brk.c +++ b/libc/sysdeps/linux/arm/brk.c @@ -21,10 +21,15 @@ #include <unistd.h> #include <sys/syscall.h> +libc_hidden_proto(brk) + /* This must be initialized data because commons can't have aliases. */ +extern void *__curbrk; +libc_hidden_proto(__curbrk) void *__curbrk = 0; +libc_hidden_data_def(__curbrk) -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk = (void*)INTERNAL_SYSCALL(brk, , 1, addr); @@ -37,4 +42,4 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/arm/bsd-_setjmp.S b/libc/sysdeps/linux/arm/bsd-_setjmp.S index 3f3a986b3..4e36143f8 100644 --- a/libc/sysdeps/linux/arm/bsd-_setjmp.S +++ b/libc/sysdeps/linux/arm/bsd-_setjmp.S @@ -27,7 +27,7 @@ .global _setjmp .type _setjmp,%function -.align 4 +.align 2 _setjmp: mov r1, #0 #ifdef __PIC__ diff --git a/libc/sysdeps/linux/arm/bsd-setjmp.S b/libc/sysdeps/linux/arm/bsd-setjmp.S index 3e5ff59fa..e803d1583 100644 --- a/libc/sysdeps/linux/arm/bsd-setjmp.S +++ b/libc/sysdeps/linux/arm/bsd-setjmp.S @@ -27,7 +27,7 @@ .global setjmp .type setjmp,%function -.align 4 +.align 2 setjmp: mov r1, #1 #ifdef __PIC__ diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S index 946d4bdda..a5a847d1e 100644 --- a/libc/sysdeps/linux/arm/clone.S +++ b/libc/sysdeps/linux/arm/clone.S @@ -21,6 +21,7 @@ and invokes a function in the right context after its all over. */ #define _ERRNO_H +#include <features.h> #include <bits/errno.h> #include <sys/syscall.h> @@ -28,10 +29,10 @@ /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ .text -.global __clone -.type __clone,%function -.align 4 -__clone: +.global clone +.type clone,%function +.align 2 +clone: @ sanity check args cmp r0, #0 cmpne r1, #0 @@ -48,10 +49,14 @@ __clone: @ get flags mov r0, r2 @ new sp is already in r1 - swi __NR_clone + DO_CALL (clone) movs a1, a1 blt __error - movne pc, lr +#if defined(__USE_BX__) + bxne lr +#else + movne pc, lr +#endif @ pick the function arg and call address off the stack and execute ldr r0, [sp, #4] @@ -59,14 +64,11 @@ __clone: ldr pc, [sp] @ and we are done, passing the return value through r0 - b _exit_internal + b HIDDEN_JUMPTARGET(_exit) __error: b __syscall_error -.size __clone,.-__clone - -.weak clone - clone = __clone +.size clone,.-clone #endif diff --git a/libc/sysdeps/linux/arm/crt1.S b/libc/sysdeps/linux/arm/crt1.S index 7470715a1..02c2f8de9 100644 --- a/libc/sysdeps/linux/arm/crt1.S +++ b/libc/sysdeps/linux/arm/crt1.S @@ -110,9 +110,19 @@ _start: mov fp, #0 mov lr, #0 +#ifdef __ARCH_USE_MMU__ /* Pop argc off the stack and save a pointer to argv */ ldr a2, [sp], #4 mov a3, sp +#else + /* + * uClinux/arm stacks look a little different from normal + * MMU-full Linux/arm stacks (for no good reason) + */ + /* pull argc and argv off the stack */ + ldr a2, [sp, #0] + ldr a3, [sp, #4] +#endif /* Push stack limit */ str a3, [sp, #-4]! diff --git a/libc/sysdeps/linux/arm/find_exidx.c b/libc/sysdeps/linux/arm/find_exidx.c new file mode 100644 index 000000000..9e4f4012f --- /dev/null +++ b/libc/sysdeps/linux/arm/find_exidx.c @@ -0,0 +1,80 @@ +/* Copyright (C) 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <link.h> +#include <unwind.h> + +struct unw_eh_callback_data +{ + _Unwind_Ptr pc; + _Unwind_Ptr exidx_start; + int exidx_len; +}; + + +/* Callback to determins if the PC lies within an object, and remember the + location of the exception index table if it does. */ + +static int +find_exidx_callback (struct dl_phdr_info * info, size_t size, void * ptr) +{ + struct unw_eh_callback_data * data; + const ElfW(Phdr) *phdr; + int i; + int match; + _Unwind_Ptr load_base; + + data = (struct unw_eh_callback_data *) ptr; + load_base = info->dlpi_addr; + phdr = info->dlpi_phdr; + + match = 0; + for (i = info->dlpi_phnum; i > 0; i--, phdr++) + { + if (phdr->p_type == PT_LOAD) + { + _Unwind_Ptr vaddr = phdr->p_vaddr + load_base; + if (data->pc >= vaddr && data->pc < vaddr + phdr->p_memsz) + match = 1; + } + else if (phdr->p_type == PT_ARM_EXIDX) + { + data->exidx_start = (_Unwind_Ptr) (phdr->p_vaddr + load_base); + data->exidx_len = phdr->p_memsz; + } + } + + return match; +} + + +/* Find the exception index table containing PC. */ + +_Unwind_Ptr +__gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount) +{ + struct unw_eh_callback_data data; + + data.pc = pc; + data.exidx_start = 0; + if (dl_iterate_phdr (find_exidx_callback, &data) <= 0) + return 0; + + *pcount = data.exidx_len / 8; + return data.exidx_start; +} diff --git a/libc/sysdeps/linux/arm/fpu_control.h b/libc/sysdeps/linux/arm/fpu_control.h index 8c13ca3a3..31d81ea29 100644 --- a/libc/sysdeps/linux/arm/fpu_control.h +++ b/libc/sysdeps/linux/arm/fpu_control.h @@ -20,7 +20,34 @@ #ifndef _FPU_CONTROL_H #define _FPU_CONTROL_H -#ifdef __MAVERICK__ +#ifdef __VFP_FP__ + +/* masking of interrupts */ +#define _FPU_MASK_IM 0x00000100 /* invalid operation */ +#define _FPU_MASK_ZM 0x00000200 /* divide by zero */ +#define _FPU_MASK_OM 0x00000400 /* overflow */ +#define _FPU_MASK_UM 0x00000800 /* underflow */ +#define _FPU_MASK_PM 0x00001000 /* inexact */ + +/* Some bits in the FPSCR are not yet defined. They must be preserved when + modifying the contents. */ +#define _FPU_RESERVED 0x0e08e0e0 +#define _FPU_DEFAULT 0x00000000 +/* Default + exceptions enabled. */ +#define _FPU_IEEE (_FPU_DEFAULT | 0x00001f00) + +/* Type of the control word. */ +typedef unsigned int fpu_control_t; + +/* Macros for accessing the hardware control word. */ +/* This is fmrx %0, fpscr. */ +#define _FPU_GETCW(cw) \ + __asm__ __volatile__ ("mrc p10, 7, %0, cr1, cr0, 0" : "=r" (cw)) +/* This is fmxr fpscr, %0. */ +#define _FPU_SETCW(cw) \ + __asm__ __volatile__ ("mcr p10, 7, %0, cr1, cr0, 0" : : "r" (cw)) + +#elif defined __MAVERICK__ /* DSPSC register: (from EP9312 User's Guide) * diff --git a/libc/sysdeps/linux/arm/ioperm.c b/libc/sysdeps/linux/arm/ioperm.c index 0c0c21182..a0a4e7d1d 100644 --- a/libc/sysdeps/linux/arm/ioperm.c +++ b/libc/sysdeps/linux/arm/ioperm.c @@ -33,12 +33,6 @@ the area affected (this is a kernel limitation). So we now just enable all the ports all of the time. */ -#define readlink __readlink -#define mmap __mmap -#define sscanf __sscanf -#define fscanf __fscanf -#define fgets __fgets - #include <errno.h> #include <fcntl.h> #include <stdio.h> @@ -53,6 +47,22 @@ #include <asm/page.h> #include <sys/sysctl.h> +#include <sys/io.h> + +libc_hidden_proto(ioperm) + +libc_hidden_proto(readlink) +libc_hidden_proto(mmap) +libc_hidden_proto(sscanf) +libc_hidden_proto(fscanf) +libc_hidden_proto(fprintf) +libc_hidden_proto(fgets) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(strcmp) +libc_hidden_proto(open) +libc_hidden_proto(close) + #include <linux/version.h> #define PATH_ARM_SYSTYPE "/etc/arm_systype" @@ -163,7 +173,7 @@ init_iosys (void) /* translate systype name into i/o system: */ for (i = 0; i < sizeof (platform) / sizeof (platform[0]); ++i) { - if (__strcmp (platform[i].name, systype) == 0) { + if (strcmp (platform[i].name, systype) == 0) { io.shift = platform[i].shift; io.io_base = platform[i].io_base; io.initdone = 1; @@ -191,14 +201,14 @@ int ioperm (unsigned long int from, unsigned long int num, int turn_on) if (! io.base) { int fd; - fd = __open ("/dev/mem", O_RDWR); + fd = open ("/dev/mem", O_RDWR); if (fd < 0) return -1; io.base = (unsigned long int) mmap (0, MAX_PORT << io.shift, PROT_READ | PROT_WRITE, MAP_SHARED, fd, io.io_base); - __close (fd); + close (fd); if ((long) io.base == -1) return -1; } @@ -206,6 +216,7 @@ int ioperm (unsigned long int from, unsigned long int num, int turn_on) return 0; } +libc_hidden_def(ioperm) void @@ -223,27 +234,27 @@ outw(unsigned short b, unsigned long int port) void -outl(unsigned int b, unsigned long int port) +outl(unsigned long b, unsigned long int port) { *((volatile unsigned long *)(IO_ADDR (port))) = b; } -unsigned int +unsigned char inb (unsigned long int port) { return *((volatile unsigned char *)(IO_ADDR (port))); } -unsigned int +unsigned short int inw(unsigned long int port) { return *((volatile unsigned short *)(IO_ADDR (port))); } -unsigned int +unsigned long int inl(unsigned long int port) { return *((volatile unsigned long *)(IO_ADDR (port))); diff --git a/libc/sysdeps/linux/arm/iopl.c b/libc/sysdeps/linux/arm/iopl.c index 0cd306d42..552ba6c67 100644 --- a/libc/sysdeps/linux/arm/iopl.c +++ b/libc/sysdeps/linux/arm/iopl.c @@ -21,6 +21,8 @@ #include <sys/io.h> #include <errno.h> +libc_hidden_proto(ioperm) + #define MAX_PORT 0x10000 int iopl(int level) diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S index dd6f3c477..ba8cb2fca 100644 --- a/libc/sysdeps/linux/arm/mmap64.S +++ b/libc/sysdeps/linux/arm/mmap64.S @@ -27,8 +27,42 @@ .text .global mmap64 .type mmap64,%function -.align 4 +.align 2 mmap64: + +#ifdef __ARM_EABI__ +#ifdef __ARMEB__ +# define LOW_OFFSET 8 + 4 +/* The initial + 4 is for the stack postdecrement. */ +# define HIGH_OFFSET 4 + 8 + 0 +#else +# define LOW_OFFSET 8 + 0 +# define HIGH_OFFSET 4 + 8 + 4 +#endif + ldr ip, [sp, $LOW_OFFSET] + str r5, [sp, #-4]! + ldr r5, [sp, $HIGH_OFFSET] + str r4, [sp, #-4]! + movs r4, ip, lsl $20 @ check that offset is page-aligned + mov ip, ip, lsr $12 + moveqs r4, r5, lsr $12 @ check for overflow + bne .Linval + ldr r4, [sp, $8] @ load fd + orr r5, ip, r5, lsl $20 @ compose page offset + DO_CALL (mmap2) + cmn r0, $4096 + ldmfd sp!, {r4, r5} +#if defined(__USE_BX__) + bxcc lr +#else + movcc pc, lr +#endif + b __syscall_error +.Linval: + mov r0, $-EINVAL + ldmfd sp!, {r4, r5} + b __syscall_error +#else stmfd sp!, {r4, r5, lr} ldr r5, [sp, $16] ldr r4, [sp, $12] @@ -40,7 +74,7 @@ mmap64: movs ip, ip, lsr $12 bne .Linval @ check for overflow mov ip, r0 - swi __NR_mmap2 + DO_CALL (mmap2) cmn r0, $4096 ldmccfd sp!, {r4, r5, pc} cmn r0, $ENOSYS @@ -52,7 +86,7 @@ mmap64: mov r0, ip @ first arg was clobbered teq r5, $0 ldmeqfd sp!, {r4, r5, lr} - beq __mmap + beq HIDDEN_JUMPTARGET(mmap) .Linval: mov r0, $-EINVAL ldmfd sp!, {r4, r5, lr} @@ -60,7 +94,7 @@ mmap64: __error: b __syscall_error - +#endif .size mmap64,.-mmap64 #endif diff --git a/libc/sysdeps/linux/arm/setjmp.S b/libc/sysdeps/linux/arm/setjmp.S index 4048d7934..dea6f5675 100644 --- a/libc/sysdeps/linux/arm/setjmp.S +++ b/libc/sysdeps/linux/arm/setjmp.S @@ -24,41 +24,38 @@ .global __sigsetjmp .type __sigsetjmp,%function -.align 4 +.align 2 __sigsetjmp: + mov ip, r0 + /* Save registers */ + stmia ip!, {v1-v6, sl, fp, sp, lr} #if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__ -# ifdef __MAVERICK__ - cfstrd mvd4, [r0], #8 ; nop - cfstrd mvd5, [r0], #8 ; nop - cfstrd mvd6, [r0], #8 ; nop - cfstrd mvd7, [r0], #8 ; nop - cfstrd mvd8, [r0], #8 ; nop - cfstrd mvd9, [r0], #8 ; nop - cfstrd mvd10, [r0], #8 ; nop - cfstrd mvd11, [r0], #8 ; nop - cfstrd mvd12, [r0], #8 ; nop - cfstrd mvd13, [r0], #8 ; nop - cfstrd mvd14, [r0], #8 ; nop - cfstrd mvd15, [r0], #8 -# else - sfmea f4, 4, [r0]! -# endif -#else -# ifdef __MAVERICK__ - add r0, r0, #96 /* skip the FP registers */ +# ifdef __VFP_FP__ + /* Store the VFP registers. */ + /* Following instruction is fstmiax ip!, {d8-d15}. */ + stc p11, cr8, [r12], #68 + /* Store the floating-point status register. */ + /* Following instruction is fmrx r2, fpscr. */ + mrc p10, 7, r2, cr1, cr0, 0 + str r2, [ip], #4 +# elif defined __MAVERICK__ + cfstrd mvd4, [ip], #8 ; nop + cfstrd mvd5, [ip], #8 ; nop + cfstrd mvd6, [ip], #8 ; nop + cfstrd mvd7, [ip], #8 ; nop + cfstrd mvd8, [ip], #8 ; nop + cfstrd mvd9, [ip], #8 ; nop + cfstrd mvd10, [ip], #8 ; nop + cfstrd mvd11, [ip], #8 ; nop + cfstrd mvd12, [ip], #8 ; nop + cfstrd mvd13, [ip], #8 ; nop + cfstrd mvd14, [ip], #8 ; nop + cfstrd mvd15, [ip], #8 # else - add r0, r0, #48 /* skip the FP registers */ + sfmea f4, 4, [ip]! # endif #endif - stmia r0, {v1-v6, sl, fp, sp, lr} - - /* Restore pointer to jmp_buf */ -#ifdef __MAVERICK__ - sub r0, r0, #96 -#else - sub r0, r0, #48 -#endif /* Make a tail call to __sigjmp_save; it takes the same args. */ #ifdef __PIC__ diff --git a/libc/sysdeps/linux/arm/sigaction.c b/libc/sysdeps/linux/arm/sigaction.c index c2f79c337..1066d33dd 100644 --- a/libc/sysdeps/linux/arm/sigaction.c +++ b/libc/sysdeps/linux/arm/sigaction.c @@ -29,6 +29,8 @@ extern void __default_sa_restorer(void); extern void __default_rt_sa_restorer(void); +extern __typeof(sigaction) __libc_sigaction; + /* When RT signals are in use we need to use a different return stub. */ #ifdef __NR_rt_sigreturn #define choose_restorer(flags) \ @@ -39,10 +41,9 @@ extern void __default_rt_sa_restorer(void); __default_sa_restorer #endif - - #ifdef __NR_rt_sigaction +libc_hidden_proto(memcpy) /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ @@ -53,7 +54,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (act) { kact.k_sa_handler = act->sa_handler; - __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER /* If the user specified SA_ONSTACK this means she is trying to @@ -78,7 +79,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER oact->sa_restorer = koact.sa_restorer; @@ -90,8 +91,6 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa #else - - /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) @@ -129,6 +128,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa #endif #ifndef LIBC_SIGACTION -hidden_weak_alias(__libc_sigaction,__sigaction) +libc_hidden_proto(sigaction) weak_alias(__libc_sigaction,sigaction) +libc_hidden_weak(sigaction) #endif diff --git a/libc/sysdeps/linux/arm/sigrestorer.S b/libc/sysdeps/linux/arm/sigrestorer.S index b4e17326b..bc175de6a 100644 --- a/libc/sysdeps/linux/arm/sigrestorer.S +++ b/libc/sysdeps/linux/arm/sigrestorer.S @@ -24,17 +24,17 @@ .global __default_sa_restorer .type __default_sa_restorer,%function -.align 4 +.align 2 __default_sa_restorer: - swi __NR_sigreturn + DO_CALL (sigreturn) #ifdef __NR_rt_sigreturn .global __default_rt_sa_restorer .type __default_rt_sa_restorer,%function -.align 4 +.align 2 __default_rt_sa_restorer: - swi __NR_rt_sigreturn + DO_CALL (rt_sigreturn) #endif diff --git a/libc/sysdeps/linux/arm/syscall-eabi.S b/libc/sysdeps/linux/arm/syscall-eabi.S new file mode 100644 index 000000000..efc30690c --- /dev/null +++ b/libc/sysdeps/linux/arm/syscall-eabi.S @@ -0,0 +1,47 @@ +/* Copyright (C) 2005 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/syscall.h> + +/* In the EABI syscall interface, we don't need a special syscall to + implement syscall(). It won't work reliably with 64-bit arguments + (but that is true on many modern platforms). */ + +.text +.global syscall +.type syscall,%function +.align 4 +syscall: + mov ip, sp + stmfd sp!, {r4, r5, r6, r7} + mov r7, r0 + mov r0, r1 + mov r1, r2 + mov r2, r3 + ldmfd ip, {r3, r4, r5, r6} + swi 0x0 + ldmfd sp!, {r4, r5, r6, r7} + cmn r0, #4096 +#if defined(__USE_BX__) + bxcc lr +#else + movcc pc, lr +#endif + b __syscall_error + +.size syscall,.-syscall diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S index 68798995a..5092023a8 100644 --- a/libc/sysdeps/linux/arm/vfork.S +++ b/libc/sysdeps/linux/arm/vfork.S @@ -2,7 +2,7 @@ /* vfork for uClibc * * Copyright (C) 2000 by Lineo, inc. and Erik Andersen - * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org> + * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org> * Written by Erik Andersen <andersen@uclibc.org> * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. @@ -24,9 +24,13 @@ __vfork: #ifdef __NR_vfork - swi __NR_vfork + DO_CALL (vfork) cmn r0, #4096 +#if defined(__USE_BX__) + bxcc lr +#else movcc pc, lr +#endif /* Check if vfork even exists. */ ldr r1, =-ENOSYS @@ -35,15 +39,20 @@ __vfork: #endif /* If we don't have vfork, use fork. */ - swi __NR_fork + DO_CALL (fork) cmn r0, #4096 /* Syscall worked. Return to child/parent */ +#if defined(__USE_BX__) + bxcc lr +#else movcc pc, lr +#endif __error: b __syscall_error .size __vfork,.-__vfork -strong_alias(__vfork,vfork) +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) #endif diff --git a/libc/sysdeps/linux/bfin/README.bfin b/libc/sysdeps/linux/bfin/README.bfin deleted file mode 100644 index e27b41dd7..000000000 --- a/libc/sysdeps/linux/bfin/README.bfin +++ /dev/null @@ -1,21 +0,0 @@ -README for uClibc on the blackfin architecture - -developed/tested with bfin-elf-gcc 3.4.1, from - -Configuration: - - Read and edit the Config file, carefully. - - TARGET_ARCH=blackfin - CROSS = bfin-elf- - CC = $(CROSS)gcc - STRIPTOOL = $(CROSS)strip - KERNEL_SOURCE= your linux 2.6.8 kernel source tree - HAS_MMU = false - HAS_FLOATS = false - MALLOC = malloc-simple - -Problems: - The regular malloc library is broken. Use simple-malloc. - -TODO: diff --git a/libc/sysdeps/linux/bfin/__longjmp.S b/libc/sysdeps/linux/bfin/__longjmp.S index 4c5189976..8648b2d7d 100644 --- a/libc/sysdeps/linux/bfin/__longjmp.S +++ b/libc/sysdeps/linux/bfin/__longjmp.S @@ -14,7 +14,9 @@ #define _ASM #include <bits/setjmp.h> -.globl ___longjmp; +.text +.global ___longjmp; +.type ___longjmp,STT_FUNC; .align 4; ___longjmp: @@ -107,4 +109,4 @@ ___longjmp: R0 = 1; finished: RTS; -___longjmp.end: +.size ___longjmp,.-___longjmp diff --git a/libc/sysdeps/linux/bfin/bits/kernel_types.h b/libc/sysdeps/linux/bfin/bits/kernel_types.h index 520daf184..702a5f03a 100644 --- a/libc/sysdeps/linux/bfin/bits/kernel_types.h +++ b/libc/sysdeps/linux/bfin/bits/kernel_types.h @@ -1,6 +1,6 @@ /* Note that we use the exact same include guard #define names - * as asm/posix_types.h. This will avoid gratuitous conflicts - * with the posix_types.h kernel header, and will ensure that + * as asm/posix_types.h. This will avoid gratuitous conflicts + * with the posix_types.h kernel header, and will ensure that * our private content, and not the kernel header, will win. * -Erik */ @@ -31,6 +31,7 @@ typedef unsigned int __kernel_gid32_t; typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; typedef long long __kernel_loff_t; +typedef __kernel_dev_t __kernel_old_dev_t; typedef struct { #ifdef __USE_ALL diff --git a/libc/sysdeps/linux/bfin/bits/syscalls.h b/libc/sysdeps/linux/bfin/bits/syscalls.h index 82692fc65..d8d628cab 100644 --- a/libc/sysdeps/linux/bfin/bits/syscalls.h +++ b/libc/sysdeps/linux/bfin/bits/syscalls.h @@ -139,5 +139,35 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ __syscall_return(type,__res); \ } +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \ + long __res; \ + __asm__ __volatile__ ( \ + "[--sp] = r5;\n\t" \ + "[--sp] = r4;\n\t" \ + "[--sp] = r3;\n\t" \ + "r4=%6;\n\t" \ + "r3=%5;\n\t" \ + "r2=%4;\n\t" \ + "r1=%3;\n\t" \ + "r0=%2;\n\t" \ + "P0=%1;\n\t" \ + "excpt 0;\n\t" \ + "%0=r0;\n\t" \ + "r3 = [sp++];\n\t" \ + "r4 = [sp++];\n\t" \ + "r5 = [sp++];\n\t" \ + : "=da" (__res) \ + : "i" (__NR_##name), \ + "rm" ((long)(arg1)), \ + "rm" ((long)(arg2)), \ + "rm" ((long)(arg3)), \ + "rm" ((long)(arg4)), \ + "rm" ((long)(arg5)), \ + "rm" ((long)(arg6)) \ + : "CC","R0","R1","R2","R3","R4","R5","P0"); \ +__syscall_return(type,__res); \ +} + #endif /* __ASSEMBLER__ */ #endif /* _BITS_SYSCALLS_H */ diff --git a/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h b/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h new file mode 100644 index 000000000..1b40e32a2 --- /dev/null +++ b/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h @@ -0,0 +1,42 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/ +#undef __UCLIBC_ABORT_INSTRUCTION__ + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#undef __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/bfin/brk.c b/libc/sysdeps/linux/bfin/brk.c index 1cb30216d..1df3ae517 100644 --- a/libc/sysdeps/linux/bfin/brk.c +++ b/libc/sysdeps/linux/bfin/brk.c @@ -1,12 +1,22 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <unistd.h> #include <sys/syscall.h> #include <errno.h> +libc_hidden_proto(brk) + /* This must be initialized data because commons can't have aliases. */ +extern void * __curbrk; +libc_hidden_proto(__curbrk) void * __curbrk = 0; +libc_hidden_data_def(__curbrk) -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; @@ -28,4 +38,4 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/bfin/bsd-_setjmp.S b/libc/sysdeps/linux/bfin/bsd-_setjmp.S index 969515fa6..6f17a6025 100644 --- a/libc/sysdeps/linux/bfin/bsd-_setjmp.S +++ b/libc/sysdeps/linux/bfin/bsd-_setjmp.S @@ -6,7 +6,9 @@ #define _SETJMP_H #include <bits/setjmp.h> -.globl _setjmp; +.text +.global _setjmp; +.type _setjmp,STT_FUNC; .align 4; _setjmp: @@ -92,6 +94,4 @@ _setjmp: R0 = 0; RTS; -_setjmp.end: - - +.size _setjmp,.-_setjmp diff --git a/libc/sysdeps/linux/bfin/clone.c b/libc/sysdeps/linux/bfin/clone.c index 746da8e22..f326f00a0 100644 --- a/libc/sysdeps/linux/bfin/clone.c +++ b/libc/sysdeps/linux/bfin/clone.c @@ -1,11 +1,9 @@ /* * libc/sysdeps/linux/bfin/clone.c -- `clone' syscall for linux/blackfin * + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License. See the file COPYING.LIB in the main - * directory of this archive for more details. - * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #include <asm/unistd.h> diff --git a/libc/sysdeps/linux/bfin/crt0.S b/libc/sysdeps/linux/bfin/crt0.S deleted file mode 100644 index 4ddfd16b9..000000000 --- a/libc/sysdeps/linux/bfin/crt0.S +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (C) 1991, 1992 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - - -/* When we enter this piece of code, the user stack looks like this: -* argc argument counter (integer) -* argv[0] program name (pointer) -* argv[1...N] program args (pointers) -* NULL -* env[0...N] environment variables (pointers) -* NULL - -* When we are done here, we want -* R0=argc -* R1=*argv[0] -* R2=*envp[0] -*/ - -.text -.align 2 -.global _start; -.type _start,STT_FUNC; -.global ___uClibc_main; -.type ___uClibc_main,STT_FUNC; - -/* Stick in a dummy reference to main(), so that if an application - * is linking when the main() function is in a static library (.a) - * we can be sure that main() actually gets linked in */ - -.type _main,STT_FUNC; - -_start: - -/* clear the frame pointer */ - FP = 0; -/* Load register R0 (argc) from the stack to its final resting place */ - P0 = SP; - R0 = [P0++]; - -/* Copy argv pointer into R1 -- which its final resting place */ - R1 = P0; - -/* Skip to the end of argv and put a pointer to the environment in R2 */ - R2 = R0; - R2 <<= 2; - R2 += 4; - R2 = R1+R2; - -/* Ok, now run uClibc's main() -- shouldn't return */ - sp += -12; - jump.l ___uClibc_main; - diff --git a/libc/sysdeps/linux/bfin/crt1.S b/libc/sysdeps/linux/bfin/crt1.S new file mode 100644 index 000000000..7b6a99de0 --- /dev/null +++ b/libc/sysdeps/linux/bfin/crt1.S @@ -0,0 +1,74 @@ +/* Initial C runtime code for Blackfin + * + * Copyright (C) 2004-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +/* When we enter this piece of code, the user stack looks like this: +* argc argument counter (integer) +* argv[0] program name (pointer) +* argv[1...N] program args (pointers) +* NULL +* env[0...N] environment variables (pointers) +* NULL + +* When we are done here, we want +* R0=argc +* R1=*argv[0] +* R2=*envp[0] +*/ + +#include <features.h> + +.text +.align 2 +.global __start; +.type __start,STT_FUNC; +.global ___uClibc_main; +.type ___uClibc_main,STT_FUNC; + +#if defined(__UCLIBC_CTOR_DTOR__) +.type __init,%function +.type __fini,%function +#else +.weak __init +.weak __fini +#endif + +/* + When we enter, our stack looks like: + [ SP ] + [argc][argv]... + + Call ___uClibc_main(argc, argv, __init, __fini) + R0 R1 R2 stack + + Before we call main, we want: + [ SP ] + [fini][argc][argv] +*/ + +__start: + +/* clear the frame pointer */ + FP = 0; + +/* Load register R0 (argc) from the stack to its final resting place */ + P0 = SP; + R0 = [P0++]; + +/* Copy argv pointer into R1 */ + R1 = P0; + +/* Load __init into R2 */ + R2 = __init; + +/* Load __fini onto the stack */ + P0 = __fini; + [SP--] = P0; + +/* Ok, now run uClibc's main() -- shouldn't return */ + sp += -8; + jump.l ___uClibc_main; +.size __start,.-__start diff --git a/libc/sysdeps/linux/bfin/crti.S b/libc/sysdeps/linux/bfin/crti.S index 36897973e..56b268a28 100644 --- a/libc/sysdeps/linux/bfin/crti.S +++ b/libc/sysdeps/linux/bfin/crti.S @@ -1,30 +1,17 @@ -.file "initfini.c"; .section .init .section .fini .text; .align 2 -.global _dummy; -.type _dummy, STT_FUNC; -_dummy: - P2 = R0; - LINK 0; - SP += -12; - cc =P2==0; - if cc jump L$L$1; - SP += 12; - UNLINK; - jump (P2); -L$L$1: - SP += 12; - UNLINK; - rts; - .size _dummy, .-_dummy -.align 2 .global __init; .type __init, STT_FUNC; __init: LINK 0; SP += -12; - .align 2 +.align 2 +.global __fini; +.type __fini, STT_FUNC; +__fini: + LINK 0; + SP += -12; diff --git a/libc/sysdeps/linux/bfin/crtn.S b/libc/sysdeps/linux/bfin/crtn.S index 4f15aec50..11ba9420d 100644 --- a/libc/sysdeps/linux/bfin/crtn.S +++ b/libc/sysdeps/linux/bfin/crtn.S @@ -1,26 +1,8 @@ -.file "initfini.c"; .section .init .section .fini .text; .align 2 -.global _dummy; -.type _dummy, STT_FUNC; -_dummy: - P2 = R0; - LINK 0; - SP += -12; - cc =P2==0; - if cc jump L$L$1; - SP += 12; - UNLINK; - jump (P2); -L$L$1: - SP += 12; - UNLINK; - rts; - .size _dummy, .-_dummy -.align 2 .global __init; .type __init, STT_FUNC; SP += 12; @@ -34,4 +16,3 @@ L$L$1: UNLINK; rts; .size __fini, .-__fini - .ident "GCC: (GNU) 3.4.1" diff --git a/libc/sysdeps/linux/bfin/setjmp.S b/libc/sysdeps/linux/bfin/setjmp.S index 9bb3ddc8b..7194a1508 100644 --- a/libc/sysdeps/linux/bfin/setjmp.S +++ b/libc/sysdeps/linux/bfin/setjmp.S @@ -13,7 +13,9 @@ #define _SETJMP_H #include <bits/setjmp.h> -.globl ___sigsetjmp; +.text +.global ___sigsetjmp; +.type ___sigsetjmp,STT_FUNC; .align 4; ___sigsetjmp: @@ -102,4 +104,4 @@ ___sigsetjmp: finished: R0 = 0; RTS; -___sigsetjmp.end: +.size ___sigsetjmp,.-___sigsetjmp diff --git a/libc/sysdeps/linux/bfin/syscall.c b/libc/sysdeps/linux/bfin/syscall.c index 6fe6cf2e6..c223f56a3 100644 --- a/libc/sysdeps/linux/bfin/syscall.c +++ b/libc/sysdeps/linux/bfin/syscall.c @@ -2,21 +2,9 @@ /* syscall for blackfin/uClibc * * Copyright (C) 2004 by Analog Devices Inc. - * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org> + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program 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 Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #include <features.h> diff --git a/libc/sysdeps/linux/bfin/vfork.S b/libc/sysdeps/linux/bfin/vfork.S index 1f9539c55..014e5cfae 100644 --- a/libc/sysdeps/linux/bfin/vfork.S +++ b/libc/sysdeps/linux/bfin/vfork.S @@ -1,12 +1,21 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +#include <features.h> #include <asm/unistd.h> - .text - .globl _vfork - .globl __libc_vfork - .type _vfork,STT_FUNC; - .align 4 -__libc_vfork: -_vfork: + +.text +.global ___vfork +.hidden ___vfork +.type ___vfork,STT_FUNC; +.align 4 +___vfork: p0 = __NR_vfork; excpt 0; rts; +.size ___vfork,.-___vfork +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/cris/__init_brk.c b/libc/sysdeps/linux/cris/__init_brk.c index 211ae9136..8e6591a62 100644 --- a/libc/sysdeps/linux/cris/__init_brk.c +++ b/libc/sysdeps/linux/cris/__init_brk.c @@ -5,8 +5,13 @@ #include <errno.h> #include "sysdep.h" +extern void *__curbrk; +libc_hidden_proto(__curbrk) void * __curbrk = 0; +libc_hidden_data_def(__curbrk) +extern int __init_brk (void); +libc_hidden_proto(__init_brk) int __init_brk (void) { @@ -29,3 +34,4 @@ __init_brk (void) } return 0; } +libc_hidden_def(__init_brk) diff --git a/libc/sysdeps/linux/cris/__longjmp.S b/libc/sysdeps/linux/cris/__longjmp.S index 98472a673..52a986fd9 100644 --- a/libc/sysdeps/linux/cris/__longjmp.S +++ b/libc/sysdeps/linux/cris/__longjmp.S @@ -1,5 +1,5 @@ /* longjmp for CRIS. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2003 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 @@ -17,24 +17,46 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <sysdep.h> +#include <features.h> +#include "sysdep.h" #define _SETJMP_H #define _ASM #include <bits/setjmp.h> + .syntax no_register_prefix + /* Saving and restoring CCR is meaningless, so we don't do it. */ ENTRY (__longjmp) /* Note that r10 = jmp_buf, r11 = retval. */ - move [$r10+16*4],$srp - test.d $r11 +#ifdef __arch_v32 + + /* We don't restore the call-clobbered registers for v32; + their space (corresponding to v10) is now defined as + reserved. */ + movem [r10],r9 + addq 14*4,r10 + cmpq 0,r11 + beq 0f + move.d [r10+],sp + + move.d r11,r9 +0: + move.d [r10+],acr + jump acr + move [r10],srp + +#else + + move [r10+16*4],srp + test.d r11 beq 0f /* Already a 1 in place. */ nop /* Offset for r9, the return value (see setjmp). */ - move.d $r11,[$r10+6*4] + move.d r11,[r10+6*4] 0: - movem [$r10],$pc -END (__longjmp) + movem [r10],pc - .weak longjmp - longjmp = __longjmp +#endif +END (__longjmp) +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/cris/bits/byteswap.h b/libc/sysdeps/linux/cris/bits/byteswap.h index e35c4b63f..4027456ac 100644 --- a/libc/sysdeps/linux/cris/bits/byteswap.h +++ b/libc/sysdeps/linux/cris/bits/byteswap.h @@ -1,51 +1,56 @@ #ifndef _BITS_BYTESWAP_H #define _BITS_BYTESWAP_H 1 -#define ___swab16(x) \ +/* CRIS specific byte swap operations: 16, 32 and 64-bit */ + +/* Swap bytes in 16 bit value. */ +#define __bswap_constant_16(x) \ ({ \ unsigned short __x = (x); \ ((unsigned short)( \ - (((unsigned short)(__x) & (unsigned short)0x00ffU) << 8) | \ - (((unsigned short)(__x) & (unsigned short)0xff00U) >> 8) )); \ + (((unsigned short)(__x) & (unsigned short)0x00ffu) << 8) | \ + (((unsigned short)(__x) & (unsigned short)0xff00u) >> 8) )); \ }) -#define ___swab32(x) \ +#if defined __GNUC__ && __GNUC__ >= 2 +# define __bswap_16(x) \ + __extension__ \ + ({ unsigned short __bswap_16_v; \ + if (__builtin_constant_p (x)) \ + __bswap_16_v = __bswap_constant_16 (x); \ + else \ + __asm__ ("swapb %0" : "=r" (__bswap_16_v) : "0" (x)); \ + __bswap_16_v; }) +#else +# define __bswap_16(x) __bswap_constant_16 (x) +#endif + + +/* Swap bytes in 32 bit value. */ +#define __bswap_constant_32(x) \ ({ \ unsigned long __x = (x); \ ((unsigned long)( \ - (((unsigned long)(__x) & (unsigned long)0x000000ffUL) << 24) | \ - (((unsigned long)(__x) & (unsigned long)0x0000ff00UL) << 8) | \ - (((unsigned long)(__x) & (unsigned long)0x00ff0000UL) >> 8) | \ - (((unsigned long)(__x) & (unsigned long)0xff000000UL) >> 24) )); \ + (((unsigned long)(__x) & (unsigned long)0x000000fful) << 24) | \ + (((unsigned long)(__x) & (unsigned long)0x0000ff00ul) << 8) | \ + (((unsigned long)(__x) & (unsigned long)0x00ff0000ul) >> 8) | \ + (((unsigned long)(__x) & (unsigned long)0xff000000ul) >> 24) )); \ }) -/* these are CRIS specific */ - -static inline unsigned short __fswab16(unsigned short x) -{ - __asm__ ("swapb %0" : "=r" (x) : "0" (x)); - - return(x); -} - -static inline unsigned long __fswab32(unsigned long x) -{ - __asm__ ("swapwb %0" : "=r" (x) : "0" (x)); - - return(x); -} - -# define __bswap_16(x) \ -(__builtin_constant_p((unsigned short)(x)) ? \ - ___swab16((x)) : \ - __fswab16((x))) - +#if defined __GNUC__ && __GNUC__ >= 2 # define __bswap_32(x) \ -(__builtin_constant_p((unsigned long)(x)) ? \ - ___swab32((x)) : \ - __fswab32((x))) + __extension__ \ + ({ unsigned long __bswap_32_v; \ + if (__builtin_constant_p (x)) \ + __bswap_32_v = __bswap_constant_32 (x); \ + else \ + __asm__ ("swapwb %0" : "=r" (__bswap_32_v) : "0" (x)); \ + __bswap_32_v; }) +#else +# define __bswap_32(x) __bswap_constant_32 (x) +#endif + -#if defined __GNUC__ && __GNUC__ >= 2 /* Swap bytes in 64 bit value. */ # define __bswap_constant_64(x) \ ((((x) & 0xff00000000000000ull) >> 56) \ @@ -57,6 +62,7 @@ static inline unsigned long __fswab32(unsigned long x) | (((x) & 0x000000000000ff00ull) << 40) \ | (((x) & 0x00000000000000ffull) << 56)) +#if defined __GNUC__ && __GNUC__ >= 2 # define __bswap_64(x) \ (__extension__ \ ({ union { __extension__ unsigned long long int __ll; \ @@ -70,6 +76,8 @@ static inline unsigned long __fswab32(unsigned long x) __r.__l[1] = __bswap_32 (__w.__l[0]); \ } \ __r.__ll; })) +#else +# define __bswap_64(x) __bswap_constant_64 (x) #endif #endif /* _BITS_BYTESWAP_H */ diff --git a/libc/sysdeps/linux/cris/bits/syscalls.h b/libc/sysdeps/linux/cris/bits/syscalls.h index 5f587854f..ce68c04d4 100644 --- a/libc/sysdeps/linux/cris/bits/syscalls.h +++ b/libc/sysdeps/linux/cris/bits/syscalls.h @@ -62,6 +62,14 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ return (type) (INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5)); \ } +#undef _syscall6 +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ +return (type) (INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6)); \ +} + #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ ({ \ diff --git a/libc/sysdeps/linux/cris/bits/termios.h b/libc/sysdeps/linux/cris/bits/termios.h new file mode 100644 index 000000000..63ca4ea93 --- /dev/null +++ b/libc/sysdeps/linux/cris/bits/termios.h @@ -0,0 +1,215 @@ +/* termios type and macro definitions. Linux version. + Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005 + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _TERMIOS_H +# error "Never include <bits/termios.h> directly; use <termios.h> instead." +#endif + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 32 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 + }; + +/* c_cc characters */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +/* c_oflag bits */ +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#if defined __USE_MISC || defined __USE_XOPEN +# define NLDLY 0000400 +# define NL0 0000000 +# define NL1 0000400 +# define CRDLY 0003000 +# define CR0 0000000 +# define CR1 0001000 +# define CR2 0002000 +# define CR3 0003000 +# define TABDLY 0014000 +# define TAB0 0000000 +# define TAB1 0004000 +# define TAB2 0010000 +# define TAB3 0014000 +# define BSDLY 0020000 +# define BS0 0000000 +# define BS1 0020000 +# define FFDLY 0100000 +# define FF0 0000000 +# define FF1 0100000 +#endif + +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 + +#ifdef __USE_MISC +# define XTABS 0014000 +#endif + +/* c_cflag bit meaning */ +#ifdef __USE_MISC +# define CBAUD 0010017 +#endif +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#ifdef __USE_MISC +# define EXTA B19200 +# define EXTB B38400 +#endif +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 +#ifdef __USE_MISC +# define CBAUDEX 0010000 +#endif +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B921600 0010005 +#define B1843200 0010006 +#define B6250000 0010007 +#ifdef __arch_v32 +#define B12500000 0010010 +#define __MAX_BAUD B12500000 +#else +#define __MAX_BAUD B6250000 +#endif +#ifdef __USE_MISC +# define CIBAUD 002003600000 /* input baud rate (not used) */ +# define CMSPAR 010000000000 /* mark or space (stick) parity */ +# define CRTSCTS 020000000000 /* flow control */ +#endif + +/* c_lflag bits */ +#define ISIG 0000001 +#define ICANON 0000002 +#if defined __USE_MISC || defined __USE_XOPEN +# define XCASE 0000004 +#endif +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#ifdef __USE_MISC +# define ECHOCTL 0001000 +# define ECHOPRT 0002000 +# define ECHOKE 0004000 +# define FLUSHO 0010000 +# define PENDIN 0040000 +#endif +#define IEXTEN 0100000 + +/* tcflow() and TCXONC use these */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* tcflush() and TCFLSH use these */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* tcsetattr uses these */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + + +#define _IOT_termios /* Hurd ioctl type field. */ \ + _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) diff --git a/libc/sysdeps/linux/cris/bits/uClibc_arch_features.h b/libc/sysdeps/linux/cris/bits/uClibc_arch_features.h new file mode 100644 index 000000000..b62a51020 --- /dev/null +++ b/libc/sysdeps/linux/cris/bits/uClibc_arch_features.h @@ -0,0 +1,45 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/ +#undef __UCLIBC_ABORT_INSTRUCTION__ + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#define __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +/* lovely */ +#define ASM_LINE_SEP @ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/cris/bits/uClibc_page.h b/libc/sysdeps/linux/cris/bits/uClibc_page.h index 8219a19da..adfc3c9af 100644 --- a/libc/sysdeps/linux/cris/bits/uClibc_page.h +++ b/libc/sysdeps/linux/cris/bits/uClibc_page.h @@ -25,4 +25,10 @@ #define PAGE_SIZE (1UL << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) +/* Some architectures always use 12 as page shift for mmap2() eventhough the + * real PAGE_SHIFT != 12. Other architectures use the same value as + * PAGE_SHIFT... + */ +#define MMAP2_PAGE_SHIFT PAGE_SHIFT + #endif /* _UCLIBC_PAGE_H */ diff --git a/libc/sysdeps/linux/cris/brk.c b/libc/sysdeps/linux/cris/brk.c index 10965d3b9..6c518f5a6 100644 --- a/libc/sysdeps/linux/cris/brk.c +++ b/libc/sysdeps/linux/cris/brk.c @@ -1,13 +1,23 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + #include <unistd.h> #include <sys/syscall.h> #include <errno.h> #include "sysdep.h" +libc_hidden_proto(brk) + extern void * __curbrk; +libc_hidden_proto(__curbrk) extern int __init_brk (void); +libc_hidden_proto(__init_brk) -int attribute_hidden __brk(void * end_data_seg) +int brk(void * end_data_seg) { if (__init_brk () == 0) { /* @@ -29,4 +39,4 @@ int attribute_hidden __brk(void * end_data_seg) return -1; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/cris/clone.S b/libc/sysdeps/linux/cris/clone.S index 19ba71996..9e284fe0a 100644 --- a/libc/sysdeps/linux/cris/clone.S +++ b/libc/sysdeps/linux/cris/clone.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2001 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2003 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 @@ -16,24 +16,27 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <asm/errno.h> +#include <features.h> #include <sys/syscall.h> -#include <sysdep.h> +#include "sysdep.h" +#define _ERRNO_H 1 +#include <bits/errno.h> /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ .syntax no_register_prefix .text -ENTRY (__clone) +ENTRY (clone) /* Sanity check arguments: No NULL function pointers. Allow a NULL stack pointer though; it makes the kernel allocate stack. */ - test.d r10 + cmpq 0,r10 beq 1f nop /* We need to muck with a few registers. */ - movem r1,[sp=sp-8] + subq 8,sp + movem r1,[sp] /* Save the function pointer and argument. We can't save them onto the new stack since it can be NULL. */ @@ -47,7 +50,7 @@ ENTRY (__clone) /* Do the system call. */ movu.w SYS_ify (clone),r9 break 13 - test.d r10 + cmpq 0,r10 beq .Lthread_start nop @@ -64,15 +67,22 @@ ENTRY (__clone) /* Terminate frame pointers here. */ moveq 0,r8 +#ifdef __arch_v32 + /* Is this the right place for an argument? */ + jsr r0 + move.d r1,r10 +#else /* I've told you once. */ move.d r1,r10 jsr r0 +#endif SETUP_PIC - PLTCALL (_exit_internal) + PLTCALL (HIDDEN_JUMPTARGET(_exit)) /* Die horribly. */ - test.d [6809] + move.d 6809,r13 + test.d [r13] /* Stop the unstoppable. */ 9: @@ -83,7 +93,4 @@ ENTRY (__clone) 1: movs.w -EINVAL,r10 /* Drop through into the ordinary error handler. */ -PSEUDO_END (__clone) - -.globl clone - clone = __clone +PSEUDO_END (clone) diff --git a/libc/sysdeps/linux/cris/crt0.c b/libc/sysdeps/linux/cris/crt0.c deleted file mode 100644 index a676ee908..000000000 --- a/libc/sysdeps/linux/cris/crt0.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Startup code compliant to the ELF CRIS ABI */ - -/* The first piece of initialized data. */ -int __data_start = 0; - -static void start1 (int argc, char **argv) __attribute__ ((used, noreturn)); - -/* - * It is important that this be the first function. - * This file is the first thing in the text section. - * This is implemented completely in assembler to avoid that the - * compiler pushes stuff on the stack (e.g. the frame pointer when - * debuging). - */ - -/* - * On the stack we have argc. We can calculate argv/envp - * from that and the succeeding stack location, but fix so - * we get the right calling convention (regs in r10/r11). - * - * Please view linux/fs/binfmt_elf.c for a complete - * understanding of this. - */ -__asm__ ( \ - ".text\n\t" \ - ".global _start\n\t" \ - "_start:\n\t" \ - "pop $r10\n\t" \ - "move.d $sp, $r11\n\t" \ - "jump start1\n\t"); - -#include <features.h> - -extern void __uClibc_main(int argc, char **argv, char **envp) - __attribute__ ((__noreturn__)); -extern void __uClibc_start_main(int argc, char **argv, char **envp, - void (*app_init)(void), void (*app_fini)(void)) - __attribute__ ((__noreturn__)); -extern void weak_function _init(void); -extern void weak_function _fini(void); - -/* Stick in a dummy reference to main(), so that if an application - * is linking when the main() function is in a static library (.a) - * we can be sure that main() actually gets linked in */ -extern void main(int argc,void *argv,void *envp); -void (*__mainp)(int argc,void *argv,void *envp) = main; - -static void -start1 (int argc, char **argv) -{ - char** environ; - - /* The environment starts just after ARGV. */ - environ = &argv[argc + 1]; - - /* - * If the first thing after ARGV is the arguments - * themselves, there is no environment. - */ - if ((char *) environ == *argv) - /* - * The environment is empty. Make environ - * point at ARGV[ARGC], which is NULL. - */ - --environ; - -#if defined L_crt0 || ! defined __UCLIBC_CTOR_DTOR__ - /* Leave control to the libc */ - __uClibc_main(argc, argv, environ); -#else - __uClibc_start_main(argc, argv, environ, _init, _fini); -#endif -} diff --git a/libc/sysdeps/linux/cris/crt1.S b/libc/sysdeps/linux/cris/crt1.S new file mode 100644 index 000000000..b07e36b51 --- /dev/null +++ b/libc/sysdeps/linux/cris/crt1.S @@ -0,0 +1,56 @@ +/* Startup code compliant to the ELF CRIS ABI */ + +#include <features.h> + + .syntax no_register_prefix + +/* The first piece of initialized data. */ + .data + .global __data_start + .align 2 + .type __data_start, @object + .size __data_start, 4 +__data_start: + .dword 0 + + .text + .align 1 + .global _start + .type _start, %function +#if defined(__UCLIBC_CTOR_DTOR__) + .type _init, %function + .type _fini, %function +#else + .weak _init + .weak _fini +#endif + .type main, %function + .type __uClibc_main, %function + +/* + * On the stack we have argc. We can calculate argv/envp + * from that and the succeeding stack location, but fix so + * we get the right calling convention (regs in r10/r11). + * + * Please view linux/fs/binfmt_elf.c for a complete + * understanding of this. + */ + +/* + * Need to call __uClibc_main(main, argc, argv, _init, _fini) + */ + +_start: + move.d main, r10 + move.d [sp+], r11 + move.d sp, r12 + subq 4, sp + move srp, [sp] + subq 4, sp + move.d _fini, r13 + move.d r13, [sp] + move.d _init, r13 + /* Leave control to the libc */ + jsr __uClibc_main + nop + .size _start, .-_start diff --git a/libc/sysdeps/linux/cris/crti.S b/libc/sysdeps/linux/cris/crti.S index 78a1862ef..0740c765d 100644 --- a/libc/sysdeps/linux/cris/crti.S +++ b/libc/sysdeps/linux/cris/crti.S @@ -1,36 +1,29 @@ -#NO_APP - .file "initfini.c" -#APP - - .section .init -#NO_APP - .align 1 - .global _init +/* glibc's sysdeps/cris/elf/initfini.c used for reference [PROLOG] */ + + .section .init + .align 1 + .global _init .type _init, @function _init: - Push $srp - subq 4,$sp - movem $r0,[$sp] - move.d $pc,$r0 - sub.d .:GOTOFF,$r0 -#APP - - .align 1 - - - .section .fini -#NO_APP - .align 1 - .global _fini + subq 4,$sp + move.d $r1,[$sp] + move $srp,$r1 + subq 4,$sp + move.d $r0,[$sp] + move.d $pc,$r0 + sub.d .:GOTOFF,$r0 + .align 1 + + .section .fini + .align 1 + .global _fini .type _fini, @function _fini: - Push $srp - subq 4,$sp - movem $r0,[$sp] - move.d $pc,$r0 - sub.d .:GOTOFF,$r0 -#APP - .align 1 - - -/*@TRAILER_BEGINS*/ + subq 4,$sp + move.d $r1,[$sp] + move $srp,$r1 + subq 4,$sp + move.d $r0,[$sp] + move.d $pc,$r0 + sub.d .:GOTOFF,$r0 + .align 1 diff --git a/libc/sysdeps/linux/cris/crtn.S b/libc/sysdeps/linux/cris/crtn.S index e9d8a963f..951ae5449 100644 --- a/libc/sysdeps/linux/cris/crtn.S +++ b/libc/sysdeps/linux/cris/crtn.S @@ -1,27 +1,23 @@ -#NO_APP - .file "initfini.c" -#APP - - .section .init -#NO_APP - .align 1 - .global _init +/* glibc's sysdeps/cris/elf/initfini.c used for reference [EPILOG] */ + + .section .init + .align 1 + .global _init .type _init, @function -#NO_APP - movem [$sp+],$r0 - Jump [$sp+] + move.d [$sp+],$r0 + move $r1,$srp + move.d [$sp+],$r1 + Ret + nop .size _init, .-_init -#APP - - .section .fini -#NO_APP - .align 1 - .global _fini + + .section .fini + .align 1 + .global _fini .type _fini, @function -#NO_APP - movem [$sp+],$r0 - Jump [$sp+] + move.d [$sp+],$r0 + move $r1,$srp + move.d [$sp+],$r1 + Ret + nop .size _fini, .-_fini -#APP - -/*@TRAILER_BEGINS*/ diff --git a/libc/sysdeps/linux/cris/fork.c b/libc/sysdeps/linux/cris/fork.c index 4dd8e0269..20b546901 100644 --- a/libc/sysdeps/linux/cris/fork.c +++ b/libc/sysdeps/linux/cris/fork.c @@ -1,4 +1,10 @@ -#include <sysdep.h> +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include "sysdep.h" #define __NR___libc_fork __NR_fork SYSCALL__ (__libc_fork, 0) @@ -8,4 +14,6 @@ SYSCALL__ (__libc_fork, 0) R0&-1==R0, and the child gets R0&0==0. */ /* i dunno what the blurb above is useful for. we just return. */ __asm__("ret\n\tnop"); -weak_alias(__libc_fork, fork) +libc_hidden_proto(fork) +weak_alias(__libc_fork,fork) +libc_hidden_weak(fork) diff --git a/libc/sysdeps/linux/cris/sbrk.c b/libc/sysdeps/linux/cris/sbrk.c index 3683435bf..15f506cd7 100644 --- a/libc/sysdeps/linux/cris/sbrk.c +++ b/libc/sysdeps/linux/cris/sbrk.c @@ -1,16 +1,25 @@ /* From libc-5.3.12 */ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <unistd.h> #include <sys/syscall.h> #include <errno.h> #include "sysdep.h" +libc_hidden_proto(sbrk) + extern void * __curbrk; +libc_hidden_proto(__curbrk) extern int __init_brk (void); +libc_hidden_proto(__init_brk) -void attribute_hidden * -__sbrk(intptr_t increment) +void * +sbrk(intptr_t increment) { if (__init_brk () == 0) { void * tmp = __curbrk + increment; @@ -34,4 +43,4 @@ __sbrk(intptr_t increment) } return ((void *) -1); } -strong_alias(__sbrk,sbrk) +libc_hidden_def(sbrk) diff --git a/libc/sysdeps/linux/cris/setjmp.S b/libc/sysdeps/linux/cris/setjmp.S index a5ea0e2d8..e7bb6358a 100644 --- a/libc/sysdeps/linux/cris/setjmp.S +++ b/libc/sysdeps/linux/cris/setjmp.S @@ -1,5 +1,5 @@ /* setjmp for CRIS. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003 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 @@ -17,15 +17,29 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <sysdep.h> -#define _ASM +#include "sysdep.h" #define _SETJMP_H +#define _ASM #include <bits/setjmp.h> .syntax no_register_prefix ENTRY (__sigsetjmp) .Local__sigsetjmp: + +#ifdef __arch_v32 + + moveq 1,r9 + move.d r10,r12 + addq 14*4,r12 + movem r9,[r10] + lapc 0f,r13 + move.d sp,[r12+] + move.d r13,[r12+] + move srp,[r12+] + +#else + moveq 1,r9 movem sp,[r10+1*4] #ifdef __PIC__ @@ -36,6 +50,15 @@ ENTRY (__sigsetjmp) #endif move.d r9,[r10] move srp,[r10+16*4] + +#endif + +/* Saving and restoring CCR is meaningless, so we don't do it. */ + +/* Saving registers would complicate the implementation, but we + can get away with not setting up R0 here since we know that + __sigjmp_save is a local symbol; it doesn't have a PLT (which + would have required GOT in R0 at the time of the jump). */ PLTJUMP (__sigjmp_save) 0: /* This is where longjmp returns. (Don't use "ret" - it's a macro. */ Ret @@ -59,18 +82,3 @@ ENTRY (setjmp) ba .Local__sigsetjmp moveq 1,r11 END (setjmp) - -/* -weak_extern (__setjmp) -weak_extern (_setjmp) -weak_extern (setjmp) -*/ - - - - - - - - - diff --git a/libc/sysdeps/linux/cris/syscall.S b/libc/sysdeps/linux/cris/syscall.S index 011d59920..d4b052e8e 100644 --- a/libc/sysdeps/linux/cris/syscall.S +++ b/libc/sysdeps/linux/cris/syscall.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2003, 2004 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 @@ -16,13 +16,33 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <sysdep.h> +#include "sysdep.h" .syntax no_register_prefix /* Make syscall (callno, ...) into a system call. */ ENTRY (syscall) +#ifdef __arch_v32 + subq 4,sp + move.d r10,r9 + move srp,[sp] + addoq 8,sp,acr + move.d r11,r10 + move [acr],mof + addoq 12,sp,acr + move.d r12,r11 + move [acr],srp + addoq 4,sp,acr + move.d r13,r12 + move.d [acr],r13 + break 13 + cmps.w -4096,r10 + bhs 0f + move [sp+],srp + Ret + nop +#else push srp move.d r10,r9 move.d r11,r10 @@ -37,4 +57,5 @@ ENTRY (syscall) pop srp Ret nop +#endif PSEUDO_END (syscall) diff --git a/libc/sysdeps/linux/cris/sysdep.S b/libc/sysdeps/linux/cris/sysdep.S index 0c98825cc..4e558153b 100644 --- a/libc/sysdeps/linux/cris/sysdep.S +++ b/libc/sysdeps/linux/cris/sysdep.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2001 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2003 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 @@ -17,7 +17,7 @@ Boston, MA 02111-1307, USA. */ #include <features.h> -#include <sysdep.h> +#include "sysdep.h" /* Make space for the errno variable. */ @@ -25,11 +25,9 @@ .type C_SYMBOL_NAME(errno),@object .lcomm C_SYMBOL_NAME(errno),4 + .weak errno errno = _errno - /* weak_alias (errno, _errno) */ - - /* The syscall stubs jump here when they detect an error, bot for PIC and non-PIC. */ @@ -39,25 +37,38 @@ ENTRY (__syscall_error) neg.d r10,r10 #ifdef __UCLIBC_HAS_THREADS__ - push r10 - push srp + subq 4,sp + move.d r10,[sp] + subq 4,sp + move srp,[sp] /* Note that __syscall_error is only visible within this library, and no-one passes it on as a pointer, so can assume that R0 (GOT pointer) is correctly set up. */ - PLTCALL (__errno_location) + PLTCALL (HIDDEN_JUMPTARGET(__errno_location)) - pop srp - pop r11 + move [sp+],srp + move.d [sp+],r11 move.d r11,[r10] #else /* not __UCLIBC_HAS_THREADS__ */ +#ifdef __arch_v32 +# ifdef __PIC__ + addo.d C_SYMBOL_NAME(errno:GOT),r0,acr + move.d [acr],r9 + move.d r10,[r9] +# else /* not __PIC__ */ + lapc C_SYMBOL_NAME(errno),acr + move.d r10,[r9] +# endif /* not __PIC__ */ +#else /* not __arch_v32 */ # ifdef __PIC__ move.d [r0+C_SYMBOL_NAME(errno:GOT)],r9 move.d r10,[r9] # else move.d r10,[C_SYMBOL_NAME(errno)] # endif +#endif /* not __arch_v32 */ #endif /* __UCLIBC_HAS_THREADS__ */ #ifdef __PIC__ @@ -69,7 +80,7 @@ ENTRY (__syscall_error) moveq -1,r10 Ret - pop r0 + move.d [sp+],r0 #else Ret moveq -1,r10 diff --git a/libc/sysdeps/linux/cris/sysdep.h b/libc/sysdeps/linux/cris/sysdep.h index b441ff122..593e7772e 100644 --- a/libc/sysdeps/linux/cris/sysdep.h +++ b/libc/sysdeps/linux/cris/sysdep.h @@ -40,9 +40,13 @@ #define END(sym) #endif -#define C_SYMBOL_NAME(name) name +#undef SYS_ify +#define SYS_ify(syscall_name) (__NR_##syscall_name) -#ifdef __ASSEMBLER__ +#ifdef __ASSEMBLER__ + +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name /* Syntactic details of assembly-code. */ @@ -54,24 +58,54 @@ of relying on hearsay. */ #define ALIGNARG(log2) log2 -#define ASM_GLOBAL_DIRECTIVE .globl #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg #define ASM_SIZE_DIRECTIVE(name) .size name,.-name /* The non-PIC jump is preferred, since it does not stall, and does not invoke generation of a PLT. These macros assume that $r0 is set up as GOT register. */ +#ifdef __arch_v32 +#ifdef __PIC__ +#define PLTJUMP(_x) \ + ba C_SYMBOL_NAME (_x):PLT @ \ + nop + +#define PLTCALL(_x) \ + bsr C_SYMBOL_NAME (_x):PLT @ \ + nop + +#define SETUP_PIC \ + subq 4,$sp @ \ + move.d $r0,[$sp] @ \ + lapc _GLOBAL_OFFSET_TABLE_,$r0 + +#define TEARDOWN_PIC move.d [$sp+],$r0 +#else +#define PLTJUMP(_x) \ + ba C_SYMBOL_NAME (_x) @ \ + nop + +#define PLTCALL(_x) \ + bsr C_SYMBOL_NAME (_x) @ \ + nop + +#define SETUP_PIC +#define TEARDOWN_PIC +#endif + +#else + #ifdef __PIC__ #define PLTJUMP(_x) \ - add.d C_SYMBOL_NAME (_x):PLT,$pc + add.d C_SYMBOL_NAME (_x):PLT,$pc #define PLTCALL(_x) \ jsr [$r0+C_SYMBOL_NAME (_x):GOTPLT16] #define SETUP_PIC \ - push $r0 @ \ + push $r0 @ \ move.d $pc,$r0 @ \ - sub.d .:GOTOFF,$r0 + sub.d .:GOTOFF,$r0 #define TEARDOWN_PIC pop $r0 #else @@ -81,38 +115,35 @@ #define TEARDOWN_PIC #endif +#endif /* __arch_v32 */ + /* Define an entry point visible from C. */ -#define ENTRY(name) \ +#define ENTRY(name) \ .text @ \ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (name) @ \ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME (name), function) @ \ .align ALIGNARG (2) @ \ - C_LABEL(name) @ \ - CALL_MCOUNT + C_LABEL(name) -#undef END +#undef END #define END(name) \ ASM_SIZE_DIRECTIVE (C_SYMBOL_NAME (name)) #define PSEUDO(name, syscall_name, args) \ - ENTRY (name) @ \ - DOARGS_##args @ \ - movu.w SYS_ify (syscall_name),$r9 @ \ - break 13 @ \ - cmps.w -4096,$r10 @ \ - bhs 0f @ \ - nop @ \ + ENTRY (name) @ \ + DOARGS_##args @ \ + movu.w SYS_ify (syscall_name),$r9 @ \ + break 13 @ \ + cmps.w -4096,$r10 @ \ + bhs 0f @ \ + nop @ \ UNDOARGS_return_##args #define PSEUDO_END(name) \ -0: @ \ - SETUP_PIC @ \ - PLTJUMP (__syscall_error) @ \ +0: @ \ + SETUP_PIC @ \ + PLTJUMP (__syscall_error) @ \ END (name) -/* If compiled for profiling, do nothing */ -#define CALL_MCOUNT /* Do nothing. */ - - #endif /* __ASSEMBLER__ */ #endif /* _SYSDEP_H_ */ diff --git a/libc/sysdeps/linux/e1/bits/uClibc_arch_features.h b/libc/sysdeps/linux/e1/bits/uClibc_arch_features.h new file mode 100644 index 000000000..ff0e20fad --- /dev/null +++ b/libc/sysdeps/linux/e1/bits/uClibc_arch_features.h @@ -0,0 +1,42 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/ +#undef __UCLIBC_ABORT_INSTRUCTION__ + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/e1/longjmp.c b/libc/sysdeps/linux/e1/longjmp.c index 89d6b76d9..e628bd7e0 100644 --- a/libc/sysdeps/linux/e1/longjmp.c +++ b/libc/sysdeps/linux/e1/longjmp.c @@ -1,6 +1,9 @@ -/* This file is lisenced under LGPL - * Copyright (C) 2002-2003, George Thanos <george.thanos@gdt.gr> - * Yannis Mitsos <yannis.mitsos@gdt.gr> +/* + * Copyright (C) 2002-2003, George Thanos <george.thanos@gdt.gr> + * Yannis Mitsos <yannis.mitsos@gdt.gr> + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #include <syscall.h> @@ -40,10 +43,12 @@ void longjmp(jmp_buf state, int value ) #undef _state_ } +libc_hidden_proto(sigprocmask) + void siglongjmp(sigjmp_buf state, int value ) { if( state->__mask_was_saved ) - __sigprocmask(SIG_SETMASK, &state->__saved_mask, NULL); + sigprocmask(SIG_SETMASK, &state->__saved_mask, NULL); if(!value) state->__jmpbuf->ReturnValue = 1; diff --git a/libc/sysdeps/linux/e1/setjmp.c b/libc/sysdeps/linux/e1/setjmp.c index 502e89b22..750c4e08e 100644 --- a/libc/sysdeps/linux/e1/setjmp.c +++ b/libc/sysdeps/linux/e1/setjmp.c @@ -7,6 +7,8 @@ #include <stdio.h> #include <signal.h> +libc_hidden_proto(sigprocmask) + int setjmp( jmp_buf state) { asm volatile( "mov %0, G3\n\t" @@ -32,7 +34,7 @@ int sigsetjmp( sigjmp_buf state , int savesigs) if(savesigs) { state->__mask_was_saved = 1; /* how arg in <sigprocmask> is not significant */ - __sigprocmask(SIG_SETMASK, NULL, &state->__saved_mask); + sigprocmask(SIG_SETMASK, NULL, &state->__saved_mask); } else state->__mask_was_saved = 0; diff --git a/libc/sysdeps/linux/e1/vfork.c b/libc/sysdeps/linux/e1/vfork.c index ec9961d62..34ae5833c 100644 --- a/libc/sysdeps/linux/e1/vfork.c +++ b/libc/sysdeps/linux/e1/vfork.c @@ -1,5 +1,15 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + #include <sys/types.h> #include <sys/syscall.h> #include <errno.h> -_syscall0(pid_t, vfork); +#define __NR___vfork __NR_vfork +attribute_hidden _syscall0(pid_t, __vfork); +libc_hidden_proto(vfork) +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/frv/Makefile b/libc/sysdeps/linux/frv/Makefile index 82d7ddf39..cfecfd9be 100644 --- a/libc/sysdeps/linux/frv/Makefile +++ b/libc/sysdeps/linux/frv/Makefile @@ -66,9 +66,5 @@ $(SOBJ): %.o : %.S $(COBJ): %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ -headers: - $(LN) -fs ../libc/sysdeps/linux/frv/link.h $(TOPDIR)/include/ - clean: $(RM) *.o *~ core - $(RM) $(TOPDIR)/include/link.h diff --git a/libc/sysdeps/linux/frv/__init_brk.c b/libc/sysdeps/linux/frv/__init_brk.c index 92e07c49d..507902fc5 100644 --- a/libc/sysdeps/linux/frv/__init_brk.c +++ b/libc/sysdeps/linux/frv/__init_brk.c @@ -4,11 +4,16 @@ #include <unistd.h> #include <sys/syscall.h> +extern void * __curbrk; +libc_hidden_proto(__curbrk) void * __curbrk = 0; +libc_hidden_data_def(__curbrk) #define __NR__brk __NR_brk attribute_hidden _syscall1(void *, _brk, void *, ptr); +extern int __init_brk(void); +libc_hidden_proto(__init_brk) int __init_brk (void) { @@ -23,3 +28,4 @@ __init_brk (void) } return 0; } +libc_hidden_def(__init_brk) diff --git a/libc/sysdeps/linux/frv/__longjmp.S b/libc/sysdeps/linux/frv/__longjmp.S index a61f8d4e0..c3145c84f 100644 --- a/libc/sysdeps/linux/frv/__longjmp.S +++ b/libc/sysdeps/linux/frv/__longjmp.S @@ -1,3 +1,9 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + #define _SETJMP_H #define _ASM #include <bits/setjmp.h> @@ -73,3 +79,5 @@ __longjmp: ret .Lend2: .size __longjmp,.Lend2-__longjmp + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/frv/bits/uClibc_arch_features.h b/libc/sysdeps/linux/frv/bits/uClibc_arch_features.h new file mode 100644 index 000000000..ff0e20fad --- /dev/null +++ b/libc/sysdeps/linux/frv/bits/uClibc_arch_features.h @@ -0,0 +1,42 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/ +#undef __UCLIBC_ABORT_INSTRUCTION__ + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/frv/brk.c b/libc/sysdeps/linux/frv/brk.c index d6063fc27..9e33830ab 100644 --- a/libc/sysdeps/linux/frv/brk.c +++ b/libc/sysdeps/linux/frv/brk.c @@ -1,15 +1,24 @@ /* From libc-5.3.12 */ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <errno.h> #include <unistd.h> #include <sys/syscall.h> +libc_hidden_proto(brk) + extern void * __curbrk; +libc_hidden_proto(__curbrk) extern int __init_brk (void); +libc_hidden_proto(__init_brk) extern void *_brk(void *ptr) attribute_hidden; -int attribute_hidden __brk(void * end_data_seg) +int brk(void * end_data_seg) { if (__init_brk () == 0) { @@ -20,4 +29,4 @@ int attribute_hidden __brk(void * end_data_seg) } return -1; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/frv/clone.S b/libc/sysdeps/linux/frv/clone.S index b714b45b1..145615734 100644 --- a/libc/sysdeps/linux/frv/clone.S +++ b/libc/sysdeps/linux/frv/clone.S @@ -20,15 +20,16 @@ /* 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 <features.h> #include <asm/unistd.h> #define _ERRNO_H 1 #include <bits/errno.h> .text - .globl __clone - .type __clone,@function + .globl clone + .type clone,@function /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ -__clone: +clone: /* Sanity check arguments. */ cmp.p gr8, gr0, icc0 cmp gr9, gr0, icc1 @@ -75,11 +76,8 @@ __clone: breakpoints work.*/ mov.p gr17, gr15 - call _exit_internal + call HIDDEN_JUMPTARGET(_exit) /* Should never get here. */ jmpl @(gr0, gr0) - .size __clone,.-__clone - -.weak clone - clone = __clone + .size clone,.-clone diff --git a/libc/sysdeps/linux/frv/crtreloc.c b/libc/sysdeps/linux/frv/crtreloc.c index 8d20e967e..1a86728a3 100644 --- a/libc/sysdeps/linux/frv/crtreloc.c +++ b/libc/sysdeps/linux/frv/crtreloc.c @@ -26,15 +26,12 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define _GNU_SOURCE 1 #include <sys/types.h> #include <link.h> /* This file is to be compiled into crt object files, to enable executables to easily self-relocate. */ -#define hidden __attribute__((__visibility__("hidden"))) - /* Compute the runtime address of pointer in the range [p,e), and then map the pointer pointed by it. */ inline static void *** @@ -65,7 +62,7 @@ reloc_range_indirect (void ***p, void ***e, /* Call __reloc_range_indirect for the given range except for the last entry, whose contents are only relocated. It's expected to hold the GOT value. */ -void* hidden +void* attribute_hidden __self_reloc (const struct elf32_fdpic_loadmap *map, void ***p, void ***e) { @@ -96,7 +93,7 @@ reloc_range (void **p, void **e, /* Remap p, adjust e by the same offset, then map the pointers in the range determined by them. */ -void hidden +void attribute_hidden __reloc_range (const struct elf32_fdpic_loadmap *map, void **p, void **e) { @@ -110,7 +107,7 @@ __reloc_range (const struct elf32_fdpic_loadmap *map, /* Remap p, adjust e by the same offset, then map pointers referenced by the (unadjusted) pointers in the range. Return the relocated value of the last pointer in the range. */ -void* hidden +void* attribute_hidden __reloc_range_indirect (const struct elf32_fdpic_loadmap *map, void ***p, void ***e) { diff --git a/libc/sysdeps/linux/frv/dl-iterate-phdr.c b/libc/sysdeps/linux/frv/dl-iterate-phdr.c index ebb3b9c4a..144e4c145 100644 --- a/libc/sysdeps/linux/frv/dl-iterate-phdr.c +++ b/libc/sysdeps/linux/frv/dl-iterate-phdr.c @@ -16,10 +16,9 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define _GNU_SOURCE #include <link.h> -extern int __attribute__((__weak__)) +extern int weak_function __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, size_t size, void *data), void *data); diff --git a/libc/sysdeps/linux/frv/fstat.c b/libc/sysdeps/linux/frv/fstat.c index ce6b68e66..a1d343cb8 100644 --- a/libc/sysdeps/linux/frv/fstat.c +++ b/libc/sysdeps/linux/frv/fstat.c @@ -1,45 +1,18 @@ /* * Syscalls for uClibc * - * Copyright (C) 2001-2003 by Erik Andersen - * Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org> - * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program 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 Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org> + * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ -#define _GNU_SOURCE -#define _LARGEFILE64_SOURCE -#include <features.h> -#undef __OPTIMIZE__ -/* We absolutely do _NOT_ want interfaces silently - * * * renamed under us or very bad things will happen... */ -#ifdef __USE_FILE_OFFSET64 -# undef __USE_FILE_OFFSET64 -#endif - -#include <errno.h> -#include <sys/types.h> -#include <sys/syscall.h> -#include <endian.h> - +#include "../common/syscalls.h" #include <unistd.h> -#define _SYS_STAT_H -#include <bits/stat.h> +#include <sys/stat.h> -#define __NR___syscall_fstat __NR_fstat -_syscall2(int, __syscall_fstat, int, fd, struct stat *, buf); -strong_alias(__syscall_fstat, fstat) +libc_hidden_proto(fstat) +_syscall2(int, fstat, int, fd, struct stat *, buf); +libc_hidden_def(fstat) diff --git a/libc/sysdeps/linux/frv/fstat64.c b/libc/sysdeps/linux/frv/fstat64.c index 27000bf83..e07a28471 100644 --- a/libc/sysdeps/linux/frv/fstat64.c +++ b/libc/sysdeps/linux/frv/fstat64.c @@ -1,47 +1,20 @@ /* * Syscalls for uClibc * - * Copyright (C) 2001-2003 by Erik Andersen - * Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org> - * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program 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 Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org> + * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ -#define _GNU_SOURCE -#define _LARGEFILE64_SOURCE -#include <features.h> -#undef __OPTIMIZE__ -/* We absolutely do _NOT_ want interfaces silently - * * * renamed under us or very bad things will happen... */ -#ifdef __USE_FILE_OFFSET64 -# undef __USE_FILE_OFFSET64 -#endif - -#include <errno.h> -#include <sys/types.h> -#include <sys/syscall.h> -#include <endian.h> - +#include "../common/syscalls.h" #include <unistd.h> -#define _SYS_STAT_H -#include <bits/stat.h> +#include <sys/stat.h> -#if defined __UCLIBC_HAS_LFS__ -#define __NR___syscall_fstat64 __NR_fstat64 -_syscall2(int, __syscall_fstat64, int, fd, struct stat64 *, buf); -strong_alias(__syscall_fstat64, fstat64) +#ifdef __UCLIBC_HAS_LFS__ +libc_hidden_proto(fstat64) +_syscall2(int, fstat64, int, fd, struct stat64 *, buf); +libc_hidden_def(fstat64) #endif diff --git a/libc/sysdeps/linux/frv/link.h b/libc/sysdeps/linux/frv/link.h deleted file mode 100644 index 121608f2b..000000000 --- a/libc/sysdeps/linux/frv/link.h +++ /dev/null @@ -1,127 +0,0 @@ -/* Data structure for communication from the run-time dynamic linker for - loaded ELF shared objects. - Copyright (C) 1995-1999, 2000, 2001, 2004 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _LINK_H -#define _LINK_H 1 - -#include <features.h> -#include <elf.h> -#include <dlfcn.h> -#include <sys/types.h> - -/* We use this macro to refer to ELF types independent of the native wordsize. - `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */ -#define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type) -#define _ElfW(e,w,t) _ElfW_1 (e, w, _##t) -#define _ElfW_1(e,w,t) e##w##t - -#include <bits/elfclass.h> /* Defines __ELF_NATIVE_CLASS. */ - -/* Rendezvous structure used by the run-time dynamic linker to communicate - details of shared object loading to the debugger. If the executable's - dynamic section has a DT_DEBUG element, the run-time linker sets that - element's value to the address where this structure can be found. */ - -struct r_debug - { - int r_version; /* Version number for this protocol. */ - - struct link_map *r_map; /* Head of the chain of loaded objects. */ - - /* This is the address of a function internal to the run-time linker, - that will always be called when the linker begins to map in a - library or unmap it, and again when the mapping change is complete. - The debugger can set a breakpoint at this address if it wants to - notice shared object mapping changes. */ - ElfW(Addr) r_brk; - enum - { - /* This state value describes the mapping change taking place when - the `r_brk' address is called. */ - RT_CONSISTENT, /* Mapping change is complete. */ - RT_ADD, /* Beginning to add a new object. */ - RT_DELETE /* Beginning to remove an object mapping. */ - } r_state; - - ElfW(Addr) r_ldbase; /* Base address the linker is loaded at. */ - }; - -/* This is the instance of that structure used by the dynamic linker. */ -extern struct r_debug _r_debug; - -/* This symbol refers to the "dynamic structure" in the `.dynamic' section - of whatever module refers to `_DYNAMIC'. So, to find its own - `struct r_debug', a program could do: - for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn) - if (dyn->d_tag == DT_DEBUG) - r_debug = (struct r_debug *) dyn->d_un.d_ptr; - */ -extern ElfW(Dyn) _DYNAMIC[]; - -#ifdef __FRV_FDPIC__ -# include <bits/elf-fdpic.h> -#endif - -/* Structure describing a loaded shared object. The `l_next' and `l_prev' - members form a chain of all the shared objects loaded at startup. - - These data structures exist in space used by the run-time dynamic linker; - modifying them may have disastrous results. */ - -struct link_map - { - /* These first few members are part of the protocol with the debugger. - This is the same format used in SVR4. */ - -#ifdef __FRV_FDPIC__ - struct elf32_fdpic_loadaddr l_addr; -#else - ElfW(Addr) l_addr; /* Base address shared object is loaded at. */ -#endif - char *l_name; /* Absolute file name object was found in. */ - ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */ - struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ - }; - -#ifdef __USE_GNU - -struct dl_phdr_info - { -#ifdef __FRV_FDPIC__ - struct elf32_fdpic_loadaddr dlpi_addr; -#else - ElfW(Addr) dlpi_addr; -#endif - const char *dlpi_name; - const ElfW(Phdr) *dlpi_phdr; - ElfW(Half) dlpi_phnum; - }; - -__BEGIN_DECLS - -extern int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, - size_t size, void *data), - void *data) __THROW; - -__END_DECLS - -#endif - -#endif /* link.h */ diff --git a/libc/sysdeps/linux/frv/lstat.c b/libc/sysdeps/linux/frv/lstat.c index b9f0350c4..b178af76b 100644 --- a/libc/sysdeps/linux/frv/lstat.c +++ b/libc/sysdeps/linux/frv/lstat.c @@ -1,45 +1,18 @@ /* * Syscalls for uClibc * - * Copyright (C) 2001-2003 by Erik Andersen - * Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org> - * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program 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 Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org> + * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ -#define _GNU_SOURCE -#define _LARGEFILE64_SOURCE -#include <features.h> -#undef __OPTIMIZE__ -/* We absolutely do _NOT_ want interfaces silently - * * * renamed under us or very bad things will happen... */ -#ifdef __USE_FILE_OFFSET64 -# undef __USE_FILE_OFFSET64 -#endif - -#include <errno.h> -#include <sys/types.h> -#include <sys/syscall.h> -#include <endian.h> - +#include "../common/syscalls.h" #include <unistd.h> -#define _SYS_STAT_H -#include <bits/stat.h> +#include <sys/stat.h> -#define __NR___syscall_lstat __NR_lstat -_syscall2(int, __syscall_lstat, const char *, file_name, struct stat *, buf); -strong_alias(__syscall_lstat, lstat) +libc_hidden_proto(lstat) +_syscall2(int, lstat, const char *, file_name, struct stat *, buf); +libc_hidden_def(lstat) diff --git a/libc/sysdeps/linux/frv/lstat64.c b/libc/sysdeps/linux/frv/lstat64.c index 8f9413a8d..9a6236b14 100644 --- a/libc/sysdeps/linux/frv/lstat64.c +++ b/libc/sysdeps/linux/frv/lstat64.c @@ -1,47 +1,20 @@ /* * Syscalls for uClibc * - * Copyright (C) 2001-2003 by Erik Andersen - * Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org> - * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program 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 Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org> + * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ -#define _GNU_SOURCE -#define _LARGEFILE64_SOURCE -#include <features.h> -#undef __OPTIMIZE__ -/* We absolutely do _NOT_ want interfaces silently - * * * renamed under us or very bad things will happen... */ -#ifdef __USE_FILE_OFFSET64 -# undef __USE_FILE_OFFSET64 -#endif - -#include <errno.h> -#include <sys/types.h> -#include <sys/syscall.h> -#include <endian.h> - +#include "../common/syscalls.h" #include <unistd.h> -#define _SYS_STAT_H -#include <bits/stat.h> +#include <sys/stat.h> -#if defined __UCLIBC_HAS_LFS__ -#define __NR___syscall_lstat64 __NR_lstat64 -_syscall2(int, __syscall_lstat64, const char *, file_name, struct stat64 *, buf); -strong_alias(__syscall_lstat64, lstat64) +#ifdef __UCLIBC_HAS_LFS__ +libc_hidden_proto(lstat64) +_syscall2(int, lstat64, const char *, file_name, struct stat64 *, buf); +libc_hidden_def(lstat64) #endif diff --git a/libc/sysdeps/linux/frv/mmap.c b/libc/sysdeps/linux/frv/mmap.c index fa801bb5f..d4cfcb062 100644 --- a/libc/sysdeps/linux/frv/mmap.c +++ b/libc/sysdeps/linux/frv/mmap.c @@ -29,6 +29,8 @@ #include <sys/syscall.h> #include <sys/mman.h> +libc_hidden_proto(mmap) + #define __NR___syscall_mmap2 __NR_mmap2 static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, off_t, offset); @@ -38,7 +40,7 @@ static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, # define MMAP2_PAGE_SHIFT 12 # endif -__ptr_t attribute_hidden __mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset) +__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset) { if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) { __set_errno (EINVAL); @@ -46,4 +48,4 @@ __ptr_t attribute_hidden __mmap(__ptr_t addr, size_t len, int prot, int flags, i } return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT))); } -strong_alias(__mmap,mmap) +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/frv/sbrk.c b/libc/sysdeps/linux/frv/sbrk.c index e9faf7db0..bb66f0148 100644 --- a/libc/sysdeps/linux/frv/sbrk.c +++ b/libc/sysdeps/linux/frv/sbrk.c @@ -4,13 +4,17 @@ #include <unistd.h> #include <sys/syscall.h> +libc_hidden_proto(sbrk) + extern void * __curbrk; +libc_hidden_proto(__curbrk) extern int __init_brk (void); +libc_hidden_proto(__init_brk) extern void *_brk(void *ptr) attribute_hidden; -void attribute_hidden * -__sbrk(intptr_t increment) +void * +sbrk(intptr_t increment) { if (__init_brk () == 0) { @@ -23,4 +27,4 @@ __sbrk(intptr_t increment) } return ((void *) -1); } -strong_alias(__sbrk,sbrk) +libc_hidden_def(sbrk) diff --git a/libc/sysdeps/linux/frv/stat.c b/libc/sysdeps/linux/frv/stat.c index 4a54b130f..56cb668db 100644 --- a/libc/sysdeps/linux/frv/stat.c +++ b/libc/sysdeps/linux/frv/stat.c @@ -1,45 +1,18 @@ /* * Syscalls for uClibc * - * Copyright (C) 2001-2003 by Erik Andersen - * Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org> - * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program 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 Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org> + * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ -#define _GNU_SOURCE -#define _LARGEFILE64_SOURCE -#include <features.h> -#undef __OPTIMIZE__ -/* We absolutely do _NOT_ want interfaces silently - * * * renamed under us or very bad things will happen... */ -#ifdef __USE_FILE_OFFSET64 -# undef __USE_FILE_OFFSET64 -#endif - -#include <errno.h> -#include <sys/types.h> -#include <sys/syscall.h> -#include <endian.h> - +#include "../common/syscalls.h" #include <unistd.h> -#define _SYS_STAT_H -#include <bits/stat.h> +#include <sys/stat.h> -#define __NR___syscall_stat __NR_stat -_syscall2(int, __syscall_stat, const char *, file_name, struct stat *, buf); -strong_alias(__syscall_stat, stat) +libc_hidden_proto(stat) +_syscall2(int, stat, const char *, file_name, struct stat *, buf); +libc_hidden_def(stat) diff --git a/libc/sysdeps/linux/frv/stat64.c b/libc/sysdeps/linux/frv/stat64.c index ecfe808cc..641644ffd 100644 --- a/libc/sysdeps/linux/frv/stat64.c +++ b/libc/sysdeps/linux/frv/stat64.c @@ -1,47 +1,20 @@ /* * Syscalls for uClibc * - * Copyright (C) 2001-2003 by Erik Andersen - * Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org> - * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program 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 Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org> + * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ -#define _GNU_SOURCE -#define _LARGEFILE64_SOURCE -#include <features.h> -#undef __OPTIMIZE__ -/* We absolutely do _NOT_ want interfaces silently - * * * renamed under us or very bad things will happen... */ -#ifdef __USE_FILE_OFFSET64 -# undef __USE_FILE_OFFSET64 -#endif - -#include <errno.h> -#include <sys/types.h> -#include <sys/syscall.h> -#include <endian.h> - +#include "../common/syscalls.h" #include <unistd.h> -#define _SYS_STAT_H -#include <bits/stat.h> +#include <sys/stat.h> -#if defined __UCLIBC_HAS_LFS__ -#define __NR___syscall_stat64 __NR_stat64 -_syscall2(int, __syscall_stat64, const char *, file_name, struct stat64 *, buf); -strong_alias(__syscall_stat64, stat64) +#ifdef __UCLIBC_HAS_LFS__ +libc_hidden_proto(stat64) +_syscall2(int, stat64, const char *, file_name, struct stat64 *, buf); +libc_hidden_def(stat64) #endif diff --git a/libc/sysdeps/linux/frv/vfork.S b/libc/sysdeps/linux/frv/vfork.S index b5ecc09af..8935a12f8 100644 --- a/libc/sysdeps/linux/frv/vfork.S +++ b/libc/sysdeps/linux/frv/vfork.S @@ -43,4 +43,5 @@ __vfork: .size __vfork,.-__vfork -strong_alias(__vfork,vfork) +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h b/libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h new file mode 100644 index 000000000..c424d9bb6 --- /dev/null +++ b/libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h @@ -0,0 +1,42 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/ +#undef __UCLIBC_ABORT_INSTRUCTION__ + +/* can your target use syscall6() for mmap ? */ +#define __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#undef __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/h8300/brk.c b/libc/sysdeps/linux/h8300/brk.c index d69f9a2d3..52ba1ac9c 100644 --- a/libc/sysdeps/linux/h8300/brk.c +++ b/libc/sysdeps/linux/h8300/brk.c @@ -1,15 +1,23 @@ /* brk on H8/300 by ysato */ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <errno.h> #include <unistd.h> #include <sys/syscall.h> +libc_hidden_proto(brk) /* This must be initialized data because commons can't have aliases. */ +extern void *__curbrk; +libc_hidden_proto(__curbrk) void *__curbrk = 0; +libc_hidden_data_def(__curbrk) - -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; @@ -31,4 +39,4 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/h8300/clone.S b/libc/sysdeps/linux/h8300/clone.S index 7d100b6c4..554a29703 100644 --- a/libc/sysdeps/linux/h8300/clone.S +++ b/libc/sysdeps/linux/h8300/clone.S @@ -19,9 +19,7 @@ .text .globl _clone -.globl ___clone _clone: -___clone: /* Sanity check arguments. */ mov.l #-EINVAL,er3 mov.l er0,er0 /* no NULL function pointers */ @@ -68,11 +66,3 @@ thread_start: mov.l er0,er1 mov.l #__NR_exit,er0 trapa #0 - -#if defined(__HAVE_ELF__) - .weak clone - clone = __clone -#else - .set clone,__clone -#endif - diff --git a/libc/sysdeps/linux/h8300/crt0.S b/libc/sysdeps/linux/h8300/crt0.S index a593b88e2..ebdca18e5 100644 --- a/libc/sysdeps/linux/h8300/crt0.S +++ b/libc/sysdeps/linux/h8300/crt0.S @@ -56,12 +56,8 @@ __exit: */ empty_func: rts -#if defined(__HAVE_ELF__) .weak atexit atexit = empty_func -#else - .set atexit,empty_func -#endif /* Define a symbol for the first piece of initialized data. */ diff --git a/libc/sysdeps/linux/h8300/pt-machine.h b/libc/sysdeps/linux/h8300/pt-machine.h deleted file mode 100644 index ad83147cb..000000000 --- a/libc/sysdeps/linux/h8300/pt-machine.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - H8/300 version. - Copyright (C) 1996, 1998, 2000, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson <rth@tamu.edu>. - - 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; see the file COPYING.LIB. If - not, write to the Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#ifndef PT_EI -# define PT_EI extern inline -#endif - -extern long int testandset (int *spinlock); - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - char ret; - - __asm__ __volatile__( - "sub.w %0,%0\n\t" - "stc ccr,@-sp\n\t" - "orc #0x80,ccr\n\t" - "bld #0,@%2\n\t" - "bset #0,@%2\n\t" - "rotxl.w %0\n\t" - "ldc @sp+,ccr\n\t" - :"=r"(ret),"=m"(*spinlock) - :"g"(spinlock) - :"cc"); - - return ret; -} - - -/* Get some notion of the current stack. Need not be exactly the top - of the stack, just something somewhere in the current frame. */ -#define CURRENT_STACK_FRAME stack_pointer -register char * stack_pointer __asm__ ("%sp"); - -#endif /* pt-machine.h */ diff --git a/libc/sysdeps/linux/h8300/vfork.S b/libc/sysdeps/linux/h8300/vfork.S index e101bf5ed..35c04e559 100644 --- a/libc/sysdeps/linux/h8300/vfork.S +++ b/libc/sysdeps/linux/h8300/vfork.S @@ -12,12 +12,11 @@ #endif .text .align 2 - .globl _errno - .globl _vfork -#if defined __HAVE_ELF__ - .type vfork,@function -#endif -_vfork: + .globl _errno + .globl ___vfork + .hidden ___vfork + .type ___vfork,@function +___vfork: mov.l @sp+, er1 sub.l er0,er0 mov.b #__NR_vfork,r0l @@ -38,3 +37,5 @@ fix_errno: dec.l #1,er0 jmp @er1 /* don't return, just jmp directly */ +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/hppa/__longjmp.S b/libc/sysdeps/linux/hppa/__longjmp.S index 62026635f..750863e95 100644 --- a/libc/sysdeps/linux/hppa/__longjmp.S +++ b/libc/sysdeps/linux/hppa/__longjmp.S @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <features.h> #define _SETJMP_H #define _ASM #include <bits/setjmp.h> @@ -69,3 +70,5 @@ __longjmp: bv,n %r0(%r2) .procend + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/hppa/__syscall_error.c b/libc/sysdeps/linux/hppa/__syscall_error.c index de65a1f39..5e109a83b 100644 --- a/libc/sysdeps/linux/hppa/__syscall_error.c +++ b/libc/sysdeps/linux/hppa/__syscall_error.c @@ -1,28 +1,17 @@ /* Wrapper for setting errno. - Copyright (C) 1997, 1998, 1999, 2000 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + * + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <errno.h> #include <features.h> /* This routine is jumped to by all the syscall handlers, to stash * an error number into errno. */ -int attribute_hidden __syscall_error(int err_no) +int __syscall_error(int err_no) attribute_hidden; +int __syscall_error(int err_no) { __set_errno(err_no); return -1; diff --git a/libc/sysdeps/linux/hppa/bits/fenv.h b/libc/sysdeps/linux/hppa/bits/fenv.h new file mode 100644 index 000000000..c5f8c4345 --- /dev/null +++ b/libc/sysdeps/linux/hppa/bits/fenv.h @@ -0,0 +1,78 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Huggins-Daines <dhd@debian.org> + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FENV_H +# error "Never use <bits/fenv.h> directly; include <fenv.h> instead." +#endif + +/* Define bits representing the exception. We use the values of the + appropriate enable bits in the FPU status word (which, + coincidentally, are the same as the flag bits, but shifted right by + 27 bits). */ +enum +{ + FE_INVALID = 1<<4, /* V */ +#define FE_INVALID FE_INVALID + FE_DIVBYZERO = 1<<3, /* Z */ +#define FE_DIVBYZERO FE_DIVBYZERO + FE_OVERFLOW = 1<<2, /* O */ +#define FE_OVERFLOW FE_OVERFLOW + FE_UNDERFLOW = 1<<1, /* U */ +#define FE_UNDERFLOW FE_UNDERFLOW + FE_INEXACT = 1<<0, /* I */ +#define FE_INEXACT FE_INEXACT +}; + +#define FE_ALL_EXCEPT \ + (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) + +/* The PA-RISC FPU supports all of the four defined rounding modes. + We use the values of the RM field in the floating point status + register for the appropriate macros. */ +enum + { + FE_TONEAREST = 0 << 9, +#define FE_TONEAREST FE_TONEAREST + FE_TOWARDZERO = 1 << 9, +#define FE_TOWARDZERO FE_TOWARDZERO + FE_UPWARD = 2 << 9, +#define FE_UPWARD FE_UPWARD + FE_DOWNWARD = 3 << 9, +#define FE_DOWNWARD FE_DOWNWARD + }; + +/* Type representing exception flags. */ +typedef unsigned int fexcept_t; + +/* Type representing floating-point environment. This structure + corresponds to the layout of the status and exception words in the + register file. */ +typedef struct +{ + unsigned int __status_word; + unsigned int __exception[7]; +} fenv_t; + +/* If the default argument is used we use this value. */ +#define FE_DFL_ENV ((fenv_t *) -1) + +#ifdef __USE_GNU +/* Floating-point environment where none of the exceptions are masked. */ +# define FE_NOMASK_ENV ((fenv_t *) -2) +#endif diff --git a/libc/sysdeps/linux/hppa/bits/kernel_sigaction.h b/libc/sysdeps/linux/hppa/bits/kernel_sigaction.h index af048cbe7..cccaabbb9 100644 --- a/libc/sysdeps/linux/hppa/bits/kernel_sigaction.h +++ b/libc/sysdeps/linux/hppa/bits/kernel_sigaction.h @@ -16,3 +16,6 @@ struct kernel_sigaction { unsigned long sa_flags; sigset_t sa_mask; }; + +extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded, + struct kernel_sigaction *__unbounded, size_t); diff --git a/libc/sysdeps/linux/hppa/bits/kernel_stat.h b/libc/sysdeps/linux/hppa/bits/kernel_stat.h index 3d5be0352..c64392037 100644 --- a/libc/sysdeps/linux/hppa/bits/kernel_stat.h +++ b/libc/sysdeps/linux/hppa/bits/kernel_stat.h @@ -4,8 +4,6 @@ #ifndef _PARISC_STAT_H #define _PARISC_STAT_H -#include <linux/types.h> - struct kernel_stat { unsigned int st_dev; /* dev_t is 32 bits on parisc */ ino_t st_ino; /* 32 bits */ diff --git a/libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h b/libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h new file mode 100644 index 000000000..bf048d3b8 --- /dev/null +++ b/libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h @@ -0,0 +1,41 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +#define __UCLIBC_ABORT_INSTRUCTION__ "iitlbp %r0,(%sr0,%r0)" + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/hppa/brk.c b/libc/sysdeps/linux/hppa/brk.c index f50360aa5..52d0b4c74 100644 --- a/libc/sysdeps/linux/hppa/brk.c +++ b/libc/sysdeps/linux/hppa/brk.c @@ -19,12 +19,18 @@ #include <errno.h> #include <sys/syscall.h> +#include <unistd.h> + +libc_hidden_proto(brk) /* This must be initialized data because commons can't have aliases. */ +extern void *__curbrk; +libc_hidden_proto(__curbrk) void *__curbrk = 0; +libc_hidden_data_def(__curbrk) -int attribute_hidden -__brk (void *addr) +int +brk (void *addr) { void *newbrk; @@ -38,4 +44,4 @@ __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/hppa/clone.S b/libc/sysdeps/linux/hppa/clone.S index 8395cdada..f6e5568d0 100644 --- a/libc/sysdeps/linux/hppa/clone.S +++ b/libc/sysdeps/linux/hppa/clone.S @@ -29,9 +29,9 @@ /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ .text -.global __clone -.type __clone,%function -__clone: +.global clone +.type clone,%function +clone: /* FIXME: I have no idea how profiling works on hppa. */ /* Sanity check arguments. */ @@ -90,13 +90,10 @@ thread_start: bl $$dyncall,%r31 copy %r31,%rp - bl _exit_internal,%rp + bl HIDDEN_JUMPTARGET(_exit),%rp copy %ret0,%arg0 /* Die horribly. */ iitlbp %r0,(%r0) -.size __clone,.-__clone - -.weak clone - clone = __clone +.size clone,.-clone diff --git a/libc/sysdeps/linux/hppa/crt1.S b/libc/sysdeps/linux/hppa/crt1.S index 413f875a1..8b42dacde 100644 --- a/libc/sysdeps/linux/hppa/crt1.S +++ b/libc/sysdeps/linux/hppa/crt1.S @@ -34,16 +34,32 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ - .text - - .align 4 - .import main, code .import $global$, data .import __uClibc_main, code +#if defined(__UCLIBC_CTOR_DTOR__) .import _fini, code .import _init, code +#else + .weak _fini + .weak _init +#endif + + /* Have the linker create plabel words + so we get PLABEL32 relocs and not 21/14 */ + .section .rodata + .align 4 +.Lpmain: + .word P%main +.Lp__uClibc_main: + .word P%__uClibc_main +.Lp_fini: + .word P%_fini +.Lp_init: + .word P%_init + .text + .align 4 .globl _start .export _start, ENTRY .type _start,@function @@ -52,28 +68,41 @@ _start: .proc .callinfo - /* load main */ - ldil LP%main, %r26 - ldo RP%main(%r26), %r26 - - /* argc and argv should be in 25 and 24 */ - /* Expand the stack to store the 5th through 7th args */ ldo 64(%sp), %sp - - /* void (*rtld_fini) (void) (actually the 6th arg) */ - stw %r23, -56(%sp) - - /* void (*init) (void) */ - ldil LP%_init, %r23 - ldo RP%_init(%r23), %r23 - - /* void (*fini) (void) */ - ldil LP%_fini, %r22 - ldo RP%_fini(%r22), %r22 + /* TODO: Follow ABI? Place more things on the stack here... */ + +#ifdef __PIC__ + /* load main (1st argument) */ + addil LR'.Lpmain, %r19 + ldw RR'.Lpmain(%r1), %r26 + ldw 0(%r26),%r26 + /* argc and argv should be in 25 and 24 (2nd and 3rd argument) */ + /* void (*init) (void) (4th argument) */ + addil LR'.Lp_init, %r19 + ldw RR'.Lp_init(%r1), %r23 + ldw 0(%r23), %r23 + /* void (*fini) (void) (5th argument) */ + addil LR'.Lp_fini, %r19 + ldw RR'.Lp_fini(%r1), %r22 + ldw 0(%r22), %r22 +#else + /* load main (1st argument) */ + ldil LR'.Lpmain, %r26 + ldw RR'.Lpmain(%r26), %r26 + /* argc and argv should be in 25 and 24 (2nd and 3rd argument) */ + /* void (*init) (void) (4th argument) */ + ldil LR'.Lp_init, %r23 + ldw RR'.Lp_init(%r23), %r23 + /* void (*fini) (void) (5th argument) */ + ldil LR'.Lp_fini, %r22 + ldw RR'.Lp_fini(%r22), %r22 +#endif + /* Store 5th argument */ stw %r22, -52(%sp) - - /* void *stack_end */ + /* void (*rtld_fini) (void) (6th argument) */ + stw %r23, -56(%sp) + /* void *stack_end (7th argument) */ stw %sp, -60(%sp) /* load global */ @@ -83,7 +112,7 @@ _start: bl __uClibc_main,%r2 nop /* die horribly if it returned (it shouldn't) */ - iitlbp %r0,(%r0) + iitlbp %r0,(%sr0,%r0) nop .procend diff --git a/libc/sysdeps/linux/hppa/mmap.c b/libc/sysdeps/linux/hppa/mmap.c index f14f1b6f9..baaee6847 100644 --- a/libc/sysdeps/linux/hppa/mmap.c +++ b/libc/sysdeps/linux/hppa/mmap.c @@ -2,10 +2,10 @@ /* * mmap() for uClibc/x86_64 * - * Copyright (C) 2005 by Erik Andersen <andersen@codepoet.org> + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * Copyright (C) 2005 by Mike Frysinger <vapier@gentoo.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #include <errno.h> @@ -13,7 +13,8 @@ #include <sys/mman.h> #include <sys/syscall.h> -#define __NR___mmap __NR_mmap -attribute_hidden _syscall6(void *, __mmap, void *, start, size_t, length, int, prot, +libc_hidden_proto(mmap) + +_syscall6(void *, mmap, void *, start, size_t, length, int, prot, int, flags, int, fd, off_t, offset); -strong_alias(__mmap,mmap) +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/i386/__longjmp.S b/libc/sysdeps/linux/i386/__longjmp.S index 52f53bb68..d73a7cda2 100644 --- a/libc/sysdeps/linux/i386/__longjmp.S +++ b/libc/sysdeps/linux/i386/__longjmp.S @@ -17,6 +17,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <features.h> #define _ASM #define _SETJMP_H #include <bits/setjmp.h> @@ -38,3 +39,5 @@ __longjmp: /* Jump to saved PC. */ jmp *%edx .size __longjmp,.-__longjmp + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/i386/__syscall_error.c b/libc/sysdeps/linux/i386/__syscall_error.c index 133500cb6..7509d4409 100644 --- a/libc/sysdeps/linux/i386/__syscall_error.c +++ b/libc/sysdeps/linux/i386/__syscall_error.c @@ -1,46 +1,36 @@ /* Wrapper for setting errno. - Copyright (C) 1997, 1998, 1999, 2000 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <features.h> + * + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ /* This routine is jumped to by all the syscall handlers, to stash * an error number into errno. */ -/* This version uses a lot of magic and relies heavily on x86 - * calling convention ... The advantage is that this is the same +/* This version uses a lot of magic and relies heavily on x86 + * calling convention ... The advantage is that this is the same * size as the previous __syscall_error() but all the .S functions * need just one instruction. * - * Local .S files have to set %eax to the negative errno value - * and then jump to this function. The neglected return to caller - * and return value of -1 is taken care of here so we don't have to + * Local .S files have to set %eax to the negative errno value + * and then jump to this function. The neglected return to caller + * and return value of -1 is taken care of here so we don't have to * worry about it in the .S functions. * - * We have to stash the errno from %eax in a local stack var because + * We have to stash the errno from %eax in a local stack var because * __set_errno will prob call a function thus clobbering %eax on us. */ -int attribute_hidden __syscall_error(void) + +#include <errno.h> +#include <features.h> + +int __syscall_error(void) attribute_hidden; +int __syscall_error(void) { - register int edx asm("%edx"); - asm("mov %eax, %edx"); - asm("negl %edx"); - __set_errno(edx); + register int edx __asm__ ("%edx"); + __asm__ ("mov %eax, %edx\n\t" + "negl %edx"); + __set_errno (edx); return -1; } diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h index 6ad3b1dd9..857491f06 100644 --- a/libc/sysdeps/linux/i386/bits/syscalls.h +++ b/libc/sysdeps/linux/i386/bits/syscalls.h @@ -20,7 +20,13 @@ /* We need some help from the assembler to generate optimal code. We define some macros here which later will be used. */ -asm (".L__X'%ebx = 1\n\t" + +#if defined __SUPPORT_LD_DEBUG__ && defined __DOMULTI__ +#error LD debugging and DOMULTI are incompatible +#endif + +#ifdef __DOMULTI__ +__asm__ (".L__X'%ebx = 1\n\t" ".L__X'%ecx = 2\n\t" ".L__X'%edx = 2\n\t" ".L__X'%eax = 3\n\t" @@ -56,7 +62,41 @@ asm (".L__X'%ebx = 1\n\t" ".endif\n\t" ".endm\n\t" ".endif\n\t"); - +#else +__asm__ (".L__X'%ebx = 1\n\t" + ".L__X'%ecx = 2\n\t" + ".L__X'%edx = 2\n\t" + ".L__X'%eax = 3\n\t" + ".L__X'%esi = 3\n\t" + ".L__X'%edi = 3\n\t" + ".L__X'%ebp = 3\n\t" + ".L__X'%esp = 3\n\t" + ".macro bpushl name reg\n\t" + ".if 1 - \\name\n\t" + ".if 2 - \\name\n\t" + "pushl %ebx\n\t" + ".else\n\t" + "xchgl \\reg, %ebx\n\t" + ".endif\n\t" + ".endif\n\t" + ".endm\n\t" + ".macro bpopl name reg\n\t" + ".if 1 - \\name\n\t" + ".if 2 - \\name\n\t" + "popl %ebx\n\t" + ".else\n\t" + "xchgl \\reg, %ebx\n\t" + ".endif\n\t" + ".endif\n\t" + ".endm\n\t" + ".macro bmovl name reg\n\t" + ".if 1 - \\name\n\t" + ".if 2 - \\name\n\t" + "movl \\reg, %ebx\n\t" + ".endif\n\t" + ".endif\n\t" + ".endm\n\t"); +#endif #undef _syscall0 #define _syscall0(type,name) \ @@ -112,7 +152,7 @@ return (type) (INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6)); \ #define INLINE_SYSCALL(name, nr, args...) \ ({ \ unsigned int resultvar; \ - asm volatile ( \ + __asm__ __volatile__ ( \ LOADARGS_##nr \ "movl %1, %%eax\n\t" \ "int $0x80\n\t" \ diff --git a/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h b/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h new file mode 100644 index 000000000..718ab2a9c --- /dev/null +++ b/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h @@ -0,0 +1,46 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +#define __UCLIBC_ABORT_INSTRUCTION__ "hlt" + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#define __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target have to worry about older [gs]etrlimit() ? */ +#define __UCLIBC_HANDLE_OLDER_RLIMIT__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#define internal_function __attribute__ ((regparm (3), stdcall)) + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/i386/brk.c b/libc/sysdeps/linux/i386/brk.c index 5790e2fca..6a654f0d0 100644 --- a/libc/sysdeps/linux/i386/brk.c +++ b/libc/sysdeps/linux/i386/brk.c @@ -21,15 +21,19 @@ #include <unistd.h> #include <sys/syscall.h> +libc_hidden_proto(brk) /* This must be initialized data because commons can't have aliases. */ +extern void *__curbrk; +libc_hidden_proto(__curbrk) void *__curbrk = 0; +libc_hidden_data_def(__curbrk) -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *__unbounded newbrk, *__unbounded scratch; - asm ("movl %%ebx, %1\n" /* Save %ebx in scratch register. */ + __asm__ ("movl %%ebx, %1\n" /* Save %ebx in scratch register. */ "movl %3, %%ebx\n" /* Put ADDR in %ebx to be syscall arg. */ "int $0x80 # %2\n" /* Perform the system call. */ "movl %1, %%ebx\n" /* Restore %ebx from scratch register. */ @@ -46,4 +50,4 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/i386/clone.S b/libc/sysdeps/linux/i386/clone.S index 35a4e5b7f..14fc25ca1 100644 --- a/libc/sysdeps/linux/i386/clone.S +++ b/libc/sysdeps/linux/i386/clone.S @@ -42,9 +42,9 @@ #define CTID TLS+PTR_SIZE .text -.global __clone -.type __clone,%function -__clone: +.global clone +.type clone,%function +clone: /* Sanity check arguments. */ movl $-EINVAL,%eax @@ -120,7 +120,4 @@ __clone: __error: jmp __syscall_error -.size __clone,.-__clone - -.weak clone - clone = __clone +.size clone,.-clone diff --git a/libc/sysdeps/linux/i386/mmap.S b/libc/sysdeps/linux/i386/mmap.S index 4c4723dff..fe7a7986c 100644 --- a/libc/sysdeps/linux/i386/mmap.S +++ b/libc/sysdeps/linux/i386/mmap.S @@ -21,13 +21,10 @@ #include <bits/errno.h> #include <sys/syscall.h> -.global mmap -.set mmap,__mmap .text -.global __mmap -.hidden __mmap -.type __mmap,%function -__mmap: +.global mmap +.type mmap,%function +mmap: /* Save registers. */ movl %ebx, %edx @@ -49,4 +46,6 @@ __mmap: /* Successful; return the syscall's value. */ ret -.size __mmap,.-__mmap +.size mmap,.-mmap + +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/i386/sigaction.c b/libc/sysdeps/linux/i386/sigaction.c index 335fc9a27..341c0d16b 100644 --- a/libc/sysdeps/linux/i386/sigaction.c +++ b/libc/sysdeps/linux/i386/sigaction.c @@ -27,10 +27,13 @@ #define SA_RESTORER 0x04000000 +extern __typeof(sigaction) __libc_sigaction; #if defined __NR_rt_sigaction -extern void restore_rt (void) asm ("__restore_rt") attribute_hidden; -extern void restore (void) asm ("__restore") attribute_hidden; +libc_hidden_proto(memcpy) + +extern void restore_rt (void) __asm__ ("__restore_rt") attribute_hidden; +extern void restore (void) __asm__ ("__restore") attribute_hidden; /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ @@ -48,7 +51,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (act) { kact.k_sa_handler = act->sa_handler; - __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); kact.sa_flags = act->sa_flags; kact.sa_flags = act->sa_flags | SA_RESTORER; @@ -63,7 +66,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); oact->sa_flags = koact.sa_flags; oact->sa_restorer = koact.sa_restorer; } @@ -72,7 +75,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa #else -extern void restore (void) asm ("__restore") attribute_hidden; +extern void restore (void) __asm__ ("__restore") attribute_hidden; /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ @@ -95,7 +98,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa kact.sa_restorer = &restore; } - asm volatile ("pushl %%ebx\n" + __asm__ __volatile__ ("pushl %%ebx\n" "movl %2, %%ebx\n" "int $0x80\n" "popl %%ebx" @@ -121,8 +124,9 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa #endif #ifndef LIBC_SIGACTION -hidden_weak_alias(__libc_sigaction,__sigaction) +libc_hidden_proto(sigaction) weak_alias(__libc_sigaction,sigaction) +libc_hidden_weak(sigaction) #endif @@ -138,7 +142,7 @@ weak_alias(__libc_sigaction,sigaction) #define RESTORE(name, syscall) RESTORE2 (name, syscall) #define RESTORE2(name, syscall) \ -asm \ +__asm__ \ ( \ ".text\n" \ " .align 16\n" \ @@ -152,10 +156,11 @@ asm \ RESTORE (restore_rt, __NR_rt_sigreturn) #endif +#ifdef __NR_sigreturn /* For the boring old signals. */ # undef RESTORE2 # define RESTORE2(name, syscall) \ -asm \ +__asm__ \ ( \ ".text\n" \ " .align 8\n" \ @@ -166,3 +171,4 @@ asm \ ); RESTORE (restore, __NR_sigreturn) +#endif diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S index 18a8e5dfa..543da6e90 100644 --- a/libc/sysdeps/linux/i386/vfork.S +++ b/libc/sysdeps/linux/i386/vfork.S @@ -1,18 +1,15 @@ /* - * June 3, 2003 Erik Andersen + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include <features.h> #include <sys/syscall.h> #ifndef __NR_vfork - /* No vfork so use fork instead */ -hidden_strong_alias(__fork,__vfork) -weak_alias(vfork,__libc_fork) - -#else +# define __NR_vfork __NR_fork +#endif .text .global __vfork @@ -30,5 +27,6 @@ __vfork: ret .size __vfork,.-__vfork -#endif -strong_alias(__vfork,vfork) + +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/i960/README b/libc/sysdeps/linux/i960/README index e1ca11f9a..185fe2572 100644 --- a/libc/sysdeps/linux/i960/README +++ b/libc/sysdeps/linux/i960/README @@ -16,8 +16,7 @@ prepended underscore -------------------- As the i960 compiler prepends an underscore to symbols, it is critical that -the Config file define __C_SYMBOL_PREFIX__ as - __C_SYMBOL_PREFIX__ = _ +bits/uClibc_arch_features.h undefines __UCLIBC_NO_UNDERSCORES__ to make sure that underscores are applied to symbol names when needed. diff --git a/libc/sysdeps/linux/i960/bits/uClibc_arch_features.h b/libc/sysdeps/linux/i960/bits/uClibc_arch_features.h new file mode 100644 index 000000000..eef651eeb --- /dev/null +++ b/libc/sysdeps/linux/i960/bits/uClibc_arch_features.h @@ -0,0 +1,42 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/ +#undef __UCLIBC_ABORT_INSTRUCTION__ + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#define __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#undef __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/i960/clone.S b/libc/sysdeps/linux/i960/clone.S index c6c0dc73a..f602fbabc 100644 --- a/libc/sysdeps/linux/i960/clone.S +++ b/libc/sysdeps/linux/i960/clone.S @@ -28,8 +28,8 @@ /* int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ - .globl __clone -__clone: + .globl clone +clone: /* set up new stack image in regs r4-r7; argument will be in r3 in child. */ ldconst 0, r4 /* pfp == 0 */ addo 16, g1, r5 /* sp == newfp + 16 */ diff --git a/libc/sysdeps/linux/i960/vfork.S b/libc/sysdeps/linux/i960/vfork.S index f519b66fe..1646e1be4 100644 --- a/libc/sysdeps/linux/i960/vfork.S +++ b/libc/sysdeps/linux/i960/vfork.S @@ -1,24 +1,14 @@ -# -# clone.S, part of the i960 support for the uClibc library. -# -# Copyright (C) 2002 by Okiok Data Ltd. http://www.okiok.com/ -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program 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 Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# at 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived from an old port of uC-libc to the i960 by Keith Adams (kma@cse.ogi.edu). -# +/* + * clone.S, part of the i960 support for the uClibc library. + * + * Copyright (C) 2002 by Okiok Data Ltd. http://www.okiok.com/ + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* + * Derived from an old port of uC-libc to the i960 by Keith Adams (kma@cse.ogi.edu). + */ #include <sys/syscall.h> @@ -26,8 +16,9 @@ #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ #endif - .globl _vfork -_vfork: + .globl ___vfork + .hidden ___vfork +___vfork: mov g13, r3 ldconst __NR_vfork, g13 calls 0 @@ -38,3 +29,5 @@ _vfork: 1: ret +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/m68k/Makefile.arch b/libc/sysdeps/linux/m68k/Makefile.arch index 2ebd602d7..14ce2e30a 100644 --- a/libc/sysdeps/linux/m68k/Makefile.arch +++ b/libc/sysdeps/linux/m68k/Makefile.arch @@ -5,12 +5,8 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CSRC := ptrace.c brk.c +CSRC := brk.c __syscall_error.c syscall.c SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S vfork.S -ifneq ($(HAVE_ELF),y) -ARCH_HEADERS := float.h -endif - include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch diff --git a/libc/sysdeps/linux/m68k/__longjmp.S b/libc/sysdeps/linux/m68k/__longjmp.S index d218f2ef5..5db9e4362 100644 --- a/libc/sysdeps/linux/m68k/__longjmp.S +++ b/libc/sysdeps/linux/m68k/__longjmp.S @@ -4,11 +4,12 @@ #define _ASM #define _SETJMP_H +#include <features.h> #include <bits/setjmp.h> -.globl __longjmp; +.globl __longjmp .type __longjmp,@function -.align 4; \ +.align 4 __longjmp: moveal %sp@(4), %a0 movel %sp@(8), %d0 @@ -22,3 +23,4 @@ __longjmp: movel %a0@(JB_PC), %sp@ rts +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/m68k/__syscall_error.c b/libc/sysdeps/linux/m68k/__syscall_error.c new file mode 100644 index 000000000..5cfdead8b --- /dev/null +++ b/libc/sysdeps/linux/m68k/__syscall_error.c @@ -0,0 +1,19 @@ +/* Wrapper for setting errno. + * + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <errno.h> +#include <features.h> + +/* This routine is jumped to by all the syscall handlers, to stash + * an error number into errno. */ +int __syscall_error(void) attribute_hidden; +int __syscall_error(void) +{ + register int err_no asm("%d0"); + __set_errno(-err_no); + return -1; +} diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h index 4b41b4715..90c0a481e 100644 --- a/libc/sysdeps/linux/m68k/bits/fcntl.h +++ b/libc/sysdeps/linux/m68k/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2004 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 @@ -45,7 +45,7 @@ # define O_DIRECTORY 040000 /* Must be a directory. */ # define O_NOFOLLOW 0100000 /* Do not follow links. */ # define O_DIRECT 0200000 /* Direct disk access. */ -# define O_STREAMING 04000000/* streaming access */ +# define O_NOATIME 01000000 /* Do not set atime. */ #endif /* For now Linux has synchronisity options for data and read operations. @@ -79,7 +79,7 @@ #define F_SETLK64 13 /* Set record locking info (non-blocking). */ #define F_SETLKW64 14 /* Set record locking info (blocking). */ -#if defined __USE_BSD || defined __USE_XOPEN2K +#if defined __USE_BSD || defined __USE_UNIX98 # define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */ # define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */ #endif @@ -178,3 +178,11 @@ struct flock64 # define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif + +__BEGIN_DECLS + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + +__END_DECLS diff --git a/libc/sysdeps/linux/m68k/bits/mman.h b/libc/sysdeps/linux/m68k/bits/mman.h index 7f644b99b..6e7bdc99d 100644 --- a/libc/sysdeps/linux/m68k/bits/mman.h +++ b/libc/sysdeps/linux/m68k/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/m68k version. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2003, 2005 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 @@ -34,6 +34,10 @@ #define PROT_WRITE 0x2 /* Page can be written. */ #define PROT_EXEC 0x4 /* Page can be executed. */ #define PROT_NONE 0x0 /* Page can not be accessed. */ +#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of + growsdown vma (mprotect only). */ +#define PROT_GROWSUP 0x02000000 /* Extend change to start of + growsup vma (mprotect only). */ /* Sharing types (must choose one and only one of these). */ #define MAP_SHARED 0x01 /* Share changes. */ @@ -52,11 +56,13 @@ /* These are Linux-specific. */ #ifdef __USE_MISC -# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */ -# define MAP_DENYWRITE 0x0800 /* ETXTBSY */ -# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */ -# define MAP_LOCKED 0x2000 /* Lock the mapping. */ -# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */ +# 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. */ #endif /* Flags to `msync'. */ @@ -74,3 +80,21 @@ # define MREMAP_MAYMOVE 1 # define MREMAP_FIXED 2 #endif + +/* Advice to `madvise'. */ +#ifdef __USE_BSD +# define MADV_NORMAL 0 /* No further special treatment. */ +# define MADV_RANDOM 1 /* Expect random page references. */ +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define MADV_WILLNEED 3 /* Will need these pages. */ +# define MADV_DONTNEED 4 /* Don't need these pages. */ +#endif + +/* The POSIX people had to invent similar names for the same things. */ +#ifdef __USE_XOPEN2K +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ +#endif diff --git a/libc/sysdeps/linux/m68k/bits/setjmp.h b/libc/sysdeps/linux/m68k/bits/setjmp.h index efad14c13..a6b0ed0f1 100644 --- a/libc/sysdeps/linux/m68k/bits/setjmp.h +++ b/libc/sysdeps/linux/m68k/bits/setjmp.h @@ -1,5 +1,5 @@ /* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2005,2006 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 @@ -25,13 +25,17 @@ # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif -#ifndef _ASM +#ifndef _ASM typedef struct { - unsigned long __dregs[6]; /* save d2 - d7 */ - unsigned long __aregs[6]; /* save a2 - a7 */ - unsigned long __pc; /* the return address */ + /* There are eight 4-byte data registers, but D0 is not saved. */ + long int __dregs[7]; + + /* There are six 4-byte address registers, plus the FP and SP. */ + int *__aregs[6]; + int *__fp; + int *__sp; #if defined __HAVE_68881__ || defined __HAVE_FPU__ /* There are eight floating point registers which @@ -41,7 +45,7 @@ typedef struct } __jmp_buf[1]; -#endif /* _ASM */ +#endif #define JB_REGS 0 #define JB_DREGS 0 diff --git a/libc/sysdeps/linux/m68k/bits/stat.h b/libc/sysdeps/linux/m68k/bits/stat.h index 213dbe267..a435240cd 100644 --- a/libc/sysdeps/linux/m68k/bits/stat.h +++ b/libc/sysdeps/linux/m68k/bits/stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002 + 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 @@ -61,11 +62,11 @@ struct stat __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ #endif __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; + unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; + unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; + unsigned long int st_ctimensec; /* Nsecs of last status change. */ #ifndef __USE_FILE_OFFSET64 unsigned long int __unused4; unsigned long int __unused5; @@ -92,11 +93,11 @@ struct stat64 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; + unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; + unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; + unsigned long int st_ctimensec; /* Nsecs of last status change. */ __ino64_t st_ino; /* File serial number. */ }; #endif @@ -104,6 +105,8 @@ struct stat64 /* 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. */ diff --git a/libc/sysdeps/linux/m68k/bits/syscalls.h b/libc/sysdeps/linux/m68k/bits/syscalls.h index 05bc7b675..284112e31 100644 --- a/libc/sysdeps/linux/m68k/bits/syscalls.h +++ b/libc/sysdeps/linux/m68k/bits/syscalls.h @@ -4,14 +4,19 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif +#include <errno.h> + /* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel * header files. It also defines the traditional `SYS_<name>' macros for older * programs. */ #include <bits/sysnum.h> -#ifndef __set_errno -# define __set_errno(val) (*__errno_location ()) = (val) -#endif +/* m68k headers does stupid stuff with __NR_iopl / __NR_vm86: + * #define __NR_iopl not supported + * #define __NR_vm86 not supported + */ +#undef __NR_iopl +#undef __NR_vm86 #ifndef __ASSEMBLER__ diff --git a/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h b/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h new file mode 100644 index 000000000..a94803749 --- /dev/null +++ b/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h @@ -0,0 +1,48 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +#if defined(__mc68000__) +# define __UCLIBC_ABORT_INSTRUCTION__ ".long 0xffffffff" +#else /* defined(__m68k__) */ +# define __UCLIBC_ABORT_INSTRUCTION__ "illegal" +#endif + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#define __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target have to worry about older [gs]etrlimit() ? */ +#define __UCLIBC_HANDLE_OLDER_RLIMIT__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/m68k/brk.c b/libc/sysdeps/linux/m68k/brk.c index 4c33549cc..b627f6400 100644 --- a/libc/sysdeps/linux/m68k/brk.c +++ b/libc/sysdeps/linux/m68k/brk.c @@ -1,13 +1,23 @@ /* consider this code LGPL - davidm */ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <unistd.h> #include <sys/syscall.h> #include <errno.h> +libc_hidden_proto(brk) + /* This must be initialized data because commons can't have aliases. */ +extern void *__curbrk; +libc_hidden_proto(__curbrk) void * __curbrk = 0; +libc_hidden_data_def(__curbrk) -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; @@ -28,4 +38,4 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/m68k/clone.S b/libc/sysdeps/linux/m68k/clone.S index 916488146..2735bcba0 100644 --- a/libc/sysdeps/linux/m68k/clone.S +++ b/libc/sysdeps/linux/m68k/clone.S @@ -13,9 +13,9 @@ .text .align 4 -.type __clone,@function -.globl __clone; -__clone: +.type clone,@function +.globl clone; +clone: /* Sanity check arguments. */ movel #-EINVAL, %d0 movel 4(%sp), %d1 /* no NULL function pointers */ @@ -55,17 +55,6 @@ __clone: rts -__syscall_error: - negl %d0 - movel %d0, %sp@- - lea __errno_location-.-8, %a0 - jsr %pc@(%a0) - movel %d0, %a0 - movel %sp@+, %a0@ - moveq #-1, %d0 - - rts - thread_start: /*subl %fp, %fp*/ /* terminate the stack frame */ jsr (%a0) @@ -73,10 +62,3 @@ thread_start: movel #__NR_exit, %d0 trap #0 /*jsr exit*/ - -#if defined(__HAVE_ELF__) - .weak clone - clone = __clone -#else - .set clone,__clone -#endif diff --git a/libc/sysdeps/linux/m68k/crt0.S b/libc/sysdeps/linux/m68k/crt0.S deleted file mode 100644 index 44aca7fd1..000000000 --- a/libc/sysdeps/linux/m68k/crt0.S +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (C) 1991, 1992 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 Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -/* - * NOTE: this file works for PIC and non-PIC code. Be very careful how - * you modify it ! - */ - -#include <features.h> - - .global _start - .global __exit - .global atexit - .global main - - .text - - nop - nop -_start: /* put here so that references to _start work with elf-PIC */ - - movea.l %d5, %a5 /* uClinux passes in data segment here */ -/* - * argc, argv and envp are on the stack, just call to main - */ - lea __uClibc_main-.-8, %a0 /* call uClibc main */ - jsr %pc@(%a0) - - /* If that didn't kill us, ... */ -__exit: - move.l %sp@+,%d1 - moveq #1,%d0 /* __NR_exit */ - trap #0 - -/* - * this was needed for gcc/g++-builds, atexit was not getting included - * for some stupid reason, this gets us a compiler - */ -empty_func: - rts -#if defined(__HAVE_ELF__) - .weak atexit - atexit = empty_func -#else - .set atexit,empty_func -#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 - diff --git a/libc/sysdeps/linux/m68k/crt0.c b/libc/sysdeps/linux/m68k/crt0.c deleted file mode 100644 index 74601ec75..000000000 --- a/libc/sysdeps/linux/m68k/crt0.c +++ /dev/null @@ -1,43 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* uClibc/sysdeps/linux/m68k/crt0.S - * Pull stuff off the stack and get uClibc moving. - * - * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program 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 Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* Stick in a dummy reference to main(), so that if an application - * is linking when the main() function is in a static library (.a) - * we can be sure that main() actually gets linked in */ -extern void main(int argc,void *argv,void *envp); -void (*mainp)(int argc,void *argv,void *envp) = main; - -extern void __uClibc_main(int argc,void *argv,void *envp); - -void _start(unsigned int first_arg) -{ - unsigned int argc; - char **argv, **envp; - unsigned long *stack; - - stack = (unsigned long*) &first_arg; - argc = *(stack - 1); - argv = (char **) stack; - envp = (char **)stack + argc + 1; - - __uClibc_main(argc, argv, envp); -} - diff --git a/libc/sysdeps/linux/m68k/crt1.S b/libc/sysdeps/linux/m68k/crt1.S new file mode 100644 index 000000000..ee25e48eb --- /dev/null +++ b/libc/sysdeps/linux/m68k/crt1.S @@ -0,0 +1,108 @@ +/* Startup code compliant to the ELF m68k ABI. + Copyright (C) 1996, 1997, 1998, 2001, 2002 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This is the canonical entry point, usually the first thing in the text + segment. The SVR4/m68k ABI says that when the entry point runs, + most registers' values are unspecified, except for: + + %a1 Contains a function pointer to be registered with `atexit'. + This is how the dynamic linker arranges to have DT_FINI + functions called for shared libraries that have been loaded + before this code runs. + + %sp The stack contains the arguments and environment: + 0(%sp) argc + 4(%sp) argv[0] + ... + (4*argc)(%sp) NULL + (4*(argc+1))(%sp) envp[0] + ... + NULL +*/ + +#include <features.h> + + .text + .type _init,%function + .type _fini,%function +#ifndef __UCLIBC_CTOR_DTOR__ + .weak _init + .weak _fini +#endif + .globl _start + .type _start,@function +_start: + /* Clear the frame pointer. The ABI suggests this be done, to mark + the outermost frame obviously. */ + sub.l %fp, %fp + + /* Extract the arguments as encoded on the stack and set up the + arguments for `main': argc, argv. envp will be determined + later in __libc_start_main. */ + move.l (%sp)+, %d0 /* Pop the argument count. */ + move.l %sp, %a0 /* The argument vector starts just at the + current stack top. */ + + /* Provide the highest stack address to the user code (for stacks + which grow downward). */ + pea (%sp) + + pea (%a1) /* Push address of the shared library + termination function. */ + + /* Push the address of our own entry points to `.fini' and + `.init'. */ + pea _fini + pea _init + + pea (%a0) /* Push second argument: argv. */ + move.l %d0, -(%sp) /* Push first argument: argc. */ + + pea main + + /* Call the user's main function, and exit with its value. But + let the libc call main. */ + jbsr __uClibc_main + + illegal /* Crash if somehow `exit' does return. */ + +/* 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 diff --git a/libc/sysdeps/linux/m68k/ptrace.c b/libc/sysdeps/linux/m68k/ptrace.c deleted file mode 100644 index e595a6ecd..000000000 --- a/libc/sysdeps/linux/m68k/ptrace.c +++ /dev/null @@ -1,34 +0,0 @@ - -#include <errno.h> -#include <asm/ptrace.h> -#include <sys/syscall.h> - -int -ptrace(int request, int pid, int addr, int data) -{ - long ret; - long res; - if (request > 0 && request < 4) data = (int)&ret; - - - __asm__ volatile ("movel %1,%/d0\n\t" - "movel %2,%/d1\n\t" - "movel %3,%/d2\n\t" - "movel %4,%/d3\n\t" - "movel %5,%/d4\n\t" - "trap #0\n\t" - "movel %/d0,%0" - :"=g" (res) - :"i" (__NR_ptrace), "g" (request), "g" (pid), - "g" (addr), "g" (data) : "%d0", "%d1", "%d2", "%d3", "%d4"); - - if (res >= 0) { - if (request > 0 && request < 4) { - __set_errno(0); - return (ret); - } - return (int) res; - } - __set_errno(-res); - return -1; -} diff --git a/libc/sysdeps/linux/m68k/syscall.c b/libc/sysdeps/linux/m68k/syscall.c new file mode 100644 index 000000000..f35702a48 --- /dev/null +++ b/libc/sysdeps/linux/m68k/syscall.c @@ -0,0 +1,46 @@ +/* syscall for m68k/uClibc + * + * Copyright (C) 2005-2006 by Christian Magnusson <mag@mag.cx> + * Copyright (C) 2005-2006 Erik Andersen <andersen@uclibc.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program 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 Library General Public License + * for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <features.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/syscall.h> + +long syscall(long sysnum, long a, long b, long c, long d, long e, long f); +long syscall(long sysnum, long a, long b, long c, long d, long e, long f) +{ + long __res; + __asm__ __volatile__ ( + "movel %7, %%a0\n\t" + "movel %6, %%d5\n\t" + "movel %5, %%d4\n\t" + "movel %4, %%d3\n\t" + "movel %3, %%d2\n\t" + "movel %2, %%d1\n\t" + "movel %1, %%d0\n\t" + "trap #0\n\t" + "movel %%d0, %0" + : "=g" (__res) + : "g" (sysnum), + "g" ((long)a), "g" ((long)b), "g" ((long)c), + "g" ((long)d), "g" ((long)e), "g" ((long)f) + : "cc", "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%a0"); + __syscall_return(long,__res); +} diff --git a/libc/sysdeps/linux/m68k/vfork.S b/libc/sysdeps/linux/m68k/vfork.S index e58b9e949..56d57f73c 100644 --- a/libc/sysdeps/linux/m68k/vfork.S +++ b/libc/sysdeps/linux/m68k/vfork.S @@ -1,3 +1,9 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + #include <features.h> #include <asm/unistd.h> @@ -12,10 +18,8 @@ .align 2 .globl errno .globl __vfork -#ifdef __HAVE_ELF__ .hidden __vfork .type __vfork,@function -#endif __vfork: movl %sp@+, %a1 /* save the return address for later */ @@ -37,4 +41,5 @@ fix_errno: jmp %a1@ /* don't return, just jmp directly */ .size __vfork,.-__vfork -strong_alias(__vfork,vfork) +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/microblaze/__longjmp.S b/libc/sysdeps/linux/microblaze/__longjmp.S index e87a6f6a3..fba1e9fbf 100644 --- a/libc/sysdeps/linux/microblaze/__longjmp.S +++ b/libc/sysdeps/linux/microblaze/__longjmp.S @@ -42,6 +42,4 @@ C_ENTRY(__longjmp): nop C_END(__longjmp) - -.weak C_SYMBOL_NAME(__sigprocmask) -C_SYMBOL_NAME(__sigprocmask) = C_SYMBOL_NAME(sigprocmask) +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h b/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h new file mode 100644 index 000000000..1b40e32a2 --- /dev/null +++ b/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h @@ -0,0 +1,42 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/ +#undef __UCLIBC_ABORT_INSTRUCTION__ + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#undef __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/microblaze/longjmp.S b/libc/sysdeps/linux/microblaze/longjmp.S deleted file mode 100644 index 2d9adebe5..000000000 --- a/libc/sysdeps/linux/microblaze/longjmp.S +++ /dev/null @@ -1,53 +0,0 @@ -/* - * libc/sysdeps/linux/microblaze/longjmp.S -- `longjmp' for microblaze - * - * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> - * Copyright (C) 2001 NEC Corporation - * Copyright (C) 2001 Miles Bader <miles@gnu.org> - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License. See the file COPYING.LIB in the main - * directory of this archive for more details. - * - * Written by Miles Bader <miles@gnu.org> - */ - -#define _SETJMP_H -#define _ASM -#include <bits/setjmp.h> - -#include <clinkage.h> - - .text -C_ENTRY(__longjmp): - /* load registers from memory to r5 (arg0)*/ - lwi r1, r5, 0 - lwi r15, r5, 4 - lwi r18, r5, 8 - lwi r19, r5, 12 - lwi r20, r5, 16 - lwi r21, r5, 20 - lwi r22, r5, 24 - lwi r23, r5, 28 - lwi r24, r5, 32 - lwi r25, r5, 36 - lwi r26, r5, 40 - lwi r27, r5, 44 - lwi r28, r5, 48 - lwi r29, r5, 52 - lwi r30, r5, 56 - - addi r3, r0, 1 // return val - rtsd r15, 8 // normal return - nop - -C_END(__longjmp) - -.weak C_SYMBOL_NAME(longjmp) -C_SYMBOL_NAME(longjmp) = C_SYMBOL_NAME(__longjmp) - -.weak C_SYMBOL_NAME(siglongjmp) -C_SYMBOL_NAME(siglongjmp) = C_SYMBOL_NAME(__longjmp) - -.weak C_SYMBOL_NAME(__sigprocmask) -C_SYMBOL_NAME(__sigprocmask) = C_SYMBOL_NAME(sigprocmask) diff --git a/libc/sysdeps/linux/microblaze/mmap.c b/libc/sysdeps/linux/microblaze/mmap.c index fbfcca3a8..cad528d17 100644 --- a/libc/sysdeps/linux/microblaze/mmap.c +++ b/libc/sysdeps/linux/microblaze/mmap.c @@ -1,9 +1,17 @@ /* Use new style mmap for microblaze */ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <unistd.h> #include <errno.h> #include <sys/mman.h> #include <sys/syscall.h> +libc_hidden_proto(mmap) + _syscall6 (__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset); +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/microblaze/vfork.S b/libc/sysdeps/linux/microblaze/vfork.S index e264d36f9..1e802ae29 100644 --- a/libc/sysdeps/linux/microblaze/vfork.S +++ b/libc/sysdeps/linux/microblaze/vfork.S @@ -1,14 +1,14 @@ /* * libc/sysdeps/linux/microblaze/vfork.S -- `vfork' syscall for linux/microblaze * - * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> - * Copyright (C) 2001 NEC Corporation - * Copyright (C) 2001 Miles Bader <miles@gnu.org> + * Copyright (C) 2001 NEC Corporation + * Copyright (C) 2001 Miles Bader <miles@gnu.org> + * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License. See the file COPYING.LIB in the main - * directory of this archive for more details. - * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* * Written by Miles Bader <miles@gnu.org> * Microblaze port by John Williams */ @@ -40,6 +40,5 @@ C_ENTRY (__vfork): rtsd r15, 8 // error return nop C_END(__vfork) - -.weak C_SYMBOL_NAME(vfork) -C_SYMBOL_NAME(vfork) = C_SYMBOL_NAME(__vfork) +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/nios/__longjmp.S b/libc/sysdeps/linux/nios/__longjmp.S index c2b1979cc..d7d1cdd86 100644 --- a/libc/sysdeps/linux/nios/__longjmp.S +++ b/libc/sysdeps/linux/nios/__longjmp.S @@ -16,6 +16,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <features.h> #define _ASM #define _SETJMP_H #include <bits/setjmp.h> @@ -99,10 +100,4 @@ __longjmp_done: jmp %o7 ; and kinda return there. mov %o0,%g1 ; (delay slot) return value - - - - - - - +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/nios/bits/uClibc_arch_features.h b/libc/sysdeps/linux/nios/bits/uClibc_arch_features.h new file mode 100644 index 000000000..ff0e20fad --- /dev/null +++ b/libc/sysdeps/linux/nios/bits/uClibc_arch_features.h @@ -0,0 +1,42 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/ +#undef __UCLIBC_ABORT_INSTRUCTION__ + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/nios/brk.c b/libc/sysdeps/linux/nios/brk.c index 2e785b734..69f60d336 100644 --- a/libc/sysdeps/linux/nios/brk.c +++ b/libc/sysdeps/linux/nios/brk.c @@ -21,11 +21,15 @@ #include <sys/syscall.h> #include <errno.h> +libc_hidden_proto(brk) /* This must be initialized data because commons can't have aliases. */ +extern void *__curbrk; +libc_hidden_proto(__curbrk) void *__curbrk = 0; +libc_hidden_data_def(__curbrk) -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; register int g1 asm("%g1") = __NR_brk; @@ -42,4 +46,4 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/nios/clone.S b/libc/sysdeps/linux/nios/clone.S index a3098f5f8..39eb54035 100644 --- a/libc/sysdeps/linux/nios/clone.S +++ b/libc/sysdeps/linux/nios/clone.S @@ -21,17 +21,17 @@ and invokes a function in the right context after its all over. */ #include <asm/errno.h> -#include <asm/unistd.h> +#include <sys/syscall.h> #include "NM_Macros.S" /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ .text .align 2 - .globl __clone - .type __clone,@function + .globl clone + .type clone,@function -__clone: +clone: save %sp,-16 MOVIP %l0, -EINVAL @@ -74,7 +74,7 @@ CLONE_ERROR_LABEL: ret restore - .size __clone, .-__clone + .size clone, .-clone .type __thread_start,@function @@ -86,6 +86,3 @@ __thread_start: nop .size __thread_start, .-__thread_start - -.globl clone; - clone = __clone diff --git a/libc/sysdeps/linux/nios/setjmp.S b/libc/sysdeps/linux/nios/setjmp.S index 70bd75c5d..c2851461c 100644 --- a/libc/sysdeps/linux/nios/setjmp.S +++ b/libc/sysdeps/linux/nios/setjmp.S @@ -16,6 +16,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <features.h> #define _ASM #define _SETJMP_H #include <bits/setjmp.h> diff --git a/libc/sysdeps/linux/nios/vfork.S b/libc/sysdeps/linux/nios/vfork.S index 22b3c30cd..f8a6d031c 100644 --- a/libc/sysdeps/linux/nios/vfork.S +++ b/libc/sysdeps/linux/nios/vfork.S @@ -9,7 +9,11 @@ * * Written by Wentao Xu <wentao@microtronix.com> */ -#include <asm/unistd.h> + +#include <features.h> + +#include <bits/errno.h> +#include <sys/syscall.h> #include "NM_Macros.S" #ifndef __NR_vfork @@ -18,15 +22,10 @@ .text .align 2 - .globl errno - .globl vfork - .globl __libc_vfork -#if defined __HAVE_ELF__ - .type vfork,@function - .type __libc_vfork,@function -#endif -vfork: -__libc_vfork: + .globl __vfork + .hidden __vfork + .type __vfork,@function +__vfork: MOVIP %g1, __NR_vfork trap 63 @@ -34,25 +33,22 @@ __libc_vfork: not %g1 /* (unsigned long) -4096 */ cmp %o0, %g1 skps cc_hi - jmp %o7 - nop - + jmp %o7 + nop + fix_errno: neg %o0 save %sp, -16 MOVIA %g1, __errno_location@h call %g1 - nop + nop st [%o0], %i0 /* store errno */ xor %i0, %i0 subi %i0, 1 /* retval=-1 */ ret - restore - - - - - - + restore +.size __vfork,.-__vfork +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/nios2/__longjmp.S b/libc/sysdeps/linux/nios2/__longjmp.S index d15f040cd..4b6508e5d 100644 --- a/libc/sysdeps/linux/nios2/__longjmp.S +++ b/libc/sysdeps/linux/nios2/__longjmp.S @@ -11,6 +11,7 @@ * */ +#include <features.h> #define _ASM #define _SETJMP_H #include <bits/setjmp.h> @@ -45,4 +46,5 @@ __longjmp: /* return to saved RA */ ret - +.size __longjmp,.-__longjmp +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/nios2/bits/uClibc_arch_features.h b/libc/sysdeps/linux/nios2/bits/uClibc_arch_features.h new file mode 100644 index 000000000..ff0e20fad --- /dev/null +++ b/libc/sysdeps/linux/nios2/bits/uClibc_arch_features.h @@ -0,0 +1,42 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/ +#undef __UCLIBC_ABORT_INSTRUCTION__ + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/nios2/bits/uClibc_page.h b/libc/sysdeps/linux/nios2/bits/uClibc_page.h new file mode 100644 index 000000000..311dd40ab --- /dev/null +++ b/libc/sysdeps/linux/nios2/bits/uClibc_page.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2004 Erik Andersen + * + * This 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, write to the Free + * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA. + */ + +/* Supply an architecture specific value for PAGE_SIZE and friends. */ + +#ifndef _UCLIBC_PAGE_H +#define _UCLIBC_PAGE_H + +/* PAGE_SHIFT determines the page size -- in this case 4096 */ +#define PAGE_SHIFT (12) +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) + +#endif /* _UCLIBC_PAGE_H */ diff --git a/libc/sysdeps/linux/nios2/brk.c b/libc/sysdeps/linux/nios2/brk.c index e5a4c5d07..2d7bf4420 100644 --- a/libc/sysdeps/linux/nios2/brk.c +++ b/libc/sysdeps/linux/nios2/brk.c @@ -21,12 +21,16 @@ #include <sys/syscall.h> #include <errno.h> +libc_hidden_proto(brk) /* This must be initialized data because commons can't have aliases. */ +extern void *__curbrk; +libc_hidden_proto(__curbrk) void *__curbrk = 0; +libc_hidden_data_def(__curbrk) -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; register int r2 asm("r2") = TRAP_ID_SYSCALL; @@ -44,4 +48,4 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/nios2/clone.S b/libc/sysdeps/linux/nios2/clone.S index 4dd8745cd..4afcb7d75 100644 --- a/libc/sysdeps/linux/nios2/clone.S +++ b/libc/sysdeps/linux/nios2/clone.S @@ -9,19 +9,19 @@ * * Written by Wentao Xu <wentao@microtronix.com> */ -#include <asm/errno.h> -#include <asm/unistd.h> +#define _ERRNO_H +#include <bits/errno.h> +#include <sys/syscall.h> + +#ifdef __NR_clone /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ .text -.balign 4 -.type clone,@function -.globl clone; +.global clone +.type clone,%function +.align 4 clone: -.type __clone,@function -.globl __clone; -__clone: addi sp,sp,-8 mov r8,r4 stw ra,4(sp) @@ -64,3 +64,7 @@ CLONE_OK: ldw r16,0(sp) addi sp,sp,8 ret + +.size clone,.-clone + +#endif diff --git a/libc/sysdeps/linux/nios2/clone.c b/libc/sysdeps/linux/nios2/clone.c index 0555658b4..019ca31bc 100644 --- a/libc/sysdeps/linux/nios2/clone.c +++ b/libc/sysdeps/linux/nios2/clone.c @@ -1,14 +1,14 @@ /* * libc/sysdeps/linux/nios2/clone.c -- `clone' syscall for linux/nios2 + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * * * Copyright (C) 2004,05 Microtronix Datacom Ltd * Copyright (C) 2002,03 NEC Electronics Corporation * Copyright (C) 2002,03 Miles Bader <miles@gnu.org> * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License. See the file COPYING.LIB in the main - * directory of this archive for more details. - * * Written by Miles Bader <miles@gnu.org> * Nios2 port by Wentao Xu */ diff --git a/libc/sysdeps/linux/nios2/crt1.S b/libc/sysdeps/linux/nios2/crt1.S index 948eeb1ed..d5e1bd7c2 100644 --- a/libc/sysdeps/linux/nios2/crt1.S +++ b/libc/sysdeps/linux/nios2/crt1.S @@ -29,9 +29,6 @@ _start: nop br 0f - .long _stext /* start address of .text + 4 */ - .long _etext /* start address of .data */ - .long _edata /* start address of .bss */ 0: /* load gp */ movhi gp, %hiadj(_gp) @@ -47,7 +44,9 @@ _start: movhi r7, %hi(_init) ori r7, r7, %lo(_init) - /* reuse the argc stack slot for the 5th arg */ + /* Allocate space on the stack for 6-7th arg, reuse 5th space */ + addi sp,sp,-8 + /* push 5-7th args on stack */ movhi r8, %hi(_fini) ori r8, r8, %lo(_fini) stw r8, 0(sp) diff --git a/libc/sysdeps/linux/nios2/setjmp.S b/libc/sysdeps/linux/nios2/setjmp.S index b2ff52162..8acd22044 100644 --- a/libc/sysdeps/linux/nios2/setjmp.S +++ b/libc/sysdeps/linux/nios2/setjmp.S @@ -11,6 +11,7 @@ * */ +#include <features.h> #define _ASM #define _SETJMP_H #include <bits/setjmp.h> @@ -47,5 +48,4 @@ __sigsetjmp: jmp r8 #endif - - +.size __sigsetjmp,.-__sigsetjmp diff --git a/libc/sysdeps/linux/nios2/vfork.S b/libc/sysdeps/linux/nios2/vfork.S index a19a90023..ca8811a4f 100644 --- a/libc/sysdeps/linux/nios2/vfork.S +++ b/libc/sysdeps/linux/nios2/vfork.S @@ -9,23 +9,23 @@ * * Written by Wentao Xu <wentao@microtronix.com> */ -#include <asm/unistd.h> + +#include <features.h> + +#define _ERRNO_H +#include <bits/errno.h> +#include <sys/syscall.h> #ifndef __NR_vfork #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ #endif - .text - .balign 4 - .globl errno - .globl vfork - .globl __libc_vfork -#if defined __HAVE_ELF__ - .type vfork,@function - .type __libc_vfork,@function -#endif -vfork: -__libc_vfork: +.text +.global __vfork +.hidden __vfork +.type __vfork,%function +.align 4 +__vfork: movui r2, TRAP_ID_SYSCALL movui r3, __NR_vfork trap @@ -51,3 +51,6 @@ fix_errno: addi sp, sp, 8 ret +.size __vfork,.-__vfork +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/powerpc/__longjmp.S b/libc/sysdeps/linux/powerpc/__longjmp.S index 874354e5a..83f094c15 100644 --- a/libc/sysdeps/linux/powerpc/__longjmp.S +++ b/libc/sysdeps/linux/powerpc/__longjmp.S @@ -80,3 +80,5 @@ FP( lfd fp31,((JB_FPRS+17*2)*4)(r3)) mr r3,r4 blr .size __longjmp,.-__longjmp + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/powerpc/__syscall_error.c b/libc/sysdeps/linux/powerpc/__syscall_error.c index de65a1f39..5e109a83b 100644 --- a/libc/sysdeps/linux/powerpc/__syscall_error.c +++ b/libc/sysdeps/linux/powerpc/__syscall_error.c @@ -1,28 +1,17 @@ /* Wrapper for setting errno. - Copyright (C) 1997, 1998, 1999, 2000 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + * + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <errno.h> #include <features.h> /* This routine is jumped to by all the syscall handlers, to stash * an error number into errno. */ -int attribute_hidden __syscall_error(int err_no) +int __syscall_error(int err_no) attribute_hidden; +int __syscall_error(int err_no) { __set_errno(err_no); return -1; diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h index 8a709841b..19649c01c 100644 --- a/libc/sysdeps/linux/powerpc/bits/fcntl.h +++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h @@ -1,5 +1,6 @@ /* O_*, F_*, FD_* bit values for Linux/PowerPC. - Copyright (C) 1995,1996,1997,1998,2000,2003 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004 + 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 @@ -45,7 +46,7 @@ # define O_DIRECT 0400000 /* Direct disk access. */ # define O_DIRECTORY 040000 /* Must be a directory. */ # define O_NOFOLLOW 0100000 /* Do not follow links. */ -# define O_STREAMING 04000000 /* streaming access */ +# define O_NOATIME 01000000 /* Do not set atime. */ #endif #ifdef __USE_LARGEFILE64 @@ -79,7 +80,7 @@ #define F_SETLK64 13 /* Set record locking info (non-blocking). */ #define F_SETLKW64 14 /* Set record locking info (blocking). */ -#if defined __USE_BSD || defined __USE_XOPEN2K +#if defined __USE_BSD || defined __USE_UNIX98 # define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */ # define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */ #endif @@ -178,3 +179,11 @@ struct flock64 # define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif + +__BEGIN_DECLS + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + +__END_DECLS diff --git a/libc/sysdeps/linux/powerpc/bits/kernel_types.h b/libc/sysdeps/linux/powerpc/bits/kernel_types.h index 711ca4f21..223037545 100644 --- a/libc/sysdeps/linux/powerpc/bits/kernel_types.h +++ b/libc/sysdeps/linux/powerpc/bits/kernel_types.h @@ -4,9 +4,11 @@ * our private content, and not the kernel header, will win. * -Erik */ -#if ! defined _PPC_POSIX_TYPES_H && ! defined _PPC64_POSIX_TYPES_H +#if ! defined _PPC_POSIX_TYPES_H && ! defined _PPC64_POSIX_TYPES_H && \ + ! defined _ASM_POWERPC_POSIX_TYPES_H #define _PPC_POSIX_TYPES_H #define _PPC64_POSIX_TYPES_H +#define _ASM_POWERPC_POSIX_TYPES_H # if __WORDSIZE == 64 typedef unsigned int __kernel_dev_t; diff --git a/libc/sysdeps/linux/powerpc/bits/mman.h b/libc/sysdeps/linux/powerpc/bits/mman.h index f92bc7fc3..580e93886 100644 --- a/libc/sysdeps/linux/powerpc/bits/mman.h +++ b/libc/sysdeps/linux/powerpc/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/PowerPC version. - Copyright (C) 1997, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2003, 2005, 2006 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 @@ -34,6 +34,10 @@ #define PROT_WRITE 0x2 /* Page can be written. */ #define PROT_EXEC 0x4 /* Page can be executed. */ #define PROT_NONE 0x0 /* Page can not be accessed. */ +#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of + growsdown vma (mprotect only). */ +#define PROT_GROWSUP 0x02000000 /* Extend change to start of + growsup vma (mprotect only). */ /* Sharing types (must choose one and only one of these). */ #define MAP_SHARED 0x001 /* Share changes. */ @@ -52,11 +56,13 @@ /* These are Linux-specific. */ #ifdef __USE_MISC -# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */ -# define MAP_DENYWRITE 0x0800 /* ETXTBSY */ -# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */ -# define MAP_LOCKED 0x0080 /* Lock the mapping. */ -# define MAP_NORESERVE 0x0040 /* Don't check for reservations. */ +# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ +# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ +# define MAP_LOCKED 0x00080 /* Lock the mapping. */ +# define MAP_NORESERVE 0x00040 /* Don't check for reservations. */ +# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ #endif /* Flags to `msync'. */ @@ -83,6 +89,9 @@ # define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ # define MADV_WILLNEED 3 /* Will need these pages. */ # define MADV_DONTNEED 4 /* Don't need these pages. */ +# define MADV_REMOVE 5 /* Remove these pages and resources. */ +# define MADV_DONTFORK 10 /* Do not inherit across fork. */ +# define MADV_DOFORK 11 /* Do inherit across fork. */ #endif /* The POSIX people had to invent similar names for the same things. */ diff --git a/libc/sysdeps/linux/powerpc/bits/msq.h b/libc/sysdeps/linux/powerpc/bits/msq.h index 45173a4cb..f19884437 100644 --- a/libc/sysdeps/linux/powerpc/bits/msq.h +++ b/libc/sysdeps/linux/powerpc/bits/msq.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 2000, 2002 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 @@ -21,7 +21,6 @@ #endif #include <bits/types.h> -#include <bits/wordsize.h> /* Define options for message queue functions. */ #define MSG_NOERROR 010000 /* no error if message is too big */ diff --git a/libc/sysdeps/linux/powerpc/bits/sem.h b/libc/sysdeps/linux/powerpc/bits/sem.h index 6a615f154..1c648cd19 100644 --- a/libc/sysdeps/linux/powerpc/bits/sem.h +++ b/libc/sysdeps/linux/powerpc/bits/sem.h @@ -22,7 +22,6 @@ #endif #include <sys/types.h> -#include <bits/wordsize.h> /* Flags for `semop'. */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ @@ -31,8 +30,8 @@ #define GETPID 11 /* get sempid */ #define GETVAL 12 /* get semval */ #define GETALL 13 /* get all semval's */ -#define GETNCNT 14 /* get semncnt */ -#define GETZCNT 15 /* get semzcnt */ +#define GETNCNT 14 /* get semncnt */ +#define GETZCNT 15 /* get semzcnt */ #define SETVAL 16 /* set semval */ #define SETALL 17 /* set all semval's */ @@ -44,11 +43,11 @@ struct semid_ds #if __WORDSIZE == 32 unsigned int __unused1; #endif - __time_t sem_otime; /* last semop() time */ + __time_t sem_otime; /* last semop() time */ #if __WORDSIZE == 32 unsigned int __unused2; #endif - __time_t sem_ctime; /* last time changed by semctl() */ + __time_t sem_ctime; /* last time changed by semctl() */ unsigned long int sem_nsems; /* number of semaphores in set */ unsigned long __unused3; unsigned long __unused4; diff --git a/libc/sysdeps/linux/powerpc/bits/shm.h b/libc/sysdeps/linux/powerpc/bits/shm.h index 6477df634..62560c0ca 100644 --- a/libc/sysdeps/linux/powerpc/bits/shm.h +++ b/libc/sysdeps/linux/powerpc/bits/shm.h @@ -22,7 +22,6 @@ #endif #include <bits/types.h> -#include <bits/wordsize.h> /* Permission flag for shmget. */ #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ @@ -81,9 +80,10 @@ struct shmid_ds # define SHM_INFO 14 /* shm_mode upper byte flags */ -# define SHM_DEST 01000 /* segment will be destroyed on last detach */ -# define SHM_LOCKED 02000 /* segment will not be swapped */ +# define SHM_DEST 01000 /* segment will be destroyed on last detach */ +# define SHM_LOCKED 02000 /* segment will not be swapped */ # define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ +# define SHM_NORESERVE 010000 /* don't check for reservations */ struct shminfo { diff --git a/libc/sysdeps/linux/powerpc/bits/stat.h b/libc/sysdeps/linux/powerpc/bits/stat.h index c85695e51..af71f275e 100644 --- a/libc/sysdeps/linux/powerpc/bits/stat.h +++ b/libc/sysdeps/linux/powerpc/bits/stat.h @@ -27,11 +27,11 @@ #define _STAT_VER_LINUX_OLD 1 #define _STAT_VER_KERNEL 1 #define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 #if __WORDSIZE == 32 -# define _STAT_VER_LINUX 3 -# define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ +# define _STAT_VER _STAT_VER_LINUX #else -# define _STAT_VER _STAT_VER_KERNEL /* The one defined below. */ +# define _STAT_VER _STAT_VER_KERNEL #endif /* Versions of the `xmknod' interface. */ @@ -70,11 +70,11 @@ struct stat __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ # endif __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; /* Reserved for atime.nanoseconds. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; /* Reserved for mtime.nanoseconds. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; /* Reserved for ctime.nanoseconds. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ unsigned long int __unused4; unsigned long int __unused5; }; @@ -95,11 +95,11 @@ struct stat64 __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; /* Reserved for atime.nanoseconds. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; /* Reserved for mtime.nanoseconds. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; /* Reserved for ctime.nanoseconds. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ unsigned long int __unused4; unsigned long int __unused5; }; @@ -134,11 +134,11 @@ struct stat __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ # endif __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; /* Reserved for atime.nanoseconds. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; /* Reserved for mtime.nanoseconds. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; /* Reserved for ctime.nanoseconds. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ unsigned long int __unused4; unsigned long int __unused5; unsigned long int __unused6; @@ -159,11 +159,11 @@ struct stat64 __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; /* Reserved for atime.nanoseconds. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; /* Reserved for mtime.nanoseconds. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; /* Reserved for ctime.nanoseconds. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ unsigned long int __unused4; unsigned long int __unused5; unsigned long int __unused6; @@ -175,6 +175,8 @@ struct stat64 /* 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. */ diff --git a/libc/sysdeps/linux/powerpc/bits/termios.h b/libc/sysdeps/linux/powerpc/bits/termios.h index f7b89ae59..7aac02dc5 100644 --- a/libc/sysdeps/linux/powerpc/bits/termios.h +++ b/libc/sysdeps/linux/powerpc/bits/termios.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1997,1999,2001,2003,2004,2005 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 @@ -40,6 +40,8 @@ struct termios { cc_t c_cc[NCCS]; /* control characters */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 }; /* c_cc characters */ @@ -77,6 +79,7 @@ struct termios { #define IXANY 0004000 #define IUCLC 0010000 #define IMAXBEL 0020000 +#define IUTF8 0040000 /* c_oflag bits */ #define OPOST 0000001 @@ -89,34 +92,41 @@ struct termios { #define OFILL 00000100 #define OFDEL 00000200 -#define NLDLY 00001400 -#define NL0 00000000 -#define NL1 00000400 -#define NL2 00001000 -#define NL3 00001400 -#define TABDLY 00006000 -#define TAB0 00000000 -#define TAB1 00002000 -#define TAB2 00004000 -#define TAB3 00006000 -#define CRDLY 00030000 -#define CR0 00000000 -#define CR1 00010000 -#define CR2 00020000 -#define CR3 00030000 -#define FFDLY 00040000 -#define FF0 00000000 -#define FF1 00040000 -#define BSDLY 00100000 -#define BS0 00000000 -#define BS1 00100000 +#if defined __USE_MISC || defined __USE_XOPEN +# define NLDLY 00001400 +# define NL0 00000000 +# define NL1 00000400 +# define NL2 00001000 +# define NL3 00001400 +# define TABDLY 00006000 +# define TAB0 00000000 +# define TAB1 00002000 +# define TAB2 00004000 +# define TAB3 00006000 +# define CRDLY 00030000 +# define CR0 00000000 +# define CR1 00010000 +# define CR2 00020000 +# define CR3 00030000 +# define FFDLY 00040000 +# define FF0 00000000 +# define FF1 00040000 +# define BSDLY 00100000 +# define BS0 00000000 +# define BS1 00100000 +#endif #define VTDLY 00200000 #define VT0 00000000 #define VT1 00200000 -#define XTABS 01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */ + +#ifdef __USE_MISC +# define XTABS 00006000 +#endif /* c_cflag bit meaning */ -#define CBAUD 0000377 +#ifdef __USE_MISC +# define CBAUD 0000377 +#endif #define B0 0000000 /* hang up */ #define B50 0000001 #define B75 0000002 @@ -133,9 +143,11 @@ struct termios { #define B9600 0000015 #define B19200 0000016 #define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CBAUDEX 0000020 +#ifdef __USE_MISC +# define EXTA B19200 +# define EXTB B38400 +# define CBAUDEX 0000020 +#endif #define B57600 00020 #define B115200 00021 #define B230400 00022 @@ -166,23 +178,30 @@ struct termios { #define HUPCL 00040000 #define CLOCAL 00100000 -#define CRTSCTS 020000000000 /* flow control */ +#ifdef __USE_MISC +# define CMSPAR 010000000000 /* mark or space (stick) parity */ +# define CRTSCTS 020000000000 /* flow control */ +#endif /* c_lflag bits */ #define ISIG 0x00000080 #define ICANON 0x00000100 -#define XCASE 0x00004000 +#if defined __USE_MISC || defined __USE_XOPEN +# define XCASE 0x00004000 +#endif #define ECHO 0x00000008 #define ECHOE 0x00000002 #define ECHOK 0x00000004 #define ECHONL 0x00000010 #define NOFLSH 0x80000000 #define TOSTOP 0x00400000 -#define ECHOCTL 0x00000040 -#define ECHOPRT 0x00000020 -#define ECHOKE 0x00000001 -#define FLUSHO 0x00800000 -#define PENDIN 0x20000000 +#ifdef __USE_MISC +# define ECHOCTL 0x00000040 +# define ECHOPRT 0x00000020 +# define ECHOKE 0x00000001 +# define FLUSHO 0x00800000 +# define PENDIN 0x20000000 +#endif #define IEXTEN 0x00000400 /* Values for the ACTION argument to `tcflow'. */ diff --git a/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h b/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h new file mode 100644 index 000000000..1e994ec68 --- /dev/null +++ b/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h @@ -0,0 +1,44 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +#define __UCLIBC_ABORT_INSTRUCTION__ ".long 0" + +/* can your target use syscall6() for mmap ? */ +#define __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#define __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target have to worry about older [gs]etrlimit() ? */ +#define __UCLIBC_HANDLE_OLDER_RLIMIT__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/powerpc/bits/wordsize.h b/libc/sysdeps/linux/powerpc/bits/wordsize.h index ba643b60a..cf934234f 100644 --- a/libc/sysdeps/linux/powerpc/bits/wordsize.h +++ b/libc/sysdeps/linux/powerpc/bits/wordsize.h @@ -1,19 +1,19 @@ -/* Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. +/* Determine the wordsize from the preprocessor defines. */ - 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. +#if defined __powerpc64__ +# define __WORDSIZE 64 +# define __WORDSIZE_COMPAT32 1 +#else +# define __WORDSIZE 32 +#endif - 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. +#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#define __WORDSIZE 32 +/* Signal the glibc ABI didn't used to have a `long double'. + The changes all the `long double' function variants to be redirects + to the double functions. */ +# define __LONG_DOUBLE_MATH_OPTIONAL 1 +# ifndef __LONG_DOUBLE_128__ +# define __NO_LONG_DOUBLE_MATH 1 +# endif +#endif diff --git a/libc/sysdeps/linux/powerpc/brk.S b/libc/sysdeps/linux/powerpc/brk.S index b718c0de4..b7b19d153 100644 --- a/libc/sysdeps/linux/powerpc/brk.S +++ b/libc/sysdeps/linux/powerpc/brk.S @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <features.h> #include "ppc_asm.h" #define _ERRNO_H 1 #include <bits/errno.h> @@ -25,12 +26,11 @@ #ifdef __NR_brk .comm __curbrk,4,4 .text - .globl __brk - .hidden __brk - .type __brk,@function + .globl brk + .type brk,@function .align 2 -__brk: +brk: stwu r1,-16(r1) stw r3,8(r1) li 0, __NR_brk; @@ -55,8 +55,9 @@ __brk: b __syscall_error - .size __brk,.-__brk + .size brk,.-brk - .weak brk - brk=__brk +libc_hidden_def(brk) +/* won't help too much, HIDDEN_JUMPTARGET should be used here as well, now the reloc remains */ +libc_hidden_data_def(__curbrk) #endif diff --git a/libc/sysdeps/linux/powerpc/clone.S b/libc/sysdeps/linux/powerpc/clone.S index 9e8a1ca53..15d03f679 100644 --- a/libc/sysdeps/linux/powerpc/clone.S +++ b/libc/sysdeps/linux/powerpc/clone.S @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <features.h> #include "ppc_asm.h" #define _ERRNO_H 1 #include <bits/errno.h> @@ -30,11 +31,11 @@ int flags [r5], void *arg [r6]); */ #ifdef __NR_clone - .globl __clone - .type __clone,@function + .globl clone + .type clone,@function .align 2 -__clone: +clone: /* Check for child_stack == NULL || fn == NULL. */ cmpwi cr0,r4,0 cmpwi cr1,r3,0 @@ -78,7 +79,7 @@ __clone: mr r3,r31 bctrl /* Call _exit with result from procedure. */ - b _exit_internal + b HIDDEN_JUMPTARGET(_exit) .Lparent: /* Parent. Restore registers & return. */ @@ -93,7 +94,5 @@ __clone: b __syscall_error - .size __clone,.-__clone - .weak clone - clone=__clone + .size clone,.-clone #endif diff --git a/libc/sysdeps/linux/powerpc/ioctl.c b/libc/sysdeps/linux/powerpc/ioctl.c index bb8842bb6..7f92be410 100644 --- a/libc/sysdeps/linux/powerpc/ioctl.c +++ b/libc/sysdeps/linux/powerpc/ioctl.c @@ -16,15 +16,17 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define tcsetattr __tcsetattr -#define tcgetattr __tcgetattr - #include <stdarg.h> #include <termios.h> #include <unistd.h> #include <sys/ioctl.h> #include <sys/syscall.h> +libc_hidden_proto(ioctl) + +libc_hidden_proto(tcsetattr) +libc_hidden_proto(tcgetattr) + /* The user-visible size of struct termios has changed. Catch ioctl calls using the new-style struct termios, and translate them to old-style. */ @@ -33,7 +35,7 @@ static inline _syscall3(int, __syscall_ioctl, int, fd, unsigned long int, request, void *, arg); -int attribute_hidden __ioctl (int fd, unsigned long int request, ...) +int ioctl (int fd, unsigned long int request, ...) { void *arg; va_list ap; @@ -69,4 +71,4 @@ int attribute_hidden __ioctl (int fd, unsigned long int request, ...) return result; } -strong_alias(__ioctl,ioctl) +libc_hidden_def(ioctl) diff --git a/libc/sysdeps/linux/powerpc/mmap.c b/libc/sysdeps/linux/powerpc/mmap.c index cac08ba65..62c97c1c5 100644 --- a/libc/sysdeps/linux/powerpc/mmap.c +++ b/libc/sysdeps/linux/powerpc/mmap.c @@ -1,16 +1,23 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <unistd.h> #include <sys/mman.h> #include <errno.h> #include <sys/syscall.h> +libc_hidden_proto(mmap) + #define __syscall_clobbers \ "r9", "r10", "r11", "r12" #define __syscall_return(type) \ return (__sc_err & 0x10000000 ? errno = __sc_ret, __sc_ret = -1 : 0), \ (type) __sc_ret -void attribute_hidden * __mmap(void *start, size_t length, int prot, int flags, int fd, +void * mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) { unsigned long __sc_ret, __sc_err; @@ -45,4 +52,4 @@ void attribute_hidden * __mmap(void *start, size_t length, int prot, int flags, __syscall_return (void *); } -strong_alias(__mmap,mmap) +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/powerpc/ppc_asm.h b/libc/sysdeps/linux/powerpc/ppc_asm.h index ad34e3e62..e51d88f73 100644 --- a/libc/sysdeps/linux/powerpc/ppc_asm.h +++ b/libc/sysdeps/linux/powerpc/ppc_asm.h @@ -1,3 +1,23 @@ +/* Copyright (C) 1999, 2001, 2002 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef __ASSEMBLER__ + /* Symbolic names for the registers. The only portable way to write asm code is to use number but this produces really unreadable code. Therefore these symbolic names. */ @@ -80,4 +100,38 @@ #define cr6 6 #define cr7 7 +/* Vector registers. */ +#define v0 0 +#define v1 1 +#define v2 2 +#define v3 3 +#define v4 4 +#define v5 5 +#define v6 6 +#define v7 7 +#define v8 8 +#define v9 9 +#define v10 10 +#define v11 11 +#define v12 12 +#define v13 13 +#define v14 14 +#define v15 15 +#define v16 16 +#define v17 17 +#define v18 18 +#define v19 19 +#define v20 20 +#define v21 21 +#define v22 22 +#define v23 23 +#define v24 24 +#define v25 25 +#define v26 26 +#define v27 27 +#define v28 28 +#define v29 29 +#define v30 30 +#define v31 31 +#endif /* __ASSEMBLER__ */ diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c index 8115d4d01..353143907 100644 --- a/libc/sysdeps/linux/powerpc/pread_write.c +++ b/libc/sysdeps/linux/powerpc/pread_write.c @@ -1,50 +1,27 @@ /* vi: set sw=4 ts=4: * - * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org> - * Based in part on the files + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* Based in part on the files * ./sysdeps/unix/sysv/linux/pwrite.c, * ./sysdeps/unix/sysv/linux/pread.c, * sysdeps/posix/pread.c * sysdeps/posix/pwrite.c * from GNU libc 2.2.5, but reworked considerably... - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program 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 Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define _GNU_SOURCE -#define _LARGEFILE64_SOURCE -#include <features.h> -#undef __OPTIMIZE__ -/* We absolutely do _NOT_ want interfaces silently - * * * renamed under us or very bad things will happen... */ -#ifdef __USE_FILE_OFFSET64 -# undef __USE_FILE_OFFSET64 -#endif - - -#include <errno.h> -#include <sys/types.h> -#include <sys/syscall.h> +#include "../common/syscalls.h" #include <unistd.h> -#if ! defined __UCLIBC_HAS_LFS__ -#define off64_t off_t +#ifndef __UCLIBC_HAS_LFS__ +# define off64_t off_t #endif #ifdef __NR_pread -#define __NR___syscall_pread __NR_pread +extern __typeof(pread) __libc_pread; +# define __NR___syscall_pread __NR_pread static inline _syscall4(ssize_t, __syscall_pread, int, fd, void *, buf, size_t, count, off64_t, offset); @@ -52,20 +29,22 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { return(__syscall_pread(fd, buf, count, (off64_t)offset)); } -weak_alias (__libc_pread, pread) +weak_alias(__libc_pread,pread) -#if defined __UCLIBC_HAS_LFS__ +# ifdef __UCLIBC_HAS_LFS__ +extern __typeof(pread64) __libc_pread64; ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { return(__syscall_pread(fd, buf, count, offset)); } -weak_alias (__libc_pread64, pread64) -#endif /* __UCLIBC_HAS_LFS__ */ +weak_alias(__libc_pread64,pread64) +# endif /* __UCLIBC_HAS_LFS__ */ #endif /* __NR_pread */ #ifdef __NR_pwrite -#define __NR___syscall_pwrite __NR_pwrite +extern __typeof(pwrite) __libc_pwrite; +# define __NR___syscall_pwrite __NR_pwrite static inline _syscall4(ssize_t, __syscall_pwrite, int, fd, const void *, buf, size_t, count, off64_t, offset); @@ -73,20 +52,25 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) { return(__syscall_pwrite(fd, buf, count, (off64_t)offset)); } -weak_alias (__libc_pwrite, pwrite) +weak_alias(__libc_pwrite,pwrite) -#if defined __UCLIBC_HAS_LFS__ +# ifdef __UCLIBC_HAS_LFS__ +extern __typeof(pwrite64) __libc_pwrite64; ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) { return(__syscall_pwrite(fd, buf, count, offset)); } -weak_alias (__libc_pwrite64, pwrite64) -#endif /* __UCLIBC_HAS_LFS__ */ +weak_alias(__libc_pwrite64,pwrite64) +# endif /* __UCLIBC_HAS_LFS__ */ #endif /* __NR_pwrite */ #if ! defined __NR_pread || ! defined __NR_pwrite +libc_hidden_proto(read) +libc_hidden_proto(write) +libc_hidden_proto(lseek) + static ssize_t __fake_pread_write(int fd, void *buf, size_t count, off_t offset, int do_pwrite) { @@ -96,11 +80,11 @@ static ssize_t __fake_pread_write(int fd, void *buf, /* Since we must not change the file pointer preserve the * value so that we can restore it later. */ - if ((old_offset=__lseek(fd, 0, SEEK_CUR)) == (off_t) -1) + if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) return -1; /* Set to wanted position. */ - if (__lseek (fd, offset, SEEK_SET) == (off_t) -1) + if (lseek (fd, offset, SEEK_SET) == (off_t) -1) return -1; if (do_pwrite==1) { @@ -114,7 +98,7 @@ static ssize_t __fake_pread_write(int fd, void *buf, /* Now we have to restore the position. If this fails we * have to return this as an error. */ save_errno = errno; - if (__lseek(fd, old_offset, SEEK_SET) == (off_t) -1) + if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) { if (result == -1) __set_errno(save_errno); @@ -124,7 +108,9 @@ static ssize_t __fake_pread_write(int fd, void *buf, return(result); } -#if defined __UCLIBC_HAS_LFS__ +# ifdef __UCLIBC_HAS_LFS__ +libc_hidden_proto(lseek64) + static ssize_t __fake_pread_write64(int fd, void *buf, size_t count, off64_t offset, int do_pwrite) { @@ -134,11 +120,11 @@ static ssize_t __fake_pread_write64(int fd, void *buf, /* Since we must not change the file pointer preserve the * value so that we can restore it later. */ - if ((old_offset=__lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) + if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) return -1; /* Set to wanted position. */ - if (__lseek64(fd, offset, SEEK_SET) == (off64_t) -1) + if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) return -1; if (do_pwrite==1) { @@ -151,7 +137,7 @@ static ssize_t __fake_pread_write64(int fd, void *buf, /* Now we have to restore the position. */ save_errno = errno; - if (__lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) { + if (lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) { if (result == -1) __set_errno (save_errno); return -1; @@ -159,7 +145,7 @@ static ssize_t __fake_pread_write64(int fd, void *buf, __set_errno (save_errno); return result; } -#endif /* __UCLIBC_HAS_LFS__ */ +# endif /* __UCLIBC_HAS_LFS__ */ #endif /* ! defined __NR_pread || ! defined __NR_pwrite */ #ifndef __NR_pread @@ -167,31 +153,30 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { return(__fake_pread_write(fd, buf, count, offset, 0)); } -weak_alias (__libc_pread, pread) +weak_alias(__libc_pread,pread) -#if defined __UCLIBC_HAS_LFS__ +# ifdef __UCLIBC_HAS_LFS__ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { return(__fake_pread_write64(fd, buf, count, offset, 0)); } -weak_alias (__libc_pread64, pread64) -#endif /* __UCLIBC_HAS_LFS__ */ +weak_alias(__libc_pread64,pread64) +# endif /* __UCLIBC_HAS_LFS__ */ #endif /* ! __NR_pread */ #ifndef __NR_pwrite ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) { - return(__fake_pread_write(fd, buf, count, offset, 1)); + return(__fake_pread_write(fd, (void*)buf, count, offset, 1)); } -weak_alias (__libc_pwrite, pwrite) +weak_alias(__libc_pwrite,pwrite) -#if defined __UCLIBC_HAS_LFS__ +# ifdef __UCLIBC_HAS_LFS__ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) { return(__fake_pread_write64(fd, (void*)buf, count, offset, 1)); } -weak_alias (__libc_pwrite64, pwrite64) -#endif /* __UCLIBC_HAS_LFS__ */ +weak_alias(__libc_pwrite64,pwrite64) +# endif /* __UCLIBC_HAS_LFS__ */ #endif /* ! __NR_pwrite */ - diff --git a/libc/sysdeps/linux/powerpc/sys/procfs.h b/libc/sysdeps/linux/powerpc/sys/procfs.h index ff85f09f9..d2d597241 100644 --- a/libc/sysdeps/linux/powerpc/sys/procfs.h +++ b/libc/sysdeps/linux/powerpc/sys/procfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1999, 2002, 2006 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 @@ -32,9 +32,17 @@ __BEGIN_DECLS +/* These definitions are normally provided by ucontext.h via + asm/sigcontext.h, asm/ptrace.h, and asm/elf.h. Otherwise we define + them here. */ +#ifndef __PPC64_ELF_H #define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ #define ELF_NFPREG 33 /* includes fpscr */ -#define ELF_NVRREG 33 /* includes vscr */ +#if __WORDSIZE == 32 +# define ELF_NVRREG 33 /* includes vscr */ +#else +# define ELF_NVRREG 34 /* includes vscr */ +#endif typedef unsigned long elf_greg_t; typedef elf_greg_t elf_gregset_t[ELF_NGREG]; @@ -45,8 +53,9 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; /* Altivec registers */ typedef struct { unsigned int u[4]; -} __attribute((aligned (16))) elf_vrreg_t; +} __attribute__ ((aligned (16))) elf_vrreg_t; typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG]; +#endif struct elf_siginfo { diff --git a/libc/sysdeps/linux/powerpc/sys/ucontext.h b/libc/sysdeps/linux/powerpc/sys/ucontext.h index 07f0933ff..9eb50aa96 100644 --- a/libc/sysdeps/linux/powerpc/sys/ucontext.h +++ b/libc/sysdeps/linux/powerpc/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2002, 2004, 2005 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 @@ -26,7 +26,110 @@ included in <signal.h>. */ #include <bits/sigcontext.h> -typedef struct sigcontext mcontext_t; +#if __WORDSIZE == 32 + +/* Number of general registers. */ +# define NGREG 48 + +/* Container for all general registers. */ +typedef unsigned long gregset_t[NGREG]; + +/* Container for floating-point registers and status */ +typedef struct _libc_fpstate +{ + double fpregs[32]; + double fpscr; + unsigned int _pad[2]; +} fpregset_t; + +/* Container for Altivec/VMX registers and status. + Needs to be aligned on a 16-byte boundary. */ +typedef struct _libc_vrstate +{ + unsigned int vrregs[32][4]; + unsigned int vrsave; + unsigned int _pad[2]; + unsigned int vscr; +} vrregset_t; + +/* Context to describe whole processor state. */ +typedef struct +{ + gregset_t gregs; + fpregset_t fpregs; + vrregset_t vrregs __attribute__((__aligned__(16))); +} mcontext_t; + +#else + +/* For 64-bit kernels with Altivec support, a machine context is exactly + * a sigcontext. For older kernel (without Altivec) the sigcontext matches + * the mcontext upto but not including the v_regs field. For kernels that + * don't AT_HWCAP or return AT_HWCAP without PPC_FEATURE_HAS_ALTIVEC the + * v_regs field may not exit and should not be referenced. The v_regd field + * can be refernced safely only after verifying that PPC_FEATURE_HAS_ALTIVEC + * is set in AT_HWCAP. */ + +/* Number of general registers. */ +# define NGREG 48 /* includes r0-r31, nip, msr, lr, etc. */ +# define NFPREG 33 /* includes fp0-fp31 &fpscr. */ +# define NVRREG 34 /* includes v0-v31, vscr, & vrsave in split vectors */ + +typedef unsigned long gregset_t[NGREG]; +typedef double fpregset_t[NFPREG]; + +/* Container for Altivec/VMX Vector Status and Control Register. Only 32-bits + but can only be copied to/from a 128-bit vector register. So we allocated + a whole quadword speedup save/restore. */ +typedef struct _libc_vscr +{ + unsigned int __pad[3]; + unsigned int vscr_word; +} vscr_t; + +/* Container for Altivec/VMX registers and status. + Must to be aligned on a 16-byte boundary. */ +typedef struct _libc_vrstate +{ + unsigned int vrregs[32][4]; + vscr_t vscr; + unsigned int vrsave; + unsigned int __pad[3]; +} vrregset_t __attribute__((__aligned__(16))); + +typedef struct { + unsigned long __unused[4]; + int signal; + int __pad0; + unsigned long handler; + unsigned long oldmask; + struct pt_regs *regs; + gregset_t gp_regs; + fpregset_t fp_regs; +/* + * To maintain compatibility with current implementations the sigcontext is + * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t) + * followed by an unstructured (vmx_reserve) field of 69 doublewords. This + * allows the array of vector registers to be quadword aligned independent of + * the alignment of the containing sigcontext or ucontext. It is the + * responsibility of the code setting the sigcontext to set this pointer to + * either NULL (if this processor does not support the VMX feature) or the + * address of the first quadword within the allocated (vmx_reserve) area. + * + * The pointer (v_regs) of vector type (elf_vrreg_t) is essentually + * an array of 34 quadword entries. The entries with + * indexes 0-31 contain the corresponding vector registers. The entry with + * index 32 contains the vscr as the last word (offset 12) within the + * quadword. This allows the vscr to be stored as either a quadword (since + * it must be copied via a vector register to/from storage) or as a word. + * The entry with index 33 contains the vrsave as the first word (offset 0) + * within the quadword. + */ + vrregset_t *v_regs; + long vmx_reserve[NVRREG+NVRREG+1]; +} mcontext_t; + +#endif /* Userlevel context. */ typedef struct ucontext @@ -34,8 +137,41 @@ typedef struct ucontext unsigned long int uc_flags; struct ucontext *uc_link; stack_t uc_stack; - mcontext_t uc_mcontext; - __sigset_t uc_sigmask; +#if __WORDSIZE == 32 + /* + * These fields are set up this way to maximize source and + * binary compatibility with code written for the old + * ucontext_t definition, which didn't include space for the + * registers. + * + * Different versions of the kernel have stored the registers on + * signal delivery at different offsets from the ucontext struct. + * Programs should thus use the uc_mcontext.uc_regs pointer to + * find where the registers are actually stored. The registers + * will be stored within the ucontext_t struct but not necessarily + * at a fixed address. As a side-effect, this lets us achieve + * 16-byte alignment for the register storage space if the + * Altivec registers are to be saved, without requiring 16-byte + * alignment on the whole ucontext_t. + * + * The uc_mcontext.regs field is included for source compatibility + * with programs written against the older ucontext_t definition, + * and its name should therefore not change. The uc_pad field + * is for binary compatibility with programs compiled against the + * old ucontext_t; it ensures that uc_mcontext.regs and uc_sigmask + * are at the same offset as previously. + */ + int uc_pad[7]; + union uc_regs_ptr { + struct pt_regs *regs; + mcontext_t *uc_regs; + } uc_mcontext; + sigset_t uc_sigmask; + char uc_reg_space[sizeof(mcontext_t) + 12]; /* last for extensibility */ +#else /* 64-bit */ + sigset_t uc_sigmask; + mcontext_t uc_mcontext; /* last for extensibility */ +#endif } ucontext_t; #endif /* sys/ucontext.h */ diff --git a/libc/sysdeps/linux/powerpc/vfork.S b/libc/sysdeps/linux/powerpc/vfork.S index 7cf5eaa16..600c980a8 100644 --- a/libc/sysdeps/linux/powerpc/vfork.S +++ b/libc/sysdeps/linux/powerpc/vfork.S @@ -1,17 +1,19 @@ -#include <features.h> +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + #include <sys/syscall.h> #ifndef __NR_vfork - /* No vfork so use fork instead */ -hidden_strong_alias(__fork,__vfork) -weak_alias(vfork,__libc_fork) - -#else +# define __NR_vfork __NR_fork +#endif .text .global __vfork -.hidden __vfork +.hidden __vfork .type __vfork,@function .type __syscall_error,@function @@ -22,5 +24,6 @@ __vfork: b __syscall_error .size __vfork,.-__vfork -#endif -strong_alias(__vfork,vfork) + +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/powerpc/vfork.c b/libc/sysdeps/linux/powerpc/vfork.c deleted file mode 100644 index 39f992513..000000000 --- a/libc/sysdeps/linux/powerpc/vfork.c +++ /dev/null @@ -1,49 +0,0 @@ -#include <unistd.h> -#include <sys/types.h> -#include <errno.h> -#include <sys/syscall.h> - -#define __syscall_clobbers \ - "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" -#define __syscall_return(type) \ - return (__sc_err & 0x10000000 ? errno = __sc_ret, __sc_ret = -1 : 0), \ - (type) __sc_ret - -pid_t attribute_hidden __vfork(void) -{ - unsigned long __sc_ret, __sc_err; - register unsigned long __sc_0 __asm__ ("r0"); - register unsigned long __sc_3 __asm__ ("r3"); - -#if 0 - /* Sigh. The vfork system call on powerpc - * seems to be completely broken. So just - * use fork instead */ - - __sc_0 = __NR_vfork; - __asm__ __volatile__ - ("sc \n\t" - "mfcr %1 " - : "=&r" (__sc_3), "=&r" (__sc_0) - : "0" (__sc_3), "1" (__sc_0) - : __syscall_clobbers); - __sc_ret = __sc_3; - __sc_err = __sc_0; - - if((__sc_err & 0x10000000) && (__sc_ret == ENOSYS)) -#endif - { - __sc_0 = __NR_fork; - __asm__ __volatile__ - ("sc \n\t" - "mfcr %1 " - : "=&r" (__sc_3), "=&r" (__sc_0) - : "0" (__sc_3), "1" (__sc_0) - : __syscall_clobbers); - __sc_ret = __sc_3; - __sc_err = __sc_0; - } - - __syscall_return (pid_t); -} -strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/sh/Makefile.arch b/libc/sysdeps/linux/sh/Makefile.arch index fa1a49543..77ad570d6 100644 --- a/libc/sysdeps/linux/sh/Makefile.arch +++ b/libc/sysdeps/linux/sh/Makefile.arch @@ -7,7 +7,7 @@ # CSRC := \ - mmap.c longjmp.c pipe.c __init_brk.c brk.c sbrk.c syscall.c pread_write.c + mmap.c pipe.c __init_brk.c brk.c sbrk.c syscall.c pread_write.c SSRC := setjmp.S __longjmp.S vfork.S clone.S ___fpscr_values.S diff --git a/libc/sysdeps/linux/sh/__init_brk.c b/libc/sysdeps/linux/sh/__init_brk.c index 92e07c49d..c14180a6c 100644 --- a/libc/sysdeps/linux/sh/__init_brk.c +++ b/libc/sysdeps/linux/sh/__init_brk.c @@ -4,11 +4,16 @@ #include <unistd.h> #include <sys/syscall.h> +extern void * __curbrk; +libc_hidden_proto(__curbrk) void * __curbrk = 0; +libc_hidden_data_def(__curbrk) #define __NR__brk __NR_brk attribute_hidden _syscall1(void *, _brk, void *, ptr); +extern int __init_brk (void); +libc_hidden_proto(__init_brk) int __init_brk (void) { @@ -23,3 +28,4 @@ __init_brk (void) } return 0; } +libc_hidden_def(__init_brk) diff --git a/libc/sysdeps/linux/sh/__longjmp.S b/libc/sysdeps/linux/sh/__longjmp.S index 9e310a283..eb569917b 100644 --- a/libc/sysdeps/linux/sh/__longjmp.S +++ b/libc/sysdeps/linux/sh/__longjmp.S @@ -61,7 +61,5 @@ __longjmp: rts ldc.l @r4+, gbr #endif -.size __longjmp,.-__longjmp; - -.weak __sigprocmask -__sigprocmask = sigprocmask +.size __longjmp,.-__longjmp +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h b/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h new file mode 100644 index 000000000..7b9a0efbb --- /dev/null +++ b/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h @@ -0,0 +1,48 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +#if defined(__sh2__) +# define __UCLIBC_ABORT_INSTRUCTION__ "trapa #32" +#else /* defined(__sh__) */ +# define __UCLIBC_ABORT_INSTRUCTION__ "trapa #0xff" +#endif + +/* can your target use syscall6() for mmap ? */ +#define __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target have to worry about older [gs]etrlimit() ? */ +#define __UCLIBC_HANDLE_OLDER_RLIMIT__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/sh/brk.c b/libc/sysdeps/linux/sh/brk.c index d6063fc27..9e33830ab 100644 --- a/libc/sysdeps/linux/sh/brk.c +++ b/libc/sysdeps/linux/sh/brk.c @@ -1,15 +1,24 @@ /* From libc-5.3.12 */ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <errno.h> #include <unistd.h> #include <sys/syscall.h> +libc_hidden_proto(brk) + extern void * __curbrk; +libc_hidden_proto(__curbrk) extern int __init_brk (void); +libc_hidden_proto(__init_brk) extern void *_brk(void *ptr) attribute_hidden; -int attribute_hidden __brk(void * end_data_seg) +int brk(void * end_data_seg) { if (__init_brk () == 0) { @@ -20,4 +29,4 @@ int attribute_hidden __brk(void * end_data_seg) } return -1; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/sh/clone.S b/libc/sysdeps/linux/sh/clone.S index 7824d4771..1806313e0 100644 --- a/libc/sysdeps/linux/sh/clone.S +++ b/libc/sysdeps/linux/sh/clone.S @@ -25,7 +25,7 @@ #include <bits/errno.h> -#if defined __HAVE_ELF__ && defined __HAVE_SHARED__ +#ifdef __HAVE_SHARED__ #define PLTJMP(_x) _x##@PLT #else #define PLTJMP(_x) _x @@ -38,9 +38,9 @@ .text .align 4 -.type __clone,@function -.globl __clone; -__clone: +.type clone,@function +.globl clone; +clone: /* sanity check arguments. */ tst r4, r4 bt 0f @@ -98,7 +98,7 @@ __clone: /* we are done, passing the return value through r0 */ mov.l .L1, r1 -#if defined __HAVE_ELF__ && defined __HAVE_SHARED__ +#ifdef __HAVE_SHARED__ mov.l r12, @-r15 sts.l pr, @-r15 mov r0, r4 @@ -118,10 +118,7 @@ __clone: #endif .align 2 .L1: - .long PLTJMP(_exit_internal) -.size __clone,.-__clone; - -.globl clone; - clone = __clone + .long PLTJMP( HIDDEN_JUMPTARGET(_exit)) +.size clone,.-clone; #include "syscall_error.S" diff --git a/libc/sysdeps/linux/sh/longjmp.c b/libc/sysdeps/linux/sh/longjmp.c deleted file mode 100644 index ee3afcd74..000000000 --- a/libc/sysdeps/linux/sh/longjmp.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 1991, 92, 94, 95, 97, 98, 2000 Free Software Foundation, Inc. - Copyright (C) 2001 Hewlett-Packard Australia - - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Library General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) any - later version. - - This program 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 Library General Public License for more - details. - - You should have received a copy of the GNU Library General Public License - along with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Derived in part from the Linux-8086 C library, the GNU C Library, and several - other sundry sources. Files within this library are copyright by their - respective copyright holders. -*/ - -#include <stddef.h> -#include <setjmp.h> -#include <signal.h> - -extern int __longjmp(char *env, int val); - -/* Set the signal mask to the one specified in ENV, and jump - to the position specified in ENV, causing the setjmp - call there to return VAL, or 1 if VAL is 0. */ -void __libc_siglongjmp (sigjmp_buf env, int val) -{ - if (env[0].__mask_was_saved) - /* Restore the saved signal mask. */ - (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask, - (sigset_t *) NULL); - - /* Call the machine-dependent function to restore machine state. */ - __longjmp ((char *) env[0].__jmpbuf, val ?: 1); -} - -__asm__(".weak longjmp; longjmp = __libc_siglongjmp"); -__asm__(".weak _longjmp; _longjmp = __libc_siglongjmp"); -__asm__(".weak siglongjmp; siglongjmp = __libc_siglongjmp"); diff --git a/libc/sysdeps/linux/sh/mmap.c b/libc/sysdeps/linux/sh/mmap.c index 5424942b6..6bc45e939 100644 --- a/libc/sysdeps/linux/sh/mmap.c +++ b/libc/sysdeps/linux/sh/mmap.c @@ -23,6 +23,8 @@ #include <errno.h> #include <sys/mman.h> +libc_hidden_proto(mmap) + #ifdef HIOS # define __SH_SYSCALL6_TRAPA "0x2E" #else @@ -31,6 +33,5 @@ #include <sys/syscall.h> -#define __NR___mmap __NR_mmap -attribute_hidden _syscall6(__ptr_t, __mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset); -strong_alias(__mmap,mmap) +_syscall6(__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset); +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/sh/pipe.c b/libc/sysdeps/linux/sh/pipe.c index a15034599..e4cc0080d 100644 --- a/libc/sysdeps/linux/sh/pipe.c +++ b/libc/sysdeps/linux/sh/pipe.c @@ -1,11 +1,17 @@ - -/* Copyright (C) 2001 Lineo, <davidm@lineo.com> */ +/* + * Copyright (C) 2001 Lineo, <davidm@lineo.com> + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <errno.h> #include <unistd.h> #include <syscall.h> -int attribute_hidden __pipe(int *fd) +libc_hidden_proto(pipe) + +int pipe(int *fd) { long __res, __res2; __asm__ __volatile__ ( @@ -27,4 +33,4 @@ int attribute_hidden __pipe(int *fd) fd[1] = __res2; return(0); } -strong_alias(__pipe,pipe) +libc_hidden_def(pipe) diff --git a/libc/sysdeps/linux/sh/pread_write.c b/libc/sysdeps/linux/sh/pread_write.c index 55b234855..dc756d647 100644 --- a/libc/sysdeps/linux/sh/pread_write.c +++ b/libc/sysdeps/linux/sh/pread_write.c @@ -1,42 +1,18 @@ /* vi: set sw=4 ts=4: * - * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org> - * Based in part on the files + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* Based in part on the files * ./sysdeps/unix/sysv/linux/pwrite.c, * ./sysdeps/unix/sysv/linux/pread.c, * sysdeps/posix/pread.c * sysdeps/posix/pwrite.c * from GNU libc 2.2.5, but reworked considerably... - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program 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 Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define _GNU_SOURCE -#define _LARGEFILE64_SOURCE -#include <features.h> -#undef __OPTIMIZE__ -/* We absolutely do _NOT_ want interfaces silently - * * * renamed under us or very bad things will happen... */ -#ifdef __USE_FILE_OFFSET64 -# undef __USE_FILE_OFFSET64 -#endif - - -#include <errno.h> -#include <sys/types.h> -#include <sys/syscall.h> +#include "../common/syscalls.h" #include <unistd.h> #include <stdint.h> @@ -48,9 +24,8 @@ #endif #ifdef __NR_pread - - -#define __NR___syscall_pread __NR_pread +extern __typeof(pread) __libc_pread; +# define __NR___syscall_pread __NR_pread static inline _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf, size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo); @@ -58,18 +33,18 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR((off_t)0,offset))); } -weak_alias (__libc_pread, pread) +weak_alias(__libc_pread,pread) -#if defined __UCLIBC_HAS_LFS__ +# ifdef __UCLIBC_HAS_LFS__ +extern __typeof(pread64) __libc_pread64; ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { uint32_t low = offset & 0xffffffff; uint32_t high = offset >> 32; return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low))); } -weak_alias (__libc_pread64, pread64) -#endif /* __UCLIBC_HAS_LFS__ */ - +weak_alias(__libc_pread64,pread64) +# endif /* __UCLIBC_HAS_LFS__ */ #endif /* __NR_pread */ /**********************************************************************/ @@ -82,8 +57,8 @@ weak_alias (__libc_pread64, pread64) #endif #ifdef __NR_pwrite - -#define __NR___syscall_pwrite __NR_pwrite +extern __typeof(pwrite) __libc_pwrite; +# define __NR___syscall_pwrite __NR_pwrite static inline _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf, size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo); @@ -91,16 +66,16 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) { return(__syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR((off_t)0,offset))); } -weak_alias (__libc_pwrite, pwrite) +weak_alias(__libc_pwrite,pwrite) -#if defined __UCLIBC_HAS_LFS__ +# ifdef __UCLIBC_HAS_LFS__ +extern __typeof(pwrite64) __libc_pwrite64; ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) { uint32_t low = offset & 0xffffffff; uint32_t high = offset >> 32; return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low))); } -weak_alias (__libc_pwrite64, pwrite64) -#endif /* __UCLIBC_HAS_LFS__ */ - +weak_alias(__libc_pwrite64,pwrite64) +# endif /* __UCLIBC_HAS_LFS__ */ #endif /* __NR_pwrite */ diff --git a/libc/sysdeps/linux/sh/sbrk.c b/libc/sysdeps/linux/sh/sbrk.c index e9faf7db0..bb66f0148 100644 --- a/libc/sysdeps/linux/sh/sbrk.c +++ b/libc/sysdeps/linux/sh/sbrk.c @@ -4,13 +4,17 @@ #include <unistd.h> #include <sys/syscall.h> +libc_hidden_proto(sbrk) + extern void * __curbrk; +libc_hidden_proto(__curbrk) extern int __init_brk (void); +libc_hidden_proto(__init_brk) extern void *_brk(void *ptr) attribute_hidden; -void attribute_hidden * -__sbrk(intptr_t increment) +void * +sbrk(intptr_t increment) { if (__init_brk () == 0) { @@ -23,4 +27,4 @@ __sbrk(intptr_t increment) } return ((void *) -1); } -strong_alias(__sbrk,sbrk) +libc_hidden_def(sbrk) diff --git a/libc/sysdeps/linux/sh/setjmp.S b/libc/sysdeps/linux/sh/setjmp.S index bb87ff0fb..3296c2ba9 100644 --- a/libc/sysdeps/linux/sh/setjmp.S +++ b/libc/sysdeps/linux/sh/setjmp.S @@ -77,7 +77,7 @@ __sigsetjmp_intern: mov.l r9, @-r4 mov.l r8, @-r4 -#if defined __HAVE_ELF__ && defined __HAVE_SHARED__ +#ifdef __HAVE_SHARED__ mov.l .LG, r2 mova .LG, r0 add r0, r2 diff --git a/libc/sysdeps/linux/sh/syscall_error.S b/libc/sysdeps/linux/sh/syscall_error.S index 7115120db..1764ebfc8 100644 --- a/libc/sysdeps/linux/sh/syscall_error.S +++ b/libc/sysdeps/linux/sh/syscall_error.S @@ -3,7 +3,7 @@ __syscall_error: /* Call errno_location, store '-r4' in errno and return -1 */ mov.l r12, @-r15 sts.l pr, @-r15 -#if defined __HAVE_ELF__ && defined __HAVE_SHARED__ +#ifdef __HAVE_SHARED__ mova .LG, r0 mov.l .LG, r12 add r0, r12 @@ -27,7 +27,7 @@ __syscall_error: .align 4 -#if defined __HAVE_ELF__ && defined __HAVE_SHARED__ +#ifdef __HAVE_SHARED__ 1: .long __errno_location@GOT .LG: .long _GLOBAL_OFFSET_TABLE_ #else diff --git a/libc/sysdeps/linux/sh/vfork.S b/libc/sysdeps/linux/sh/vfork.S index f3c20a9d6..d9840946f 100644 --- a/libc/sysdeps/linux/sh/vfork.S +++ b/libc/sysdeps/linux/sh/vfork.S @@ -108,7 +108,7 @@ __vfork: .word __NR_fork .size __vfork, .-__vfork -strong_alias(__vfork,vfork) +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) #include "syscall_error.S" - diff --git a/libc/sysdeps/linux/sh64/__init_brk.c b/libc/sysdeps/linux/sh64/__init_brk.c index 92e07c49d..c14180a6c 100644 --- a/libc/sysdeps/linux/sh64/__init_brk.c +++ b/libc/sysdeps/linux/sh64/__init_brk.c @@ -4,11 +4,16 @@ #include <unistd.h> #include <sys/syscall.h> +extern void * __curbrk; +libc_hidden_proto(__curbrk) void * __curbrk = 0; +libc_hidden_data_def(__curbrk) #define __NR__brk __NR_brk attribute_hidden _syscall1(void *, _brk, void *, ptr); +extern int __init_brk (void); +libc_hidden_proto(__init_brk) int __init_brk (void) { @@ -23,3 +28,4 @@ __init_brk (void) } return 0; } +libc_hidden_def(__init_brk) diff --git a/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h b/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h new file mode 100644 index 000000000..55cd44c1f --- /dev/null +++ b/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h @@ -0,0 +1,41 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +#define __UCLIBC_ABORT_INSTRUCTION__ "movi 0x10, r9; shori 0xff, r9; trapa r9" + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/sh64/brk.c b/libc/sysdeps/linux/sh64/brk.c index d6063fc27..9e33830ab 100644 --- a/libc/sysdeps/linux/sh64/brk.c +++ b/libc/sysdeps/linux/sh64/brk.c @@ -1,15 +1,24 @@ /* From libc-5.3.12 */ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <errno.h> #include <unistd.h> #include <sys/syscall.h> +libc_hidden_proto(brk) + extern void * __curbrk; +libc_hidden_proto(__curbrk) extern int __init_brk (void); +libc_hidden_proto(__init_brk) extern void *_brk(void *ptr) attribute_hidden; -int attribute_hidden __brk(void * end_data_seg) +int brk(void * end_data_seg) { if (__init_brk () == 0) { @@ -20,4 +29,4 @@ int attribute_hidden __brk(void * end_data_seg) } return -1; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/sh64/sbrk.c b/libc/sysdeps/linux/sh64/sbrk.c index e9faf7db0..bb66f0148 100644 --- a/libc/sysdeps/linux/sh64/sbrk.c +++ b/libc/sysdeps/linux/sh64/sbrk.c @@ -4,13 +4,17 @@ #include <unistd.h> #include <sys/syscall.h> +libc_hidden_proto(sbrk) + extern void * __curbrk; +libc_hidden_proto(__curbrk) extern int __init_brk (void); +libc_hidden_proto(__init_brk) extern void *_brk(void *ptr) attribute_hidden; -void attribute_hidden * -__sbrk(intptr_t increment) +void * +sbrk(intptr_t increment) { if (__init_brk () == 0) { @@ -23,4 +27,4 @@ __sbrk(intptr_t increment) } return ((void *) -1); } -strong_alias(__sbrk,sbrk) +libc_hidden_def(sbrk) diff --git a/libc/sysdeps/linux/sparc/Makefile.arch b/libc/sysdeps/linux/sparc/Makefile.arch index a6f44f2f0..1e401fc84 100644 --- a/libc/sysdeps/linux/sparc/Makefile.arch +++ b/libc/sysdeps/linux/sparc/Makefile.arch @@ -9,6 +9,6 @@ CSRC := brk.c __syscall_error.c SSRC := \ __longjmp.S fork.S vfork.S clone.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \ - urem.S udiv.S umul.S sdiv.S rem.S + syscall.S urem.S udiv.S umul.S sdiv.S rem.S include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch diff --git a/libc/sysdeps/linux/sparc/__longjmp.S b/libc/sysdeps/linux/sparc/__longjmp.S index 06828e61e..fa60264ef 100644 --- a/libc/sysdeps/linux/sparc/__longjmp.S +++ b/libc/sysdeps/linux/sparc/__longjmp.S @@ -16,6 +16,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <features.h> #include <sys/syscall.h> #define _ASM 1 @@ -83,3 +84,5 @@ __longjmp: mov %g2, %o0 /* Delay slot: set return value. */ .size __longjmp,.-__longjmp + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/sparc/__syscall_error.c b/libc/sysdeps/linux/sparc/__syscall_error.c index de65a1f39..5e109a83b 100644 --- a/libc/sysdeps/linux/sparc/__syscall_error.c +++ b/libc/sysdeps/linux/sparc/__syscall_error.c @@ -1,28 +1,17 @@ /* Wrapper for setting errno. - Copyright (C) 1997, 1998, 1999, 2000 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + * + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <errno.h> #include <features.h> /* This routine is jumped to by all the syscall handlers, to stash * an error number into errno. */ -int attribute_hidden __syscall_error(int err_no) +int __syscall_error(int err_no) attribute_hidden; +int __syscall_error(int err_no) { __set_errno(err_no); return -1; diff --git a/libc/sysdeps/linux/sparc/bits/kernel_stat.h b/libc/sysdeps/linux/sparc/bits/kernel_stat.h index e483baa2c..2f6e13d66 100644 --- a/libc/sysdeps/linux/sparc/bits/kernel_stat.h +++ b/libc/sysdeps/linux/sparc/bits/kernel_stat.h @@ -30,26 +30,24 @@ struct kernel_stat { #endif struct kernel_stat64 { - unsigned char __pad0[6]; - unsigned short st_dev; + unsigned long long st_dev; unsigned long long st_ino; unsigned int st_mode; unsigned int st_nlink; unsigned int st_uid; unsigned int st_gid; - unsigned char __pad2[6]; - unsigned short st_rdev; + unsigned long long st_rdev; unsigned char __pad3[8]; long long st_size; unsigned int st_blksize; unsigned char __pad4[8]; unsigned int st_blocks; unsigned int st_atime; - unsigned int __unused1; + unsigned int st_atime_nsec; unsigned int st_mtime; - unsigned int __unused2; + unsigned int st_mtime_nsec; unsigned int st_ctime; - unsigned int __unused3; + unsigned int st_ctime_nsec; unsigned int __unused4; unsigned int __unused5; }; diff --git a/libc/sysdeps/linux/sparc/bits/syscalls.h b/libc/sysdeps/linux/sparc/bits/syscalls.h index ddd8e5f6b..b8865d453 100644 --- a/libc/sysdeps/linux/sparc/bits/syscalls.h +++ b/libc/sysdeps/linux/sparc/bits/syscalls.h @@ -4,6 +4,8 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif +#include <bits/wordsize.h> + /* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel * header files. It also defines the traditional `SYS_<name>' macros for older * programs. */ @@ -13,47 +15,106 @@ # define __set_errno(val) (*__errno_location ()) = (val) #endif -/* - macros taken from glibc-2.3/sysdeps/unix/sysv/linux/sparc/sysdep.h - Copyright (C) 2000, 2002 Free Software Foundation, Inc. - Contributed by Jakub Jelinek <jakub@redhat.com>, 2000. -*/ - #ifndef __ASSEMBLER__ +#undef __SYSCALL_STRING +#if __WORDSIZE == 32 +# define __SYSCALL_STRING \ + "t 0x10\n\t" \ + "bcc 1f\n\t" \ + "mov %%o0, %0\n\t" \ + "sub %%g0, %%o0, %0\n\t" \ + "1:\n\t" +# define __SYSCALL_RES_CHECK (__res < -255 || __res >= 0) +#elif __WORDSIZE == 64 +# define __SYSCALL_STRING \ + "t 0x6d\n\t" \ + "sub %%g0, %%o0, %0\n\t" \ + "movcc %%xcc, %%o0, %0\n\t" +# define __SYSCALL_RES_CHECK (__res >= 0) +#else +# error unknown __WORDSIZE +#endif + +#define __SYSCALL_RETURN(type) \ + if (__SYSCALL_RES_CHECK) \ + return (type) __res; \ + __set_errno (-__res); \ + return (type) -1; + #undef _syscall0 #define _syscall0(type,name) \ type name(void) \ { \ -return (type) (INLINE_SYSCALL(name, 0)); \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##name; \ +__asm__ __volatile__ (__SYSCALL_STRING \ + : "=r" (__res)\ + : "r" (__g1) \ + : "o0", "cc"); \ +__SYSCALL_RETURN(type) \ } #undef _syscall1 #define _syscall1(type,name,type1,arg1) \ type name(type1 arg1) \ { \ -return (type) (INLINE_SYSCALL(name, 1, arg1)); \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##name; \ +register long __o0 __asm__ ("o0") = (long)(arg1); \ +__asm__ __volatile__ (__SYSCALL_STRING \ + : "=r" (__res), "=&r" (__o0) \ + : "1" (__o0), "r" (__g1) \ + : "cc"); \ +__SYSCALL_RETURN(type) \ } #undef _syscall2 #define _syscall2(type,name,type1,arg1,type2,arg2) \ type name(type1 arg1,type2 arg2) \ { \ -return (type) (INLINE_SYSCALL(name, 2, arg1, arg2)); \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##name; \ +register long __o0 __asm__ ("o0") = (long)(arg1); \ +register long __o1 __asm__ ("o1") = (long)(arg2); \ +__asm__ __volatile__ (__SYSCALL_STRING \ + : "=r" (__res), "=&r" (__o0) \ + : "1" (__o0), "r" (__o1), "r" (__g1) \ + : "cc"); \ +__SYSCALL_RETURN(type) \ } #undef _syscall3 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1,type2 arg2,type3 arg3) \ { \ -return (type) (INLINE_SYSCALL(name, 3, arg1, arg2, arg3)); \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##name; \ +register long __o0 __asm__ ("o0") = (long)(arg1); \ +register long __o1 __asm__ ("o1") = (long)(arg2); \ +register long __o2 __asm__ ("o2") = (long)(arg3); \ +__asm__ __volatile__ (__SYSCALL_STRING \ + : "=r" (__res), "=&r" (__o0) \ + : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \ + : "cc"); \ +__SYSCALL_RETURN(type) \ } #undef _syscall4 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ { \ -return (type) (INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4)); \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##name; \ +register long __o0 __asm__ ("o0") = (long)(arg1); \ +register long __o1 __asm__ ("o1") = (long)(arg2); \ +register long __o2 __asm__ ("o2") = (long)(arg3); \ +register long __o3 __asm__ ("o3") = (long)(arg4); \ +__asm__ __volatile__ (__SYSCALL_STRING \ + : "=r" (__res), "=&r" (__o0) \ + : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \ + : "cc"); \ +__SYSCALL_RETURN(type) \ } #undef _syscall5 @@ -61,7 +122,18 @@ return (type) (INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4)); \ type5,arg5) \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ { \ -return (type) (INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5)); \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##name; \ +register long __o0 __asm__ ("o0") = (long)(arg1); \ +register long __o1 __asm__ ("o1") = (long)(arg2); \ +register long __o2 __asm__ ("o2") = (long)(arg3); \ +register long __o3 __asm__ ("o3") = (long)(arg4); \ +register long __o4 __asm__ ("o4") = (long)(arg5); \ +__asm__ __volatile__ (__SYSCALL_STRING \ + : "=r" (__res), "=&r" (__o0) \ + : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \ + : "cc"); \ +__SYSCALL_RETURN(type) \ } #undef _syscall6 @@ -69,132 +141,20 @@ return (type) (INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5)); \ type5,arg5,type6,arg6) \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6) \ { \ -return (type) (INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6)); \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##name; \ +register long __o0 __asm__ ("o0") = (long)(arg1); \ +register long __o1 __asm__ ("o1") = (long)(arg2); \ +register long __o2 __asm__ ("o2") = (long)(arg3); \ +register long __o3 __asm__ ("o3") = (long)(arg4); \ +register long __o4 __asm__ ("o4") = (long)(arg5); \ +register long __o5 __asm__ ("o5") = (long)(arg6); \ +__asm__ __volatile__ (__SYSCALL_STRING \ + : "=r" (__res), "=&r" (__o0) \ + : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__o5), "r" (__g1) \ + : "cc"); \ +__SYSCALL_RETURN(type) \ } -#undef _syscall7 -#define _syscall7(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6,type7,arg7) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6,type7 arg7) \ -{ \ -return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7)); \ -} - -#define __SYSCALL_STRING \ - "ta 0x10;" \ - "bcs 2f;" \ - " nop;" \ - "1:" \ - ".subsection 2;" \ - "2:" \ - "save %%sp, -192, %%sp;" \ - "call __errno_location;" \ - " nop;" \ - "st %%i0,[%%o0];" \ - "ba 1b;" \ - " restore %%g0, -1, %%o0;" \ - ".previous;" - -#define __SYSCALL_CLOBBERS "g2", "g3", "g4", "g5", "g7", \ - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ - "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ - "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \ - "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \ - "cc", "memory" - -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) _INLINE_SYSCALL##nr(name, args) - -#define _INLINE_SYSCALL0(name,dummy...) \ -({ \ - register long __o0 __asm__ ("o0"); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ - __asm __volatile (__SYSCALL_STRING : "=r" (__g1), "=r" (__o0) : \ - "0" (__g1) : \ - __SYSCALL_CLOBBERS); \ - __o0; \ -}) - -#define _INLINE_SYSCALL1(name,arg1) \ -({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ - __asm __volatile (__SYSCALL_STRING : "=r" (__g1), "=r" (__o0) : \ - "0" (__g1), "1" (__o0) : \ - __SYSCALL_CLOBBERS); \ - __o0; \ -}) - -#define _INLINE_SYSCALL2(name,arg1,arg2) \ -({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ - __asm __volatile (__SYSCALL_STRING : "=r" (__g1), "=r" (__o0) : \ - "0" (__g1), "1" (__o0), "r" (__o1) : \ - __SYSCALL_CLOBBERS); \ - __o0; \ -}) - -#define _INLINE_SYSCALL3(name,arg1,arg2,arg3) \ -({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ - __asm __volatile (__SYSCALL_STRING : "=r" (__g1), "=r" (__o0) : \ - "0" (__g1), "1" (__o0), "r" (__o1), \ - "r" (__o2) : \ - __SYSCALL_CLOBBERS); \ - __o0; \ -}) - -#define _INLINE_SYSCALL4(name,arg1,arg2,arg3,arg4) \ -({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __o3 __asm__ ("o3") = (long)(arg4); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ - __asm __volatile (__SYSCALL_STRING : "=r" (__g1), "=r" (__o0) : \ - "0" (__g1), "1" (__o0), "r" (__o1), \ - "r" (__o2), "r" (__o3) : \ - __SYSCALL_CLOBBERS); \ - __o0; \ -}) - -#define _INLINE_SYSCALL5(name,arg1,arg2,arg3,arg4,arg5) \ -({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __o3 __asm__ ("o3") = (long)(arg4); \ - register long __o4 __asm__ ("o4") = (long)(arg5); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ - __asm __volatile (__SYSCALL_STRING : "=r" (__g1), "=r" (__o0) : \ - "0" (__g1), "1" (__o0), "r" (__o1), \ - "r" (__o2), "r" (__o3), "r" (__o4) : \ - __SYSCALL_CLOBBERS); \ - __o0; \ -}) - -#define _INLINE_SYSCALL6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ -({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __o3 __asm__ ("o3") = (long)(arg4); \ - register long __o4 __asm__ ("o4") = (long)(arg5); \ - register long __o5 __asm__ ("o5") = (long)(arg6); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ - __asm __volatile (__SYSCALL_STRING : "=r" (__g1), "=r" (__o0) : \ - "0" (__g1), "1" (__o0), "r" (__o1), \ - "r" (__o2), "r" (__o3), "r" (__o4), \ - "r" (__o5) : \ - __SYSCALL_CLOBBERS); \ - __o0; \ -}) - #endif /* __ASSEMBLER__ */ #endif /* _BITS_SYSCALLS_H */ - diff --git a/libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h b/libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h new file mode 100644 index 000000000..2cf505256 --- /dev/null +++ b/libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h @@ -0,0 +1,41 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +#define __UCLIBC_ABORT_INSTRUCTION__ "unimp 0xf00" + +/* can your target use syscall6() for mmap ? */ +#define __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/sparc/brk.c b/libc/sysdeps/linux/sparc/brk.c index 9e178e34f..a855ef013 100644 --- a/libc/sysdeps/linux/sparc/brk.c +++ b/libc/sysdeps/linux/sparc/brk.c @@ -21,12 +21,15 @@ #include <unistd.h> #include <sys/syscall.h> +libc_hidden_proto(brk) /* This must be initialized data because commons can't have aliases. */ +extern void *__curbrk; +libc_hidden_proto(__curbrk) void *__curbrk = 0; +libc_hidden_data_def(__curbrk) - -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; @@ -47,4 +50,4 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/sparc/clone.S b/libc/sysdeps/linux/sparc/clone.S index e9e6b17dd..0e41ee0cb 100644 --- a/libc/sysdeps/linux/sparc/clone.S +++ b/libc/sysdeps/linux/sparc/clone.S @@ -20,16 +20,17 @@ /* 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 <features.h> #include <asm/unistd.h> /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ .text -.global __clone -.type __clone,%function +.global clone +.type clone,%function .align 4 -__clone: +clone: save %sp,-96,%sp /* sanity check arguments */ @@ -52,17 +53,14 @@ __clone: __error: jmp __syscall_error -.size __clone,.-__clone +.size clone,.-clone .type __thread_start,%function __thread_start: call %i0 mov %i3,%o0 - call _exit_internal,0 + call HIDDEN_JUMPTARGET(_exit),0 nop .size __thread_start,.-__thread_start - -.weak clone - clone = __clone diff --git a/libc/sysdeps/linux/sparc/fork.S b/libc/sysdeps/linux/sparc/fork.S index dfa109dcd..00157cffd 100644 --- a/libc/sysdeps/linux/sparc/fork.S +++ b/libc/sysdeps/linux/sparc/fork.S @@ -23,12 +23,11 @@ #include <sys/syscall.h> .text -.global __fork -.hidden __fork -.type __fork,%function +.global __libc_fork +.type __libc_fork,%function .align 4 -__fork: +__libc_fork: mov __NR_fork, %g1 ta 0x10 bcc,a 9000f @@ -45,6 +44,6 @@ __fork: retl and %o0, %o1, %o0 -.size __fork,.-__fork -strong_alias(__fork,fork) -weak_alias(fork,__libc_fork) +.size __libc_fork,.-__libc_fork +weak_alias(__libc_fork,fork) +libc_hidden_weak(fork) diff --git a/libc/sysdeps/linux/sparc/syscall.S b/libc/sysdeps/linux/sparc/syscall.S new file mode 100644 index 000000000..86055ec71 --- /dev/null +++ b/libc/sysdeps/linux/sparc/syscall.S @@ -0,0 +1,50 @@ +/* Copyright (C) 1991, 1992, 1997, 2002 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <features.h> +#include <sys/syscall.h> + +.text +.global syscall +.type syscall,%function +#if __WORDSIZE == 32 +.align 4 +#else +.align 2 +#endif + +syscall: + mov %o0, %g1 + mov %o1, %o0 + mov %o2, %o1 + mov %o3, %o2 + mov %o4, %o3 + mov %o5, %o4 + +#if __WORDSIZE == 32 + ta 0x10 + bcs __syscall_error +#else + ta 0x6d + bcs,pn %xcc,__syscall_error +#endif + + nop + retl + nop +.size syscall,.-syscall diff --git a/libc/sysdeps/linux/sparc/vfork.S b/libc/sysdeps/linux/sparc/vfork.S index 9b7092c98..35ca037d8 100644 --- a/libc/sysdeps/linux/sparc/vfork.S +++ b/libc/sysdeps/linux/sparc/vfork.S @@ -23,11 +23,8 @@ #ifndef __NR_vfork /* No vfork so use fork instead */ - -hidden_strong_alias(__fork,__vfork) -weak_alias(vfork,__libc_fork) - -#else +# define __NR_vfork __NR_fork +#endif .text .global __vfork @@ -53,5 +50,6 @@ __vfork: and %o0, %o1, %o0 .size __vfork,.-__vfork -#endif /* __NR_vfork */ -strong_alias(__vfork,vfork) + +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/v850/__longjmp.S b/libc/sysdeps/linux/v850/__longjmp.S index f91086189..2c470264f 100644 --- a/libc/sysdeps/linux/v850/__longjmp.S +++ b/libc/sysdeps/linux/v850/__longjmp.S @@ -11,6 +11,7 @@ * Written by Miles Bader <miles@gnu.org> */ +#include <features.h> #define _SETJMP_H #define _ASM #include <bits/setjmp.h> @@ -37,6 +38,4 @@ C_ENTRY(__longjmp): mov 1, r10 // return val jmp [lp] C_END(__longjmp) - -.weak C_SYMBOL_NAME(__sigprocmask) -C_SYMBOL_NAME(__sigprocmask) = C_SYMBOL_NAME(sigprocmask) +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/v850/bits/uClibc_arch_features.h b/libc/sysdeps/linux/v850/bits/uClibc_arch_features.h new file mode 100644 index 000000000..1b40e32a2 --- /dev/null +++ b/libc/sysdeps/linux/v850/bits/uClibc_arch_features.h @@ -0,0 +1,42 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/ +#undef __UCLIBC_ABORT_INSTRUCTION__ + +/* can your target use syscall6() for mmap ? */ +#undef __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#undef __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/v850/mmap.c b/libc/sysdeps/linux/v850/mmap.c index a9cb0bcab..72fb37dd2 100644 --- a/libc/sysdeps/linux/v850/mmap.c +++ b/libc/sysdeps/linux/v850/mmap.c @@ -1,9 +1,17 @@ /* Use new style mmap for v850 */ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <unistd.h> #include <errno.h> #include <sys/mman.h> #include <sys/syscall.h> +libc_hidden_proto(mmap) + _syscall6 (__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset); +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/v850/vfork.S b/libc/sysdeps/linux/v850/vfork.S index e5058a49a..82d127079 100644 --- a/libc/sysdeps/linux/v850/vfork.S +++ b/libc/sysdeps/linux/v850/vfork.S @@ -11,6 +11,7 @@ * Written by Miles Bader <miles@gnu.org> */ +#include <features.h> #define _ERRNO_H 1 #include <bits/errno.h> #define _SYSCALL_H @@ -37,6 +38,5 @@ C_ENTRY (__vfork): st.w r10, 0[r11] jmp [lp] // error return C_END(__vfork) - -.weak C_SYMBOL_NAME(vfork) -C_SYMBOL_NAME(vfork) = C_SYMBOL_NAME(__vfork) +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/x86_64/__longjmp.S b/libc/sysdeps/linux/x86_64/__longjmp.S index aa47b7233..1ff6e0169 100644 --- a/libc/sysdeps/linux/x86_64/__longjmp.S +++ b/libc/sysdeps/linux/x86_64/__longjmp.S @@ -16,6 +16,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <features.h> #define _ASM #define _SETJMP_H #include <bits/setjmp.h> @@ -43,3 +44,4 @@ __longjmp: movq (JB_RSP*8)(%rdi),%rsp jmpq *%rdx .size __longjmp,.-__longjmp +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/x86_64/__syscall_error.c b/libc/sysdeps/linux/x86_64/__syscall_error.c index de65a1f39..448f50983 100644 --- a/libc/sysdeps/linux/x86_64/__syscall_error.c +++ b/libc/sysdeps/linux/x86_64/__syscall_error.c @@ -1,29 +1,21 @@ /* Wrapper for setting errno. - Copyright (C) 1997, 1998, 1999, 2000 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + * + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <errno.h> #include <features.h> /* This routine is jumped to by all the syscall handlers, to stash * an error number into errno. */ -int attribute_hidden __syscall_error(int err_no) +int __syscall_error(void) attribute_hidden; +int __syscall_error(void) { + register int err_no __asm__ ("%rcx"); + __asm__ ("mov %rax, %rcx\n\t" + "neg %rcx"); __set_errno(err_no); return -1; } diff --git a/libc/sysdeps/linux/x86_64/bits/environments.h b/libc/sysdeps/linux/x86_64/bits/environments.h new file mode 100644 index 000000000..a51a564cb --- /dev/null +++ b/libc/sysdeps/linux/x86_64/bits/environments.h @@ -0,0 +1,87 @@ +/* Copyright (C) 1999, 2001, 2004 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _UNISTD_H +# error "Never include this file directly. Use <unistd.h> instead" +#endif + +#include <bits/wordsize.h> + +/* This header should define the following symbols under the described + situations. A value `1' means that the model is always supported, + `-1' means it is never supported. Undefined means it cannot be + statically decided. + + _POSIX_V6_ILP32_OFF32 32bit int, long, pointers, and off_t type + _POSIX_V6_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type + + _POSIX_V6_LP64_OFF32 64bit long and pointers and 32bit off_t type + _POSIX_V6_LPBIG_OFFBIG 64bit long and pointers and large off_t type + + The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and + _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard + and are available only for compatibility. +*/ + +#if __WORDSIZE == 64 + +/* Environments with 32-bit wide pointers are optionally provided. + Therefore following macros aren't defined: + # undef _POSIX_V6_ILP32_OFF32 + # undef _POSIX_V6_ILP32_OFFBIG + # undef _XBS5_ILP32_OFF32 + # undef _XBS5_ILP32_OFFBIG + and users need to check at runtime. */ + +/* We also have no use (for now) for an environment with bigger pointers + and offsets. */ +# define _POSIX_V6_LPBIG_OFFBIG -1 +# define _XBS5_LPBIG_OFFBIG -1 + +/* By default we have 64-bit wide `long int', pointers and `off_t'. */ +# define _POSIX_V6_LP64_OFF64 1 +# define _XBS5_LP64_OFF64 1 + +#else /* __WORDSIZE == 32 */ + +/* By default we have 32-bit wide `int', `long int', pointers and `off_t' + and all platforms support LFS. */ +# define _POSIX_V6_ILP32_OFF32 1 +# define _POSIX_V6_ILP32_OFFBIG 1 +# define _XBS5_ILP32_OFF32 1 +# define _XBS5_ILP32_OFFBIG 1 + +/* We optionally provide an environment with the above size but an 64-bit + side `off_t'. Therefore we don't define _XBS5_ILP32_OFFBIG. */ + +/* Environments with 64-bit wide pointers can be provided, + so these macros aren't defined: + # undef _POSIX_V6_LP64_OFF64 + # undef _POSIX_V6_LPBIG_OFFBIG + # undef _XBS5_LP64_OFF64 + # undef _XBS5_LPBIG_OFFBIG + and sysconf tests for it at runtime. */ + +#endif /* __WORDSIZE == 32 */ + +#define __ILP32_OFF32_CFLAGS "-m32" +#define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +#define __ILP32_OFF32_LDFLAGS "-m32" +#define __ILP32_OFFBIG_LDFLAGS "-m32" +#define __LP64_OFF64_CFLAGS "-m64" +#define __LP64_OFF64_LDFLAGS "-m64" diff --git a/libc/sysdeps/linux/x86_64/bits/fcntl.h b/libc/sysdeps/linux/x86_64/bits/fcntl.h index 6ba65c7c6..9198c70bd 100644 --- a/libc/sysdeps/linux/x86_64/bits/fcntl.h +++ b/libc/sysdeps/linux/x86_64/bits/fcntl.h @@ -193,3 +193,11 @@ struct flock64 # define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif + +__BEGIN_DECLS + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + +__END_DECLS diff --git a/libc/sysdeps/linux/x86_64/bits/fenv.h b/libc/sysdeps/linux/x86_64/bits/fenv.h index 04576933f..11859f00c 100644 --- a/libc/sysdeps/linux/x86_64/bits/fenv.h +++ b/libc/sysdeps/linux/x86_64/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2000,2001,2004 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 @@ -20,6 +20,8 @@ # error "Never use <bits/fenv.h> directly; include <fenv.h> instead." #endif +#include <bits/wordsize.h> + /* Define bits representing the exception. We use the bit positions of the appropriate bits in the FPU control word. */ @@ -80,7 +82,9 @@ typedef struct unsigned int __data_offset; unsigned short int __data_selector; unsigned short int __unused5; +#if __WORDSIZE == 64 unsigned int __mxcsr; +#endif } fenv_t; diff --git a/libc/sysdeps/linux/x86_64/bits/mman.h b/libc/sysdeps/linux/x86_64/bits/mman.h index c25900372..b1a8b93d3 100644 --- a/libc/sysdeps/linux/x86_64/bits/mman.h +++ b/libc/sysdeps/linux/x86_64/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/x86_64 version. - Copyright (C) 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2006 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 @@ -89,6 +89,7 @@ # define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ # define MADV_WILLNEED 3 /* Will need these pages. */ # define MADV_DONTNEED 4 /* Don't need these pages. */ +# define MADV_REMOVE 5 /* Remove these pages and resources. */ #endif /* The POSIX people had to invent similar names for the same things. */ diff --git a/libc/sysdeps/linux/x86_64/bits/shm.h b/libc/sysdeps/linux/x86_64/bits/shm.h index d8e2230ca..3d8c05d21 100644 --- a/libc/sysdeps/linux/x86_64/bits/shm.h +++ b/libc/sysdeps/linux/x86_64/bits/shm.h @@ -22,7 +22,6 @@ #endif #include <bits/types.h> -#include <bits/wordsize.h> /* Permission flag for shmget. */ #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ @@ -81,6 +80,7 @@ struct shmid_ds # define SHM_DEST 01000 /* segment will be destroyed on last detach */ # define SHM_LOCKED 02000 /* segment will not be swapped */ # define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ +# define SHM_NORESERVE 010000 /* don't check for reservations */ struct shminfo { diff --git a/libc/sysdeps/linux/x86_64/bits/sigcontext.h b/libc/sysdeps/linux/x86_64/bits/sigcontext.h new file mode 100644 index 000000000..c0d5fe72d --- /dev/null +++ b/libc/sysdeps/linux/x86_64/bits/sigcontext.h @@ -0,0 +1,159 @@ +/* Copyright (C) 2002 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _BITS_SIGCONTEXT_H +#define _BITS_SIGCONTEXT_H 1 + +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H +# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead." +#endif + +#include <bits/wordsize.h> + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; + + + +#if __WORDSIZE == 32 + +struct _fpstate +{ + /* Regular FPU environment. */ + __uint32_t cw; + __uint32_t sw; + __uint32_t tag; + __uint32_t ipoff; + __uint32_t cssel; + __uint32_t dataoff; + __uint32_t datasel; + struct _fpreg _st[8]; + unsigned short status; + unsigned short magic; + + /* FXSR FPU environment. */ + __uint32_t _fxsr_env[6]; + __uint32_t mxcsr; + __uint32_t reserved; + struct _fpxreg _fxsr_st[8]; + struct _xmmreg _xmm[8]; + __uint32_t padding[56]; +}; + +#ifndef sigcontext_struct +/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but + we need sigcontext. Some packages have come to rely on + sigcontext_struct being defined on 32-bit x86, so define this for + their benefit. */ +# define sigcontext_struct sigcontext +#endif + +struct sigcontext +{ + unsigned short gs, __gsh; + unsigned short fs, __fsh; + unsigned short es, __esh; + unsigned short ds, __dsh; + unsigned long edi; + unsigned long esi; + unsigned long ebp; + unsigned long esp; + unsigned long ebx; + unsigned long edx; + unsigned long ecx; + unsigned long eax; + unsigned long trapno; + unsigned long err; + unsigned long eip; + unsigned short cs, __csh; + unsigned long eflags; + unsigned long esp_at_signal; + unsigned short ss, __ssh; + struct _fpstate * fpstate; + unsigned long oldmask; + unsigned long cr2; +}; + +#else /* __WORDSIZE == 64 */ + +struct _fpstate +{ + /* FPU environment matching the 64-bit FXSAVE layout. */ + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long r11; + unsigned long r12; + unsigned long r13; + unsigned long r14; + unsigned long r15; + unsigned long rdi; + unsigned long rsi; + unsigned long rbp; + unsigned long rbx; + unsigned long rdx; + unsigned long rax; + unsigned long rcx; + unsigned long rsp; + unsigned long rip; + unsigned long eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + unsigned long err; + unsigned long trapno; + unsigned long oldmask; + unsigned long cr2; + struct _fpstate * fpstate; + unsigned long __reserved1 [8]; +}; + +#endif /* __WORDSIZE == 64 */ + +#endif /* _BITS_SIGCONTEXT_H */ diff --git a/libc/sysdeps/linux/x86_64/bits/stat.h b/libc/sysdeps/linux/x86_64/bits/stat.h new file mode 100644 index 000000000..ddc292a34 --- /dev/null +++ b/libc/sysdeps/linux/x86_64/bits/stat.h @@ -0,0 +1,173 @@ +/* Copyright (C) 1999,2000,2001,2002,2003 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_STAT_H +# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." +#endif + +/* Versions of the `struct stat' data structure. */ +#define _STAT_VER_KERNEL 0 + +#if __WORDSIZE == 32 +# define _STAT_VER_SVR4 2 +# define _STAT_VER_LINUX 3 + +/* i386 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. */ +#else +# define _STAT_VER_LINUX 1 + +/* x86-64 versions of the `xmknod' interface. */ +# define _MKNOD_VER_LINUX 0 +#endif + +#define _STAT_VER _STAT_VER_LINUX + +struct stat + { + __dev_t st_dev; /* Device. */ +#if __WORDSIZE == 32 + unsigned short int __pad1; +#endif +#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64 + __ino_t st_ino; /* File serial number. */ +#else + __ino_t __st_ino; /* 32bit file serial number. */ +#endif +#if __WORDSIZE == 32 + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ +#else + __nlink_t st_nlink; /* Link count. */ + __mode_t st_mode; /* File mode. */ +#endif + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ +#if __WORDSIZE == 64 + int pad0; +#endif + __dev_t st_rdev; /* Device number, if device. */ +#if __WORDSIZE == 32 + unsigned short int __pad2; +#endif +#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64 + __off_t st_size; /* Size of file, in bytes. */ +#else + __off64_t st_size; /* Size of file, in bytes. */ +#endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ +#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64 + __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ +#else + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +#endif + __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. */ +#if __WORDSIZE == 64 + long int __unused[3]; +#else +# ifndef __USE_FILE_OFFSET64 + unsigned long int __unused4; + unsigned long int __unused5; +# else + __ino64_t st_ino; /* File serial number. */ +# endif +#endif + }; + +#ifdef __USE_LARGEFILE64 +/* Note stat64 has the same shape as stat for x86-64. */ +struct stat64 + { + __dev_t st_dev; /* Device. */ +#if __WORDSIZE == 64 + __ino64_t st_ino; /* File serial number. */ + __nlink_t st_nlink; /* Link count. */ + __mode_t st_mode; /* File mode. */ +#else + unsigned int __pad1; + __ino_t __st_ino; /* 32bit file serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ +#endif + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ +#if __WORDSIZE == 64 + int pad0; + __dev_t st_rdev; /* Device number, if device. */ + __off_t st_size; /* Size of file, in bytes. */ +#else + __dev_t st_rdev; /* Device number, if device. */ + unsigned int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ +#endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ + __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. */ +#if __WORDSIZE == 64 + long int __unused[3]; +#else + __ino64_t st_ino; /* File serial number. */ +#endif + }; +#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. */ diff --git a/libc/sysdeps/linux/x86_64/bits/syscalls.h b/libc/sysdeps/linux/x86_64/bits/syscalls.h index 9a4608c48..d44f637ac 100644 --- a/libc/sysdeps/linux/x86_64/bits/syscalls.h +++ b/libc/sysdeps/linux/x86_64/bits/syscalls.h @@ -130,13 +130,13 @@ return (type) (INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6)); \ #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ ({ \ - unsigned long resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \ + unsigned long _resultvar = INTERNAL_SYSCALL (name, , nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_resultvar, ), 0)) \ { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = (unsigned long) -1; \ + __set_errno (INTERNAL_SYSCALL_ERRNO (_resultvar, )); \ + _resultvar = (unsigned long) -1; \ } \ - (long) resultvar; }) + (long) _resultvar; }) #undef INTERNAL_SYSCALL_DECL #define INTERNAL_SYSCALL_DECL(err) do { } while (0) diff --git a/libc/sysdeps/linux/x86_64/bits/uClibc_arch_features.h b/libc/sysdeps/linux/x86_64/bits/uClibc_arch_features.h new file mode 100644 index 000000000..03d8125e0 --- /dev/null +++ b/libc/sysdeps/linux/x86_64/bits/uClibc_arch_features.h @@ -0,0 +1,41 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +#define __UCLIBC_ABORT_INSTRUCTION__ "hlt" + +/* can your target use syscall6() for mmap ? */ +#define __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/x86_64/brk.c b/libc/sysdeps/linux/x86_64/brk.c index a00e2361e..e0f9637c4 100644 --- a/libc/sysdeps/linux/x86_64/brk.c +++ b/libc/sysdeps/linux/x86_64/brk.c @@ -21,10 +21,15 @@ #include <unistd.h> #include <sys/syscall.h> +libc_hidden_proto(brk) + /* This must be initialized data because commons can't have aliases. */ +extern void *__curbrk; +libc_hidden_proto(__curbrk) void *__curbrk = 0; +libc_hidden_data_def(__curbrk) -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *__unbounded newbrk; @@ -42,4 +47,4 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/x86_64/clone.S b/libc/sysdeps/linux/x86_64/clone.S index 4a7e96500..2dc9a502c 100644 --- a/libc/sysdeps/linux/x86_64/clone.S +++ b/libc/sysdeps/linux/x86_64/clone.S @@ -19,12 +19,12 @@ /* 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 <features.h> #define _ERRNO_H 1 #include <bits/errno.h> #include <sys/syscall.h> - -#define CLONE_VM 0x00000100 -#define CLONE_THREAD 0x00010000 +#define _SCHED_H +#include <bits/sched.h> /* The userland implementation is: int clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg), @@ -50,16 +50,16 @@ .text -.global __clone -.type __clone,%function +.global clone +.type clone,%function .align 4 -__clone: +clone: /* Sanity check arguments. */ movq $-EINVAL,%rax testq %rdi,%rdi /* no NULL function pointers */ - jz __error + jz __syscall_error testq %rsi,%rsi /* no NULL stack pointers */ - jz __error + jz __syscall_error /* Insert the argument onto the new stack. */ subq $16,%rsi @@ -79,7 +79,7 @@ __clone: syscall testq %rax,%rax - jl __error + jl __syscall_error jz .Lthread_start .Lpseudo_end: @@ -109,12 +109,6 @@ __clone: call *%rax /* Call exit with return value from function call. */ movq %rax, %rdi - call _exit_internal - -__error: - jmp __syscall_error - -.size __clone,.-__clone + call HIDDEN_JUMPTARGET(_exit) -.weak clone - clone = __clone +.size clone,.-clone diff --git a/libc/sysdeps/linux/x86_64/mmap.c b/libc/sysdeps/linux/x86_64/mmap.c index f14f1b6f9..baaee6847 100644 --- a/libc/sysdeps/linux/x86_64/mmap.c +++ b/libc/sysdeps/linux/x86_64/mmap.c @@ -2,10 +2,10 @@ /* * mmap() for uClibc/x86_64 * - * Copyright (C) 2005 by Erik Andersen <andersen@codepoet.org> + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * Copyright (C) 2005 by Mike Frysinger <vapier@gentoo.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #include <errno.h> @@ -13,7 +13,8 @@ #include <sys/mman.h> #include <sys/syscall.h> -#define __NR___mmap __NR_mmap -attribute_hidden _syscall6(void *, __mmap, void *, start, size_t, length, int, prot, +libc_hidden_proto(mmap) + +_syscall6(void *, mmap, void *, start, size_t, length, int, prot, int, flags, int, fd, off_t, offset); -strong_alias(__mmap,mmap) +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/x86_64/sigaction.c b/libc/sysdeps/linux/x86_64/sigaction.c index 250c8b5c6..dad45f69e 100644 --- a/libc/sysdeps/linux/x86_64/sigaction.c +++ b/libc/sysdeps/linux/x86_64/sigaction.c @@ -23,11 +23,8 @@ #include <signal.h> #include <string.h> - #include <sys/syscall.h> - - /* The difference here is that the sigaction structure used in the kernel is not the same as we use in the libc. Therefore we must translate it here. */ @@ -36,16 +33,18 @@ /* We do not globally define the SA_RESTORER flag so do it here. */ #define SA_RESTORER 0x04000000 -#if defined __NR_rt_sigaction +extern __typeof(sigaction) __libc_sigaction; + +#ifdef __NR_rt_sigaction /* Using the hidden attribute here does not change the code but it helps to avoid warnings. */ extern void restore_rt (void) asm ("__restore_rt") attribute_hidden; extern void restore (void) asm ("__restore") attribute_hidden; +libc_hidden_proto(memcpy) + /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ -/* psm: couldn't use __sigaction, if building w/ disabled hidden, - * it will conflict w/ the one in libpthread */ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { @@ -54,7 +53,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) if (act) { kact.k_sa_handler = act->sa_handler; - __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); kact.sa_flags = act->sa_flags | SA_RESTORER; kact.sa_restorer = &restore_rt; @@ -67,7 +66,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); oact->sa_flags = koact.sa_flags; oact->sa_restorer = koact.sa_restorer; } @@ -121,8 +120,9 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) #endif #ifndef LIBC_SIGACTION -hidden_weak_alias(__libc_sigaction,__sigaction) +libc_hidden_proto(sigaction) weak_alias(__libc_sigaction,sigaction) +libc_hidden_weak(sigaction) #endif /* NOTE: Please think twice before making any changes to the bits of diff --git a/libc/sysdeps/linux/x86_64/sys/epoll.h b/libc/sysdeps/linux/x86_64/sys/epoll.h new file mode 100644 index 000000000..02672d3c7 --- /dev/null +++ b/libc/sysdeps/linux/x86_64/sys/epoll.h @@ -0,0 +1,110 @@ +/* Copyright (C) 2002,2003,2004,2005,2006 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_EPOLL_H +#define _SYS_EPOLL_H 1 + +#include <stdint.h> +#include <sys/types.h> + + +enum EPOLL_EVENTS + { + EPOLLIN = 0x001, +#define EPOLLIN EPOLLIN + EPOLLPRI = 0x002, +#define EPOLLPRI EPOLLPRI + EPOLLOUT = 0x004, +#define EPOLLOUT EPOLLOUT + EPOLLRDNORM = 0x040, +#define EPOLLRDNORM EPOLLRDNORM + EPOLLRDBAND = 0x080, +#define EPOLLRDBAND EPOLLRDBAND + EPOLLWRNORM = 0x100, +#define EPOLLWRNORM EPOLLWRNORM + EPOLLWRBAND = 0x200, +#define EPOLLWRBAND EPOLLWRBAND + EPOLLMSG = 0x400, +#define EPOLLMSG EPOLLMSG + EPOLLERR = 0x008, +#define EPOLLERR EPOLLERR + EPOLLHUP = 0x010, +#define EPOLLHUP EPOLLHUP + EPOLLONESHOT = (1 << 30), +#define EPOLLONESHOT EPOLLONESHOT + EPOLLET = (1 << 31) +#define EPOLLET EPOLLET + }; + + +/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ +#define EPOLL_CTL_ADD 1 /* Add a file decriptor to the interface. */ +#define EPOLL_CTL_DEL 2 /* Remove a file decriptor from the interface. */ +#define EPOLL_CTL_MOD 3 /* Change file decriptor epoll_event structure. */ + + +typedef union epoll_data +{ + void *ptr; + int fd; + uint32_t u32; + uint64_t u64; +} epoll_data_t; + +struct epoll_event +{ + uint32_t events; /* Epoll events */ + epoll_data_t data; /* User data variable */ +} __attribute__ ((__packed__)); + + +__BEGIN_DECLS + +/* Creates an epoll instance. Returns an fd for the new instance. + The "size" parameter is a hint specifying the number of file + descriptors to be associated with the new instance. The fd + returned by epoll_create() should be closed with close(). */ +extern int epoll_create (int __size) __THROW; + + +/* Manipulate an epoll instance "epfd". Returns 0 in case of success, + -1 in case of error ( the "errno" variable will contain the + specific error code ) The "op" parameter is one of the EPOLL_CTL_* + constants defined above. The "fd" parameter is the target of the + operation. The "event" parameter describes which events the caller + is interested in and any associated user data. */ +extern int epoll_ctl (int __epfd, int __op, int __fd, + struct epoll_event *__event) __THROW; + + +/* Wait for events on an epoll instance "epfd". Returns the number of + triggered events returned in "events" buffer. Or -1 in case of + error with the "errno" variable set to the specific error code. The + "events" parameter is a buffer that will contain triggered + events. The "maxevents" is the maximum number of events to be + returned ( usually size of "events" ). The "timeout" parameter + specifies the maximum wait time in milliseconds (-1 == infinite). + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int epoll_wait (int __epfd, struct epoll_event *__events, + int __maxevents, int __timeout); + +__END_DECLS + +#endif /* sys/epoll.h */ diff --git a/libc/sysdeps/linux/x86_64/syscall.S b/libc/sysdeps/linux/x86_64/syscall.S index f6273b75f..86306906a 100644 --- a/libc/sysdeps/linux/x86_64/syscall.S +++ b/libc/sysdeps/linux/x86_64/syscall.S @@ -37,10 +37,7 @@ syscall: movq 8(%rsp),%r9 /* arg6 is on the stack. */ syscall /* Do the system call. */ cmpq $-4095, %rax /* Check %rax for error. */ - jae __error /* Branch forward if it failed. */ + jae __syscall_error /* Branch forward if it failed. */ ret /* Return to caller. */ -__error: - jmp __syscall_error - .size syscall,.-syscall diff --git a/libc/sysdeps/linux/x86_64/vfork.S b/libc/sysdeps/linux/x86_64/vfork.S index 5786058d2..b22b7b422 100644 --- a/libc/sysdeps/linux/x86_64/vfork.S +++ b/libc/sysdeps/linux/x86_64/vfork.S @@ -16,7 +16,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <features.h> #include <sys/syscall.h> /* Clone the calling process, but without copying the whole address space. @@ -26,10 +25,8 @@ #ifndef __NR_vfork /* No vfork so use fork instead */ -hidden_strong_alias(__fork,__vfork) -weak_alias(vfork,__libc_fork) - -#else +# define __NR_vfork __NR_fork +#endif .text .global __vfork @@ -51,15 +48,12 @@ __vfork: pushq %rdi cmpl $-4095, %eax - jae __error /* Branch forward if it failed. */ + jae __syscall_error /* Branch forward if it failed. */ /* Normal return. */ ret -__error: - jmp __syscall_error - .size __vfork,.-__vfork -#endif /* __NR_vfork */ -strong_alias(__vfork,vfork) +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) |