diff options
Diffstat (limited to 'libc/sysdeps/linux')
60 files changed, 405 insertions, 378 deletions
diff --git a/libc/sysdeps/linux/alpha/brk.S b/libc/sysdeps/linux/alpha/brk.S index 4e15518d2..a3f2edfe7 100644 --- a/libc/sysdeps/linux/alpha/brk.S +++ b/libc/sysdeps/linux/alpha/brk.S @@ -39,6 +39,7 @@ __curbrk: .skip 8 .text .globl __brk; +.hidden __brk; .align 3; .ent __brk , 0; diff --git a/libc/sysdeps/linux/alpha/clone.S b/libc/sysdeps/linux/alpha/clone.S index b326925d7..ed5a4f487 100644 --- a/libc/sysdeps/linux/alpha/clone.S +++ b/libc/sysdeps/linux/alpha/clone.S @@ -87,7 +87,7 @@ thread_start: /* Call _exit rather than doing it inline for breakpoint purposes */ mov v0,a0 - jsr ra,_exit + jsr ra,_exit_internal /* Die horribly. */ halt diff --git a/libc/sysdeps/linux/arm/brk.c b/libc/sysdeps/linux/arm/brk.c index 82b9835ae..e711db3b1 100644 --- a/libc/sysdeps/linux/arm/brk.c +++ b/libc/sysdeps/linux/arm/brk.c @@ -24,7 +24,7 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk = (void*)INTERNAL_SYSCALL(brk, , 1, addr); @@ -37,3 +37,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S index a4d5f99bd..946d4bdda 100644 --- a/libc/sysdeps/linux/arm/clone.S +++ b/libc/sysdeps/linux/arm/clone.S @@ -59,11 +59,7 @@ __clone: ldr pc, [sp] @ and we are done, passing the return value through r0 -#ifdef __PIC__ - b _exit(PLT) -#else - b _exit -#endif + b _exit_internal __error: b __syscall_error diff --git a/libc/sysdeps/linux/arm/ioperm.c b/libc/sysdeps/linux/arm/ioperm.c index 837de8adf..0c0c21182 100644 --- a/libc/sysdeps/linux/arm/ioperm.c +++ b/libc/sysdeps/linux/arm/ioperm.c @@ -37,6 +37,7 @@ #define mmap __mmap #define sscanf __sscanf #define fscanf __fscanf +#define fgets __fgets #include <errno.h> #include <fcntl.h> diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S index 530bba07c..68798995a 100644 --- a/libc/sysdeps/linux/arm/vfork.S +++ b/libc/sysdeps/linux/arm/vfork.S @@ -8,16 +8,20 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <features.h> + #define _ERRNO_H #include <bits/errno.h> #include <sys/syscall.h> #ifdef __NR_fork .text -.global vfork -.type vfork,%function +.global __vfork +.hidden __vfork +.type __vfork,%function .align 4 -vfork: + +__vfork: #ifdef __NR_vfork swi __NR_vfork @@ -34,11 +38,12 @@ vfork: swi __NR_fork cmn r0, #4096 - /* Syscal worked. Return to child/parent */ + /* Syscall worked. Return to child/parent */ movcc pc, lr __error: b __syscall_error -.size vfork,.-vfork +.size __vfork,.-__vfork +strong_alias(__vfork,vfork) #endif diff --git a/libc/sysdeps/linux/bfin/Makefile b/libc/sysdeps/linux/bfin/Makefile index 85f3cb910..3970f6263 100644 --- a/libc/sysdeps/linux/bfin/Makefile +++ b/libc/sysdeps/linux/bfin/Makefile @@ -1,55 +1,13 @@ # Makefile for uClibc # -# Copyright (C) 2000-2004 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. +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -# 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 - -TOPDIR=../../../../ -include $(TOPDIR)Rules.mak - -CRT_SRC := crt0.S -CRT_OBJ := crt0.o - -SSRC := __longjmp.S setjmp.S bsd-_setjmp.S vfork.S -SOBJ := $(patsubst %.S,%.o, $(SSRC)) - -CSRC := brk.c bsdsetjmp.c clone.c syscall.c -COBJ := $(patsubst %.c,%.o, $(CSRC)) - -OBJS := $(SOBJ) $(COBJ) - -OBJ_LIST := ../../../obj.sysdeps.$(TARGET_ARCH) - -all: $(OBJ_LIST) - -$(OBJ_LIST): $(OBJS) $(CRT_OBJ) - $(STRIPTOOL) -x -R .note -R .comment $^ - $(INSTALL) -d $(TOPDIR)lib/ - cp $(CRT_OBJ) $(TOPDIR)lib/ - echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $@ - -$(CRT_OBJ): $(CRT_SRC) - $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o - -$(SOBJ): %.o : %.S - $(CC) $(ASFLAGS) -c $< -o $@ - -$(COBJ): %.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - -headers: -clean: - $(RM) *.o *~ core +top_srcdir=../../../../ +top_builddir=../../../../ +all: objs +include $(top_builddir)Rules.mak +include Makefile.arch +include $(top_srcdir)Makerules diff --git a/libc/sysdeps/linux/bfin/Makefile.arch b/libc/sysdeps/linux/bfin/Makefile.arch new file mode 100644 index 000000000..7a428b380 --- /dev/null +++ b/libc/sysdeps/linux/bfin/Makefile.arch @@ -0,0 +1,12 @@ +# Makefile for uClibc +# +# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +CSRC := brk.c bsdsetjmp.c clone.c syscall.c + +SSRC := __longjmp.S setjmp.S bsd-_setjmp.S vfork.S + +include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch diff --git a/libc/sysdeps/linux/bfin/bits/syscalls.h b/libc/sysdeps/linux/bfin/bits/syscalls.h index 62541b873..82692fc65 100644 --- a/libc/sysdeps/linux/bfin/bits/syscalls.h +++ b/libc/sysdeps/linux/bfin/bits/syscalls.h @@ -6,14 +6,138 @@ #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 */ +/* This code is mostly cut & paste from the uClinux bfin port */ + +#ifndef __ASSEMBLER__ + +#define __syscall_return(type, res) \ +do { \ + if ((unsigned long)(res) >= (unsigned long)(-125)) \ + { __set_errno(-(res)); \ + res = -1; \ + } \ + return (type) (res); \ +} while (0) + +#define _syscall0(type,name) \ +type name(void) { \ + long __res; \ + __asm__ __volatile__ ( \ + "p0 = %1;\n\t" \ + "excpt 0;\n\t" \ + "%0=r0;\n\t" \ + : "=da" (__res) \ + : "i" (__NR_##name) \ + : "CC", "P0"); \ +__syscall_return(type,__res); \ +} + +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) { \ + long __res; \ + __asm__ __volatile__ ( \ + "r0=%2;\n\t" \ + "p0=%1;\n\t" \ + "excpt 0;\n\t" \ + "%0=r0;\n\t" \ + : "=da" (__res) \ + : "i" (__NR_##name), \ + "a" ((long)(arg1)) \ + : "CC", "R0", "P0"); \ +__syscall_return(type,__res); \ +} +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) { \ + long __res; \ + __asm__ __volatile__ ( \ + "r1=%3;\n\t" \ + "r0=%2;\n\t" \ + "p0=%1;\n\t" \ + "excpt 0;\n\t" \ + "%0=r0;\n\t" \ + : "=da" (__res) \ + : "i" (__NR_##name), \ + "a" ((long)(arg1)), \ + "a" ((long)(arg2)) \ + : "CC", "R0","R1", "P0"); \ +__syscall_return(type,__res); \ +} + + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) { \ + long __res; \ + __asm__ __volatile__ ( \ + "r2=%4;\n\t" \ + "r1=%3;\n\t" \ + "r0=%2;\n\t" \ + "p0=%1;\n\t" \ + "excpt 0;\n\t" \ + "%0=r0;\n\t" \ + : "=da" (__res) \ + : "i" (__NR_##name), \ + "a" ((long)(arg1)), \ + "a" ((long)(arg2)), \ + "a" ((long)(arg3)) \ + : "CC", "R0","R1","R2", "P0"); \ +__syscall_return(type,__res); \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ + long __res; \ + __asm__ __volatile__ ( \ + "[--sp] = r3;\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" \ + : "=da" (__res) \ + : "i" (__NR_##name), \ + "a" ((long)(arg1)), \ + "a" ((long)(arg2)), \ + "a" ((long)(arg3)), \ + "a" ((long)(arg4)) \ + : "CC", "R0","R1","R2","R3", "P0"); \ +__syscall_return(type,__res); \ +} + +#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 __res; \ + __asm__ __volatile__ ( \ + "[--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" \ + : "=da" (__res) \ + : "i" (__NR_##name), \ + "rm" ((long)(arg1)), \ + "rm" ((long)(arg2)), \ + "rm" ((long)(arg3)), \ + "rm" ((long)(arg4)), \ + "rm" ((long)(arg5)) \ + : "CC","R0","R1","R2","R3","R4","P0"); \ +__syscall_return(type,__res); \ +} + +#endif /* __ASSEMBLER__ */ +#endif /* _BITS_SYSCALLS_H */ diff --git a/libc/sysdeps/linux/bfin/bits/uClibc_page.h b/libc/sysdeps/linux/bfin/bits/uClibc_page.h new file mode 100644 index 000000000..311dd40ab --- /dev/null +++ b/libc/sysdeps/linux/bfin/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/bfin/brk.c b/libc/sysdeps/linux/bfin/brk.c index 178124ed3..1cb30216d 100644 --- a/libc/sysdeps/linux/bfin/brk.c +++ b/libc/sysdeps/linux/bfin/brk.c @@ -6,7 +6,7 @@ /* This must be initialized data because commons can't have aliases. */ void * __curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; @@ -28,3 +28,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/cris/brk.c b/libc/sysdeps/linux/cris/brk.c index 0bc08d5e6..10965d3b9 100644 --- a/libc/sysdeps/linux/cris/brk.c +++ b/libc/sysdeps/linux/cris/brk.c @@ -7,7 +7,7 @@ extern void * __curbrk; extern int __init_brk (void); -int brk(void * end_data_seg) +int attribute_hidden __brk(void * end_data_seg) { if (__init_brk () == 0) { /* @@ -29,3 +29,4 @@ int brk(void * end_data_seg) return -1; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/cris/clone.S b/libc/sysdeps/linux/cris/clone.S index 56ea05c72..19ba71996 100644 --- a/libc/sysdeps/linux/cris/clone.S +++ b/libc/sysdeps/linux/cris/clone.S @@ -69,7 +69,7 @@ ENTRY (__clone) jsr r0 SETUP_PIC - PLTCALL (_exit) + PLTCALL (_exit_internal) /* Die horribly. */ test.d [6809] diff --git a/libc/sysdeps/linux/cris/fork.c b/libc/sysdeps/linux/cris/fork.c index 0399edce8..4dd8e0269 100644 --- a/libc/sysdeps/linux/cris/fork.c +++ b/libc/sysdeps/linux/cris/fork.c @@ -8,5 +8,4 @@ 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); - +weak_alias(__libc_fork, fork) diff --git a/libc/sysdeps/linux/cris/sbrk.c b/libc/sysdeps/linux/cris/sbrk.c index 1ed1d9df9..3683435bf 100644 --- a/libc/sysdeps/linux/cris/sbrk.c +++ b/libc/sysdeps/linux/cris/sbrk.c @@ -9,8 +9,8 @@ extern void * __curbrk; extern int __init_brk (void); -void * -sbrk(intptr_t increment) +void attribute_hidden * +__sbrk(intptr_t increment) { if (__init_brk () == 0) { void * tmp = __curbrk + increment; @@ -34,3 +34,4 @@ sbrk(intptr_t increment) } return ((void *) -1); } +strong_alias(__sbrk,sbrk) diff --git a/libc/sysdeps/linux/frv/__init_brk.c b/libc/sysdeps/linux/frv/__init_brk.c index c9a2a3ec5..92e07c49d 100644 --- a/libc/sysdeps/linux/frv/__init_brk.c +++ b/libc/sysdeps/linux/frv/__init_brk.c @@ -7,7 +7,7 @@ void * __curbrk = 0; #define __NR__brk __NR_brk -_syscall1(void *, _brk, void *, ptr); +attribute_hidden _syscall1(void *, _brk, void *, ptr); int __init_brk (void) diff --git a/libc/sysdeps/linux/frv/brk.c b/libc/sysdeps/linux/frv/brk.c index 2406904a3..d6063fc27 100644 --- a/libc/sysdeps/linux/frv/brk.c +++ b/libc/sysdeps/linux/frv/brk.c @@ -7,9 +7,9 @@ extern void * __curbrk; extern int __init_brk (void); -extern void *_brk(void *ptr); +extern void *_brk(void *ptr) attribute_hidden; -int brk(void * end_data_seg) +int attribute_hidden __brk(void * end_data_seg) { if (__init_brk () == 0) { @@ -20,3 +20,4 @@ int brk(void * end_data_seg) } return -1; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/frv/clone.S b/libc/sysdeps/linux/frv/clone.S index f835f0ba2..b714b45b1 100644 --- a/libc/sysdeps/linux/frv/clone.S +++ b/libc/sysdeps/linux/frv/clone.S @@ -75,7 +75,7 @@ __clone: breakpoints work.*/ mov.p gr17, gr15 - call _exit + call _exit_internal /* Should never get here. */ jmpl @(gr0, gr0) diff --git a/libc/sysdeps/linux/frv/sbrk.c b/libc/sysdeps/linux/frv/sbrk.c index 1c9e5b172..e9faf7db0 100644 --- a/libc/sysdeps/linux/frv/sbrk.c +++ b/libc/sysdeps/linux/frv/sbrk.c @@ -7,10 +7,10 @@ extern void * __curbrk; extern int __init_brk (void); -extern void *_brk(void *ptr); +extern void *_brk(void *ptr) attribute_hidden; -void * -sbrk(intptr_t increment) +void attribute_hidden * +__sbrk(intptr_t increment) { if (__init_brk () == 0) { @@ -23,3 +23,4 @@ sbrk(intptr_t increment) } return ((void *) -1); } +strong_alias(__sbrk,sbrk) diff --git a/libc/sysdeps/linux/frv/vfork.S b/libc/sysdeps/linux/frv/vfork.S index 230f2f820..b5ecc09af 100644 --- a/libc/sysdeps/linux/frv/vfork.S +++ b/libc/sysdeps/linux/frv/vfork.S @@ -17,15 +17,18 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <features.h> + #include <asm/unistd.h> #define _ERRNO_H 1 #include <bits/errno.h> .text - .globl vfork - .type vfork,@function + .globl __vfork + .hidden __vfork + .type __vfork,@function /* int vfork(void) */ -vfork: +__vfork: setlos.p #__NR_vfork, gr7 setlos #-4096, gr4 tra gr0, gr0 @@ -38,5 +41,6 @@ vfork: ldd @(gr14, gr15), gr14 jmpl @(gr14, gr0) - .size vfork,.-vfork + .size __vfork,.-__vfork +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/h8300/brk.c b/libc/sysdeps/linux/h8300/brk.c index bd0ecaa5c..d69f9a2d3 100644 --- a/libc/sysdeps/linux/h8300/brk.c +++ b/libc/sysdeps/linux/h8300/brk.c @@ -9,7 +9,7 @@ void *__curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; @@ -31,3 +31,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/hppa/brk.c b/libc/sysdeps/linux/hppa/brk.c index 68bc3ffc8..f50360aa5 100644 --- a/libc/sysdeps/linux/hppa/brk.c +++ b/libc/sysdeps/linux/hppa/brk.c @@ -23,8 +23,8 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; -int -brk (void *addr) +int attribute_hidden +__brk (void *addr) { void *newbrk; @@ -38,3 +38,4 @@ brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/hppa/clone.S b/libc/sysdeps/linux/hppa/clone.S index 56a40eadc..8395cdada 100644 --- a/libc/sysdeps/linux/hppa/clone.S +++ b/libc/sysdeps/linux/hppa/clone.S @@ -90,7 +90,7 @@ thread_start: bl $$dyncall,%r31 copy %r31,%rp - bl _exit,%rp + bl _exit_internal,%rp copy %ret0,%arg0 /* Die horribly. */ diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h index df3b0b429..6ad3b1dd9 100644 --- a/libc/sysdeps/linux/i386/bits/syscalls.h +++ b/libc/sysdeps/linux/i386/bits/syscalls.h @@ -101,6 +101,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)); \ +} + #define INLINE_SYSCALL(name, nr, args...) \ ({ \ unsigned int resultvar; \ @@ -126,6 +134,7 @@ return (type) (INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5)); \ #define LOADARGS_3 LOADARGS_1 #define LOADARGS_4 LOADARGS_1 #define LOADARGS_5 LOADARGS_1 +#define LOADARGS_6 LOADARGS_1 "push %%ebp ; movl %7, %%ebp\n\t" #define RESTOREARGS_0 #define RESTOREARGS_1 \ @@ -134,6 +143,7 @@ return (type) (INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5)); \ #define RESTOREARGS_3 RESTOREARGS_1 #define RESTOREARGS_4 RESTOREARGS_1 #define RESTOREARGS_5 RESTOREARGS_1 +#define RESTOREARGS_6 "pop %%ebp\n\t" RESTOREARGS_1 #define ASMFMT_0() #define ASMFMT_1(arg1) \ @@ -146,6 +156,8 @@ return (type) (INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5)); \ , "aD" (arg1), "c" (arg2), "d" (arg3), "S" (arg4) #define ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \ , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5) +#define ASMFMT_6(arg1, arg2, arg3, arg4, arg5, arg6) \ + , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5), "m" (arg6) #endif /* __ASSEMBLER__ */ #endif /* _BITS_SYSCALLS_H */ diff --git a/libc/sysdeps/linux/i386/brk.c b/libc/sysdeps/linux/i386/brk.c index 09c6be7e3..5790e2fca 100644 --- a/libc/sysdeps/linux/i386/brk.c +++ b/libc/sysdeps/linux/i386/brk.c @@ -25,8 +25,7 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; - -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *__unbounded newbrk, *__unbounded scratch; @@ -47,3 +46,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S index d382dbac3..18a8e5dfa 100644 --- a/libc/sysdeps/linux/i386/vfork.S +++ b/libc/sysdeps/linux/i386/vfork.S @@ -3,17 +3,20 @@ * */ +#include <features.h> #include <sys/syscall.h> #ifndef __NR_vfork /* No vfork so use fork instead */ -.weak vfork ; vfork = __libc_fork +hidden_strong_alias(__fork,__vfork) +weak_alias(vfork,__libc_fork) #else .text .global __vfork +.hidden __vfork .type __vfork,%function .align 1<<4 @@ -27,7 +30,5 @@ __vfork: ret .size __vfork,.-__vfork - - -.weak vfork ; vfork = __vfork #endif +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/m68k/Makefile.arch b/libc/sysdeps/linux/m68k/Makefile.arch index 81e5b27f7..2ebd602d7 100644 --- a/libc/sysdeps/linux/m68k/Makefile.arch +++ b/libc/sysdeps/linux/m68k/Makefile.arch @@ -11,8 +11,6 @@ SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S vfork.S ifneq ($(HAVE_ELF),y) ARCH_HEADERS := float.h -else -ARCH_HEADERS := fpu_control.h endif include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch diff --git a/libc/sysdeps/linux/m68k/brk.c b/libc/sysdeps/linux/m68k/brk.c index 689bc5bf7..4c33549cc 100644 --- a/libc/sysdeps/linux/m68k/brk.c +++ b/libc/sysdeps/linux/m68k/brk.c @@ -7,7 +7,7 @@ /* This must be initialized data because commons can't have aliases. */ void * __curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; @@ -28,3 +28,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/m68k/vfork.S b/libc/sysdeps/linux/m68k/vfork.S index 5db163bf5..e58b9e949 100644 --- a/libc/sysdeps/linux/m68k/vfork.S +++ b/libc/sysdeps/linux/m68k/vfork.S @@ -1,3 +1,4 @@ +#include <features.h> #include <asm/unistd.h> @@ -10,11 +11,13 @@ .text .align 2 .globl errno - .globl vfork -#if defined __HAVE_ELF__ - .type vfork,@function + .globl __vfork +#ifdef __HAVE_ELF__ + .hidden __vfork + .type __vfork,@function #endif -vfork: + +__vfork: movl %sp@+, %a1 /* save the return address for later */ movl IMM __NR_vfork,%d0 trap #0 @@ -24,7 +27,7 @@ vfork: jmp %a1@ /* don't return, just jmp directly */ fix_errno: negl %d0 -#ifndef __PIC__ +#ifndef __PIC__ /* needs handling as the other archs */ movl errno, %a0 #else movl errno@GOT(%a5), %a0 @@ -33,3 +36,5 @@ fix_errno: movl IMM -1, %d0 jmp %a1@ /* don't return, just jmp directly */ +.size __vfork,.-__vfork +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/nios/Makefile b/libc/sysdeps/linux/nios/Makefile index b1c558fee..3970f6263 100644 --- a/libc/sysdeps/linux/nios/Makefile +++ b/libc/sysdeps/linux/nios/Makefile @@ -1,56 +1,13 @@ # Makefile for uClibc # -# Copyright (C) 2000-2003 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. +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -# 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 - -TOPDIR=../../../../ -include $(TOPDIR)Rules.mak - -CRT_SRC := crt0.S -CRT_OBJ := crt0.o crt1.o - -SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S vfork.S -SOBJ := $(patsubst %.S,%.o, $(SSRC)) - -CSRC := brk.c crtbegin.c crtend.c -COBJ := $(patsubst %.c,%.o, $(CSRC)) - -OBJS := $(SOBJ) $(COBJ) - -OBJ_LIST := ../../../obj.sysdeps.$(TARGET_ARCH) - -all: $(OBJ_LIST) - -$(OBJ_LIST): $(OBJS) $(CRT_OBJ) - $(STRIPTOOL) -x -R .note -R .comment $^ - $(INSTALL) -d $(TOPDIR)lib/ - cp $(CRT_OBJ) $(TOPDIR)lib/ - echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $@ - -$(CRT_OBJ): $(CRT_SRC) - $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o - -$(SOBJ): %.o : %.S - $(CC) $(ASFLAGS) -c $< -o $@ - -$(COBJ): %.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - -headers: - $(LN) -fs ../libc/sysdeps/linux/nios/fpu_control.h $(TOPDIR)/include/ -clean: - $(RM) *.o *~ core +top_srcdir=../../../../ +top_builddir=../../../../ +all: objs +include $(top_builddir)Rules.mak +include Makefile.arch +include $(top_srcdir)Makerules diff --git a/libc/sysdeps/linux/nios/Makefile.arch b/libc/sysdeps/linux/nios/Makefile.arch new file mode 100644 index 000000000..9bcd0be7e --- /dev/null +++ b/libc/sysdeps/linux/nios/Makefile.arch @@ -0,0 +1,14 @@ +# Makefile for uClibc +# +# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +CSRC := brk.c crtbegin.c crtend.c + +SSRC := \ + __longjmp.S bsd-_setjmp.S bsd-setjmp.S setjmp.S \ + clone.S vfork.S + +include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch diff --git a/libc/sysdeps/linux/nios/brk.c b/libc/sysdeps/linux/nios/brk.c index 797a66d0a..2e785b734 100644 --- a/libc/sysdeps/linux/nios/brk.c +++ b/libc/sysdeps/linux/nios/brk.c @@ -25,8 +25,7 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; - -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; register int g1 asm("%g1") = __NR_brk; @@ -43,3 +42,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/nios/crt0.c b/libc/sysdeps/linux/nios/crt0.c deleted file mode 100644 index 48b1a0f07..000000000 --- a/libc/sysdeps/linux/nios/crt0.c +++ /dev/null @@ -1,73 +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. */ - -#include <asm/ptrace.h> - -#define nop() __asm__ __volatile__ ("nop") - -extern inline int _stack_frame_address(void) -{ - int retval; - __asm__ __volatile__( - "mov %0, %%fp\n\t" - : "=r" (retval) ); - return retval; -} - -void __uClibc_main(int argc,void *argv,void *envp); - -void _start(void) -{ - void **p; - - nop(); /* placeholder for breakpoint */ - nop(); - - p = (int *) (_stack_frame_address() + REGWIN_SZ); - __uClibc_main( (int) *p, *(p+1), *(p+2) ); - -/* If that didn't kill us, ... */ - - asm("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 -// .weak atexit -// atexit = empty_func -// -// /* -// * a little bit of stuff to support C++ -// */ -// .section .ctors,"aw" -// .align 4 -// .global __CTOR_LIST__ -// __CTOR_LIST__: -// .long -1 -// -// .section .dtors,"aw" -// .align 4 -// .global __DTOR_LIST__ -// __DTOR_LIST__: -// .long -1 - diff --git a/libc/sysdeps/linux/nios/crt0.S b/libc/sysdeps/linux/nios/crt1.S index bbf4ede6a..98777e831 100644 --- a/libc/sysdeps/linux/nios/crt0.S +++ b/libc/sysdeps/linux/nios/crt1.S @@ -27,7 +27,8 @@ Cambridge, MA 02139, USA. */ .type __start,@function .weak _init .weak _fini - .type __uClibc_start_main,@function + .type main,@function + .type __uClibc_main,@function .type __h_errno_location, @function .type _stdio_init, @function .type _stdio_term, @function @@ -38,15 +39,17 @@ _start: nop nop - lds %o0,[%sp, (REGWIN_SZ / 4) + 0] // main's argc - lds %o1,[%sp, (REGWIN_SZ / 4) + 1] // main's argv - lds %o2,[%sp, (REGWIN_SZ / 4) + 2] // main's envp + MOVIA %o0, main@h + lds %o1,[%sp, (REGWIN_SZ / 4) + 0] // main's argc + lds %o2,[%sp, (REGWIN_SZ / 4) + 1] // main's argv MOVIA %o3, _init@h MOVIA %o4, _fini@h - MOVIA %o5, __uClibc_start_main@h - - call %o5 + mov %o5, %i0 /* rtld_fini */ + mov %o6, %sp /* stack_end */ + MOVIA %o7, __uClibc_main@h + + call %o7 nop @@ -54,4 +57,3 @@ _start: __exit: MOVIP %g1, __NR_exit trap 63 -
\ No newline at end of file diff --git a/libc/sysdeps/linux/nios2/Makefile b/libc/sysdeps/linux/nios2/Makefile index 4202eb611..633c91f3e 100644 --- a/libc/sysdeps/linux/nios2/Makefile +++ b/libc/sysdeps/linux/nios2/Makefile @@ -1,71 +1,13 @@ # Makefile for uClibc # -# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org> +# Copyright (C) 2000-2005 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. +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -# 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 - -TOPDIR=../../../../ -include $(TOPDIR)Rules.mak - -CRT_SRC := crt0.S -CRT_OBJ := crt0.o crt1.o -CTOR_TARGETS := $(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o - -SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S setjmp.S vfork.S clone.S -SOBJ := $(patsubst %.S,%.o, $(SSRC)) - -CSRC := brk.c syscall.c -COBJ := $(patsubst %.c,%.o, $(CSRC)) - -OBJS := $(SOBJ) $(COBJ) - -OBJ_LIST := ../../../obj.sysdeps.$(TARGET_ARCH) - -all: $(OBJ_LIST) $(CTOR_TARGETS) - -$(OBJ_LIST): $(OBJS) $(CRT_OBJ) - $(STRIPTOOL) -x -R .note -R .comment $^ - $(INSTALL) -d $(TOPDIR)lib/ - cp $(CRT_OBJ) $(TOPDIR)lib/ - echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $@ - -$(CRT_OBJ): $(CRT_SRC) - $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o - -$(SOBJ): %.o : %.S - $(CC) $(ASFLAGS) -c $< -o $@ - -$(COBJ): %.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - -ifeq ($(UCLIBC_CTOR_DTOR),y) -$(TOPDIR)lib/crti.o: crti.S - $(INSTALL) -d $(TOPDIR)lib/ - $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@ - -$(TOPDIR)lib/crtn.o: crtn.S - $(INSTALL) -d $(TOPDIR)lib/ - $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@ -else -$(CTOR_TARGETS): - $(INSTALL) -d $(TOPDIR)lib/ - $(AR) $(ARFLAGS) $@ -endif - -headers: - $(LN) -fs ../libc/sysdeps/linux/nios2/fpu_control.h $(TOPDIR)/include/ -clean: - $(RM) *.o *~ core +top_srcdir=../../../../ +top_builddir=../../../../ +all: objs +include $(top_builddir)Rules.mak +include Makefile.arch +include $(top_srcdir)Makerules diff --git a/libc/sysdeps/linux/nios2/Makefile.arch b/libc/sysdeps/linux/nios2/Makefile.arch new file mode 100644 index 000000000..fadde953e --- /dev/null +++ b/libc/sysdeps/linux/nios2/Makefile.arch @@ -0,0 +1,14 @@ +# Makefile for uClibc +# +# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +CSRC := brk.c syscall.c + +SSRC := \ + __longjmp.S bsd-_setjmp.S bsd-setjmp.S setjmp.S \ + vfork.S clone.S + +include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch diff --git a/libc/sysdeps/linux/nios2/brk.c b/libc/sysdeps/linux/nios2/brk.c index 1e7eb0382..e5a4c5d07 100644 --- a/libc/sysdeps/linux/nios2/brk.c +++ b/libc/sysdeps/linux/nios2/brk.c @@ -26,7 +26,7 @@ void *__curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; register int r2 asm("r2") = TRAP_ID_SYSCALL; @@ -44,3 +44,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/nios2/crt0.S b/libc/sysdeps/linux/nios2/crt1.S index 95c9450cd..948eeb1ed 100644 --- a/libc/sysdeps/linux/nios2/crt0.S +++ b/libc/sysdeps/linux/nios2/crt1.S @@ -8,6 +8,7 @@ * directory of this archive for more details. * * Written by Wentao Xu <wentao@microtronix.com> + * Updated by Thomas Chou <thomas@wytron.com.tw> for crt1.S * */ @@ -18,7 +19,8 @@ .type __start,@function .weak _init .weak _fini - .type __uClibc_start_main,@function + .type main,@function + .type __uClibc_main,@function .type __h_errno_location, @function .type _stdio_init, @function .type _stdio_term, @function @@ -35,30 +37,34 @@ _start: movhi gp, %hiadj(_gp) addi gp, gp, %lo(_gp) - /* load argc, argv, envp from stack */ - ldw r4, 0(sp) - ldw r5, 4(sp) - ldw r6, 8(sp) - + /* load main, argc, argv from stack */ + movhi r4, %hi(main) + ori r4, r4, %lo(main) /* main */ + ldw r5, 0(sp) /* argc */ + ldw r6, 4(sp) /* argv */ + /* load the 4th arg */ movhi r7, %hi(_init) ori r7, r7, %lo(_init) - + /* reuse the argc stack slot for the 5th arg */ movhi r8, %hi(_fini) ori r8, r8, %lo(_fini) stw r8, 0(sp) - + + stw r2, 4(sp) /* rtld_fini */ + stw sp, 8(sp) /* stack_end */ + /* call uClibc_main, shouldn't return */ #ifdef __PIC__ /* just pray 16 bit offset is enough */ - br __uClibc_start_main + br __uClibc_main #else - call __uClibc_start_main + call __uClibc_main #endif /* crash in the event of return */ __exit: movui r2, TRAP_ID_SYSCALL movui r3, __NR_exit - trap
\ No newline at end of file + trap diff --git a/libc/sysdeps/linux/powerpc/brk.S b/libc/sysdeps/linux/powerpc/brk.S index c0b436d96..b718c0de4 100644 --- a/libc/sysdeps/linux/powerpc/brk.S +++ b/libc/sysdeps/linux/powerpc/brk.S @@ -26,6 +26,7 @@ .comm __curbrk,4,4 .text .globl __brk + .hidden __brk .type __brk,@function .align 2 diff --git a/libc/sysdeps/linux/powerpc/clone.S b/libc/sysdeps/linux/powerpc/clone.S index f7c6bd18e..9e8a1ca53 100644 --- a/libc/sysdeps/linux/powerpc/clone.S +++ b/libc/sysdeps/linux/powerpc/clone.S @@ -78,11 +78,7 @@ __clone: mr r3,r31 bctrl /* Call _exit with result from procedure. */ -#ifdef __PIC__ - b _exit@plt -#else - b _exit -#endif + b _exit_internal .Lparent: /* Parent. Restore registers & return. */ diff --git a/libc/sysdeps/linux/powerpc/crt1.S b/libc/sysdeps/linux/powerpc/crt1.S index c042462e9..47419bb52 100644 --- a/libc/sysdeps/linux/powerpc/crt1.S +++ b/libc/sysdeps/linux/powerpc/crt1.S @@ -60,7 +60,8 @@ _start: lwz r4,0(r9) /* find argv one word offset from the stack pointer */ addi r5,r9,4 - mr r8,r7 /* Pass _dl_fini from ldso or NULL if statically linked */ + mr r8,r3 /* Pass _dl_fini from ldso or NULL if statically linked + Note: using r3 instead of r7, since linux 2.6 clobbers r7 */ /* Ok, now run uClibc's main() -- shouldn't return */ #ifdef __PIC__ lwz r6,_init@got(r31) diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c index 7f8923720..8115d4d01 100644 --- a/libc/sysdeps/linux/powerpc/pread_write.c +++ b/libc/sysdeps/linux/powerpc/pread_write.c @@ -96,11 +96,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 +114,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); @@ -134,11 +134,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 +151,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; diff --git a/libc/sysdeps/linux/powerpc/vfork.S b/libc/sysdeps/linux/powerpc/vfork.S index 67d8aaeac..7cf5eaa16 100644 --- a/libc/sysdeps/linux/powerpc/vfork.S +++ b/libc/sysdeps/linux/powerpc/vfork.S @@ -1,14 +1,17 @@ +#include <features.h> #include <sys/syscall.h> #ifndef __NR_vfork /* No vfork so use fork instead */ -.weak vfork ; vfork = __libc_fork +hidden_strong_alias(__fork,__vfork) +weak_alias(vfork,__libc_fork) #else .text .global __vfork +.hidden __vfork .type __vfork,@function .type __syscall_error,@function @@ -17,7 +20,7 @@ __vfork: sc bnslr+ b __syscall_error -.size __vfork,.-__vfork -.weak vfork ; vfork = __vfork +.size __vfork,.-__vfork #endif +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/powerpc/vfork.c b/libc/sysdeps/linux/powerpc/vfork.c index 6623d8dde..39f992513 100644 --- a/libc/sysdeps/linux/powerpc/vfork.c +++ b/libc/sysdeps/linux/powerpc/vfork.c @@ -9,7 +9,7 @@ return (__sc_err & 0x10000000 ? errno = __sc_ret, __sc_ret = -1 : 0), \ (type) __sc_ret -pid_t vfork(void) +pid_t attribute_hidden __vfork(void) { unsigned long __sc_ret, __sc_err; register unsigned long __sc_0 __asm__ ("r0"); @@ -46,4 +46,4 @@ pid_t vfork(void) __syscall_return (pid_t); } - +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/sh/__init_brk.c b/libc/sysdeps/linux/sh/__init_brk.c index c9a2a3ec5..92e07c49d 100644 --- a/libc/sysdeps/linux/sh/__init_brk.c +++ b/libc/sysdeps/linux/sh/__init_brk.c @@ -7,7 +7,7 @@ void * __curbrk = 0; #define __NR__brk __NR_brk -_syscall1(void *, _brk, void *, ptr); +attribute_hidden _syscall1(void *, _brk, void *, ptr); int __init_brk (void) diff --git a/libc/sysdeps/linux/sh/bits/kernel_stat.h b/libc/sysdeps/linux/sh/bits/kernel_stat.h index cd818464d..c841b0cee 100644 --- a/libc/sysdeps/linux/sh/bits/kernel_stat.h +++ b/libc/sysdeps/linux/sh/bits/kernel_stat.h @@ -30,10 +30,10 @@ struct kernel_stat { }; struct kernel_stat64 { -#if defined(__BIG_ENDIAN__) +#if (__BYTE_ORDER == __BIG_ENDIAN) unsigned char __pad0b[6]; unsigned short st_dev; -#elif defined(__LITTLE_ENDIAN__) +#elif (__BYTE_ORDER == __LITTLE_ENDIAN) unsigned short st_dev; unsigned char __pad0b[6]; #else @@ -48,7 +48,7 @@ struct kernel_stat64 { unsigned long st_uid; unsigned long st_gid; -#if defined(__BIG_ENDIAN__) +#if (__BYTE_ORDER == __BIG_ENDIAN) unsigned char __pad3b[6]; unsigned short st_rdev; #else /* Must be little */ @@ -60,7 +60,7 @@ struct kernel_stat64 { long long st_size; unsigned long st_blksize; -#if defined(__BIG_ENDIAN__) +#if (__BYTE_ORDER == __BIG_ENDIAN) unsigned long __pad4; /* Future possible st_blocks hi bits */ unsigned long st_blocks; /* Number 512-byte blocks allocated. */ #else /* Must be little */ diff --git a/libc/sysdeps/linux/sh/brk.c b/libc/sysdeps/linux/sh/brk.c index 2406904a3..d6063fc27 100644 --- a/libc/sysdeps/linux/sh/brk.c +++ b/libc/sysdeps/linux/sh/brk.c @@ -7,9 +7,9 @@ extern void * __curbrk; extern int __init_brk (void); -extern void *_brk(void *ptr); +extern void *_brk(void *ptr) attribute_hidden; -int brk(void * end_data_seg) +int attribute_hidden __brk(void * end_data_seg) { if (__init_brk () == 0) { @@ -20,3 +20,4 @@ int brk(void * end_data_seg) } return -1; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/sh/clone.S b/libc/sysdeps/linux/sh/clone.S index 98086ef09..7824d4771 100644 --- a/libc/sysdeps/linux/sh/clone.S +++ b/libc/sysdeps/linux/sh/clone.S @@ -118,7 +118,7 @@ __clone: #endif .align 2 .L1: - .long PLTJMP(_exit) + .long PLTJMP(_exit_internal) .size __clone,.-__clone; .globl clone; diff --git a/libc/sysdeps/linux/sh/sbrk.c b/libc/sysdeps/linux/sh/sbrk.c index 1c9e5b172..e9faf7db0 100644 --- a/libc/sysdeps/linux/sh/sbrk.c +++ b/libc/sysdeps/linux/sh/sbrk.c @@ -7,10 +7,10 @@ extern void * __curbrk; extern int __init_brk (void); -extern void *_brk(void *ptr); +extern void *_brk(void *ptr) attribute_hidden; -void * -sbrk(intptr_t increment) +void attribute_hidden * +__sbrk(intptr_t increment) { if (__init_brk () == 0) { @@ -23,3 +23,4 @@ sbrk(intptr_t increment) } return ((void *) -1); } +strong_alias(__sbrk,sbrk) diff --git a/libc/sysdeps/linux/sh/vfork.S b/libc/sysdeps/linux/sh/vfork.S index 981928e08..f3c20a9d6 100644 --- a/libc/sysdeps/linux/sh/vfork.S +++ b/libc/sysdeps/linux/sh/vfork.S @@ -32,9 +32,11 @@ and the process ID of the new process to the old process. */ .text -.align 4 +.globl __vfork +.hidden __vfork .type __vfork,@function -.globl __vfork; +.align 4 + __vfork: mov.w .L2, r3 trapa #0x10 @@ -104,9 +106,9 @@ __vfork: .word __NR_vfork .L3: .word __NR_fork - .size __vfork, .-__vfork -.weak vfork - vfork = __vfork + +.size __vfork, .-__vfork +strong_alias(__vfork,vfork) #include "syscall_error.S" diff --git a/libc/sysdeps/linux/sh64/__init_brk.c b/libc/sysdeps/linux/sh64/__init_brk.c index c9a2a3ec5..92e07c49d 100644 --- a/libc/sysdeps/linux/sh64/__init_brk.c +++ b/libc/sysdeps/linux/sh64/__init_brk.c @@ -7,7 +7,7 @@ void * __curbrk = 0; #define __NR__brk __NR_brk -_syscall1(void *, _brk, void *, ptr); +attribute_hidden _syscall1(void *, _brk, void *, ptr); int __init_brk (void) diff --git a/libc/sysdeps/linux/sh64/brk.c b/libc/sysdeps/linux/sh64/brk.c index 2406904a3..d6063fc27 100644 --- a/libc/sysdeps/linux/sh64/brk.c +++ b/libc/sysdeps/linux/sh64/brk.c @@ -7,9 +7,9 @@ extern void * __curbrk; extern int __init_brk (void); -extern void *_brk(void *ptr); +extern void *_brk(void *ptr) attribute_hidden; -int brk(void * end_data_seg) +int attribute_hidden __brk(void * end_data_seg) { if (__init_brk () == 0) { @@ -20,3 +20,4 @@ int brk(void * end_data_seg) } return -1; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/sh64/sbrk.c b/libc/sysdeps/linux/sh64/sbrk.c index 1c9e5b172..e9faf7db0 100644 --- a/libc/sysdeps/linux/sh64/sbrk.c +++ b/libc/sysdeps/linux/sh64/sbrk.c @@ -7,10 +7,10 @@ extern void * __curbrk; extern int __init_brk (void); -extern void *_brk(void *ptr); +extern void *_brk(void *ptr) attribute_hidden; -void * -sbrk(intptr_t increment) +void attribute_hidden * +__sbrk(intptr_t increment) { if (__init_brk () == 0) { @@ -23,3 +23,4 @@ sbrk(intptr_t increment) } return ((void *) -1); } +strong_alias(__sbrk,sbrk) diff --git a/libc/sysdeps/linux/sparc/brk.c b/libc/sysdeps/linux/sparc/brk.c index 82d6147ca..9e178e34f 100644 --- a/libc/sysdeps/linux/sparc/brk.c +++ b/libc/sysdeps/linux/sparc/brk.c @@ -26,7 +26,7 @@ void *__curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; @@ -47,3 +47,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/sparc/clone.S b/libc/sysdeps/linux/sparc/clone.S index 7421ef672..e9e6b17dd 100644 --- a/libc/sysdeps/linux/sparc/clone.S +++ b/libc/sysdeps/linux/sparc/clone.S @@ -59,7 +59,7 @@ __error: __thread_start: call %i0 mov %i3,%o0 - call _exit,0 + call _exit_internal,0 nop .size __thread_start,.-__thread_start diff --git a/libc/sysdeps/linux/sparc/fork.S b/libc/sysdeps/linux/sparc/fork.S index c382f4b4e..dfa109dcd 100644 --- a/libc/sysdeps/linux/sparc/fork.S +++ b/libc/sysdeps/linux/sparc/fork.S @@ -19,14 +19,16 @@ /* Code taken from glibc2.2.2/sysdeps/unix/sysv/linux/sparc/vfork.S */ +#include <features.h> #include <sys/syscall.h> .text -.global __libc_fork -.type __libc_fork,%function +.global __fork +.hidden __fork +.type __fork,%function .align 4 -__libc_fork: +__fork: mov __NR_fork, %g1 ta 0x10 bcc,a 9000f @@ -43,7 +45,6 @@ __libc_fork: retl and %o0, %o1, %o0 -.size __libc_fork,.-__libc_fork - -.weak fork - fork = __libc_fork +.size __fork,.-__fork +strong_alias(__fork,fork) +weak_alias(fork,__libc_fork) diff --git a/libc/sysdeps/linux/sparc/vfork.S b/libc/sysdeps/linux/sparc/vfork.S index 854b66182..9b7092c98 100644 --- a/libc/sysdeps/linux/sparc/vfork.S +++ b/libc/sysdeps/linux/sparc/vfork.S @@ -23,14 +23,16 @@ #ifndef __NR_vfork /* No vfork so use fork instead */ -.weak vfork - vfork = __libc_fork + +hidden_strong_alias(__fork,__vfork) +weak_alias(vfork,__libc_fork) #else .text -.global vfork -.type vfork,%function +.global __vfork +.hidden __vfork +.type __vfork,%function .align 4 __vfork: @@ -51,8 +53,5 @@ __vfork: and %o0, %o1, %o0 .size __vfork,.-__vfork - -.weak vfork - vfork = __vfork - #endif /* __NR_vfork */ +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/x86_64/brk.c b/libc/sysdeps/linux/x86_64/brk.c index 303b5c0de..a00e2361e 100644 --- a/libc/sysdeps/linux/x86_64/brk.c +++ b/libc/sysdeps/linux/x86_64/brk.c @@ -24,7 +24,7 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *__unbounded newbrk; @@ -42,3 +42,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/x86_64/clone.S b/libc/sysdeps/linux/x86_64/clone.S index cb614a5dc..4a7e96500 100644 --- a/libc/sysdeps/linux/x86_64/clone.S +++ b/libc/sysdeps/linux/x86_64/clone.S @@ -109,7 +109,7 @@ __clone: call *%rax /* Call exit with return value from function call. */ movq %rax, %rdi - call _exit@PLT //HIDDEN_JUMPTARGET (_exit) + call _exit_internal __error: jmp __syscall_error diff --git a/libc/sysdeps/linux/x86_64/vfork.S b/libc/sysdeps/linux/x86_64/vfork.S index dde29e96a..5786058d2 100644 --- a/libc/sysdeps/linux/x86_64/vfork.S +++ b/libc/sysdeps/linux/x86_64/vfork.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> /* Clone the calling process, but without copying the whole address space. @@ -25,15 +26,17 @@ #ifndef __NR_vfork /* No vfork so use fork instead */ -.weak vfork - vfork = __libc_fork +hidden_strong_alias(__fork,__vfork) +weak_alias(vfork,__libc_fork) #else .text .global __vfork +.hidden __vfork .type __vfork,%function .align 16 + __vfork: /* Pop the return PC value into RDI. We need a register that @@ -58,7 +61,5 @@ __error: .size __vfork,.-__vfork -.weak vfork - vfork = __vfork - #endif /* __NR_vfork */ +strong_alias(__vfork,vfork) |
