From f2e3c0ca3efaf5ade26ad45a6df875b49cb2c3f0 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 20 Feb 2011 16:21:54 +0100 Subject: [PATCH] - further ARM fixes - global fixes for utime(2), fadvise*(2) --- dietlibc-github.patch | 1379 ++++++++++++++++++++++++++++++++++++++--- dietlibc.spec | 6 +- 2 files changed, 1300 insertions(+), 85 deletions(-) diff --git a/dietlibc-github.patch b/dietlibc-github.patch index edc8620..b8b64f0 100644 --- a/dietlibc-github.patch +++ b/dietlibc-github.patch @@ -1,3 +1,10 @@ +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..0a72698 +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1 @@ ++/.cvsps diff --git a/Makefile b/Makefile index 143113b..a4f0c0c 100644 --- a/Makefile @@ -249,54 +256,480 @@ index 7e7cf9b..b13c9c9 100644 #ifdef WANT_DYNAMIC /* in v0 ($0) is the ld.so _fini pointer */ mov $0, $19 /* mov v0(dynload) to a3 */ -diff --git a/arm/__mmap.S b/arm/__mmap.S +diff --git a/alpha/utime.S b/alpha/utime.S +deleted file mode 100644 +index a9a8aad..0000000 +--- a/alpha/utime.S ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include "syscalls.h" +- +-syscall(utimes,utime) +diff --git a/arm/Makefile.add b/arm/Makefile.add +index f6126ec..7aaae27 100644 +--- a/arm/Makefile.add ++++ b/arm/Makefile.add +@@ -1,5 +1,6 @@ + + LIBOBJ+=$(OBJDIR)/md5asm.o $(OBJDIR)/__aeabi_unwind_cpp.o ++LIBOBJ+=$(OBJDIR)/__fadvise.o $(OBJDIR)/arm_fadvise.o + CFLAGS+=-Os -fomit-frame-pointer -fstrict-aliasing + #ifdef __ARM_EABI__ + CFLAGS+=-mabi=aapcs-linux -mfloat-abi=soft -mno-thumb-interwork +diff --git a/arm/__aeabi_unwind_cpp.S b/arm/__aeabi_unwind_cpp.S +index ca631bc..9334eee 100644 +--- a/arm/__aeabi_unwind_cpp.S ++++ b/arm/__aeabi_unwind_cpp.S +@@ -1,21 +1,14 @@ +-.text +-.global __aeabi_unwind_cpp_pr0 +-.hidden __aeabi_unwind_cpp_pr0 +-.type __aeabi_unwind_cpp_pr0, %function ++#include "arm-features.h" + +-.global __aeabi_unwind_cpp_pr1 ++FUNC_START __aeabi_unwind_cpp_pr0 ++FUNC_START __aeabi_unwind_cpp_pr1 ++FUNC_START __aeabi_unwind_cpp_pr2 ++.hidden __aeabi_unwind_cpp_pr0 + .hidden __aeabi_unwind_cpp_pr1 +-.type __aeabi_unwind_cpp_pr1, %function +- +-.global __aeabi_unwind_cpp_pr2 + .hidden __aeabi_unwind_cpp_pr2 +-.type __aeabi_unwind_cpp_pr2, %function + +-__aeabi_unwind_cpp_pr0: +-__aeabi_unwind_cpp_pr1: +-__aeabi_unwind_cpp_pr2: +- mov pc, lr @ return from subroutine ++ RET + +-.size __aeabi_unwind_cpp_pr0,.-__aeabi_unwind_cpp_pr0 +-.size __aeabi_unwind_cpp_pr1,.-__aeabi_unwind_cpp_pr1 +-.size __aeabi_unwind_cpp_pr2,.-__aeabi_unwind_cpp_pr2 ++FUNC_END __aeabi_unwind_cpp_pr2 ++FUNC_END __aeabi_unwind_cpp_pr1 ++FUNC_END __aeabi_unwind_cpp_pr0 +diff --git a/arm/__fadvise.c b/arm/__fadvise.c new file mode 100644 -index 0000000..fdda683 +index 0000000..0aa1246 --- /dev/null -+++ b/arm/__mmap.S -@@ -0,0 +1,42 @@ -+#ifndef __NR_mmap -+ -+#include ++++ b/arm/__fadvise.c +@@ -0,0 +1,14 @@ ++#include +#include "syscalls.h" + -+.text ++#ifndef __NR_fadvise64 ++long fadvise64_64(int fd, off64_t offset, off64_t len, int advice) ++{ ++ extern long __arm_fadvise64_64(int fd, int advice, off64_t offset, off64_t len); + -+@ -+@ mmap takes 6 parameters - ie more than can be passed in registers via the -+@ regular syscall interface. Instead, parameters are passed on the stack. -+@ -+@ On entry, the compiler will have already placed the fifth and sixth -+@ parameters on the stack - all we need do here is push the first four and -+@ call the syscall. -+@ ++ return __arm_fadvise64_64(fd, advice, offset, len); ++} + -+@ TODO: check whether pgoffset is really in 4096 bytes or in PAGESIZE -+@ units. ++int posix_fadvise(int fd, off64_t offset, off64_t len, int advise) ++ __attribute__((__alias__("fadvise64_64"))); ++#endif +diff --git a/arm/__guard.S b/arm/__guard.S +index 7218d13..a4e53aa 100644 +--- a/arm/__guard.S ++++ b/arm/__guard.S +@@ -1,4 +1,5 @@ + .data ++.align 2 + .type __guard,#object + .global __guard + .type __stack_chk_guard,#object +@@ -7,3 +8,5 @@ __guard: + __stack_chk_guard: + .long 0xaff00 + ++.size __guard, . - __guard ++.size __stack_chk_guard, . - __stack_chk_guard +diff --git a/arm/__longjmp.S b/arm/__longjmp.S +index 31307bd..5850398 100644 +--- a/arm/__longjmp.S ++++ b/arm/__longjmp.S +@@ -1,7 +1,6 @@ +-.text +-.global __longjmp +-.type __longjmp,function +-__longjmp: ++#include "arm-features.h" + -+.global mmap -+.type mmap,function ++FUNC_START __longjmp + mov ip, r0 + movs r0, r1 + moveq r0, #1 +@@ -9,3 +8,4 @@ __longjmp: + lfm f4, 4, [ip], #48 + #endif + ldmia ip, {r4-r11, sp, pc} ++FUNC_END __longjmp +diff --git a/arm/__testandset.S b/arm/__testandset.S +index d9c5764..3b62c51 100644 +--- a/arm/__testandset.S ++++ b/arm/__testandset.S +@@ -1,7 +1,15 @@ +-.text +-.global __testandset +-__testandset: ++#include "arm-features.h" + -+mmap: -+ stmfd sp!,{r4,r5,r7,lr} -+# if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || defined(__ARM_ARCH_5T__) ++FUNC_START __testandset + mov r2, r0 + mov r1, #1 ++# if __ARM_ARCH__ < 6 + swp r0, r1, [r2] +- mov pc, lr ++# else ++1: ldrex r0, [r2] ++ strex r3, r1, [r2] ++ cmp r3, #0 ++ bne 1b ++# endif ++ RET ++FUNC_END __testandset +diff --git a/arm/arm-features.h b/arm/arm-features.h +new file mode 100644 +index 0000000..cf330eb +--- /dev/null ++++ b/arm/arm-features.h +@@ -0,0 +1,103 @@ ++/* --*- asm -*-- */ ++ ++#ifndef H_DIETLIBC_ARM_FEATURES_H ++#define H_DIETLIBC_ARM_FEATURES_H ++ ++/* Stolen from gcc (gcc/config/arm/lib1funcs.asm) */ ++#if defined(__ARM_ARCH_2__) ++# define __ARM_ARCH__ 2 ++#endif ++ ++#if defined(__ARM_ARCH_3__) ++# define __ARM_ARCH__ 3 ++#endif ++ ++#if defined(__ARM_ARCH_3M__) || defined(__ARM_ARCH_4__) \ ++ || defined(__ARM_ARCH_4T__) ++# define __ARM_ARCH__ 4 ++#endif ++ ++#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ ++ || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ ++ || defined(__ARM_ARCH_5TEJ__) ++# define __ARM_ARCH__ 5 ++#endif ++ ++#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ ++ || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ ++ || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \ ++ || defined(__ARM_ARCH_6M__) ++# define __ARM_ARCH__ 6 ++#endif ++ ++#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ ++ || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) ++# define __ARM_ARCH__ 7 ++#endif ++ ++#ifndef __ARM_ARCH__ ++#error Unable to determine architecture. ++#endif ++ ++ ++ ++#ifdef __ASSEMBLER__ ++ ++.macro FUNC_START name ++ .text ++ .align 0 ++ .global \name ++ .type \name, %function ++\name: ++.endm ++ ++.macro FUNC_START_WEAK name ++ .text ++ .align 0 ++ .weak \name ++ .type \name, %function ++\name: ++.endm ++ ++.macro FUNC_END name ++ .size \name, . - \name ++.endm ++ ++.macro RET ++#if (__ARM_ARCH__ > 4) || defined(__ARM_ARCH_4T__) ++ bx lr ++#else ++ mov pc, lr ++#endif ++.endm ++ ++.macro SWI_UNIFIED name ++#ifdef __ARM_EABI__ ++ b __unified_syscall_swi ++#else ++ swi \name ++ b __unified_syscall ++#endif ++.endm ++ ++.macro SWI_UNIFIED4 ++#ifdef __ARM_EABI__ ++ b __unified_syscall_swi ++#else ++ swi \name ++ b __unified_syscall4 ++#endif ++.endm ++ ++.macro LOAD_ARG4_5 ++#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || defined(__ARM_ARCH_5T__) + ldr r4, [sp,#16] + ldr r5, [sp,#20] -+# else ++#else + ldrd r4, [sp,#16] -+# endif -+ ldr r7, =__NR_mmap2 -+ tst r5, #0x0ff @ check whether r5 % 4096 == 0 -+ tsteq r5, #0xf00 @ holds -+ movne r0, #-EINVAL -+ bne __unified_syscall4 -+ lsr r5, r5, #12 @ div-by 4096 -+ swi 0 -+ b __unified_syscall4 -+ -+.size mmap, . - mmap -+ +#endif ++.endm ++ ++#endif /* __ASSEMBLER__ */ ++ ++#endif /* H_DIETLIBC_ARM_FEATURES_H */ +diff --git a/arm/arm_fadvise.S b/arm/arm_fadvise.S +new file mode 100644 +index 0000000..216cdcc +--- /dev/null ++++ b/arm/arm_fadvise.S +@@ -0,0 +1,5 @@ ++#include "syscalls.h" ++ ++#ifdef __NR_arm_fadvise64_64 ++syscall(arm_fadvise64_64, __arm_fadvise64_64); ++#endif +diff --git a/arm/clone.S b/arm/clone.S +index 4a4b2f4..b2ef450 100644 +--- a/arm/clone.S ++++ b/arm/clone.S +@@ -1,11 +1,8 @@ + + #include + #include "syscalls.h" ++#include "arm-features.h" + +- .text +- .weak clone +- .global __clone +- + @ + @ Some slightly tricky stuff here... edit with care :-) + @ +@@ -19,9 +16,8 @@ + @ ; don't do this yet + @#define RESET_PID + +- +-clone: +-__clone: ++FUNC_START_WEAK clone ++FUNC_START __clone + @ ; start with a sanity check + cmp r0, #0 + cmpne r1, #0 +@@ -51,7 +47,8 @@ __clone: + beq 1f + ldmfd sp!, {r4, r7} + blt __unified_syscall @ (return code < 0): handle as an error +- bx lr ++ RET ++ + 1: + #ifdef RESET_PID + tst ip, #CLONE_THREAD +@@ -76,12 +73,13 @@ __clone: + + @ ; and we're done, passing return value through r0 + b _exit @ branch to _exit (PIC safe) ++FUNC_END __clone ++FUNC_END clone + +- + #else + +-clone: +-__clone: ++FUNC_START_WEAK clone ++FUNC_START __clone + movs r12, r0 @ check function pointer + cmpne r1, #0 @ if function check for stack pointer + moveq r0, #-EINVAL @ if one is not available set errno value +@@ -101,5 +99,7 @@ __clone: + ldmia sp!, { r0, pc } @ load function param and jump to thread function + + 1: b _exit @ branch to _exit (PIC safe) ++FUNC_END __clone ++FUNC_END clone + + #endif +diff --git a/arm/dyn_syscalls.S b/arm/dyn_syscalls.S +index 895657f..c128891 100644 +--- a/arm/dyn_syscalls.S ++++ b/arm/dyn_syscalls.S +@@ -8,11 +8,15 @@ + + #include + #include "syscalls.h" ++#include "arm-features.h" + +-.text +-__unified_syscall4: ++#ifdef __ARM_EABI__ ++# error "dyn_syscall.S not ported for EABI yet" ++#endif ++ ++FUNC_START __unified_syscall4 + ldmfd sp!, {r4, r5, r6} +-__unified_syscall: ++FUNC_START __unified_syscall + cmn r0, #4096 + movcc pc, lr + rsb r1, r0, #0 +@@ -25,7 +29,9 @@ __unified_syscall: + + mvn r0, #0 + #include "dietuglyweaks.h" +- mov pc, lr ++ RET ++FUNC_END __unified_syscall ++FUNC_END __unified_syscall4 + + /* ok now include all syscalls.s (*.S) and sysdep *.S */ + #include "mmap.S" +@@ -278,9 +284,11 @@ __unified_syscall: + #include "../syscalls.s/fgetxattr.S" + + /* other asm-files w.o. changes ... */ +-__exit: ++FUNC_START __exit + swi $__NR_exit + eor pc,lr,lr ++FUNC_END __exit ++ + #define _exit __exit + #include "clone.S" + #undef _exit +diff --git a/arm/mcount.S b/arm/mcount.S +index a397e92..2e25adf 100644 +--- a/arm/mcount.S ++++ b/arm/mcount.S +@@ -1,4 +1,4 @@ +- ++#include "arm-features.h" + @ + @ mcount.S: ARM assembler implementation of mcount + @ +@@ -27,11 +27,7 @@ + @ + @ + +-.text +- +-.global mcount +- +-mcount: ++FUNC_START mcount + mov ip, sp + stmdb sp!, { r0 - r3, fp, ip, lr, pc } @ build stack frame + sub fp, ip, #4 @ setup new fp +@@ -43,4 +39,4 @@ mcount: + bl __mcount @ call __mcount + + ldmdb fp, { r0 - r3, fp, sp, pc } @ restore context from stack frame and return. +- ++FUNC_END mcount +diff --git a/arm/md5asm.S b/arm/md5asm.S +index 370b503..14ba4b9 100644 +--- a/arm/md5asm.S ++++ b/arm/md5asm.S +@@ -50,45 +50,35 @@ + *****************************************************************************/ + + #include ++#include "arm-features.h" + + #if (__BYTE_ORDER == __LITTLE_ENDIAN) + +- .global MD5Init +- .global MD5Update +- +- .text +-#ifdef __ARM_EABI__ +- .align 4 +-#else +- .align 2 +-#endif +- + @ -- + @ void MD5Init (MD5_CTX* context); + @ -- + +-MD5Init: +- ++FUNC_START MD5Init + adr r1, 1f @ r1 = base address of MD5InitData array + ldmia r1, { r1 - r3, r12 } @ load 4 elements from MD5InitData array + stmia r0, { r1 - r3, r12 } @ store into MD5 context->state[0..3] + mov r1, #0 + str r1, [r0, #0x10] @ initial count[0] = 0 + str r1, [r0, #0x14] @ initial count[1] = 0 +- mov pc, lr @ return ++ RET + ++ .align 3 + 1: .word 0x67452301 @ initial MD5 context->state[0] + .word 0xefcdab89 @ initial MD5 context->state[1] + .word 0x98badcfe @ initial MD5 context->state[2] + .word 0x10325476 @ initial MD5 context->state[3] +- ++FUNC_END MD5Init + + @ -- + @ void MD5Update (MD5_CTX* context, const uint8_t* buf, signed int len); + @ -- + +-MD5Update: +- ++FUNC_START MD5Update + stmdb sp!, { r4 - r8, lr } + add r4, r0, #(6 * 4) @ r4 = &context->buffer[0] + ldmdb r4, { r0, r3 } @ r0 = count[0], r3 = count[1] +@@ -122,12 +112,13 @@ MD5Update: + sub r2, r8, r2 + 2: ldmia sp!, { r4 - r8, lr } + b memcpy @ classic tail-call optimisation... +- ++FUNC_END MD5Update + + @ -- + @ static void __MD5Transform (uint32_t *buf, const uint32_t *in, int repeat); + @ -- + ++ .align 3 + MD5MagicData: + + 1: .word 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee +@@ -148,6 +139,7 @@ MD5MagicData: + .word 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391, (17f-19f-4) + .word 0x6e4120A9, 0x20657264, 0x7543634d, 0x00796472, (19f-19f-4) + ++ .align 2 + __MD5Transform: + + cmp r2, #0 diff --git a/arm/mmap.S b/arm/mmap.S deleted file mode 100644 index d3ea131..0000000 @@ -346,21 +779,65 @@ index d3ea131..0000000 - -#endif diff --git a/arm/setjmp.S b/arm/setjmp.S -index 6b850d4..4c46e05 100644 +index 6b850d4..797d21b 100644 --- a/arm/setjmp.S +++ b/arm/setjmp.S -@@ -15,3 +15,4 @@ sigsetjmp: +@@ -1,17 +1,18 @@ +-.text +-.weak setjmp +-setjmp: +-.global __setjmp +-__setjmp: ++#include "arm-features.h" ++ ++FUNC_START_WEAK setjmp ++FUNC_START __setjmp + mov r1, #0 +-.global __sigsetjmp +-__sigsetjmp: +-.weak sigsetjmp +-sigsetjmp: ++FUNC_END __setjmp ++FUNC_END setjmp ++ ++FUNC_START_WEAK sigsetjmp ++FUNC_START __sigsetjmp + #ifndef __SOFTFP__ + sfm f4, 4, [r0], #48 + #endif + stmia r0, {r4-r11, sp, lr} sub r0, r0, #48 b __sigjmp_save - -+.size __sigsetjmp, . - __sigsetjmp +- ++FUNC_END __sigsetjmp ++FUNC_END sigsetjmp diff --git a/arm/start.S b/arm/start.S -index ccbac48..765021b 100644 +index ccbac48..cfb298c 100644 --- a/arm/start.S +++ b/arm/start.S -@@ -19,12 +19,23 @@ - _start: +@@ -1,30 +1,29 @@ + #include "dietfeatures.h" + #include "syscalls.h" +- +- .text +-#ifdef __ARM_EABI__ +- .align 4 +-#else +- .align 2 +-#endif +- +- .global _start +- .weak exit +- .global _exit +- ++#include "arm-features.h" + + #ifdef __ARM_EABI__ + +-_start: +- ++FUNC_START _start mov fp, #0 @ clear the frame pointer - ldr a1, [sp], #4 @ argc - mov a2, sp @ argv @@ -384,7 +861,36 @@ index ccbac48..765021b 100644 bl main @ -@@ -59,11 +70,25 @@ _start: +@@ -32,21 +31,22 @@ _start: + @ We need to branch to 'exit' in case we have linked with 'atexit'. + @ + bl exit ++FUNC_END _start + +-exit: +-_exit: +- ++FUNC_START _exit ++FUNC_START_WEAK exit + mov r7, #__NR_exit + swi 0 @ never returns. + ++ .align 2 + .L3: .word environ +- ++FUNC_END exit ++FUNC_END _exit + + #else + + +-_start: +- ++FUNC_START _start + #ifdef WANT_DYNAMIC + mov a4, a1 @ save dynamic ld.so _fini + #endif +@@ -59,11 +59,25 @@ _start: #ifdef __DYN_LIB ldr sl, .L4 1: add sl, pc, sl @@ -411,72 +917,306 @@ index ccbac48..765021b 100644 #ifdef PROFILING stmdb sp!, { r0 - r3 } ldr r0, .L5 +@@ -83,18 +97,21 @@ _start: + @ We need to branch to 'exit' in case we have linked with 'atexit'. + @ + bl exit ++FUNC_END _start + +-exit: +-_exit: +- ++FUNC_START _exit ++FUNC_START_WEAK exit + #ifdef PROFILING + mov r4, r0 @ save a copy of exit status + bl _stop_monitor + mov r0, r4 + #endif + swi $__NR_exit @ never returns. ++FUNC_END exit ++FUNC_END _exit + + ++ .align 2 + #ifdef __DYN_LIB + .L3: .word environ(GOT) + .L4: .word _GLOBAL_OFFSET_TABLE_-(1b+8) +diff --git a/arm/strcpy.S b/arm/strcpy.S +index 20e1029..cc376d3 100644 +--- a/arm/strcpy.S ++++ b/arm/strcpy.S +@@ -1,10 +1,7 @@ + #include "dietfeatures.h" ++#include "arm-features.h" + +-.text +- .align 2 +- .global strcpy +- +-strcpy: ++FUNC_START strcpy + #ifndef WANT_SMALL_STRING_ROUTINES + mov ip, r0 + ands r2, r1, #3 +@@ -61,6 +58,6 @@ strcpy: + ldrneb r2, [r1], #1 + #endif + bne .Lloop +- mov pc, lr +-.Lfe1: +- .size strcpy,.Lfe1-strcpy ++ RET ++FUNC_END strcpy ++ +diff --git a/arm/strlen.S b/arm/strlen.S +index 6b2b459..a6af8f0 100644 +--- a/arm/strlen.S ++++ b/arm/strlen.S +@@ -1,12 +1,7 @@ + #include "dietfeatures.h" ++#include "arm-features.h" + +- .text +- .align 2 +- +- .global strlen +- +-strlen: +- ++FUNC_START strlen + #if 0 + teq a1, #0 @ is string pointer NULL ?? + moveq pc, lr @ if so, return 0 +@@ -61,12 +56,10 @@ strlen: + sub a1, a1, a2 + #endif + +- mov pc, lr ++ RET + + #ifndef WANT_SMALL_STRING_ROUTINES + .Lmagic: + .word 0x01010101 + #endif +- +-.Lstrlen: +- .size strlen,.Lstrlen-strlen ++FUNC_END strlen diff --git a/arm/syscalls.h b/arm/syscalls.h -index 774350a..21bb579 100644 +index 774350a..6720496 100644 --- a/arm/syscalls.h +++ b/arm/syscalls.h -@@ -785,6 +785,8 @@ - ldr r7, =\name - swi 0 - b __unified_syscall -+ -+.size \sym, . - \sym +@@ -697,9 +697,9 @@ + #define __ARGS_getpeername 0 + #define __ARGS_socketpair 0 + #define __ARGS_send 0 +-#define __ARGS_sendto 0 ++#define __ARGS_sendto 6 + #define __ARGS_recv 0 +-#define __ARGS_recvfrom 0 ++#define __ARGS_recvfrom 6 + #define __ARGS_shutdown 0 + #define __ARGS_setsockopt 0 + #define __ARGS_getsockopt 0 +@@ -768,70 +768,30 @@ + + #ifdef __ASSEMBLER__ + +-#ifdef __ARM_EABI__ ++#include "arm-features.h" + + #define syscall_weak(name,wsym,sym) __syscall_weak __NR_##name, wsym, sym, __ARGS_##name + .macro __syscall_weak name wsym sym typ +-.text +-.type \wsym,function +-.weak \wsym +-\wsym: +-.type \sym,function +-.global \sym +-\sym: +- stmfd sp!,{r4,r5,r7,lr} +- ldr r4, [sp,#16] +- ldr r5, [sp,#20] +- ldr r7, =\name +- swi 0 +- b __unified_syscall ++FUNC_START_WEAK \wsym ++__syscall \name, \sym, \typ ++FUNC_END \wsym .endm ++#ifdef __ARM_EABI__ -@@ -800,6 +802,8 @@ - ldr r7, =\name - swi 0 - b __unified_syscall -+ -+.size \sym, . - \sym + #define syscall(name,sym) __syscall __NR_##name, sym, __ARGS_##name + .macro __syscall name sym typ +-.text +-.type \sym,function +-.global \sym +-\sym: +- stmfd sp!,{r4,r5,r7,lr} +- ldr r4, [sp,#16] +- ldr r5, [sp,#20] +- ldr r7, =\name +- swi 0 +- b __unified_syscall ++FUNC_START \sym ++ ldr ip, =\name ++ b __unified_syscall_swi ++FUNC_END \sym .endm #else -@@ -824,6 +828,8 @@ - .else - b __unified_syscall - .endif -+ -+.size \sym, . - \sym - .endm +-#define syscall_weak(name,wsym,sym) __syscall_weak $__NR_##name, wsym, sym, __ARGS_##name +-.macro __syscall_weak name wsym sym typ +-.text +-.type \wsym,function +-.weak \wsym +-\wsym: +-.type \sym,function +-.global \sym +-\sym: +-.ifgt \typ +- mov ip, sp +- stmfd sp!,{r4, r5, r6} +- ldmia ip, {r4, r5, r6} +-.endif +- swi \name +-.ifgt \typ +- b __unified_syscall4 +-.else +- b __unified_syscall +-.endif +-.endm +- #define syscall(name,sym) __syscall $__NR_##name, sym, __ARGS_##name -@@ -843,6 +849,8 @@ + .macro __syscall name sym typ +-.text +-.type \sym,function +-.global \sym +-\sym: ++FUNC_START \sym + .ifgt \typ + mov ip, sp + stmfd sp!,{r4, r5, r6} +@@ -843,6 +803,7 @@ .else b __unified_syscall .endif -+ -+.size \sym, . - \sym ++FUNC_END \sym .endm #endif diff --git a/arm/unified.S b/arm/unified.S -index 3023032..efdd8d3 100644 +index 3023032..999d4f3 100644 --- a/arm/unified.S +++ b/arm/unified.S -@@ -25,9 +25,12 @@ __unified_syscall: +@@ -1,21 +1,28 @@ + + #include ++#include "arm-features.h" + +- .text + #ifdef __ARM_EABI__ +- .align 4 +-#else +- .align 2 +-#endif +- .global __unified_syscall +- .global __unified_syscall4 +- + +-#ifdef __ARM_EABI__ ++/* expects: ++ * r0-r3 ... syscall arguments 0-3 ++ * ip ... syscall number ++ */ ++FUNC_START __unified_syscall_swi ++ .hidden __unified_syscall_swi ++ stmfd sp!,{r4,r5,r7,lr} ++ mov r7, ip ++ LOAD_ARG4_5 ++ swi 0 ++ /* fallthrough to __unified4_syscall */ ++FUNC_END __unified_syscall_swi + +-__unified_syscall4: +-__unified_syscall: +- ++/* expects: ++ * r0 ... syscall return value ++ * original r4-r7 + lr on stack ++ */ ++FUNC_START __unified_syscall ++ .hidden __unified_syscall + cmn r0, #4096 + rsbcs r2, r0, #0 + ldrcs r3, 1f +@@ -25,15 +32,17 @@ __unified_syscall: .balign 4 1: .word errno -+ .size __unified_syscall, . - __unified_syscall -+ .size __unified_syscall4, . - __unified_syscall4 - - /* here we go and "reuse" the return for weak-void functions */ +- +-/* here we go and "reuse" the return for weak-void functions */ ++FUNC_END __unified_syscall ++ #include "dietuglyweaks.h" -+ mov pc, lr @ return ++ RET #else -@@ -52,6 +55,8 @@ __unified_syscall: - #include "dietuglyweaks.h" +-__unified_syscall4: ++FUNC_START __unified_syscall4 + ldmia sp!, {r4, r5, r6} +-__unified_syscall: ++ ++FUNC_START __unified_syscall + cmn r0, #4096 + movcc pc, lr @ return value comes direct from kernel. - mov pc, lr @ return -+ .size __unified_syscall, . - __unified_syscall -+ .size __unified_syscall4, . - __unified_syscall4 +@@ -50,11 +59,14 @@ __unified_syscall: + + /* here we go and "reuse" the return for weak-void functions */ + #include "dietuglyweaks.h" ++ RET + +- mov pc, lr @ return #ifndef WANT_THREAD_SAFE ++ .align 2 .L0: .long errno + #endif ++FUNC_END __unified_syscall ++FUNC_END __unified_syscall4 + + #endif +diff --git a/arm/waitpid.S b/arm/waitpid.S +index 2c3a75b..0d099a8 100644 +--- a/arm/waitpid.S ++++ b/arm/waitpid.S +@@ -1,15 +1,8 @@ +-.text +-#ifdef __ARM_EABI__ +-.align 4 +-#else +-.align 2 +-#endif +-.weak waitpid +-.type waitpid, %function +-waitpid: +-.global __libc_waitpid +-.type __libc_waitpid, %function +-__libc_waitpid: ++#include "arm-features.h" ++ ++FUNC_START_WEAK waitpid ++FUNC_START __libc_waitpid + mov r3, #0 + b wait4 +- .size waitpid, .-waitpid ++FUNC_END __libc_waitpid ++FUNC_END waitpid diff --git a/diet.c b/diet.c index e7fd3e8..22e3696 100644 --- a/diet.c @@ -690,6 +1430,29 @@ index 50fd015..c917721 100644 #ifdef WANT_DYNAMIC /* FIXME: dl_init parameter ??? */ br.call.sptk.few rp = _dyn_start +diff --git a/ia64/utime.S b/ia64/utime.S +deleted file mode 100644 +index a9a8aad..0000000 +--- a/ia64/utime.S ++++ /dev/null +@@ -1,3 +0,0 @@ +-#include "syscalls.h" +- +-syscall(utimes,utime) +diff --git a/include/fcntl.h b/include/fcntl.h +index 510826c..d085ba5 100644 +--- a/include/fcntl.h ++++ b/include/fcntl.h +@@ -673,7 +673,9 @@ int utimensat(int dirfd, const char *pathname, struct timespec* t); + #endif + + #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0) >= 600 ++#include "linux/fadvise.h" + int posix_fallocate(int fd, off64_t offset, off64_t len) __THROW; ++int posix_fadvise(int fd, off64_t offset, off64_t len, int advice) __THROW; + #endif + + __END_DECLS diff --git a/include/paths.h b/include/paths.h index 553b4fa..9bf216f 100644 --- a/include/paths.h @@ -750,6 +1513,19 @@ index 9b2d04d..70bb17e 100644 extern int shmget(key_t key, int size, int shmflg) __THROW; extern void *shmat(int shmid, const void *shmaddr, int shmflg) __THROW; extern int shmdt (const void *shmaddr) __THROW; +diff --git a/include/utime.h b/include/utime.h +index eebc4da..ce98bff 100644 +--- a/include/utime.h ++++ b/include/utime.h +@@ -12,7 +12,7 @@ struct utimbuf { + time_t modtime; /* modification time */ + }; + +-int utime(const char* filename, struct utimbuf* buf) __THROW; ++int utime(const char* filename, const struct utimbuf* buf) __THROW; + + __END_DECLS + diff --git a/lib/__alarm.c b/lib/__alarm.c new file mode 100644 index 0000000..9b4bc30 @@ -906,6 +1682,45 @@ index 0000000..87a6d5d + return tv.tv_sec; +} +#endif +diff --git a/lib/__umount.c b/lib/__umount.c +new file mode 100644 +index 0000000..24bb220 +--- /dev/null ++++ b/lib/__umount.c +@@ -0,0 +1,9 @@ ++#include ++#include "syscalls.h" ++ ++#ifndef __NR_umount ++int umount(const char *target) ++{ ++ return umount2(target, 0); ++} ++#endif +diff --git a/lib/__utime.c b/lib/__utime.c +new file mode 100644 +index 0000000..e013265 +--- /dev/null ++++ b/lib/__utime.c +@@ -0,0 +1,18 @@ ++#include ++#include ++ ++#ifndef __NR_utime ++int utime(const char *filename, const struct utimbuf *times) ++{ ++ if (times == NULL) ++ return utimes(filename, NULL); ++ else { ++ struct timeval tvs[2]; ++ tvs[0].tv_sec = times->actime; ++ tvs[0].tv_usec = 0; ++ tvs[1].tv_sec = times->modtime; ++ tvs[1].tv_usec = 0; ++ return utimes(filename, tvs); ++ } ++} ++#endif diff --git a/lib/__v_printf.c b/lib/__v_printf.c index 36202f5..964c005 100644 --- a/lib/__v_printf.c @@ -1092,6 +1907,19 @@ index 2530d1a..847685e 100644 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (t == MAP_FAILED) lose: +diff --git a/lib/posix_fallocate.c b/lib/posix_fallocate.c +index ef9f985..82c3e1d 100644 +--- a/lib/posix_fallocate.c ++++ b/lib/posix_fallocate.c +@@ -1,7 +1,7 @@ + #define _GNU_SOURCE + #define _XOPEN_SOURCE 600 +-#include + ++#include + int posix_fallocate(int fd, off64_t offset, off64_t len) { + return fallocate(fd,0,offset,len); + } diff --git a/lib/readdir.c b/lib/readdir.c index ed885a5..d80a406 100644 --- a/lib/readdir.c @@ -1648,6 +2476,30 @@ index a79c4e7..a884658 100644 /* When starting a binary via the dynamic linker, %g1 contains the address of the shared library termination function, which will be registered with atexit(). If we are statically linked, this will +diff --git a/syscalls.s/__pread.S b/syscalls.s/__pread.S +index 9cf11ce..dfcbbd3 100644 +--- a/syscalls.s/__pread.S ++++ b/syscalls.s/__pread.S +@@ -1,3 +1,7 @@ + #include "syscalls.h" + ++#ifdef __NR_pread64 ++syscall_weak(pread64,pread64,__libc_pread64) ++#elif defined(__NR_pread) + syscall_weak(pread,pread64,__libc_pread64) ++#endif +diff --git a/syscalls.s/__pwrite.S b/syscalls.s/__pwrite.S +index fc826d6..0bb704d 100644 +--- a/syscalls.s/__pwrite.S ++++ b/syscalls.s/__pwrite.S +@@ -1,3 +1,7 @@ + #include "syscalls.h" + ++#ifdef __NR_pwrite64 ++syscall_weak(pwrite64,pwrite64,__libc_pwrite64) ++#elif defined(__NR_pwrite) + syscall_weak(pwrite,pwrite64,__libc_pwrite64) ++#endif diff --git a/syscalls.s/environ.S b/syscalls.s/environ.S index a4dd95e..294f2d4 100644 --- a/syscalls.s/environ.S @@ -1679,6 +2531,34 @@ index a4dd95e..294f2d4 100644 +#endif +.size __elfinfo,.-__elfinfo +#endif +diff --git a/syscalls.s/fadvise64.S b/syscalls.s/fadvise64.S +index 0f96da9..fe448b1 100644 +--- a/syscalls.s/fadvise64.S ++++ b/syscalls.s/fadvise64.S +@@ -1,3 +1,11 @@ + #include "syscalls.h" + ++#ifdef __NR_fadvise64 + syscall(fadvise64,fadvise64) ++ ++#ifndef __NR_fadvise64_64 ++.set posix_fadvise, fadvise64 ++.globl posix_fadvise ++#endif ++ ++#endif +diff --git a/syscalls.s/fadvise64_64.S b/syscalls.s/fadvise64_64.S +index 1893962..9bf66b5 100644 +--- a/syscalls.s/fadvise64_64.S ++++ b/syscalls.s/fadvise64_64.S +@@ -2,4 +2,7 @@ + + #ifdef __NR_fadvise64_64 + syscall(fadvise64_64,fadvise64_64) ++ ++.set posix_fadvise, fadvise64_64 ++.globl posix_fadvise + #endif diff --git a/syscalls.s/getrlimit.S b/syscalls.s/getrlimit.S index 1c63c01..3341add 100644 --- a/syscalls.s/getrlimit.S @@ -1707,8 +2587,115 @@ index 2e57fbb..486b531 100644 syscall(mmap,mmap) + +#endif +diff --git a/syscalls.s/umount.S b/syscalls.s/umount.S +index 4a423d9..00278be 100644 +--- a/syscalls.s/umount.S ++++ b/syscalls.s/umount.S +@@ -1,3 +1,5 @@ + #include "syscalls.h" + ++#ifdef __NR_umount + syscall(umount,umount) ++#endif +diff --git a/syscalls.s/utime.S b/syscalls.s/utime.S +index 08cd221..9878b8f 100644 +--- a/syscalls.s/utime.S ++++ b/syscalls.s/utime.S +@@ -1,3 +1,5 @@ + #include "syscalls.h" + ++#ifdef __NR_utime + syscall(utime,utime) ++#endif +diff --git a/test/.gitignore b/test/.gitignore +new file mode 100644 +index 0000000..9d74220 +--- /dev/null ++++ b/test/.gitignore +@@ -0,0 +1,81 @@ ++/adjtime ++/alarm ++/argv ++/asprintf ++/atexit ++/bsearch ++/byteswap ++/calloc ++/confstr ++/cycles ++/empty ++/ffs ++/flush ++/fnmatch ++/fputc ++/ftw ++/fwrite ++/getaddrinfo ++/getdelim ++/getenv ++/getgrnam ++/gethostbyaddr ++/gethostbyname ++/gethostbyname_r ++/getmntent ++/getopt ++/getpass ++/getpwnam ++/getservbyname ++/getservbyport ++/getusershell ++/glob ++/grent ++/hasmntopt ++/hello ++/iconv ++/if_nameindex ++/ltostr ++/malloc-debugger ++/math ++/md5_testharness ++/memccpy ++/memchr ++/memcmp ++/memrchr ++/memusage ++/mktime ++/mmap_test ++/pipe ++/printf ++/printftest ++/protoent ++/prototypes ++/putenv ++/pwent ++/rand48 ++/read1 ++/readdir ++/regex ++/select ++/sendfile ++/servent ++/siglist ++/speed ++/spent ++/sprintf ++/sscanf ++/stdarg ++/strcasecmp ++/strcmp ++/strncat ++/strncpy ++/strptime ++/strrchr ++/strstr ++/strtol ++/sysconf ++/sysenter ++/ungetc ++/utime ++/waitpid diff --git a/test/Makefile b/test/Makefile -index eea0075..69454e5 100644 +index eea0075..8f5b964 100644 --- a/test/Makefile +++ b/test/Makefile @@ -7,14 +7,14 @@ CFLAGS=-nostdinc -Wall @@ -1716,7 +2703,7 @@ index eea0075..69454e5 100644 LCOMPAT=-lcompat -TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty flush fnmatch \ -+TESTPROGRAMS=adjtime alarm argv asprintf atexit bsearch byteswap calloc confstr cycles empty flush fnmatch \ ++TESTPROGRAMS=adjtime alarm argv asprintf atexit bsearch byteswap calloc confstr cycles empty fadvise flush fnmatch \ fputc ftw fwrite getaddrinfo getenv getgrnam gethostbyaddr gethostbyname \ gethostbyname_r getmntent getopt getpass getpwnam getservbyname getservbyport getusershell \ -glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness \ @@ -1725,10 +2712,41 @@ index eea0075..69454e5 100644 protoent prototypes putenv pwent rand48 read1 readdir regex select sendfile servent siglist \ speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr \ -strstr strtol sysenter ungetc waitpid -+strstr strtol sysconf sysenter ungetc waitpid ++strstr strtol sysconf sysenter ungetc utime waitpid test: $(TESTPROGRAMS) +diff --git a/test/adjtime.c b/test/adjtime.c +index d42d129..8d7a016 100644 +--- a/test/adjtime.c ++++ b/test/adjtime.c +@@ -1,9 +1,25 @@ + #include ++#include ++#include + #include + + int main() { + struct timeval a,b; ++ int rc; + a.tv_sec=0; a.tv_usec=0; +- printf("%d\n",adjtime(&a,&b)); ++ rc = adjtime(&a,&b); ++ assert(!rc || errno == EPERM); ++ ++ rc = adjtime(&a, NULL); ++ assert(!rc || errno == EPERM); ++ ++ rc = adjtime(NULL,&b); ++ assert(!rc); ++ assert(b.tv_sec < 30); /* 30 seconds delta is very unlikely... */ ++ assert(b.tv_sec > -30); /* 30 seconds delta is very unlikely... */ ++ assert(b.tv_usec > -1000000); ++ assert(b.tv_usec < 1000000); ++ ++ printf("%lu/%d\n", (unsigned long)b.tv_sec, (int)b.tv_usec); + return 0; + } diff --git a/test/alarm.c b/test/alarm.c new file mode 100644 index 0000000..d1e13ce @@ -1882,6 +2900,41 @@ index 35547f8..46b2f32 100644 return 0; } +diff --git a/test/dirent/.gitignore b/test/dirent/.gitignore +new file mode 100644 +index 0000000..eea7a22 +--- /dev/null ++++ b/test/dirent/.gitignore +@@ -0,0 +1,2 @@ ++/opendir-tst1 ++/tst-seekdir +diff --git a/test/fadvise.c b/test/fadvise.c +new file mode 100644 +index 0000000..cdd6428 +--- /dev/null ++++ b/test/fadvise.c +@@ -0,0 +1,21 @@ ++#define _GNU_SOURCE ++#define _XOPEN_SOURCE 600 ++ ++#include ++#include ++#include ++#include ++ ++int main(void) ++{ ++ char file[] = "/tmp/dietlibc-fadvise-test.XXXXXX"; ++ int fd; ++ ++ fd = mkstemp(file); ++ unlink(file); ++ ++ assert(posix_fadvise(fd, 23, 42, POSIX_FADV_RANDOM) == 0); ++ close(fd); ++ ++ return EXIT_SUCCESS; ++} diff --git a/test/getmntent.c b/test/getmntent.c index fc17a83..1039d06 100644 --- a/test/getmntent.c @@ -1909,6 +2962,23 @@ index b70ca19..caf1c9f 100644 int main(int argc,char *argv[]) { struct servent* se; +diff --git a/test/if_nameindex.c b/test/if_nameindex.c +index b3c8b22..0c171f8 100644 +--- a/test/if_nameindex.c ++++ b/test/if_nameindex.c +@@ -1,8 +1,12 @@ + #include ++#include + #include + + int main() { + struct if_nameindex* t=if_nameindex(); ++ ++ assert(t != NULL); ++ + if (t) { + struct if_nameindex* t1=t; + while (t->if_index) { diff --git a/test/malloc-debugger.c b/test/malloc-debugger.c index 040196e..058807e 100644 --- a/test/malloc-debugger.c @@ -1980,6 +3050,33 @@ index 5e9e65c..9b4bd5e 100644 return 0; } +diff --git a/test/mmap_test.c b/test/mmap_test.c +index 1fc2616..5aa79eb 100644 +--- a/test/mmap_test.c ++++ b/test/mmap_test.c +@@ -15,7 +15,7 @@ int main (int argc, char * argv[]) + void *filememory_1; + void *filememory_2; + +- fd = open (FILENAME, O_RDWR | O_CREAT); ++ fd = open (FILENAME, O_RDWR | O_CREAT, 0600); + + if (fd < 0) + { +diff --git a/test/pipe.c b/test/pipe.c +index fb6ba31..315b4ca 100644 +--- a/test/pipe.c ++++ b/test/pipe.c +@@ -5,6 +5,9 @@ int + main (void) + { + int fd[2]; ++ close(3); ++ close(4); ++ + assert (!pipe (fd)); + /* if for some reason the parent process has fd3 or fd4 + already open, then this will fail although there is diff --git a/test/printf.c b/test/printf.c index 719461a..ef6050d 100644 --- a/test/printf.c @@ -2117,14 +3214,14 @@ index 4f5b08f..1e67632 100644 return 0; } diff --git a/test/runtests.sh b/test/runtests.sh -index 6d89efb..3896fbf 100644 +index 6d89efb..4703888 100644 --- a/test/runtests.sh +++ b/test/runtests.sh @@ -1,6 +1,6 @@ SUBDIRS="dirent inet stdio string stdlib time" -TESTPROGRAMS="adjtime argv atexit bsearch byteswap calloc confstr empty flush fputc ffs fnmatch ftw fwrite getaddrinfo getenv getdelim getgrnam gethostbyaddr gethostbyname gethostbyname_r getmntent getopt getpwnam getservbyname getservbyport getusershell glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest protoent prototypes putenv pwent rand48 readdir regex select sendfile servent siglist speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysenter ungetc waitpid" -+TESTPROGRAMS="adjtime alarm argv atexit bsearch byteswap calloc confstr empty flush fputc ffs fnmatch ftw fwrite getaddrinfo getenv getdelim getgrnam gethostbyaddr gethostbyname gethostbyname_r getmntent getopt getpwnam getservbyname getservbyport getusershell glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger math md5_testharness memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest protoent prototypes putenv pwent rand48 readdir regex select sendfile servent siglist speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysconf sysenter ungetc waitpid" ++TESTPROGRAMS="adjtime alarm argv atexit bsearch byteswap calloc confstr empty fadvise flush fputc ffs fnmatch ftw fwrite getaddrinfo getenv getdelim getgrnam gethostbyaddr gethostbyname gethostbyname_r getmntent getopt getpwnam getservbyname getservbyport getusershell glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger math md5_testharness memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest protoent prototypes putenv pwent rand48 readdir regex select sendfile servent siglist speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysconf sysenter ungetc utime waitpid" STDIN="read1" PASS="getpass" @@ -2156,6 +3253,26 @@ index 674b9a8..22249a7 100644 + printf("%ld\n", (long)time(0)); return 0; } +diff --git a/test/stdio/.gitignore b/test/stdio/.gitignore +new file mode 100644 +index 0000000..8892d20 +--- /dev/null ++++ b/test/stdio/.gitignore +@@ -0,0 +1,14 @@ ++/tst-fdopen ++/tst-ferror ++/tst-fileno ++/tst-fphex ++/tst-fseek ++/tst-printf ++/tst-sprintf ++/tst-sscanf ++/tst-tmpnam ++/tst-unbputc ++/tst-ungetc ++/tstdiomisc ++/tstgetln ++/tstscanf diff --git a/test/stdio/tstscanf.c b/test/stdio/tstscanf.c index 44ddf49..0f55c3c 100644 --- a/test/stdio/tstscanf.c @@ -2177,6 +3294,25 @@ index 44ddf49..0f55c3c 100644 { fputs ("test failed!\n", stdout); result = 1; +diff --git a/test/stdlib/.gitignore b/test/stdlib/.gitignore +new file mode 100644 +index 0000000..ce37703 +--- /dev/null ++++ b/test/stdlib/.gitignore +@@ -0,0 +1,13 @@ ++/test-canon ++/testdiv ++/testrand ++/testsort ++/tst-calloc ++/tst-environ ++/tst-limits ++/tst-malloc ++/tst-rand48 ++/tst-strtod ++/tst-strtol ++/tst-strtoll ++/tst-system diff --git a/test/stdlib/testsort.c b/test/stdlib/testsort.c index aa4332a..5a92bc0 100644 --- a/test/stdlib/testsort.c @@ -2250,6 +3386,28 @@ index 630a8fc..bacdca7 100644 status = 1; } +diff --git a/test/string/.gitignore b/test/string/.gitignore +new file mode 100644 +index 0000000..94b11fc +--- /dev/null ++++ b/test/string/.gitignore +@@ -0,0 +1,16 @@ ++/memccpy ++/memchr ++/memcmp ++/memcpy ++/mempcpy ++/memrchr ++/strcasecmp ++/strcmp ++/strcspn ++/strlen ++/strncat ++/strncpy ++/strpbrk ++/strrchr ++/strspn ++/strstr diff --git a/test/sysconf.c b/test/sysconf.c new file mode 100644 index 0000000..32263a5 @@ -2355,6 +3513,16 @@ index a8fa3a8..3d85916 100644 } return 0; } +diff --git a/test/time/.gitignore b/test/time/.gitignore +new file mode 100644 +index 0000000..dcd3b38 +--- /dev/null ++++ b/test/time/.gitignore +@@ -0,0 +1,4 @@ ++/tst-mktime ++/tst-posixtz ++/tst-strftime ++/tst-strptime diff --git a/test/time/tst-strftime.c b/test/time/tst-strftime.c index e092e93..27db9a4 100644 --- a/test/time/tst-strftime.c @@ -2441,6 +3609,49 @@ index 6277ea6..2773180 100644 { printf ("not all of `%s' read\n", day_tests[i].input); result = 1; +diff --git a/test/utime.c b/test/utime.c +new file mode 100644 +index 0000000..955ac6f +--- /dev/null ++++ b/test/utime.c +@@ -0,0 +1,37 @@ ++#include ++#include ++#include ++#include ++#include ++ ++int main(void) ++{ ++ char file[] = "/tmp/utime-test.XXXXXX"; ++ int tmp_fd; ++ struct utimbuf utm = { ++ .actime = 23, ++ .modtime = 42, ++ }; ++ struct stat st; ++ time_t now; ++ ++ tmp_fd = mkstemp(file); ++ close(tmp_fd); ++ ++ assert(utime(file, &utm) == 0); ++ assert(stat(file, &st) == 0); ++ assert(st.st_atime == utm.actime); ++ assert(st.st_mtime == utm.modtime); ++ ++ now = time(NULL); ++ assert(utime(file, NULL) == 0); ++ assert(stat(file, &st) == 0); ++ ++ assert(st.st_atime == st.st_mtime); ++ assert(st.st_atime >= now); ++ assert(st.st_atime - now < 10); ++ ++ unlink(file); ++ ++ return EXIT_SUCCESS; ++} diff --git a/test/waitpid.c b/test/waitpid.c index fe2cb5b..92c0b0e 100644 --- a/test/waitpid.c diff --git a/dietlibc.spec b/dietlibc.spec index b98d2a2..3981eb5 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -34,7 +34,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1504 +Release: %release_func 1505 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -198,6 +198,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun Feb 20 2011 Enrico Scholz - 0.33-0.1505.20101223 +- further ARM fixes +- global fixes for utime(2), fadvise*(2) + * Tue Feb 08 2011 Fedora Release Engineering - 0.33-0.1504.20101223 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild