summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/sh
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/sh')
-rw-r--r--libc/sysdeps/linux/sh/Makefile.arch2
-rw-r--r--libc/sysdeps/linux/sh/__init_brk.c6
-rw-r--r--libc/sysdeps/linux/sh/__longjmp.S6
-rw-r--r--libc/sysdeps/linux/sh/bits/uClibc_arch_features.h48
-rw-r--r--libc/sysdeps/linux/sh/brk.c13
-rw-r--r--libc/sysdeps/linux/sh/clone.S17
-rw-r--r--libc/sysdeps/linux/sh/longjmp.c45
-rw-r--r--libc/sysdeps/linux/sh/mmap.c7
-rw-r--r--libc/sysdeps/linux/sh/pipe.c14
-rw-r--r--libc/sysdeps/linux/sh/pread_write.c65
-rw-r--r--libc/sysdeps/linux/sh/sbrk.c10
-rw-r--r--libc/sysdeps/linux/sh/setjmp.S2
-rw-r--r--libc/sysdeps/linux/sh/syscall_error.S4
-rw-r--r--libc/sysdeps/linux/sh/vfork.S4
14 files changed, 121 insertions, 122 deletions
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"
-