diff options
Diffstat (limited to 'libc')
91 files changed, 506 insertions, 347 deletions
diff --git a/libc/sysdeps/linux/alpha/bits/fcntl.h b/libc/sysdeps/linux/alpha/bits/fcntl.h index f2fa87ebe..9fa9c5a0b 100644 --- a/libc/sysdeps/linux/alpha/bits/fcntl.h +++ b/libc/sysdeps/linux/alpha/bits/fcntl.h @@ -190,13 +190,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -213,6 +214,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/alpha/bits/kernel_stat.h b/libc/sysdeps/linux/alpha/bits/kernel_stat.h index 0e1f2f7bd..9fcbc031a 100644 --- a/libc/sysdeps/linux/alpha/bits/kernel_stat.h +++ b/libc/sysdeps/linux/alpha/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ @@ -12,7 +16,7 @@ struct kernel_stat { unsigned int st_uid; unsigned int st_gid; unsigned int st_rdev; - long st_size; + long int st_size; unsigned long st_atime; unsigned long st_mtime; unsigned long st_ctime; @@ -21,24 +25,28 @@ struct kernel_stat { unsigned int st_flags; unsigned int st_gen; }; + struct kernel_stat64 { - unsigned int st_dev; - unsigned int st_ino; + unsigned long st_dev; + unsigned long st_ino; + unsigned long st_rdev; + long st_size; + unsigned long st_blocks; + unsigned int st_mode; - unsigned int st_nlink; unsigned int st_uid; unsigned int st_gid; - unsigned int st_rdev; - long st_size; + unsigned int st_blksize; + unsigned int st_nlink; + unsigned int __pad0; + unsigned long st_atime; + unsigned long st_atimensec; unsigned long st_mtime; + unsigned long st_mtimensec; unsigned long st_ctime; - unsigned int st_blksize; - int st_blocks; - unsigned int st_flags; - unsigned int st_gen; + unsigned long st_ctimensec; + long __unused[3]; }; - #endif /* _BITS_STAT_STRUCT_H */ - diff --git a/libc/sysdeps/linux/alpha/bits/syscalls.h b/libc/sysdeps/linux/alpha/bits/syscalls.h index 561d4bf15..02b73c5a8 100644 --- a/libc/sysdeps/linux/alpha/bits/syscalls.h +++ b/libc/sysdeps/linux/alpha/bits/syscalls.h @@ -4,11 +4,6 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -/* 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 __ASSEMBLER__ #include <errno.h> diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch index eef7a9d1a..c599a22d0 100644 --- a/libc/sysdeps/linux/arm/Makefile.arch +++ b/libc/sysdeps/linux/arm/Makefile.arch @@ -5,7 +5,7 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CSRC := brk.c ioperm.c iopl.c sigaction.c __syscall_error.c +CSRC := brk.c ioperm.c iopl.c mmap.c sigaction.c __syscall_error.c SSRC := \ __longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S \ diff --git a/libc/sysdeps/linux/arm/__longjmp.S b/libc/sysdeps/linux/arm/__longjmp.S index 27f127122..4261797f8 100644 --- a/libc/sysdeps/linux/arm/__longjmp.S +++ b/libc/sysdeps/linux/arm/__longjmp.S @@ -60,6 +60,16 @@ __longjmp: lfmfd f4, 4, [ip] ! /* load the floating point regs */ # endif #endif +#ifdef __IWMMXT__ + /* Restore the call-preserved iWMMXt registers. */ + /* Following instructions are wldrd wr10, [ip], #8 (etc.) */ + ldcl p1, cr10, [r12], #8 + ldcl p1, cr11, [r12], #8 + ldcl p1, cr12, [r12], #8 + ldcl p1, cr13, [r12], #8 + ldcl p1, cr14, [r12], #8 + ldcl p1, cr15, [r12], #8 +#endif #if defined(__USE_BX__) bx lr diff --git a/libc/sysdeps/linux/arm/bits/fcntl.h b/libc/sysdeps/linux/arm/bits/fcntl.h index c7d667a6a..1153d2760 100644 --- a/libc/sysdeps/linux/arm/bits/fcntl.h +++ b/libc/sysdeps/linux/arm/bits/fcntl.h @@ -206,13 +206,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -229,6 +230,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/arm/bits/kernel_stat.h b/libc/sysdeps/linux/arm/bits/kernel_stat.h index b58b28e30..b3f8c37d0 100644 --- a/libc/sysdeps/linux/arm/bits/kernel_stat.h +++ b/libc/sysdeps/linux/arm/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/arm/bits/setjmp.h b/libc/sysdeps/linux/arm/bits/setjmp.h index 745cdb8f7..ac52f1281 100644 --- a/libc/sysdeps/linux/arm/bits/setjmp.h +++ b/libc/sysdeps/linux/arm/bits/setjmp.h @@ -35,7 +35,7 @@ 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__ +#elif defined __MAVERICK__ || defined __IWMMXT__ typedef int __jmp_buf[34]; #else typedef int __jmp_buf[22]; diff --git a/libc/sysdeps/linux/arm/bits/syscalls.h b/libc/sysdeps/linux/arm/bits/syscalls.h index 64c625f6d..2da150624 100644 --- a/libc/sysdeps/linux/arm/bits/syscalls.h +++ b/libc/sysdeps/linux/arm/bits/syscalls.h @@ -4,22 +4,15 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -/* 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> - /* Some of the sneaky macros in the code were taken from glibc-2.3.2/sysdeps/unix/sysv/linux/arm/sysdep.h */ -#ifndef __ASSEMBLER__ - -#include <errno.h> - #define SYS_ify(syscall_name) (__NR_##syscall_name) +#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. */ @@ -34,8 +27,11 @@ #define DO_CALL(syscall_name) \ swi SYS_ify (syscall_name); #endif + #else +#include <errno.h> + #undef _syscall0 #define _syscall0(type,name) \ type name(void) \ @@ -111,27 +107,50 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7) #undef INTERNAL_SYSCALL #if defined(__ARM_EABI__) +#if !defined(__thumb__) #define INTERNAL_SYSCALL(name, err, nr, args...) \ ({unsigned int _sys_result; \ { \ - register int _a1 asm ("r0"), _nr asm ("r7"); \ + register int _a1 __asm__ ("r0"), _nr __asm__ ("r7"); \ LOAD_ARGS_##nr (args) \ _nr = SYS_ify(name); \ - asm volatile ("swi 0x0 @ syscall " #name \ + __asm__ volatile ("swi 0x0 @ syscall " #name \ : "=r" (_a1) \ : "r" (_nr) ASM_ARGS_##nr \ : "memory"); \ _sys_result = _a1; \ } \ (int) _sys_result; }) +#else /* !defined(__thumb__) */ +/* 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 /*!defined(__thumb__)*/ #else /* !defined(__ARM_EABI__) */ #if !defined(__thumb__) #define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ unsigned int _sys_result; \ { \ - register int _a1 asm ("a1"); \ + register int _a1 __asm__ ("a1"); \ LOAD_ARGS_##nr (args) \ - asm volatile ("swi %1 @ syscall " #name \ + __asm__ volatile ("swi %1 @ syscall " #name \ : "=r" (_a1) \ : "i" (SYS_ify(name)) ASM_ARGS_##nr \ : "memory"); \ @@ -147,10 +166,10 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7) #define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ unsigned int _sys_result; \ { \ - register int _a1 asm ("a1"); \ + register int _a1 __asm__ ("a1"); \ LOAD_ARGS_##nr (args) \ - register int _r7 asm ("r7") = (int) (SYS_ify(name)); \ - asm volatile ("swi 0 @ syscall " #name \ + register int _r7 __asm__ ("r7") = (int) (SYS_ify(name)); \ + __asm__ volatile ("swi 0 @ syscall " #name \ : "=r" (_a1) \ : "r" (_r7) ASM_ARGS_##nr \ : "memory"); \ @@ -165,10 +184,10 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7) #define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ unsigned int _sys_result; \ { \ - register int _a1 asm ("a1"); \ + register int _a1 __asm__ ("a1"); \ LOAD_ARGS_##nr (args) \ - register int _v3 asm ("v3") = (int) (SYS_ify(name)); \ - asm volatile ("push {r7}\n" \ + 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}" \ @@ -196,27 +215,27 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7) LOAD_ARGS_0 () #define ASM_ARGS_1 ASM_ARGS_0, "r" (_a1) #define LOAD_ARGS_2(a1, a2) \ - register int _a2 asm ("a2") = (int) (a2); \ + register int _a2 __asm__ ("a2") = (int) (a2); \ LOAD_ARGS_1 (a1) #define ASM_ARGS_2 ASM_ARGS_1, "r" (_a2) #define LOAD_ARGS_3(a1, a2, a3) \ - register int _a3 asm ("a3") = (int) (a3); \ + register int _a3 __asm__ ("a3") = (int) (a3); \ LOAD_ARGS_2 (a1, a2) #define ASM_ARGS_3 ASM_ARGS_2, "r" (_a3) #define LOAD_ARGS_4(a1, a2, a3, a4) \ - register int _a4 asm ("a4") = (int) (a4); \ + register int _a4 __asm__ ("a4") = (int) (a4); \ LOAD_ARGS_3 (a1, a2, a3) #define ASM_ARGS_4 ASM_ARGS_3, "r" (_a4) #define LOAD_ARGS_5(a1, a2, a3, a4, a5) \ - register int _v1 asm ("v1") = (int) (a5); \ + register int _v1 __asm__ ("v1") = (int) (a5); \ LOAD_ARGS_4 (a1, a2, a3, a4) #define ASM_ARGS_5 ASM_ARGS_4, "r" (_v1) #define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \ - register int _v2 asm ("v2") = (int) (a6); \ + register int _v2 __asm__ ("v2") = (int) (a6); \ LOAD_ARGS_5 (a1, a2, a3, a4, a5) #define ASM_ARGS_6 ASM_ARGS_5, "r" (_v2) #define LOAD_ARGS_7(a1, a2, a3, a4, a5, a6, a7) \ - register int _v3 asm ("v3") = (int) (a7); \ + register int _v3 __asm__ ("v3") = (int) (a7); \ LOAD_ARGS_6 (a1, a2, a3, a4, a5, a6) #define ASM_ARGS_7 ASM_ARGS_6, "r" (_v3) diff --git a/libc/sysdeps/linux/arm/crti.S b/libc/sysdeps/linux/arm/crti.S index 0cacb1f10..4835b8331 100644 --- a/libc/sysdeps/linux/arm/crti.S +++ b/libc/sysdeps/linux/arm/crti.S @@ -1,26 +1,86 @@ .file "initfini.c" .section .init - .align 2 .global _init .type _init, %function +#if defined __thumb__ + .align 1 + .thumb + .thumb_func _init: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 0, uses_anonymous_args = 0 - str lr, [sp, #-4]! - - .align 2 - - - .section .fini + push {r4-r7, lr} +#else .align 2 + .arm +_init: + @ gcc 3.3.2 didn't create a stack frame, gcc 3.4.4 does - + @ presumably 3.4.4 can put stuff into .init which requires + @ the arguments to be saved. This code is copied from 3.4.4 + mov ip, sp + stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc} + sub fp, ip, #4 +#endif + + + .section .fini .global _fini .type _fini, %function +#if defined __thumb__ + .align 1 + .thumb + .thumb_func _fini: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 0, uses_anonymous_args = 0 - str lr, [sp, #-4]! - .align 2 - - + push {r4-r7, lr} +#else + .align 2 + .arm +_fini: + mov ip, sp + stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc} + sub fp, ip, #4 +#endif + + +#if (defined __thumb__ || defined __THUMB_INTERWORK__) && (defined __ARM_ARCH_4T__ || defined __ARM_ARCH_5T__ || defined __ARM_ARCH_5TE__) + @ To support thumb code it is currently necessary to have the _call_via_rX + @ functions exposed to the linker for any program or shared library. PLT + @ references are inadequate - the PLT zaps ip and therefore breaks _call_via_ip + @ (and the compiler does generate this). It is simpler to put all the + @ required code in here - it only amounts to 60 bytes overhead. + @NOTE: it would be better to have the compiler generate this stuff as + @ required... + .section ".text" + .align 0 + .force_thumb + +.macro call_via register + .global _call_via_\register + .type _call_via_\register, %function + .weak _call_via_\register + .hidden _call_via_\register + .thumb_func +_call_via_\register: + bx \register + nop + .size _call_via_\register, . - _call_via_\register +.endm + + @ and calls for the 15 general purpose registers (2 bytes each). + call_via r0 + call_via r1 + call_via r2 + call_via r3 + call_via r4 + call_via r5 + call_via r6 + call_via r7 + call_via r8 + call_via r9 + call_via sl + call_via fp + call_via ip + call_via sp + call_via lr +#endif + .ident "GCC: (GNU) 3.3.2 20031005 (Debian prerelease)" diff --git a/libc/sysdeps/linux/arm/crtn.S b/libc/sysdeps/linux/arm/crtn.S index 851898de0..7a1ca1ab1 100644 --- a/libc/sysdeps/linux/arm/crtn.S +++ b/libc/sysdeps/linux/arm/crtn.S @@ -1,17 +1,34 @@ .file "initfini.c" .section .init - .align 2 .global _init .type _init, %function - ldr pc, [sp], #4 +#if defined __thumb__ + .align 1 + .thumb + @ this will not work on ARMv4T, but lots of stuff + @ in here won't work there anyway... + pop {r4-r7, pc} +#else + .align 2 + .arm + ldmdb fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc} +#endif .size _init, .-_init .section .fini - .align 2 .global _fini .type _fini, %function - ldr pc, [sp], #4 +#if defined __thumb__ + .align 1 + .thumb + pop {r4-r7, pc} +#else + .align 2 + .arm + ldmdb fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc} +#endif .size _fini, .-_fini + @ In fact this is modified to 3.4.4 .ident "GCC: (GNU) 3.3.2 20031005 (Debian prerelease)" diff --git a/libc/sysdeps/linux/arm/setjmp.S b/libc/sysdeps/linux/arm/setjmp.S index ceea96a40..8d15b8324 100644 --- a/libc/sysdeps/linux/arm/setjmp.S +++ b/libc/sysdeps/linux/arm/setjmp.S @@ -53,6 +53,16 @@ __sigsetjmp: sfmea f4, 4, [ip]! # endif #endif +#ifdef __IWMMXT__ + /* Save the call-preserved iWMMXt registers. */ + /* Following instructions are wstrd wr10, [ip], #8 (etc.) */ + stcl p1, cr10, [r12], #8 + stcl p1, cr11, [r12], #8 + stcl p1, cr12, [r12], #8 + stcl p1, cr13, [r12], #8 + stcl p1, cr14, [r12], #8 + stcl p1, cr15, [r12], #8 +#endif /* Make a tail call to __sigjmp_save; it takes the same args. */ #ifdef __PIC__ diff --git a/libc/sysdeps/linux/bfin/bits/fcntl.h b/libc/sysdeps/linux/bfin/bits/fcntl.h index ebf925acf..544e2145b 100644 --- a/libc/sysdeps/linux/bfin/bits/fcntl.h +++ b/libc/sysdeps/linux/bfin/bits/fcntl.h @@ -196,13 +196,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -219,6 +220,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/bfin/bits/huge_val.h b/libc/sysdeps/linux/bfin/bits/huge_val.h index f5f5b642a..9c8b72159 100644 --- a/libc/sysdeps/linux/bfin/bits/huge_val.h +++ b/libc/sysdeps/linux/bfin/bits/huge_val.h @@ -1,6 +1,8 @@ -/* `HUGE_VAL' constants for blackfin (where it is infinity). +/* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity). Used by <stdlib.h> and <math.h> functions for overflow. - Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + Blackfin version. + Copyright (C) 1992, 95, 96, 97, 98, 99, 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 @@ -22,25 +24,19 @@ # error "Never use <bits/huge_val.h> directly; include <math.h> instead." #endif -#include <features.h> - /* IEEE positive infinity (-HUGE_VAL is negative infinity). */ -#ifdef __GNUC__ - -# if __GNUC_PREREQ(2,96) - -# define HUGE_VAL (__extension__ 0x1.0p2047) +#if __GNUC_PREREQ(3,3) +# define HUGE_VAL (__builtin_huge_val()) +#elif __GNUC_PREREQ(2,96) +# define HUGE_VAL (__extension__ 0x1.0p2047) +#elif defined __GNUC__ -# else - -# define HUGE_VAL \ +# define HUGE_VAL \ (__extension__ \ ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \ { __l: 0x000000007ff00000ULL }).__d) -# endif - #else /* not GCC */ # include <endian.h> @@ -58,46 +54,3 @@ static __huge_val_t __huge_val = { __HUGE_VAL_bytes }; # define HUGE_VAL (__huge_val.__d) #endif /* GCC. */ - - -/* ISO C99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */ - -#ifdef __USE_ISOC99 - -# ifdef __GNUC__ - -# if __GNUC_PREREQ(2,96) - -# define HUGE_VALF (__extension__ 0x1.0p255f) - -# else - -# define HUGE_VALF \ - (__extension__ \ - ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \ - { __l: 0x7f800000UL }).__d) - -# endif - -# else /* not GCC */ - -typedef union { unsigned char __c[4]; float __f; } __huge_valf_t; - -# if __BYTE_ORDER == __BIG_ENDIAN -# define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } -# endif -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f } -# endif - -static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; -# define HUGE_VALF (__huge_valf.__f) - -# endif /* GCC. */ - - -/* Generally there is no separate `long double' format and it is the - same as `double'. */ -# define HUGE_VALL HUGE_VAL - -#endif /* __USE_ISOC99. */ diff --git a/libc/sysdeps/linux/bfin/bits/kernel_stat.h b/libc/sysdeps/linux/bfin/bits/kernel_stat.h index 1bfdb8e44..2a59d8eea 100644 --- a/libc/sysdeps/linux/bfin/bits/kernel_stat.h +++ b/libc/sysdeps/linux/bfin/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/bfin/bits/mman.h b/libc/sysdeps/linux/bfin/bits/mman.h index 06767a9c0..c57238726 100644 --- a/libc/sysdeps/linux/bfin/bits/mman.h +++ b/libc/sysdeps/linux/bfin/bits/mman.h @@ -57,6 +57,8 @@ # 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_UNINITIALIZE 0x4000000 /* For anonymous mmap, memory could + be uninitialized. */ #endif /* Flags to `msync'. */ diff --git a/libc/sysdeps/linux/bfin/bits/syscalls.h b/libc/sysdeps/linux/bfin/bits/syscalls.h index 2309f7f6d..d1d904c1c 100644 --- a/libc/sysdeps/linux/bfin/bits/syscalls.h +++ b/libc/sysdeps/linux/bfin/bits/syscalls.h @@ -4,11 +4,6 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -/* 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 __ASSEMBLER__ #include <errno.h> diff --git a/libc/sysdeps/linux/bfin/crt1.S b/libc/sysdeps/linux/bfin/crt1.S index ead8dbfbe..ffbd6e9af 100644 --- a/libc/sysdeps/linux/bfin/crt1.S +++ b/libc/sysdeps/linux/bfin/crt1.S @@ -34,11 +34,15 @@ Cambridge, MA 02139, USA. */ #include <features.h> +#ifndef L_Scrt1 + .text .align 2 .global __start; .type __start,STT_FUNC; -.global ___uClibc_main; +.weak __init; +.weak __fini; +.global ___uClibc_main; .type ___uClibc_main,STT_FUNC; /* Stick in a dummy reference to main(), so that if an application @@ -49,7 +53,7 @@ Cambridge, MA 02139, USA. */ __start: -#ifdef __BFIN_FDPIC__ +#if defined(__BFIN_FDPIC__) && !defined(__pie__) /* P0 contains a pointer to the program's load map. */ call .Lcall; .Lcall: @@ -77,7 +81,10 @@ __start: L1 = 0; L2 = 0; L3 = 0; - + +#ifdef __ID_SHARED_LIB__ + CALL ___shared_flat_add_library; +#endif /* Load register R1 (argc) from the stack to its final resting place */ P0 = SP; R1 = [P0++]; @@ -92,21 +99,37 @@ __start: R3 += 4; R3 = R2 + R3; - SP += -24; + P2 = SP; + SP += -32; [SP + 12] = R3; +#ifndef __BFIN_FDPIC__ + R7 = 0; +#endif + /* Pass highest stack pointer to the app. */ + [SP + 28] = P2; + /* Store the pointer to ld.so's fini that we got in P1. */ + [SP + 24] = R7; + /* Ok, now run uClibc's main() -- shouldn't return */ #if defined L_crt1 && defined __UCLIBC_CTOR_DTOR__ + #ifdef __BFIN_FDPIC__ R3 = [P3 + __init@FUNCDESC_GOT17M4]; +#elif defined __ID_SHARED_LIB__ + P5 = [P5 + _current_shared_library_p5_offset_]; + R3 = [P5 + ___shared_flat_init@GOT]; #else R3.H = __init; R3.L = __init; #endif [SP+16] = R3; + #ifdef __BFIN_FDPIC__ R3 = [P3 + __fini@FUNCDESC_GOT17M4]; -#else +#elif defined __ID_SHARED_LIB__ + R3 = [P5 + ___shared_flat_fini@GOT]; +#else R3.H = __fini; R3.L = __fini; #endif @@ -119,8 +142,28 @@ __start: #ifdef __BFIN_FDPIC__ R0 = [P3 + _main@FUNCDESC_GOT17M4]; +#elif defined __ID_SHARED_LIB__ + R0 = [P5 + _main@GOT]; #else R0.H = _main; R0.L = _main; #endif +#ifdef __ID_SHARED_LIB__ + P0 = [P5 + ___uClibc_main@GOT]; + jump (P0) +#else jump.l ___uClibc_main; +#endif + +#else + .text + .global lib_main + .hidden lib_main + .type lib_main,@function +lib_main: + RETS = [SP++]; + P0 = [P5 + ___shared_flat_add_library@GOT]; + JUMP (P0); + + .hidden _current_shared_library_p5_offset_ +#endif diff --git a/libc/sysdeps/linux/cris/bits/fcntl.h b/libc/sysdeps/linux/cris/bits/fcntl.h index 8baa20555..87e943f78 100644 --- a/libc/sysdeps/linux/cris/bits/fcntl.h +++ b/libc/sysdeps/linux/cris/bits/fcntl.h @@ -197,13 +197,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -220,6 +221,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/cris/bits/kernel_stat.h b/libc/sysdeps/linux/cris/bits/kernel_stat.h index d4be6a64d..50202e542 100644 --- a/libc/sysdeps/linux/cris/bits/kernel_stat.h +++ b/libc/sysdeps/linux/cris/bits/kernel_stat.h @@ -3,6 +3,10 @@ #ifndef _CRIS_STAT_H #define _CRIS_STAT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + struct __old_kernel_stat { unsigned short st_dev; unsigned short st_ino; diff --git a/libc/sysdeps/linux/cris/bits/syscalls.h b/libc/sysdeps/linux/cris/bits/syscalls.h index 8b74518ce..065f48742 100644 --- a/libc/sysdeps/linux/cris/bits/syscalls.h +++ b/libc/sysdeps/linux/cris/bits/syscalls.h @@ -5,9 +5,6 @@ #error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead." #endif -/* Include the __NR_<name> definitions. */ -#include <bits/sysnum.h> - #ifndef __ASSEMBLER__ #include <errno.h> diff --git a/libc/sysdeps/linux/cris/sysdep.S b/libc/sysdeps/linux/cris/sysdep.S index 4e558153b..416751d65 100644 --- a/libc/sysdeps/linux/cris/sysdep.S +++ b/libc/sysdeps/linux/cris/sysdep.S @@ -19,15 +19,6 @@ #include <features.h> #include "sysdep.h" -/* Make space for the errno variable. */ - - .globl C_SYMBOL_NAME(errno) - .type C_SYMBOL_NAME(errno),@object - .lcomm C_SYMBOL_NAME(errno),4 - - .weak errno - errno = _errno - /* The syscall stubs jump here when they detect an error, bot for PIC and non-PIC. */ diff --git a/libc/sysdeps/linux/e1/bits/kernel_stat.h b/libc/sysdeps/linux/e1/bits/kernel_stat.h index bfef64cea..908a153d8 100644 --- a/libc/sysdeps/linux/e1/bits/kernel_stat.h +++ b/libc/sysdeps/linux/e1/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/e1/bits/syscalls.h b/libc/sysdeps/linux/e1/bits/syscalls.h index cd67de776..8852a0f55 100644 --- a/libc/sysdeps/linux/e1/bits/syscalls.h +++ b/libc/sysdeps/linux/e1/bits/syscalls.h @@ -10,11 +10,6 @@ #include <features.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> - /* Include the library _syscallx macros */ #include <bits/unistd.h> diff --git a/libc/sysdeps/linux/frv/bits/kernel_stat.h b/libc/sysdeps/linux/frv/bits/kernel_stat.h index c6d61412d..51cb57eda 100644 --- a/libc/sysdeps/linux/frv/bits/kernel_stat.h +++ b/libc/sysdeps/linux/frv/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/frv/bits/syscalls.h b/libc/sysdeps/linux/frv/bits/syscalls.h index fae1079bd..eea3050ba 100644 --- a/libc/sysdeps/linux/frv/bits/syscalls.h +++ b/libc/sysdeps/linux/frv/bits/syscalls.h @@ -4,11 +4,6 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -/* 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 __ASSEMBLER__ #include <errno.h> diff --git a/libc/sysdeps/linux/frv/fstat.c b/libc/sysdeps/linux/frv/fstat.c index a1d343cb8..fc8a25af5 100644 --- a/libc/sysdeps/linux/frv/fstat.c +++ b/libc/sysdeps/linux/frv/fstat.c @@ -9,7 +9,7 @@ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ -#include "../common/syscalls.h" +#include <sys/syscall.h> #include <unistd.h> #include <sys/stat.h> diff --git a/libc/sysdeps/linux/frv/fstat64.c b/libc/sysdeps/linux/frv/fstat64.c index e07a28471..dcb9b922c 100644 --- a/libc/sysdeps/linux/frv/fstat64.c +++ b/libc/sysdeps/linux/frv/fstat64.c @@ -9,7 +9,7 @@ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ -#include "../common/syscalls.h" +#include <sys/syscall.h> #include <unistd.h> #include <sys/stat.h> diff --git a/libc/sysdeps/linux/frv/lstat.c b/libc/sysdeps/linux/frv/lstat.c index b178af76b..7a0297bfa 100644 --- a/libc/sysdeps/linux/frv/lstat.c +++ b/libc/sysdeps/linux/frv/lstat.c @@ -9,7 +9,7 @@ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ -#include "../common/syscalls.h" +#include <sys/syscall.h> #include <unistd.h> #include <sys/stat.h> diff --git a/libc/sysdeps/linux/frv/lstat64.c b/libc/sysdeps/linux/frv/lstat64.c index 9a6236b14..e95653ed5 100644 --- a/libc/sysdeps/linux/frv/lstat64.c +++ b/libc/sysdeps/linux/frv/lstat64.c @@ -9,7 +9,7 @@ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ -#include "../common/syscalls.h" +#include <sys/syscall.h> #include <unistd.h> #include <sys/stat.h> diff --git a/libc/sysdeps/linux/frv/stat.c b/libc/sysdeps/linux/frv/stat.c index 56cb668db..6c3f0b962 100644 --- a/libc/sysdeps/linux/frv/stat.c +++ b/libc/sysdeps/linux/frv/stat.c @@ -9,7 +9,7 @@ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ -#include "../common/syscalls.h" +#include <sys/syscall.h> #include <unistd.h> #include <sys/stat.h> diff --git a/libc/sysdeps/linux/frv/stat64.c b/libc/sysdeps/linux/frv/stat64.c index 641644ffd..659ad8ae2 100644 --- a/libc/sysdeps/linux/frv/stat64.c +++ b/libc/sysdeps/linux/frv/stat64.c @@ -9,7 +9,7 @@ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com> */ -#include "../common/syscalls.h" +#include <sys/syscall.h> #include <unistd.h> #include <sys/stat.h> diff --git a/libc/sysdeps/linux/h8300/bits/kernel_stat.h b/libc/sysdeps/linux/h8300/bits/kernel_stat.h index c227a30d0..f589b1f66 100644 --- a/libc/sysdeps/linux/h8300/bits/kernel_stat.h +++ b/libc/sysdeps/linux/h8300/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/h8300/bits/syscalls.h b/libc/sysdeps/linux/h8300/bits/syscalls.h index b734a6251..8ef399fd7 100644 --- a/libc/sysdeps/linux/h8300/bits/syscalls.h +++ b/libc/sysdeps/linux/h8300/bits/syscalls.h @@ -8,12 +8,6 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -/* 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> - - #define __syscall_return(type, res) \ do { \ if ((unsigned long)(res) >= (unsigned long)(-125)) { \ diff --git a/libc/sysdeps/linux/hppa/bits/fcntl.h b/libc/sysdeps/linux/hppa/bits/fcntl.h index 4141a37c5..28600b580 100644 --- a/libc/sysdeps/linux/hppa/bits/fcntl.h +++ b/libc/sysdeps/linux/hppa/bits/fcntl.h @@ -195,12 +195,13 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -216,6 +217,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/hppa/bits/kernel_stat.h b/libc/sysdeps/linux/hppa/bits/kernel_stat.h index c64392037..51b5b0748 100644 --- a/libc/sysdeps/linux/hppa/bits/kernel_stat.h +++ b/libc/sysdeps/linux/hppa/bits/kernel_stat.h @@ -4,6 +4,10 @@ #ifndef _PARISC_STAT_H #define _PARISC_STAT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + 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/syscalls.h b/libc/sysdeps/linux/hppa/bits/syscalls.h index 365f5b4b1..99effb260 100644 --- a/libc/sysdeps/linux/hppa/bits/syscalls.h +++ b/libc/sysdeps/linux/hppa/bits/syscalls.h @@ -4,11 +4,6 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -/* 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 __ASSEMBLER__ #include <errno.h> diff --git a/libc/sysdeps/linux/hppa/clone.S b/libc/sysdeps/linux/hppa/clone.S index 599575d24..b8e354cda 100644 --- a/libc/sysdeps/linux/hppa/clone.S +++ b/libc/sysdeps/linux/hppa/clone.S @@ -124,7 +124,7 @@ thread_start: bl $$dyncall,%r31 copy %r31,%rp - bl _exit,%rp + bl HIDDEN_JUMPTARGET(_exit),%rp copy %ret0,%arg0 /* Die horribly. */ diff --git a/libc/sysdeps/linux/i386/bits/fcntl.h b/libc/sysdeps/linux/i386/bits/fcntl.h index 30fcc8367..10286a88d 100644 --- a/libc/sysdeps/linux/i386/bits/fcntl.h +++ b/libc/sysdeps/linux/i386/bits/fcntl.h @@ -198,13 +198,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -221,6 +222,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/i386/bits/kernel_stat.h b/libc/sysdeps/linux/i386/bits/kernel_stat.h index a574bd5f4..9f659a47e 100644 --- a/libc/sysdeps/linux/i386/bits/kernel_stat.h +++ b/libc/sysdeps/linux/i386/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h index 73f858521..d612071b4 100644 --- a/libc/sysdeps/linux/i386/bits/syscalls.h +++ b/libc/sysdeps/linux/i386/bits/syscalls.h @@ -4,11 +4,6 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -/* 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> - /* Some of the sneaky macros in the code were taken from glibc-2.2.5/sysdeps/unix/sysv/linux/i386/sysdep.h diff --git a/libc/sysdeps/linux/i960/bits/syscalls.h b/libc/sysdeps/linux/i960/bits/syscalls.h index 62541b873..b21851333 100644 --- a/libc/sysdeps/linux/i960/bits/syscalls.h +++ b/libc/sysdeps/linux/i960/bits/syscalls.h @@ -8,12 +8,8 @@ /* Do something very evil for now. Until we create our own syscall * macros, short circuit bits/sysnum.h and use asm/unistd.h instead */ +#warning "fixme -- add arch specific syscall macros.h" #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 */ diff --git a/libc/sysdeps/linux/ia64/bits/fcntl.h b/libc/sysdeps/linux/ia64/bits/fcntl.h index 46b38937d..e7e7c3039 100644 --- a/libc/sysdeps/linux/ia64/bits/fcntl.h +++ b/libc/sysdeps/linux/ia64/bits/fcntl.h @@ -192,13 +192,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -215,6 +216,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/ia64/bits/kernel_stat.h b/libc/sysdeps/linux/ia64/bits/kernel_stat.h index b46369c3c..c67c92d16 100644 --- a/libc/sysdeps/linux/ia64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/ia64/bits/kernel_stat.h @@ -4,6 +4,10 @@ #ifndef _ASM_IA64_STAT_H #define _ASM_IA64_STAT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* * Modified 1998, 1999 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co diff --git a/libc/sysdeps/linux/ia64/bits/syscalls.h b/libc/sysdeps/linux/ia64/bits/syscalls.h index 666468a7a..b9c45a741 100644 --- a/libc/sysdeps/linux/ia64/bits/syscalls.h +++ b/libc/sysdeps/linux/ia64/bits/syscalls.h @@ -26,11 +26,6 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -/* 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 __ASSEMBLER__ #include <errno.h> diff --git a/libc/sysdeps/linux/ia64/vfork.S b/libc/sysdeps/linux/ia64/vfork.S index d100443b7..f233b05e2 100644 --- a/libc/sysdeps/linux/ia64/vfork.S +++ b/libc/sysdeps/linux/ia64/vfork.S @@ -39,6 +39,6 @@ ENTRY(__vfork) (p6) br.cond.spnt.few __syscall_error ret PSEUDO_END(__vfork) -libc_hidden_weak (vfork) -weak_alias (__vfork, vfork) +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h index 6983cd410..85cc59188 100644 --- a/libc/sysdeps/linux/m68k/bits/fcntl.h +++ b/libc/sysdeps/linux/m68k/bits/fcntl.h @@ -196,13 +196,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -219,6 +220,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/m68k/bits/kernel_stat.h b/libc/sysdeps/linux/m68k/bits/kernel_stat.h index 3d2805e7f..5f0514843 100644 --- a/libc/sysdeps/linux/m68k/bits/kernel_stat.h +++ b/libc/sysdeps/linux/m68k/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/m68k/bits/syscalls.h b/libc/sysdeps/linux/m68k/bits/syscalls.h index 3e3303897..d1ade8036 100644 --- a/libc/sysdeps/linux/m68k/bits/syscalls.h +++ b/libc/sysdeps/linux/m68k/bits/syscalls.h @@ -4,13 +4,6 @@ # 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> - /* m68k headers does stupid stuff with __NR_iopl / __NR_vm86: * #define __NR_iopl not supported * #define __NR_vm86 not supported @@ -20,6 +13,8 @@ #ifndef __ASSEMBLER__ +#include <errno.h> + /* Linux takes system call arguments in registers: syscall number %d0 call-clobbered diff --git a/libc/sysdeps/linux/m68k/bits/uClibc_page.h b/libc/sysdeps/linux/m68k/bits/uClibc_page.h index 57bea0724..51c6f1446 100644 --- a/libc/sysdeps/linux/m68k/bits/uClibc_page.h +++ b/libc/sysdeps/linux/m68k/bits/uClibc_page.h @@ -20,15 +20,21 @@ #ifndef _UCLIBC_PAGE_H #define _UCLIBC_PAGE_H +/* #include <linux/config.h> +*/ /* PAGE_SHIFT determines the page size */ +/* #ifndef CONFIG_SUN3 +*/ #define PAGE_SHIFT (12) +/* #else #define PAGE_SHIFT (13) #endif +*/ #define PAGE_SIZE (1UL << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) diff --git a/libc/sysdeps/linux/m68k/bsd-setjmp.S b/libc/sysdeps/linux/m68k/bsd-setjmp.S index b83573c80..fdd7540a6 100644 --- a/libc/sysdeps/linux/m68k/bsd-setjmp.S +++ b/libc/sysdeps/linux/m68k/bsd-setjmp.S @@ -5,6 +5,7 @@ #define _ASM #define _SETJMP_H #include <bits/setjmp.h> +#include "m68k_pic.S" .globl setjmp; .type setjmp,@function @@ -18,6 +19,5 @@ setjmp: fmovemx %fp2-%fp7, %a0@(JB_FPREGS) #endif clrl %d0 - lea __sigjmp_save-.-8, %a0 - jmp 0(%pc, %a0) + JUMP __sigjmp_save,%a0 diff --git a/libc/sysdeps/linux/m68k/clone.S b/libc/sysdeps/linux/m68k/clone.S index 8ef916e91..7eddff10c 100644 --- a/libc/sysdeps/linux/m68k/clone.S +++ b/libc/sysdeps/linux/m68k/clone.S @@ -8,6 +8,7 @@ #include <features.h> #include <bits/errno.h> #include <sys/syscall.h> +#include "m68k_pic.S" /* int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ @@ -21,11 +22,11 @@ clone: movel 4(%sp), %d1 /* no NULL function pointers */ movel %d1, %a0 tstl %d1 - jbeq __syscall_error + beq.w __syscall_error_trampoline movel 8(%sp), %d1 /* no NULL stack pointers */ movel %d1, %a1 tstl %d1 - jbeq __syscall_error + beq.w __syscall_error_trampoline /* Allocate space and copy the argument onto the new stack. */ movel 16(%sp), -(%a1) @@ -50,7 +51,7 @@ clone: #endif tstl %d0 - jbmi __syscall_error + bmi.w __syscall_error_trampoline beq.w thread_start rts @@ -62,3 +63,7 @@ thread_start: movel #__NR_exit, %d0 trap #0 /*jsr exit*/ + +__syscall_error_trampoline: + JUMP __syscall_error,%a0 + diff --git a/libc/sysdeps/linux/m68k/crt1.S b/libc/sysdeps/linux/m68k/crt1.S index 9ce14e594..a9cf00193 100644 --- a/libc/sysdeps/linux/m68k/crt1.S +++ b/libc/sysdeps/linux/m68k/crt1.S @@ -34,6 +34,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <features.h> +#include "m68k_pic.S" + +#ifndef L_Scrt1 /* 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: @@ -60,8 +64,6 @@ 8(%sp) envp */ -#include <features.h> - .text .type _init,%function .type _fini,%function @@ -76,6 +78,17 @@ _start: the outermost frame obviously. */ sub.l %fp, %fp +#if !defined __ARCH_USE_MMU__ && defined __PIC__ + /* Set up the global pointer. The GOT is at the beginning of the + data segment, whose address is in %d5. */ + move.l %d5,%a5 + .equ have_current_got, 1 +#endif + +#ifdef __UCLIBC_FORMAT_SHARED_FLAT__ + CALL __shared_flat_add_library,%a1 +#endif + /* 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. */ @@ -100,19 +113,35 @@ _start: /* Push the address of our own entry points to `.fini' and `.init'. */ - pea _fini - pea _init +#if defined __UCLIBC_FORMAT_SHARED_FLAT__ + PEA_TEXT __shared_flat_fini,%a1 + PEA_TEXT __shared_flat_init,%a1 +#else + PEA_TEXT _fini,%a1 + PEA_TEXT _init,%a1 +#endif pea (%a0) /* Push second argument: argv. */ move.l %d0, -(%sp) /* Push first argument: argc. */ - pea main + PEA_TEXT main,%a1 /* Call the user's main function, and exit with its value. But let the libc call main. */ - jbsr __uClibc_main + CALL __uClibc_main,%a1 illegal /* Crash if somehow `exit' does return. */ +#else + .text + .globl lib_main + .hidden lib_main + .type lib_main,@function +lib_main: + move.l %d5,%a5 + JUMP __shared_flat_add_library,%a0 + + .hidden _current_shared_library_a5_offset_ +#endif /* Define a symbol for the first piece of initialized data. */ .data diff --git a/libc/sysdeps/linux/m68k/crti.S b/libc/sysdeps/linux/m68k/crti.S index ccfe99133..1b4b643b6 100644 --- a/libc/sysdeps/linux/m68k/crti.S +++ b/libc/sysdeps/linux/m68k/crti.S @@ -1,27 +1,17 @@ - .file "initfini.c" -#APP - +#include "m68k_pic.S" + .section .init -#NO_APP .align 2 .globl _init .type _init, @function _init: - link.w %a6,#0 -#APP - - .align 2 - + link.w %a6,#0 + INIT_GP .section .fini -#NO_APP .align 2 .globl _fini .type _fini, @function _fini: - link.w %a6,#0 -#APP - .align 2 - - - .ident "GCC: (GNU) 3.3.2" + link.w %a6,#0 + INIT_GP diff --git a/libc/sysdeps/linux/m68k/crtn.S b/libc/sysdeps/linux/m68k/crtn.S index d29c02dec..2a29b8726 100644 --- a/libc/sysdeps/linux/m68k/crtn.S +++ b/libc/sysdeps/linux/m68k/crtn.S @@ -1,26 +1,11 @@ - .file "initfini.c" -#APP - +#include "m68k_pic.S" + .section .init -#NO_APP - .align 2 - .globl _init - .type _init, @function -#NO_APP - unlk %a6 + FINI_GP + unlk %a6 rts - .size _init, .-_init -#APP .section .fini -#NO_APP - .align 2 - .globl _fini - .type _fini, @function -#NO_APP - unlk %a6 + FINI_GP + unlk %a6 rts - .size _fini, .-_fini -#APP - - .ident "GCC: (GNU) 3.3.2" diff --git a/libc/sysdeps/linux/m68k/setjmp.S b/libc/sysdeps/linux/m68k/setjmp.S index d7ca5dd6d..4adda0af5 100644 --- a/libc/sysdeps/linux/m68k/setjmp.S +++ b/libc/sysdeps/linux/m68k/setjmp.S @@ -5,6 +5,7 @@ #define _ASM #define _SETJMP_H #include <bits/setjmp.h> +#include "m68k_pic.S" .globl __sigsetjmp; .type __sigsetjmp,@function @@ -18,6 +19,5 @@ __sigsetjmp: fmovemx %fp2-%fp7, %a0@(JB_FPREGS) #endif clrl %d0 - lea __sigjmp_save-.-8, %a0 - jmp 0(%pc, %a0) + JUMP __sigjmp_save,%a0 diff --git a/libc/sysdeps/linux/microblaze/bits/kernel_stat.h b/libc/sysdeps/linux/microblaze/bits/kernel_stat.h index e8ef01493..248345e8b 100644 --- a/libc/sysdeps/linux/microblaze/bits/kernel_stat.h +++ b/libc/sysdeps/linux/microblaze/bits/kernel_stat.h @@ -3,6 +3,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + struct kernel_stat { __kernel_dev_t st_dev; diff --git a/libc/sysdeps/linux/microblaze/bits/syscalls.h b/libc/sysdeps/linux/microblaze/bits/syscalls.h index 62541b873..b21851333 100644 --- a/libc/sysdeps/linux/microblaze/bits/syscalls.h +++ b/libc/sysdeps/linux/microblaze/bits/syscalls.h @@ -8,12 +8,8 @@ /* Do something very evil for now. Until we create our own syscall * macros, short circuit bits/sysnum.h and use asm/unistd.h instead */ +#warning "fixme -- add arch specific syscall macros.h" #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 */ diff --git a/libc/sysdeps/linux/nios/bits/fcntl.h b/libc/sysdeps/linux/nios/bits/fcntl.h index b3e12f41e..1d7df4c81 100644 --- a/libc/sysdeps/linux/nios/bits/fcntl.h +++ b/libc/sysdeps/linux/nios/bits/fcntl.h @@ -196,13 +196,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -219,6 +220,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/nios/bits/syscalls.h b/libc/sysdeps/linux/nios/bits/syscalls.h index 21f4a370c..c2b6b9735 100644 --- a/libc/sysdeps/linux/nios/bits/syscalls.h +++ b/libc/sysdeps/linux/nios/bits/syscalls.h @@ -8,5 +8,6 @@ /* Do something very evil for now. Until we include our out syscall * macros, short circuit bits/syscall.h and use asm/unistd.h instead */ #include <asm/unistd.h> + #endif /* _BITS_SYSCALLS_H */ diff --git a/libc/sysdeps/linux/nios2/bits/fcntl.h b/libc/sysdeps/linux/nios2/bits/fcntl.h index ebf925acf..544e2145b 100644 --- a/libc/sysdeps/linux/nios2/bits/fcntl.h +++ b/libc/sysdeps/linux/nios2/bits/fcntl.h @@ -196,13 +196,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -219,6 +220,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/nios2/bits/kernel_stat.h b/libc/sysdeps/linux/nios2/bits/kernel_stat.h index bfef64cea..908a153d8 100644 --- a/libc/sysdeps/linux/nios2/bits/kernel_stat.h +++ b/libc/sysdeps/linux/nios2/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/nios2/bits/syscalls.h b/libc/sysdeps/linux/nios2/bits/syscalls.h index 62541b873..b21851333 100644 --- a/libc/sysdeps/linux/nios2/bits/syscalls.h +++ b/libc/sysdeps/linux/nios2/bits/syscalls.h @@ -8,12 +8,8 @@ /* Do something very evil for now. Until we create our own syscall * macros, short circuit bits/sysnum.h and use asm/unistd.h instead */ +#warning "fixme -- add arch specific syscall macros.h" #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 */ diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h index c2ed000af..3dec6923c 100644 --- a/libc/sysdeps/linux/powerpc/bits/fcntl.h +++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h @@ -198,13 +198,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -221,6 +222,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h index 556ffe2dd..d3c3f911c 100644 --- a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h +++ b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/powerpc/bits/syscalls.h b/libc/sysdeps/linux/powerpc/bits/syscalls.h index ae269b876..e469f1723 100644 --- a/libc/sysdeps/linux/powerpc/bits/syscalls.h +++ b/libc/sysdeps/linux/powerpc/bits/syscalls.h @@ -5,11 +5,6 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -/* 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 __ASSEMBLER__ /* Define a macro which expands inline into the wrapper code for a system diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c index 353143907..e9f8cbef8 100644 --- a/libc/sysdeps/linux/powerpc/pread_write.c +++ b/libc/sysdeps/linux/powerpc/pread_write.c @@ -12,7 +12,7 @@ * from GNU libc 2.2.5, but reworked considerably... */ -#include "../common/syscalls.h" +#include <sys/syscall.h> #include <unistd.h> #ifndef __UCLIBC_HAS_LFS__ diff --git a/libc/sysdeps/linux/sh/bits/fcntl.h b/libc/sysdeps/linux/sh/bits/fcntl.h index 30fcc8367..10286a88d 100644 --- a/libc/sysdeps/linux/sh/bits/fcntl.h +++ b/libc/sysdeps/linux/sh/bits/fcntl.h @@ -198,13 +198,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -221,6 +222,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/sh/bits/kernel_stat.h b/libc/sysdeps/linux/sh/bits/kernel_stat.h index c841b0cee..8a29b3f5f 100644 --- a/libc/sysdeps/linux/sh/bits/kernel_stat.h +++ b/libc/sysdeps/linux/sh/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/sh/bits/syscalls.h b/libc/sysdeps/linux/sh/bits/syscalls.h index 83b20f63e..234f80653 100644 --- a/libc/sysdeps/linux/sh/bits/syscalls.h +++ b/libc/sysdeps/linux/sh/bits/syscalls.h @@ -4,10 +4,12 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -/* 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> +/* The Linux kernel uses different trap numbers on sh-2. */ +#ifdef __CONFIG_SH2__ +# define __SH_SYSCALL_TRAP_BASE 0x20 +#else +# define __SH_SYSCALL_TRAP_BASE 0x10 +#endif #ifndef __ASSEMBLER__ @@ -33,9 +35,9 @@ do { \ type name(void) \ { \ register long __sc0 __asm__ ("r3") = __NR_##name; \ -__asm__ __volatile__ ("trapa #0x10" \ +__asm__ __volatile__ ("trapa %1" \ : "=z" (__sc0) \ - : "0" (__sc0) \ + : "i" (__SH_SYSCALL_TRAP_BASE), "0" (__sc0) \ : "memory" ); \ __syscall_return(type,__sc0); \ } @@ -45,9 +47,9 @@ type name(type1 arg1) \ { \ register long __sc0 __asm__ ("r3") = __NR_##name; \ register long __sc4 __asm__ ("r4") = (long) arg1; \ -__asm__ __volatile__ ("trapa #0x11" \ +__asm__ __volatile__ ("trapa %1" \ : "=z" (__sc0) \ - : "0" (__sc0), "r" (__sc4) \ + : "i" (__SH_SYSCALL_TRAP_BASE + 1), "0" (__sc0), "r" (__sc4) \ : "memory"); \ __syscall_return(type,__sc0); \ } @@ -58,9 +60,10 @@ type name(type1 arg1,type2 arg2) \ register long __sc0 __asm__ ("r3") = __NR_##name; \ register long __sc4 __asm__ ("r4") = (long) arg1; \ register long __sc5 __asm__ ("r5") = (long) arg2; \ -__asm__ __volatile__ ("trapa #0x12" \ +__asm__ __volatile__ ("trapa %1" \ : "=z" (__sc0) \ - : "0" (__sc0), "r" (__sc4), "r" (__sc5) \ + : "i" (__SH_SYSCALL_TRAP_BASE + 2), "0" (__sc0), "r" (__sc4), \ + "r" (__sc5) \ : "memory"); \ __syscall_return(type,__sc0); \ } @@ -72,9 +75,10 @@ register long __sc0 __asm__ ("r3") = __NR_##name; \ register long __sc4 __asm__ ("r4") = (long) arg1; \ register long __sc5 __asm__ ("r5") = (long) arg2; \ register long __sc6 __asm__ ("r6") = (long) arg3; \ -__asm__ __volatile__ ("trapa #0x13" \ +__asm__ __volatile__ ("trapa %1" \ : "=z" (__sc0) \ - : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6) \ + : "i" (__SH_SYSCALL_TRAP_BASE + 3), "0" (__sc0), "r" (__sc4), \ + "r" (__sc5), "r" (__sc6) \ : "memory"); \ __syscall_return(type,__sc0); \ } @@ -87,9 +91,10 @@ register long __sc4 __asm__ ("r4") = (long) arg1; \ register long __sc5 __asm__ ("r5") = (long) arg2; \ register long __sc6 __asm__ ("r6") = (long) arg3; \ register long __sc7 __asm__ ("r7") = (long) arg4; \ -__asm__ __volatile__ ("trapa #0x14" \ +__asm__ __volatile__ ("trapa %1" \ : "=z" (__sc0) \ - : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), \ + : "i" (__SH_SYSCALL_TRAP_BASE + 4), "0" (__sc0), "r" (__sc4), \ + "r" (__sc5), "r" (__sc6), \ "r" (__sc7) \ : "memory" ); \ __syscall_return(type,__sc0); \ @@ -104,18 +109,19 @@ register long __sc5 __asm__ ("r5") = (long) arg2; \ register long __sc6 __asm__ ("r6") = (long) arg3; \ register long __sc7 __asm__ ("r7") = (long) arg4; \ register long __sc0 __asm__ ("r0") = (long) arg5; \ -__asm__ __volatile__ ("trapa #0x15" \ +__asm__ __volatile__ ("trapa %1" \ : "=z" (__sc0) \ - : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \ - "r" (__sc3) \ + : "i" (__SH_SYSCALL_TRAP_BASE + 5), "0" (__sc0), "r" (__sc4), \ + "r" (__sc5), "r" (__sc6), "r" (__sc7), "r" (__sc3) \ : "memory" ); \ __syscall_return(type,__sc0); \ } -/* Add in _syscall6 which is not in the kernel header */ #ifndef __SH_SYSCALL6_TRAPA -# define __SH_SYSCALL6_TRAPA "0x16" +#define __SH_SYSCALL6_TRAPA __SH_SYSCALL_TRAP_BASE + 6 #endif + +/* Add in _syscall6 which is not in the kernel header */ #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) \ { \ @@ -126,10 +132,10 @@ register long __sc6 __asm__ ("r6") = (long) arg3; \ register long __sc7 __asm__ ("r7") = (long) arg4; \ register long __sc0 __asm__ ("r0") = (long) arg5; \ register long __sc1 __asm__ ("r1") = (long) arg6; \ -__asm__ __volatile__ ("trapa #" __SH_SYSCALL6_TRAPA \ +__asm__ __volatile__ ("trapa %1" \ : "=z" (__sc0) \ - : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \ - "r" (__sc3), "r" (__sc1) \ + : "i" (__SH_SYSCALL6_TRAPA), "0" (__sc0), "r" (__sc4), \ + "r" (__sc5), "r" (__sc6), "r" (__sc7), "r" (__sc3), "r" (__sc1) \ : "memory" ); \ __syscall_return(type,__sc0); \ } diff --git a/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h b/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h index 7b9a0efbb..e2b480e75 100644 --- a/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h +++ b/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h @@ -6,9 +6,9 @@ #define _BITS_UCLIBC_ARCH_FEATURES_H /* instruction used when calling abort() to kill yourself */ -#if defined(__sh2__) +#if defined(__CONFIG_SH2__) # define __UCLIBC_ABORT_INSTRUCTION__ "trapa #32" -#else /* defined(__sh__) */ +#else # define __UCLIBC_ABORT_INSTRUCTION__ "trapa #0xff" #endif diff --git a/libc/sysdeps/linux/sh/clone.S b/libc/sysdeps/linux/sh/clone.S index 1806313e0..dec05a2c7 100644 --- a/libc/sysdeps/linux/sh/clone.S +++ b/libc/sysdeps/linux/sh/clone.S @@ -23,6 +23,8 @@ #include <asm/unistd.h> #define _ERRNO_H 1 #include <bits/errno.h> +#define _SYSCALL_H +#include <bits/sysnum.h> #ifdef __HAVE_SHARED__ @@ -59,9 +61,9 @@ clone: /* do the system call */ mov r6, r4 - trapa #0x12 + trapa #(__SH_SYSCALL_TRAP_BASE + 2) mov r0, r1 -#ifdef __sh2__ +#ifdef __CONFIG_SH2__ // 12 arithmetic shifts for the crappy sh2, because shad doesn't exist! shar r1 shar r1 diff --git a/libc/sysdeps/linux/sh/crti.S b/libc/sysdeps/linux/sh/crti.S index 349613ab1..43ba28583 100644 --- a/libc/sysdeps/linux/sh/crti.S +++ b/libc/sysdeps/linux/sh/crti.S @@ -8,20 +8,21 @@ .type _init, @function _init: mov.l r12,@-r15 - mova .L6,r0 mov.l r14,@-r15 sts.l pr,@-r15 +#ifndef __HAVE_SHARED__ + mova .L6,r0 mov.l .L6,r12 - mov r15,r14 add r0,r12 - - - +#endif + mov r15,r14 bra 1f nop .align 2 +#ifndef __HAVE_SHARED__ .L6: .long _GLOBAL_OFFSET_TABLE_ +#endif 1: .section .fini @@ -31,19 +32,22 @@ _init: .type _fini, @function _fini: mov.l r12,@-r15 - mova .L11,r0 mov.l r14,@-r15 sts.l pr,@-r15 - mov.l .L11,r12 mov r15,r14 +#ifndef __HAVE_SHARED__ + mov.l .L11,r12 + mova .L11,r0 add r0,r12 - - +#endif + bra 1f nop .align 2 +#ifndef __HAVE_SHARED__ .L11: .long _GLOBAL_OFFSET_TABLE_ +#endif 1: .ident "GCC: (GNU) 3.3.2" diff --git a/libc/sysdeps/linux/sh/mmap.c b/libc/sysdeps/linux/sh/mmap.c index 6bc45e939..e711b0ff8 100644 --- a/libc/sysdeps/linux/sh/mmap.c +++ b/libc/sysdeps/linux/sh/mmap.c @@ -26,9 +26,7 @@ libc_hidden_proto(mmap) #ifdef HIOS -# define __SH_SYSCALL6_TRAPA "0x2E" -#else -# define __SH_SYSCALL6_TRAPA "0x15" +# define __SH_SYSCALL6_TRAPA 0x2E #endif #include <sys/syscall.h> diff --git a/libc/sysdeps/linux/sh/pipe.c b/libc/sysdeps/linux/sh/pipe.c index 167db8903..432a5bc03 100644 --- a/libc/sysdeps/linux/sh/pipe.c +++ b/libc/sysdeps/linux/sh/pipe.c @@ -20,12 +20,13 @@ int pipe(int *fd) __asm__ __volatile__ ( "mov %2, r3;" "mov %3, r4;" - "trapa #0x13;" + "trapa %4;" "mov r1, %1;" : "=z" (__res), "=r" ((long) __res2) : "r" ((long) __NR_pipe), - "r" ((long) fd) + "r" ((long) fd), + "i" (__SH_SYSCALL_TRAP_BASE + 3) : "cc", "memory", "r1", "r3", "r4"); if ((unsigned long)(__res) >= (unsigned long)(-125)) { int __err = -(__res); diff --git a/libc/sysdeps/linux/sh/pread_write.c b/libc/sysdeps/linux/sh/pread_write.c index dc756d647..9cc4bbf97 100644 --- a/libc/sysdeps/linux/sh/pread_write.c +++ b/libc/sysdeps/linux/sh/pread_write.c @@ -12,7 +12,7 @@ * from GNU libc 2.2.5, but reworked considerably... */ -#include "../common/syscalls.h" +#include <sys/syscall.h> #include <unistd.h> #include <stdint.h> diff --git a/libc/sysdeps/linux/sh/syscall.c b/libc/sysdeps/linux/sh/syscall.c index 5369cd5e4..ba187c9b7 100644 --- a/libc/sysdeps/linux/sh/syscall.c +++ b/libc/sysdeps/linux/sh/syscall.c @@ -16,9 +16,11 @@ register long __sc6 __asm__ ("r6") = (long) arg3; register long __sc7 __asm__ ("r7") = (long) arg4; register long __sc0 __asm__ ("r0") = (long) arg5; register long __sc1 __asm__ ("r1") = (long) arg6; -__asm__ __volatile__ ("trapa #0x16" \ +__asm__ __volatile__ ( + "trapa %1" : "=z" (__sc0) \ - : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \ + : "i" (__SH_SYSCALL_TRAP_BASE + 6), + "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \ "r" (__sc3), "r" (__sc1) \ : "memory" ); __syscall_return(long,__sc0); diff --git a/libc/sysdeps/linux/sh/vfork.S b/libc/sysdeps/linux/sh/vfork.S index d9840946f..5d7e51dd5 100644 --- a/libc/sysdeps/linux/sh/vfork.S +++ b/libc/sysdeps/linux/sh/vfork.S @@ -25,6 +25,7 @@ #include <bits/sysnum.h> #define _ERRNO_H 1 #include <bits/errno.h> +#include <bits/sysnum.h> /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is @@ -39,9 +40,9 @@ __vfork: mov.w .L2, r3 - trapa #0x10 + trapa #__SH_SYSCALL_TRAP_BASE mov r0, r1 -#ifdef __sh2__ +#ifdef __CONFIG_SH2__ // 12 arithmetic shifts for the crappy sh2, because shad doesn't exist! shar r1 shar r1 @@ -70,9 +71,9 @@ __vfork: /* If we don't have vfork, use fork. */ mov.w .L3, r3 - trapa #0x10 + trapa #__SH_SYSCALL_TRAP_BASE mov r0, r1 -#ifdef __sh2__ +#ifdef __CONFIG_SH2__ // 12 arithmetic shifts for the crappy sh2, because shad doesn't exist! shar r1 shar r1 diff --git a/libc/sysdeps/linux/sh64/bits/kernel_stat.h b/libc/sysdeps/linux/sh64/bits/kernel_stat.h index 036448e6d..cde7bc880 100644 --- a/libc/sysdeps/linux/sh64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/sh64/bits/kernel_stat.h @@ -3,6 +3,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + struct kernel_stat { unsigned short st_dev; unsigned short __pad1; diff --git a/libc/sysdeps/linux/sh64/bits/syscalls.h b/libc/sysdeps/linux/sh64/bits/syscalls.h index 9b4efc2e5..84877d042 100644 --- a/libc/sysdeps/linux/sh64/bits/syscalls.h +++ b/libc/sysdeps/linux/sh64/bits/syscalls.h @@ -4,11 +4,6 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -/* 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 __ASSEMBLER__ #include <errno.h> diff --git a/libc/sysdeps/linux/sparc/bits/fcntl.h b/libc/sysdeps/linux/sparc/bits/fcntl.h index 5314a5240..cb4e6a8c8 100644 --- a/libc/sysdeps/linux/sparc/bits/fcntl.h +++ b/libc/sysdeps/linux/sparc/bits/fcntl.h @@ -217,13 +217,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -240,6 +241,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/sparc/bits/kernel_stat.h b/libc/sysdeps/linux/sparc/bits/kernel_stat.h index 2f6e13d66..ac167fadd 100644 --- a/libc/sysdeps/linux/sparc/bits/kernel_stat.h +++ b/libc/sysdeps/linux/sparc/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/sparc/bits/syscalls.h b/libc/sysdeps/linux/sparc/bits/syscalls.h index b0f953972..9065b0042 100644 --- a/libc/sysdeps/linux/sparc/bits/syscalls.h +++ b/libc/sysdeps/linux/sparc/bits/syscalls.h @@ -6,11 +6,6 @@ #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. */ -#include <bits/sysnum.h> - #ifndef __ASSEMBLER__ #include <errno.h> diff --git a/libc/sysdeps/linux/v850/bits/kernel_stat.h b/libc/sysdeps/linux/v850/bits/kernel_stat.h index 5e55ed01d..02343ed48 100644 --- a/libc/sysdeps/linux/v850/bits/kernel_stat.h +++ b/libc/sysdeps/linux/v850/bits/kernel_stat.h @@ -3,6 +3,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + struct kernel_stat { __kernel_dev_t st_dev; diff --git a/libc/sysdeps/linux/v850/bits/syscalls.h b/libc/sysdeps/linux/v850/bits/syscalls.h index 62541b873..b21851333 100644 --- a/libc/sysdeps/linux/v850/bits/syscalls.h +++ b/libc/sysdeps/linux/v850/bits/syscalls.h @@ -8,12 +8,8 @@ /* Do something very evil for now. Until we create our own syscall * macros, short circuit bits/sysnum.h and use asm/unistd.h instead */ +#warning "fixme -- add arch specific syscall macros.h" #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 */ diff --git a/libc/sysdeps/linux/vax/bits/fcntl.h b/libc/sysdeps/linux/vax/bits/fcntl.h index be3e6cc4f..fb72b21fa 100644 --- a/libc/sysdeps/linux/vax/bits/fcntl.h +++ b/libc/sysdeps/linux/vax/bits/fcntl.h @@ -167,13 +167,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -190,6 +191,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/vax/bits/kernel_stat.h b/libc/sysdeps/linux/vax/bits/kernel_stat.h index ece9d347b..2b5cb28f2 100644 --- a/libc/sysdeps/linux/vax/bits/kernel_stat.h +++ b/libc/sysdeps/linux/vax/bits/kernel_stat.h @@ -1,6 +1,10 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + /* This file provides whatever this particular arch's kernel thinks * struct stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/vax/bits/syscalls.h b/libc/sysdeps/linux/vax/bits/syscalls.h index f80b40539..101aacb2e 100644 --- a/libc/sysdeps/linux/vax/bits/syscalls.h +++ b/libc/sysdeps/linux/vax/bits/syscalls.h @@ -4,11 +4,6 @@ # error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead." #endif -/* 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 __ASSEMBLER__ #include <errno.h> diff --git a/libc/sysdeps/linux/x86_64/bits/fcntl.h b/libc/sysdeps/linux/x86_64/bits/fcntl.h index f69bcf60e..7114eb87e 100644 --- a/libc/sysdeps/linux/x86_64/bits/fcntl.h +++ b/libc/sysdeps/linux/x86_64/bits/fcntl.h @@ -212,13 +212,14 @@ struct flock64 __BEGIN_DECLS -#if 0 /*def __USE_GNU*/ +#ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; +#if 0 /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); @@ -235,6 +236,7 @@ extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) /* In-kernel implementation of tee for pipe buffers. */ extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) __THROW; +#endif #endif diff --git a/libc/sysdeps/linux/x86_64/bits/kernel_stat.h b/libc/sysdeps/linux/x86_64/bits/kernel_stat.h index 84125b917..a2af2cd37 100644 --- a/libc/sysdeps/linux/x86_64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/x86_64/bits/kernel_stat.h @@ -4,6 +4,10 @@ #ifndef _ASM_X86_64_STAT_H #define _ASM_X86_64_STAT_H +#ifndef _LIBC +#error bits/kernel_stat.h is for internal uClibc use only! +#endif + #define STAT_HAVE_NSEC 1 struct kernel_stat { diff --git a/libc/sysdeps/linux/x86_64/bits/syscalls.h b/libc/sysdeps/linux/x86_64/bits/syscalls.h index afd97c0b0..d31304430 100644 --- a/libc/sysdeps/linux/x86_64/bits/syscalls.h +++ b/libc/sysdeps/linux/x86_64/bits/syscalls.h @@ -4,11 +4,6 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -/* 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> - /* Some of the sneaky macros in the code were taken from glibc-2.2.5/sysdeps/unix/sysv/linux/x86_64/sysdep.h |