summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO34
-rw-r--r--docs/PORTING2
-rw-r--r--extra/Configs/Config.arm28
-rw-r--r--extra/Configs/Config.bfin2
-rw-r--r--ldso/ldso/arm/dl-syscalls.h35
-rw-r--r--ldso/ldso/arm/dl-sysdep.h60
-rw-r--r--ldso/ldso/arm/elfinterp.c4
-rw-r--r--ldso/ldso/arm/resolve.S187
-rw-r--r--libc/sysdeps/linux/alpha/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/alpha/bits/kernel_stat.h32
-rw-r--r--libc/sysdeps/linux/alpha/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/arm/Makefile.arch2
-rw-r--r--libc/sysdeps/linux/arm/__longjmp.S10
-rw-r--r--libc/sysdeps/linux/arm/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/arm/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/arm/bits/setjmp.h2
-rw-r--r--libc/sysdeps/linux/arm/bits/syscalls.h69
-rw-r--r--libc/sysdeps/linux/arm/crti.S90
-rw-r--r--libc/sysdeps/linux/arm/crtn.S25
-rw-r--r--libc/sysdeps/linux/arm/setjmp.S10
-rw-r--r--libc/sysdeps/linux/bfin/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/bfin/bits/huge_val.h67
-rw-r--r--libc/sysdeps/linux/bfin/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/bfin/bits/mman.h2
-rw-r--r--libc/sysdeps/linux/bfin/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/bfin/crt1.S53
-rw-r--r--libc/sysdeps/linux/cris/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/cris/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/cris/bits/syscalls.h3
-rw-r--r--libc/sysdeps/linux/cris/sysdep.S9
-rw-r--r--libc/sysdeps/linux/e1/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/e1/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/frv/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/frv/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/frv/fstat.c2
-rw-r--r--libc/sysdeps/linux/frv/fstat64.c2
-rw-r--r--libc/sysdeps/linux/frv/lstat.c2
-rw-r--r--libc/sysdeps/linux/frv/lstat64.c2
-rw-r--r--libc/sysdeps/linux/frv/stat.c2
-rw-r--r--libc/sysdeps/linux/frv/stat64.c2
-rw-r--r--libc/sysdeps/linux/h8300/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/h8300/bits/syscalls.h6
-rw-r--r--libc/sysdeps/linux/hppa/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/hppa/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/hppa/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/hppa/clone.S2
-rw-r--r--libc/sysdeps/linux/i386/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/i386/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/i386/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/i960/bits/syscalls.h6
-rw-r--r--libc/sysdeps/linux/ia64/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/ia64/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/ia64/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/ia64/vfork.S4
-rw-r--r--libc/sysdeps/linux/m68k/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/m68k/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/m68k/bits/syscalls.h9
-rw-r--r--libc/sysdeps/linux/m68k/bits/uClibc_page.h6
-rw-r--r--libc/sysdeps/linux/m68k/bsd-setjmp.S4
-rw-r--r--libc/sysdeps/linux/m68k/clone.S11
-rw-r--r--libc/sysdeps/linux/m68k/crt1.S41
-rw-r--r--libc/sysdeps/linux/m68k/crti.S22
-rw-r--r--libc/sysdeps/linux/m68k/crtn.S27
-rw-r--r--libc/sysdeps/linux/m68k/setjmp.S4
-rw-r--r--libc/sysdeps/linux/microblaze/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/microblaze/bits/syscalls.h6
-rw-r--r--libc/sysdeps/linux/nios/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/nios/bits/syscalls.h1
-rw-r--r--libc/sysdeps/linux/nios2/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/nios2/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/nios2/bits/syscalls.h6
-rw-r--r--libc/sysdeps/linux/powerpc/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/powerpc/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/powerpc/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/powerpc/pread_write.c2
-rw-r--r--libc/sysdeps/linux/sh/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/sh/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/sh/bits/syscalls.h50
-rw-r--r--libc/sysdeps/linux/sh/bits/uClibc_arch_features.h4
-rw-r--r--libc/sysdeps/linux/sh/clone.S6
-rw-r--r--libc/sysdeps/linux/sh/crti.S22
-rw-r--r--libc/sysdeps/linux/sh/mmap.c4
-rw-r--r--libc/sysdeps/linux/sh/pipe.c5
-rw-r--r--libc/sysdeps/linux/sh/pread_write.c2
-rw-r--r--libc/sysdeps/linux/sh/syscall.c6
-rw-r--r--libc/sysdeps/linux/sh/vfork.S9
-rw-r--r--libc/sysdeps/linux/sh64/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/sh64/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/sparc/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/sparc/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/sparc/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/v850/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/v850/bits/syscalls.h6
-rw-r--r--libc/sysdeps/linux/vax/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/vax/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/vax/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/x86_64/bits/fcntl.h4
-rw-r--r--libc/sysdeps/linux/x86_64/bits/kernel_stat.h4
-rw-r--r--libc/sysdeps/linux/x86_64/bits/syscalls.h5
-rw-r--r--libpthread/linuxthreads.old/Makefile.in5
-rw-r--r--libpthread/linuxthreads.old/cancel.c46
-rw-r--r--libpthread/linuxthreads.old/condvar.c8
-rw-r--r--libpthread/linuxthreads.old/debug.h16
-rw-r--r--libpthread/linuxthreads.old/internals.h16
-rw-r--r--libpthread/linuxthreads.old/join.c21
-rw-r--r--libpthread/linuxthreads.old/manager.c5
-rw-r--r--libpthread/linuxthreads.old/oldsemaphore.c2
-rw-r--r--libpthread/linuxthreads.old/pthread.c2
-rw-r--r--libpthread/linuxthreads.old/ptlongjmp.c21
-rw-r--r--libpthread/linuxthreads.old/queue.h1
-rw-r--r--libpthread/linuxthreads.old/semaphore.c8
-rw-r--r--libpthread/linuxthreads.old/spinlock.c2
-rw-r--r--libpthread/linuxthreads.old/sysdeps/pthread/pthread.h3
-rw-r--r--libpthread/linuxthreads.old/wrapsyscall.c2
-rw-r--r--libpthread/linuxthreads/sysdeps/pthread/pthread.h3
115 files changed, 878 insertions, 488 deletions
diff --git a/TODO b/TODO
index 3674855c1..fbac20901 100644
--- a/TODO
+++ b/TODO
@@ -1,30 +1,44 @@
TODO list for every uClibc release:
-------------------------------------------------
+ *) Test cris, i386, mips, mipsel, sh, x86_64, arm, armeb, and powerpc
+ with the latest LTP testsuite. Fix any regressions and post LTP
+ testsuite results for each architecture on uclibc.org.
*) Audit header files. Remove prototypes for all functions that
are not supported -- especially needed for the libm headers.
*) Audit header files. When options are disabled, also disable
them in the include files as well by checking for the proper
define from include/bits/uClibc_config.h (pulled in from features.h)
- *) Test cris, i386, mips, mipsel, sh, x86_64, arm, armeb, and powerpc
- with the latest LTP testsuite. Fix any regressions and post LTP
- testsuite results for each architecture on uclibc.org.
- *) Fix it so valgrind 2.4.0 no longer complains about the memory mmaped
- and used by ldso. Currently it whines on basically about virtually
- every function call when doing default lazy binding, which makes its
- output virtually useless due to the excess noise.
+
+
+
+General release feature sets:
+-------------------------------------------------
+.29 will be mostly as-is
+.30 will be the NPTL merge
+.31 for the no-kernel-headers fix, etc, etc.
+
TODO list for the uClibc 0.9.29 release:
-------------------------------------------------
+ *) as many of the arch-specific issues as possible
+ *) Remove N instances of libc_hidden_proto() from uClibc internals.
+ Instead add internal only header(s) defining all hidden prototypes.
+ This will avoid clutter and guarantee prototype consistancy.
+ *) The __is*_l() functions were all removed, such that we now only export
+ the is*_l() functions (no prefix). Before, we had the prefixed versions
+ for use by libstdc++ and weak versions without prefixes exported because
+ those functions belong to no std (unless you call glibc a std). This should
+ be fixed. Similar problems likely were created elsewhere.
*) misc stdio bugs:
http://bugs.uclibc.org/view.php?id=420
http://bugs.uclibc.org/view.php?id=539
*) bug in getopt handling:
http://bugs.uclibc.org/view.php?id=61
http://www.uclibc.org/lists/uclibc/2006-January/013851.html
- *) fold NPTL branch back into trunk
- *) as many of the arch-specific issues as possible
-
+ *) Should integrate test subdir better ... need to propagate CPU
+ CFLAGS/LDFLAGS to the build/link for target binaries so that when we have
+ a multilib toolchain, the proper ABI is selected.
TODO list for the uClibc 1.0.0 release:
diff --git a/docs/PORTING b/docs/PORTING
index 5c1a3989a..3c454ddb9 100644
--- a/docs/PORTING
+++ b/docs/PORTING
@@ -27,7 +27,7 @@ you are hacking on.
the funcion __uClibc_main() which takes these parameters:
__uClibc_main(main(), argc, argv, _init(), _fini())
Initially if you wish to make things easier on yourself, you can disable the
- UCLIBC_CTOR_DTOR option and just set those two arguments to NULL
+ UCLIBC_CTOR_DTOR option and just set the init/fini arguments to NULL.
glibc generally stores this function in libc/sysdeps/ARCH/elf/start.S
- create these additional files in ARCH/bits/
diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm
index 1b53cd61f..085a82abf 100644
--- a/extra/Configs/Config.arm
+++ b/extra/Configs/Config.arm
@@ -17,16 +17,24 @@ config ARCH_CFLAGS
config LIBGCC_CFLAGS
string
-config CONFIG_ARM_EABI
- bool "Use ARM EABI"
- default n
+choice
+ prompt "Target ABI"
+ default CONFIG_ARM_OABI
help
- If you choose "Y" here, functions and constants required by the
- ARM EABI will be built into the library. You should choose "Y"
+ If you choose "EABI" here, functions and constants required by the
+ ARM EABI will be built into the library. You should choose "EABI"
if your compiler uses the ARM EABI, in which case you will also
- need a kernel supporting the EABI system call interface, or "N"
+ need a kernel supporting the EABI system call interface, or "OABI"
for a compiler using the old Linux ABI.
+config CONFIG_ARM_OABI
+ bool "OABI"
+
+config CONFIG_ARM_EABI
+ bool "EABI"
+
+endchoice
+
config USE_BX
bool "Use BX in function return"
default y
@@ -85,6 +93,10 @@ config CONFIG_ARM926T
bool "Arm 926T"
select ARCH_HAS_MMU
+config CONFIG_ARM10T
+ bool "Arm 10T"
+ select ARCH_HAS_MMU
+
config CONFIG_ARM1136JF_S
bool "Arm 1136JF-S"
select ARCH_HAS_MMU
@@ -101,4 +113,8 @@ config CONFIG_ARM_XSCALE
bool "Intel Xscale"
select ARCH_HAS_MMU
+config CONFIG_ARM_IWMMXT
+ bool "Intel Xscale With WMMX PXA27x"
+ select ARCH_HAS_MMU
+
endchoice
diff --git a/extra/Configs/Config.bfin b/extra/Configs/Config.bfin
index 406bb3662..d61064f1e 100644
--- a/extra/Configs/Config.bfin
+++ b/extra/Configs/Config.bfin
@@ -11,7 +11,7 @@ config FORCE_OPTIONS_FOR_ARCH
default y
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_NO_MMU
- select ARCH_HAS_NO_LDSO
+ select UCLIBC_HAS_LFS
config ARCH_CFLAGS
string
diff --git a/ldso/ldso/arm/dl-syscalls.h b/ldso/ldso/arm/dl-syscalls.h
index 4b42a57e0..ecbe96a1c 100644
--- a/ldso/ldso/arm/dl-syscalls.h
+++ b/ldso/ldso/arm/dl-syscalls.h
@@ -4,4 +4,39 @@
extern int _dl_errno;
#undef __set_errno
#define __set_errno(X) {(_dl_errno) = (X);}
+/* _call_via_rX calls are used in thumb ldso because of calls via
+ * function pointers, but ldso is not linked with anything which
+ * provides them, so define them here (only required for thumb).
+ */
+#if defined(__thumb__)
+asm(
+ ".macro call_via register\n"
+ " .global _call_via_\\register\n"
+ " .hidden _call_via_\\register\n"
+ " .type _call_via_\\register, %function\n"
+ " .thumb_func\n"
+ "_call_via_\\register:\n"
+ " bx \\register\n"
+ " .size _call_via_\\register, . - _call_via_\\register\n"
+ ".endm\n"
+ ".text\n"
+ ".thumb\n"
+ ".align 1\n"
+ " call_via r0\n"
+ " call_via r1\n"
+ " call_via r2\n"
+ " call_via r3\n"
+ " call_via r4\n"
+ " call_via r5\n"
+ " call_via r6\n"
+ " call_via r7\n"
+ " call_via r8\n"
+ " call_via r9\n"
+ " call_via r10\n"
+ " call_via r11\n"
+ " call_via r12\n"
+ " call_via r13\n"
+ " call_via r14\n"
+);
+#endif
diff --git a/ldso/ldso/arm/dl-sysdep.h b/ldso/ldso/arm/dl-sysdep.h
index 5935738e1..c5ec891df 100644
--- a/ldso/ldso/arm/dl-sysdep.h
+++ b/ldso/ldso/arm/dl-sysdep.h
@@ -69,15 +69,39 @@ unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
| (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY))
/* Return the link-time address of _DYNAMIC. Conveniently, this is the
- first element of the GOT. This must be inlined in a function which
- uses global data. */
+ first element of the GOT. We used to use the PIC register to do this
+ without a constant pool reference, but GCC 4.2 will use a pseudo-register
+ for the PIC base, so it may not be in r10. */
static inline Elf32_Addr __attribute__ ((unused))
elf_machine_dynamic (void)
{
- register Elf32_Addr *got asm ("r10");
- return *got;
-}
+ Elf32_Addr dynamic;
+#if !defined __thumb__
+ asm ("ldr %0, 2f\n"
+ "1: ldr %0, [pc, %0]\n"
+ "b 3f\n"
+ "2: .word _GLOBAL_OFFSET_TABLE_ - (1b+8)\n"
+ "3:" : "=r" (dynamic));
+#else
+ int tmp;
+ asm (".align 2\n"
+ "bx pc\n"
+ "nop\n"
+ ".arm\n"
+ "ldr %0, 2f\n"
+ "1: ldr %0, [pc, %0]\n"
+ "b 3f\n"
+ "2: .word _GLOBAL_OFFSET_TABLE_ - (1b+8)\n"
+ "3:"
+ ".align 2\n"
+ "orr %1, pc, #1\n"
+ "bx %1\n"
+ ".force_thumb\n"
+ : "=r" (dynamic), "=&r" (tmp));
+#endif
+ return dynamic;
+}
/* Return the run-time load address of the shared object. */
static inline Elf32_Addr __attribute__ ((unused))
@@ -86,24 +110,20 @@ elf_machine_load_address (void)
extern void __dl_start asm ("_dl_start");
Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
Elf32_Addr pcrel_addr;
-#if !defined __thumb__
+#if defined __OPTIMIZE__ && !defined __thumb__
asm ("adr %0, _dl_start" : "=r" (pcrel_addr));
#else
+ /* A simple adr does not work in Thumb mode because the offset is
+ negative, and for debug builds may be too large. */
int tmp;
- /* The above adr will not work on thumb because it
- * is negative. The only safe way is to temporarily
- * swap to arm.
- */
- asm( ".align 2\n"
- " bx pc\n"
- " nop \n"
- " .arm \n"
- " adr %0, _dl_start\n"
- " .align 2\n"
- " orr %1, pc, #1\n"
- " bx %1\n"
- " .force_thumb\n"
- : "=r" (pcrel_addr), "=&r" (tmp));
+ asm ("adr %1, 1f\n\t"
+ "ldr %0, [%1]\n\t"
+ "add %0, %0, %1\n\t"
+ "b 2f\n\t"
+ ".align 2\n\t"
+ "1: .word _dl_start - 1b\n\t"
+ "2:"
+ : "=r" (pcrel_addr), "=r" (tmp));
#endif
return pcrel_addr - got_addr;
}
diff --git a/ldso/ldso/arm/elfinterp.c b/ldso/ldso/arm/elfinterp.c
index 4ccfba769..37531126a 100644
--- a/ldso/ldso/arm/elfinterp.c
+++ b/ldso/ldso/arm/elfinterp.c
@@ -57,7 +57,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
rel_addr = (ELF_RELOC *) tpnt->dynamic_info[DT_JMPREL];
- this_reloc = rel_addr + (reloc_entry >> 3);
+ this_reloc = rel_addr + reloc_entry;
reloc_type = ELF32_R_TYPE(this_reloc->r_info);
symtab_index = ELF32_R_SYM(this_reloc->r_info);
@@ -85,7 +85,9 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
_dl_exit(1);
}
#if defined (__SUPPORT_LD_DEBUG__)
+#if !defined __SUPPORT_LD_DEBUG_EARLY__
if ((unsigned long) got_addr < 0x40000000)
+#endif
{
if (_dl_debug_bindings)
{
diff --git a/ldso/ldso/arm/resolve.S b/ldso/ldso/arm/resolve.S
index 8b51ed1c7..cbeb2232d 100644
--- a/ldso/ldso/arm/resolve.S
+++ b/ldso/ldso/arm/resolve.S
@@ -1,43 +1,168 @@
/*
- * This function is _not_ called directly. It is jumped to (so no return
- * address is on the stack) when attempting to use a symbol that has not yet
- * been resolved. The first time a jump symbol (such as a function call inside
- * a shared library) is used (before it gets resolved) it will jump here to
- * _dl_linux_resolve. When we get called the stack looks like this:
- * reloc_entry
- * tpnt
- *
- * This function saves all the registers, puts a copy of reloc_entry and tpnt
- * on the stack (as function arguments) then make the function call
- * _dl_linux_resolver(tpnt, reloc_entry). _dl_linux_resolver() figures out
- * where the jump symbol is _really_ supposed to have jumped to and returns
- * that to us. Once we have that, we overwrite tpnt with this fixed up
- * address. We then clean up after ourselves, put all the registers back how we
- * found them, then we jump to the fixed up address, which is where the jump
- * symbol that got us here really wanted to jump to in the first place.
- * -Erik Andersen
+ *
+ * add ip, pc, #0xNN00000
+ * add ip, ip, #0xNN000
+ * ldr pc, [ip, #0xNNN]!
+ *
+ * So that, effectively, causes the following to happen:
+ *
+ * ip : = pc+0x0NNNNNNN
+ * pc : = *ip
+ *
+ * For thumb the above fragment is preceded by "bx pc, nop" to switch to ARM
+ * mode and the thumb 'bl' must go to PLT-4 - the PLT entry is expanded by
+ * four bytes to accomodate the trampoline code.
+ *
+ * 0x0NNNNNNN is the offset of the GOT entry for this function relative to
+ * the PLT entry for this function (where the code is). So the code in the
+ * PLT causes a branch to whatever is in the GOT, leaving the actual address
+ * of the GOT entry in ip. (Note that the GOT must follow the PLT - the
+ * added value is 28 bit unsigned).
+ *
+ * ip is a pointer to the GOT entry for this function, the first time round
+ * *ip points to this code:
+ *
+ * str lr, [sp, #-4]! @ save lr
+ * ldr lr, [pc, #4] @ lr : = *dat (&GOT_TABLE[0]-.)
+ * add lr, pc, lr @ lr += &dat (so lr == &GOT_TABLE[0])
+ * ldr pc, [lr, #8]! @ pc : = GOT_TABLE[2]
+ *dat: *.long &GOT_TABLE[0] - .
+ *
+ * (this code is actually held in the first entry of the PLT). The code
+ * preserves lr then uses it as a scratch register (this preserves the ip
+ * value calculated above). GOT_TABLE[2] is initialized by INIT_GOT in
+ * dl-sysdep.h to point to _dl_linux_resolve - this function. The first
+ * three entries in the GOT are reserved, then they are followed by the
+ * entries for the PLT entries, in order.
+ *
+ * The linker initialises the following (non-reserved) GOT entries to
+ * the offset of the PLT with an associated relocation so that on load
+ * the entry is relocated to point to the PLT - the above code.
+ *
+ * The net effect of all this is that on the first call to an external (as
+ * yet unresolved) function all seven of the above instructions are
+ * executed in sequence and the program ends up executing _dl_linux_resolve
+ * with the following important values in registers:
+ *
+ * ip - a pointer to the GOT entry for the as yet unresolved function
+ * lr - &GOT_TABLE[2]
+ *
+ * GOT_TABLE[2] has already been initialised to _dl_linux_resolve, and
+ * GOT_TABLE[1] is a pointer to the (elf_resolve*) from INIT_GOT.
+ * _dl_linux_resolve unfrobnicates the ip and lr values to obtain arguments
+ * for a call to _dl_linux_resolver (not the additional 'r' on the end) -
+ * this is in elfinterp.c in this directory. The call takes arguments:
+ *
+ * _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
+ *
+ * And returns the address of the function, it also overwrites the GOT
+ * table entry so that the next time round only the first code fragment will
+ * be executed - it will call the function directly.
+ *
+ * [[Of course, this simply doesn't work on ARM 4T with a thumb target - because
+ * 4T did not do the thumb/arm change on ldr pc! It can be made to work by
+ * changing _dl_linux_resolver to return __%s_from_arm for an STT_TFUNC, but
+ * this hasn't been done, and there is no guarantee that the linker generated
+ * that glue anyway.]]
+ *
+ * _dl_linux_resolve gets the arguments to call the resolver as follows:
+ *
+ * tpnt *GOT_TABLE[1], [lr-4]
+ * reloc-entry &GOT-&GOT_TABLE[3], (ip - lr - 4)/4
+ *
+ * (I.e. 'GOT' means the table entry for this function, the thing for which
+ * ip holds the address.) The reloc-entry is passed as an index, since
+ * since the GOT table has 4 byte entries the code needs to divide this by 4
+ * to get the actual index.
+ *
+ * John Bowler, August 13, 2005 - determined by experiment and examination
+ * of generated ARM code (there was no documentation...)
+ *
+ * This code is all ARM code - not thumb - _dl_linux_resolver may, itself,
+ * be thumb, in which case the linker will insert the appropriate glue. A
+ * call from thumb to the PLT hits the trampoline code described above.
+ * This code (now) builds a proper stack frame.
+ *
+ * The code does *not* set sb (r9,v6) - to do that the basic PLT instructions
+ * would need to save sb and load the new value and that would require
+ * support in the linker since it generates those instructions. (Also note
+ * that linux/uclibc seems to be using r10 - sl - as a PIC base register - see
+ * dl-startup.c).
*/
-#define sl r10
-#define fp r11
-#define ip r12
+#include <sys/syscall.h>
+
+#include <features.h>
-.text
-.globl _dl_linux_resolve
-.type _dl_linux_resolve,%function
-.align 4;
+ .text
+ .align 4 @ 16 byte boundary and there are 32 bytes below (arm case)
+ #if !defined(__thumb__)
+ .arm
+ .globl _dl_linux_resolve
+ .type _dl_linux_resolve,%function
+ .align 4;
_dl_linux_resolve:
- stmdb sp!, {r0, r1, r2, r3, sl, fp}
- sub r1, ip, lr
- sub r1, r1, #4
- add r1, r1, r1
- ldr r0, [lr, #-4]
- mov r3,r0
+ @ _dl_linux_resolver is a standard subroutine call, therefore it
+ @ preserves everything except r0-r3 (a1-a4), ip and lr. This
+ @ function must branch to the real function, and that expects
+ @ r0-r3 and lr to be as they were before the whole PLT stuff -
+ @ ip can be trashed.
+ @ This routine is called after pushing lr, so we must push an odd
+ @ number of words to keep the stack correctly aligned.
+
+ stmdb sp!, {r0, r1, r2, r3, r4}
+ ldr r0, [lr, #-4] @ r0 : = [lr-4] (GOT_TABLE[1])
+ sub r1, lr, ip @ r1 : = (lr-ip) (a multple of 4)
+ mvn r1, r1, ASR #2 @ r1 : = ~((lr-ip)>>2), since -x = (1+~x)
+ @ ~x = -x-1, therefore ~(r1>>2) = (-((lr-ip)>>2)-1)
+ @ = - ((lr-ip)/4) - 1 = (ip - lr - 4)/4, as required
bl _dl_linux_resolver
mov ip, r0
- ldmia sp!, {r0, r1, r2, r3, sl, fp, lr}
+ ldmia sp!, {r0, r1, r2, r3, r4, lr}
+
+#if defined(__USE_BX__)
+ bx ip
+#else
mov pc,ip
+#endif
+#else
+ @ In the thumb case _dl_linux_resolver is thumb. If a bl is used
+ @ from arm code the linker will insert a stub call which, with
+ @ binutils 2.16, is not PIC. Since this code is accessed by an
+ @ ldr pc the reasonable fix is to make _dl_linux_resolve thumb too.
+ .thumb
+ .globl _dl_linux_resolve
+ .thumb_func
+ .type _dl_linux_resolve,%function
+ _dl_linux_resolve:
+ @ _dl_linux_resolver is a standard subroutine call, therefore it
+ @ preserves everything except r0-r3 (a1-a4), ip and lr. This
+ @ function must branch to the real function, and that expects
+ @ r0-r3 and lr to be as they were before the whole PLT stuff -
+ @ ip can be trashed.
+ @ This routine is called after pushing lr, so we must push an odd
+ @ number of words to keep the stack correctly aligned.
+ push {r0-r4}
+ mov r1, lr @ &GOT_TABLE[2]
+ sub r0, r1, #4
+ mov r2, ip @ &GOT[n]
+ ldr r0, [r0] @ r0 := GOT_TABLE[1]
+ @ for the function call r1 := n-3
+ sub r1, r2
+ asr r1, r1, #2
+ mvn r1, r1 @ exactly as in the arm code above
+ bl _dl_linux_resolver
+ @ r0 contains the branch address, the return address is above
+ @ the saved r0..r3
+ mov ip, r0
+ ldr r1, [sp, #20]
+ mov lr, r1
+ pop {r0-r4}
+ add sp, #4
+ bx ip
+
+#endif
.size _dl_linux_resolve, .-_dl_linux_resolve
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
diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in
index 6ebaa144b..9c152764f 100644
--- a/libpthread/linuxthreads.old/Makefile.in
+++ b/libpthread/linuxthreads.old/Makefile.in
@@ -11,11 +11,6 @@ CFLAGS-linuxthreads.old := $(CFLAGS-dir_linuxthreads.old) $(SSP_ALL_CFLAGS)
CFLAGS-libpthread/linuxthreads.old/sysdeps/$(TARGET_ARCH)/ := $(CFLAGS-linuxthreads.old)
-# This stuff will not compile without at least -O1
-# psm: can't handle this here, could maybe search for -O0 in CFLAGS
-# and append -O1 if found
-#CFLAGS:=$(CFLAGS:-O0=-O1)
-
ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -z defs
else
diff --git a/libpthread/linuxthreads.old/cancel.c b/libpthread/linuxthreads.old/cancel.c
index 1356348a7..ac66c5855 100644
--- a/libpthread/linuxthreads.old/cancel.c
+++ b/libpthread/linuxthreads.old/cancel.c
@@ -25,6 +25,17 @@
#include <rpc/rpc.h>
extern void __rpc_thread_destroy(void);
#endif
+#include <bits/stackinfo.h>
+
+#include <stdio.h>
+
+#ifdef _STACK_GROWS_DOWN
+# define FRAME_LEFT(frame, other) ((char *) frame >= (char *) other)
+#elif _STACK_GROWS_UP
+# define FRAME_LEFT(frame, other) ((char *) frame <= (char *) other)
+#else
+# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+#endif
int pthread_setcancelstate(int state, int * oldstate)
@@ -37,7 +48,7 @@ int pthread_setcancelstate(int state, int * oldstate)
if (THREAD_GETMEM(self, p_canceled) &&
THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE &&
THREAD_GETMEM(self, p_canceltype) == PTHREAD_CANCEL_ASYNCHRONOUS)
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
return 0;
}
@@ -51,7 +62,7 @@ int pthread_setcanceltype(int type, int * oldtype)
if (THREAD_GETMEM(self, p_canceled) &&
THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE &&
THREAD_GETMEM(self, p_canceltype) == PTHREAD_CANCEL_ASYNCHRONOUS)
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
return 0;
}
@@ -62,6 +73,7 @@ int pthread_cancel(pthread_t thread)
int dorestart = 0;
pthread_descr th;
pthread_extricate_if *pextricate;
+ int already_canceled;
__pthread_lock(&handle->h_lock, NULL);
if (invalid_handle(handle, thread)) {
@@ -71,13 +83,15 @@ int pthread_cancel(pthread_t thread)
th = handle->h_descr;
- if (th->p_canceled) {
+ already_canceled = th->p_canceled;
+ th->p_canceled = 1;
+
+ if (th->p_cancelstate == PTHREAD_CANCEL_DISABLE || already_canceled) {
__pthread_unlock(&handle->h_lock);
return 0;
}
pextricate = th->p_extricate;
- th->p_canceled = 1;
pid = th->p_pid;
/* If the thread has registered an extrication interface, then
@@ -115,7 +129,7 @@ void pthread_testcancel(void)
pthread_descr self = thread_self();
if (THREAD_GETMEM(self, p_canceled)
&& THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE)
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
void _pthread_cleanup_push(struct _pthread_cleanup_buffer * buffer,
@@ -125,6 +139,8 @@ void _pthread_cleanup_push(struct _pthread_cleanup_buffer * buffer,
buffer->__routine = routine;
buffer->__arg = arg;
buffer->__prev = THREAD_GETMEM(self, p_cleanup);
+ if (buffer->__prev != NULL && FRAME_LEFT (buffer, buffer->__prev))
+ buffer->__prev = NULL;
THREAD_SETMEM(self, p_cleanup, buffer);
}
@@ -144,6 +160,8 @@ void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer * buffer,
buffer->__arg = arg;
buffer->__canceltype = THREAD_GETMEM(self, p_canceltype);
buffer->__prev = THREAD_GETMEM(self, p_cleanup);
+ if (buffer->__prev != NULL && FRAME_LEFT (buffer, buffer->__prev))
+ buffer->__prev = NULL;
THREAD_SETMEM(self, p_canceltype, PTHREAD_CANCEL_DEFERRED);
THREAD_SETMEM(self, p_cleanup, buffer);
}
@@ -158,15 +176,27 @@ void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer * buffer,
if (THREAD_GETMEM(self, p_canceled) &&
THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE &&
THREAD_GETMEM(self, p_canceltype) == PTHREAD_CANCEL_ASYNCHRONOUS)
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
-void __pthread_perform_cleanup(void)
+void __pthread_perform_cleanup(char *currentframe)
{
pthread_descr self = thread_self();
struct _pthread_cleanup_buffer * c;
+
for (c = THREAD_GETMEM(self, p_cleanup); c != NULL; c = c->__prev)
- c->__routine(c->__arg);
+ {
+#if _STACK_GROWS_DOWN
+ if ((char *) c <= currentframe)
+ break;
+#elif _STACK_GROWS_UP
+ if ((char *) c >= currentframe)
+ break;
+#else
+# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+#endif
+ c->__routine(c->__arg);
+ }
#ifdef __UCLIBC_HAS_RPC__
/* And the TSD which needs special help. */
diff --git a/libpthread/linuxthreads.old/condvar.c b/libpthread/linuxthreads.old/condvar.c
index 62df907c1..3d77f781a 100644
--- a/libpthread/linuxthreads.old/condvar.c
+++ b/libpthread/linuxthreads.old/condvar.c
@@ -93,7 +93,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
if (already_canceled) {
__pthread_set_own_extricate_if(self, 0);
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
__pthread_mutex_unlock(mutex);
@@ -122,7 +122,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
&& THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) {
THREAD_SETMEM(self, p_woken_by_cancel, 0);
__pthread_mutex_lock(mutex);
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
/* Put back any resumes we caught that don't belong to us. */
@@ -168,7 +168,7 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond,
if (already_canceled) {
__pthread_set_own_extricate_if(self, 0);
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
__pthread_mutex_unlock(mutex);
@@ -216,7 +216,7 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond,
&& THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) {
THREAD_SETMEM(self, p_woken_by_cancel, 0);
__pthread_mutex_lock(mutex);
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
/* Put back any resumes we caught that don't belong to us. */
diff --git a/libpthread/linuxthreads.old/debug.h b/libpthread/linuxthreads.old/debug.h
index a2ac5113a..94b7c084b 100644
--- a/libpthread/linuxthreads.old/debug.h
+++ b/libpthread/linuxthreads.old/debug.h
@@ -29,9 +29,6 @@
# define DEBUG_PT
#endif
-/* include asserts for now */
-#define DO_ASSERT
-
/* define the PDEBUG macro here */
#undef PDEBUG
#ifdef DEBUG_PT
@@ -40,17 +37,4 @@
# define PDEBUG(fmt, args...) /* debug switched off */
#endif
-/* nothing; placeholder to disable a PDEBUG message but don't delete it */
-#undef PDEBUGG
-#define PDEBUGG(fmt, args...)
-
-/* Define ASSERT to stop/warn. Should be void in production code */
-#undef ASSERT
-#ifdef DO_ASSERT
-# define ASSERT(x) if (!(x)) fprintf(stderr, "pt: assertion failed in %s:%i.\n",\
- __FILE__, __LINE__)
-#else
-# define ASSERT(x)
-#endif
-
#endif /* _PT_DEBUG_H */
diff --git a/libpthread/linuxthreads.old/internals.h b/libpthread/linuxthreads.old/internals.h
index 17b724e64..ab227d6cc 100644
--- a/libpthread/linuxthreads.old/internals.h
+++ b/libpthread/linuxthreads.old/internals.h
@@ -24,6 +24,7 @@
#include <setjmp.h>
#include <signal.h>
#include <unistd.h>
+#include <bits/stackinfo.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "pt-machine.h"
@@ -445,21 +446,12 @@ static inline pthread_descr thread_self (void)
extern int __libc_multiple_threads attribute_hidden;
extern int __librt_multiple_threads;
-/* Debugging */
-
-#ifdef DEBUG
-#include <assert.h>
-#define ASSERT assert
-#define MSG __pthread_message
-#else
-#define ASSERT(x)
-#define MSG(msg,arg...)
-#endif
-
/* Internal global functions */
+void __pthread_do_exit (void *retval, char *currentframe)
+ __attribute__ ((__noreturn__));
void __pthread_destroy_specifics(void);
-void __pthread_perform_cleanup(void);
+void __pthread_perform_cleanup(char *currentframe);
int __pthread_initialize_manager(void);
void __pthread_message(char * fmt, ...);
int __pthread_manager(void *reqfd);
diff --git a/libpthread/linuxthreads.old/join.c b/libpthread/linuxthreads.old/join.c
index 6a8a9d982..4bdc77a25 100644
--- a/libpthread/linuxthreads.old/join.c
+++ b/libpthread/linuxthreads.old/join.c
@@ -27,16 +27,25 @@
void pthread_exit(void * retval)
{
+ __pthread_do_exit (retval, CURRENT_STACK_FRAME);
+}
+
+void __pthread_do_exit(void *retval, char *currentframe)
+{
pthread_descr self = thread_self();
pthread_descr joining;
struct pthread_request request;
PDEBUG("self=%p, pid=%d\n", self, self->p_pid);
- /* Reset the cancellation flag to avoid looping if the cleanup handlers
- contain cancellation points */
- THREAD_SETMEM(self, p_canceled, 0);
+ /* obey POSIX behavior and prevent cancellation functions from
+ * being called more than once.
+ * http://sourceware.org/ml/libc-ports/2006-10/msg00043.html
+ */
+ THREAD_SETMEM(self, p_cancelstate, PTHREAD_CANCEL_DISABLE);
+ THREAD_SETMEM(self, p_canceltype, PTHREAD_CANCEL_DEFERRED);
+
/* Call cleanup functions and destroy the thread-specific data */
- __pthread_perform_cleanup();
+ __pthread_perform_cleanup(currentframe);
__pthread_destroy_specifics();
/* Store return value */
__pthread_lock(THREAD_GETMEM(self, p_lock), self);
@@ -150,7 +159,7 @@ int pthread_join(pthread_t thread_id, void ** thread_return)
if (already_canceled) {
__pthread_set_own_extricate_if(self, 0);
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
PDEBUG("before suspend\n");
@@ -163,7 +172,7 @@ int pthread_join(pthread_t thread_id, void ** thread_return)
if (THREAD_GETMEM(self, p_woken_by_cancel)
&& THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) {
THREAD_SETMEM(self, p_woken_by_cancel, 0);
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
__pthread_lock(&handle->h_lock, self);
}
diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c
index e57080d17..cad2aacdf 100644
--- a/libpthread/linuxthreads.old/manager.c
+++ b/libpthread/linuxthreads.old/manager.c
@@ -148,7 +148,6 @@ int attribute_noreturn __pthread_manager(void *arg)
/* Synchronize debugging of the thread manager */
n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request,
sizeof(request)));
- ASSERT(n == sizeof(request) && request.req_kind == REQ_DEBUG);
#ifndef USE_SELECT
ufd.fd = reqfd;
ufd.events = POLLIN;
@@ -187,7 +186,6 @@ int attribute_noreturn __pthread_manager(void *arg)
PDEBUG("before __libc_read\n");
n = __libc_read(reqfd, (char *)&request, sizeof(request));
PDEBUG("after __libc_read, n=%d\n", n);
- ASSERT(n == sizeof(request));
switch(request.req_kind) {
case REQ_CREATE:
PDEBUG("got REQ_CREATE\n");
@@ -311,7 +309,7 @@ pthread_start_thread(void *arg)
outcome = self->p_start_args.start_routine(THREAD_GETMEM(self,
p_start_args.arg));
/* Exit with the given return value */
- pthread_exit(outcome);
+ __pthread_do_exit(outcome, CURRENT_STACK_FRAME);
}
static int
@@ -698,7 +696,6 @@ static void pthread_free(pthread_descr th)
pthread_readlock_info *iter, *next;
char *h_bottom_save;
- ASSERT(th->p_exited);
/* Make the handle invalid */
handle = thread_handle(th->p_tid);
__pthread_lock(&handle->h_lock, NULL);
diff --git a/libpthread/linuxthreads.old/oldsemaphore.c b/libpthread/linuxthreads.old/oldsemaphore.c
index 6e91dc3c7..178affa1b 100644
--- a/libpthread/linuxthreads.old/oldsemaphore.c
+++ b/libpthread/linuxthreads.old/oldsemaphore.c
@@ -136,7 +136,7 @@ int __old_sem_wait(old_sem_t * sem)
}
}
}
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
}
}
diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c
index d9adfa432..2efb4d2d4 100644
--- a/libpthread/linuxthreads.old/pthread.c
+++ b/libpthread/linuxthreads.old/pthread.c
@@ -819,7 +819,7 @@ static void pthread_handle_sigcancel(int sig)
if (__builtin_expect (THREAD_GETMEM(self, p_canceled), 0)
&& THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) {
if (THREAD_GETMEM(self, p_canceltype) == PTHREAD_CANCEL_ASYNCHRONOUS)
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
jmpbuf = THREAD_GETMEM(self, p_cancel_jmp);
if (jmpbuf != NULL) {
THREAD_SETMEM(self, p_cancel_jmp, NULL);
diff --git a/libpthread/linuxthreads.old/ptlongjmp.c b/libpthread/linuxthreads.old/ptlongjmp.c
index 055a217d3..b3ff2746f 100644
--- a/libpthread/linuxthreads.old/ptlongjmp.c
+++ b/libpthread/linuxthreads.old/ptlongjmp.c
@@ -18,6 +18,7 @@
#include <setjmp.h>
#include "pthread.h"
#include "internals.h"
+#include <bits/stackinfo.h>
/* These functions are not declared anywhere since they shouldn't be
used at another place but here. */
@@ -28,11 +29,29 @@ static void pthread_cleanup_upto(__jmp_buf target)
{
pthread_descr self = thread_self();
struct _pthread_cleanup_buffer * c;
+ char *currentframe = CURRENT_STACK_FRAME;
for (c = THREAD_GETMEM(self, p_cleanup);
c != NULL && _JMPBUF_UNWINDS(target, c);
c = c->__prev)
- c->__routine(c->__arg);
+ {
+#if _STACK_GROWS_DOWN
+ if ((char *) c <= currentframe)
+ {
+ c = NULL;
+ break;
+ }
+#elif _STACK_GROWS_UP
+ if ((char *) c >= currentframe)
+ {
+ c = NULL;
+ break;
+ }
+#else
+# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+#endif
+ c->__routine(c->__arg);
+ }
THREAD_SETMEM(self, p_cleanup, c);
if (THREAD_GETMEM(self, p_in_sighandler)
&& _JMPBUF_UNWINDS(target, THREAD_GETMEM(self, p_in_sighandler)))
diff --git a/libpthread/linuxthreads.old/queue.h b/libpthread/linuxthreads.old/queue.h
index 28bd75531..c7f8471b9 100644
--- a/libpthread/linuxthreads.old/queue.h
+++ b/libpthread/linuxthreads.old/queue.h
@@ -21,7 +21,6 @@
static inline void enqueue(pthread_descr * q, pthread_descr th)
{
int prio = th->p_priority;
- ASSERT(th->p_nextwaiting == NULL);
for (; *q != NULL; q = &((*q)->p_nextwaiting)) {
if (prio > (*q)->p_priority) {
th->p_nextwaiting = *q;
diff --git a/libpthread/linuxthreads.old/semaphore.c b/libpthread/linuxthreads.old/semaphore.c
index a44f52411..7502b6e78 100644
--- a/libpthread/linuxthreads.old/semaphore.c
+++ b/libpthread/linuxthreads.old/semaphore.c
@@ -87,7 +87,7 @@ int __new_sem_wait(sem_t * sem)
if (already_canceled) {
__pthread_set_own_extricate_if(self, 0);
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
/* Wait for sem_post or cancellation, or fall through if already canceled */
@@ -113,7 +113,7 @@ int __new_sem_wait(sem_t * sem)
if (THREAD_GETMEM(self, p_woken_by_cancel)
&& THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) {
THREAD_SETMEM(self, p_woken_by_cancel, 0);
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
/* We got the semaphore */
return 0;
@@ -252,7 +252,7 @@ int sem_timedwait(sem_t *sem, const struct timespec *abstime)
if (already_canceled) {
__pthread_set_own_extricate_if(self, 0);
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
spurious_wakeup_count = 0;
@@ -297,7 +297,7 @@ int sem_timedwait(sem_t *sem, const struct timespec *abstime)
if (THREAD_GETMEM(self, p_woken_by_cancel)
&& THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) {
THREAD_SETMEM(self, p_woken_by_cancel, 0);
- pthread_exit(PTHREAD_CANCELED);
+ __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
}
/* We got the semaphore */
return 0;
diff --git a/libpthread/linuxthreads.old/spinlock.c b/libpthread/linuxthreads.old/spinlock.c
index e00bc3156..f5999e4d2 100644
--- a/libpthread/linuxthreads.old/spinlock.c
+++ b/libpthread/linuxthreads.old/spinlock.c
@@ -620,8 +620,6 @@ void __pthread_alt_unlock(struct _pthread_fastlock *lock)
if (maxprio == INT_MIN)
continue;
- ASSERT (p_max_prio != (struct wait_node *) 1);
-
/* Now we want to to remove the max priority thread's wait node from
the list. Before we can do this, we must atomically try to change the
node's abandon state from zero to nonzero. If we succeed, that means we
diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
index 0cee6a84f..448636bd9 100644
--- a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
+++ b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
@@ -24,9 +24,6 @@
#include <signal.h>
#include <bits/pthreadtypes.h>
#include <bits/initspin.h>
-#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc)
-#include <bits/uClibc_pthread.h>
-#endif
__BEGIN_DECLS
diff --git a/libpthread/linuxthreads.old/wrapsyscall.c b/libpthread/linuxthreads.old/wrapsyscall.c
index 369c190d5..684989be0 100644
--- a/libpthread/linuxthreads.old/wrapsyscall.c
+++ b/libpthread/linuxthreads.old/wrapsyscall.c
@@ -96,9 +96,11 @@ CANCELABLE_SYSCALL (off64_t, lseek64, (int fd, off64_t offset, int whence),
(fd, offset, whence))
#endif
+#ifdef __NR_msync
/* msync(2). */
CANCELABLE_SYSCALL (int, msync, (__ptr_t addr, size_t length, int flags),
(addr, length, flags))
+#endif
/* nanosleep(2). */
diff --git a/libpthread/linuxthreads/sysdeps/pthread/pthread.h b/libpthread/linuxthreads/sysdeps/pthread/pthread.h
index 08843d18d..0fa3be131 100644
--- a/libpthread/linuxthreads/sysdeps/pthread/pthread.h
+++ b/libpthread/linuxthreads/sysdeps/pthread/pthread.h
@@ -24,9 +24,6 @@
#include <signal.h>
#include <bits/pthreadtypes.h>
#include <bits/initspin.h>
-#if defined _LIBC && ( defined IS_IN_libc || defined NOT_IN_libc )
-#include <bits/uClibc_pthread.h>
-#endif
__BEGIN_DECLS