diff options
Diffstat (limited to 'libc/sysdeps/linux/nios2')
-rw-r--r-- | libc/sysdeps/linux/nios2/__longjmp.S | 4 | ||||
-rw-r--r-- | libc/sysdeps/linux/nios2/bits/uClibc_arch_features.h | 42 | ||||
-rw-r--r-- | libc/sysdeps/linux/nios2/bits/uClibc_page.h | 29 | ||||
-rw-r--r-- | libc/sysdeps/linux/nios2/brk.c | 8 | ||||
-rw-r--r-- | libc/sysdeps/linux/nios2/clone.S | 20 | ||||
-rw-r--r-- | libc/sysdeps/linux/nios2/clone.c | 8 | ||||
-rw-r--r-- | libc/sysdeps/linux/nios2/crt1.S | 7 | ||||
-rw-r--r-- | libc/sysdeps/linux/nios2/setjmp.S | 4 | ||||
-rw-r--r-- | libc/sysdeps/linux/nios2/vfork.S | 27 |
9 files changed, 116 insertions, 33 deletions
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) |