From 3a8c47ad89f5ebe60ceed09eaf23f79f1a40c7f7 Mon Sep 17 00:00:00 2001 From: ensc Date: Wed, 13 Feb 2008 17:52:03 +0000 Subject: [PATCH 001/161] initial checkin --- dietlibc-0.31-printftest.patch | 46 +++++++++++++++++++++++++ dietlibc-0.31.20080212-printffmt.patch | 33 ++++++++++++++++++ dietlibc-0.31.20080212-teststdout.patch | 46 +++++++++++++++++++++++++ runtests-X.sh | 29 ++++++++++++++++ 4 files changed, 154 insertions(+) create mode 100644 dietlibc-0.31-printftest.patch create mode 100644 dietlibc-0.31.20080212-printffmt.patch create mode 100644 dietlibc-0.31.20080212-teststdout.patch create mode 100644 runtests-X.sh diff --git a/dietlibc-0.31-printftest.patch b/dietlibc-0.31-printftest.patch new file mode 100644 index 0000000..b0bb3b9 --- /dev/null +++ b/dietlibc-0.31-printftest.patch @@ -0,0 +1,46 @@ +diff -up dietlibc-0.31.20080212/test/printf.c.~1~ dietlibc-0.31.20080212/test/printf.c +--- dietlibc-0.31.20080212/test/printf.c.~1~ 2004-01-07 16:06:48.000000000 +0100 ++++ dietlibc-0.31.20080212/test/printf.c 2008-02-13 17:25:35.000000000 +0100 +@@ -38,7 +38,8 @@ + #define TEST_SNPRINTF(EXP,SZ, ...) \ + { \ + volatile char * args[] = { EXP, #SZ }; \ +- int test_sz=MIN((SZ),sizeof(EXP))-1; \ ++ ssize_t test_sz=MIN((SZ),sizeof(EXP))-1; \ ++ (void)args; \ + TEST_INIT(EXP); \ + rc=snprintf(buf+ALGN,(SZ),__VA_ARGS__); \ + TEST_CHECK(EXP, test_sz); \ +@@ -80,6 +80,7 @@ int main() + + TEST("foobar", "%s", "foobar"); + TEST("01.23", "%05.2f", 1.23); ++ TEST("001.2", "%05.2g", 1.23); + + TEST("42", "%i", 42); + TEST("", "%.0i", 0); +@@ -111,6 +112,24 @@ int main() + + TEST("0x1", "%#x", 1); + ++ TEST("abcX", "%2sX", "abc"); ++ TEST("abcX", "%-2sX", "abc"); ++ ++ TEST("001234", "%.6u", 1234); ++ TEST("-001234", "%.6i", -1234); ++ TEST(" 1234", "%6u", 1234); ++ TEST(" -1234", "%6i", -1234); ++ TEST("001234", "%06u", 1234); ++ TEST("-01234", "%06i", -1234); ++ TEST("1234 ", "%-6u", 1234); ++ TEST("-1234 ", "%-6i", -1234); ++ TEST("1234", "%.6s", "1234"); ++ TEST(" 1234", "%6s", "1234"); ++ TEST("1234 ", "%-6s", "1234"); ++ TEST(" 01234", "%6.5u", 1234); ++ TEST("-01234", "%6.5i", -1234); ++ TEST(" 1234", "%6.5s", "1234"); ++ + #ifdef XSI_TESTS + setlocale(LC_ALL, "de_DE"); + diff --git a/dietlibc-0.31.20080212-printffmt.patch b/dietlibc-0.31.20080212-printffmt.patch new file mode 100644 index 0000000..1d95d07 --- /dev/null +++ b/dietlibc-0.31.20080212-printffmt.patch @@ -0,0 +1,33 @@ +diff -up dietlibc-0.31.20080212/test/printf.c.~1~ dietlibc-0.31.20080212/test/printf.c +diff -up dietlibc-0.31.20080212/lib/__v_printf.c.~1~ dietlibc-0.31.20080212/lib/__v_printf.c +--- dietlibc-0.31.20080212/lib/__v_printf.c.~1~ 2008-02-13 15:42:52.000000000 +0100 ++++ dietlibc-0.31.20080212/lib/__v_printf.c 2008-02-13 17:26:13.000000000 +0100 +@@ -222,7 +222,7 @@ print_out: + + if (flag_dot && width==0) width=preci; + if (!flag_dot) preci=sz; +- if (!flag_left) { /* do left-side padding */ ++ if (!flag_left && padwith==' ') { /* do left-side padding with spaces */ + if (write_pad(&len,fn,width-preci,padwith)) + return -1; + } +@@ -230,6 +230,10 @@ print_out: + B_WRITE(fn,sign,todo); + len+=todo; + } ++ if (!flag_left && padwith!=' ') { /* do left-side padding with '0' */ ++ if (write_pad(&len,fn,width-preci,padwith)) ++ return -1; ++ } + /* do preci padding */ + if (write_pad(&len,fn,preci-sz,precpadwith)) + return -1; +@@ -385,7 +389,7 @@ num_printf: + + sz=strlen(s); + if (width + + void blah(void) { +- write(2,"atexit\n",7); ++ write(1,"atexit\n",7); + } + + int main() { +diff -up dietlibc-0.31.20080212/test/sendfile.c.~1~ dietlibc-0.31.20080212/test/sendfile.c +--- dietlibc-0.31.20080212/test/sendfile.c.~1~ 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080212/test/sendfile.c 2008-02-13 18:35:34.000000000 +0100 +@@ -11,5 +11,5 @@ int main() { + + printf("sendfile returned %d\n",ret); + +-return 0; ++ return ret<0 ? 1 : 0; + } +diff -up dietlibc-0.31.20080212/test/malloc-debugger.c.~1~ dietlibc-0.31.20080212/test/malloc-debugger.c +--- dietlibc-0.31.20080212/test/malloc-debugger.c.~1~ 2003-02-20 16:57:13.000000000 +0100 ++++ dietlibc-0.31.20080212/test/malloc-debugger.c 2008-02-13 18:34:27.000000000 +0100 +@@ -4,7 +4,7 @@ + int main() { + char* c=malloc(13); + char* tmp; +- fprintf(stderr,"got %p\n",c); ++ fprintf(stdout,"got %p\n",c); + c[0]=14; + // c[15]=0; + tmp=realloc(c,12345); +diff -up dietlibc-0.31.20080212/test/waitpid.c.~1~ dietlibc-0.31.20080212/test/waitpid.c +--- dietlibc-0.31.20080212/test/waitpid.c.~1~ 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080212/test/waitpid.c 2008-02-13 18:35:57.000000000 +0100 +@@ -11,7 +11,7 @@ int main() { + perror("fork"); + _exit(1); + case 0: +- fprintf(stderr,"child, my pid is %u\n",getpid()); ++ fprintf(stdout,"child, my pid is %u\n",getpid()); + sleep(1); + _exit(23); + } diff --git a/runtests-X.sh b/runtests-X.sh new file mode 100644 index 0000000..24037c1 --- /dev/null +++ b/runtests-X.sh @@ -0,0 +1,29 @@ +#! /bin/sh + +eval $(grep '^\(TESTPROGRAMS\|SUBDIRS\)=' runtests.sh) + +rc=0 + +: ${RUNTEST_INDENT=0} +export RUNTEST_INDENT + +for p in $TESTPROGRAMS; do + ! tty -s || printf '%*s%-20s' $RUNTEST_INDENT '' "$p" + ./$p >/dev/null && res='OK' || { res='FAIL'; let ++rc; } + + printf '\r%*s%-20s%s\n' $RUNTEST_INDENT '' "$p" "$res" +done + +test $rc -eq 0 || \ + printf "%*s--> %u tests failed\n" $RUNTEST_INDENT '' $rc + +for d in $SUBDIRS; do + echo "--- entering directory $d ---" + let RUNTEST_INDENT+=2 + cd $d && bash ./runtests-X.sh || let ++rc + let RUNTEST_INDENT-=2 + + cd $OLDPWD || exit 1 +done + +test $rc -eq 0 && exit 0 || exit 1 From eaa1d202095b07b34b23af0f2449ca09df0c1866 Mon Sep 17 00:00:00 2001 From: ensc Date: Wed, 13 Feb 2008 17:52:30 +0000 Subject: [PATCH 002/161] added 'cvs-sources' target --- Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ba7d5a1..ad740a7 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Makefile for source rpm: dietlibc -# $Id$ +# $Id: Makefile,v 1.1 2005/03/04 00:52:22 ensc Exp $ NAME := dietlibc SPECFILE = $(firstword $(wildcard *.spec)) @@ -19,3 +19,12 @@ MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) endif include $(MAKEFILE_COMMON) + + +CVS_BASEVER = 0.31 +CVS_DATE := $(shell date +'%Y%m%d' -d '-1 day') +_cvs_suffix = ${CVS_BASEVER}.${CVS_DATE} + +cvs-sources: + cd ${DESTDIR} . && cvs -d :pserver:cvs@cvs.fefe.de:/cvs -z9 export -D${CVS_DATE} -d dietlibc-${_cvs_suffix} dietlibc + cd ${DESTDIR} . && tar cjf dietlibc-${_cvs_suffix}.tar.bz2 dietlibc-${_cvs_suffix} --owner root --group root From 8fdd3c7786e072ae556e7abc65fcbc45408f2453 Mon Sep 17 00:00:00 2001 From: ensc Date: Wed, 13 Feb 2008 17:53:40 +0000 Subject: [PATCH 003/161] updated to CVS snapshot 20080212 --- sources | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sources b/sources index c78adf9..91d1271 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -acb98d469ee932d902fdf6de07802b7c dietlibc-0.31.tar.bz2 -77dadb56faa06c1a5177d76806e79b28 dietlibc-0.31.tar.bz2.sig +11c4b650b3644269a8d2a624fd9780ea dietlibc-0.31.20080212.tar.bz2 From 18415a91b7f9c9813f4f81e477cfd0f3a7becf2f Mon Sep 17 00:00:00 2001 From: ensc Date: Wed, 13 Feb 2008 17:54:35 +0000 Subject: [PATCH 004/161] - updated to CVS snapshot 20080212 - fixed printf regression for '%+04i' style formats - added %%check and run a testsuite; it does not succeed now so it is for informational purposes only... --- dietlibc.spec | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index debadf4..274202a 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -5,6 +5,8 @@ ## Fedora Extras specific customization below... ## +%global snapshot 20080212 + %ifarch %ix86 x86_64 arm %global do_dyn 0 %else @@ -27,12 +29,18 @@ Summary: Small libc implementation Name: dietlibc Version: 0.31 -Release: %release_func 1 +Release: %release_func 1%{?snapshot:.%snapshot} License: GPL Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ +%if !0%{?snapshot:1} Source0: http://www.kernel.org/pub/linux/libs/dietlibc/%name-%version.tar.bz2 Source1: http://www.fefe.de/dietlibc/%name-%version.tar.bz2.sig +%else +# generated by 'make cvs-sources [CVS_DATE=....]' +Source0: %name-%version.%snapshot.tar.bz2 +%endif +Source10: runtests-X.sh Patch1: dietlibc-0.28-setpriority.patch Patch10: dietlibc-0.29-scall.patch Patch20: dietlibc-0.29-nostackprotector.patch @@ -40,6 +48,9 @@ Patch30: dietlibc-0.30-longdouble.patch Patch31: dietlibc-0.31-defpath.patch Patch32: dietlibc-0.31-stacksmash.patch Patch33: dietlibc-0.31-stacksmash-dyn.patch +Patch34: dietlibc-0.31.20080212-printffmt.patch +Patch40: dietlibc-0.31-printftest.patch +Patch41: dietlibc-0.31.20080212-teststdout.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dyn:Requires: dietlibc-lib = %version-%release} %{!?with_dyn:Obsoletes: dietlibc-lib < %version-%release} @@ -66,13 +77,17 @@ This package contains the dynamic libraries for dietlibc. %prep -%setup -q +%setup -q %{?snapshot:-n %name-%version.%snapshot} %patch1 -p1 -b .nice %patch10 -p1 -b .scall %patch30 -p1 -b .longdouble %patch31 -p1 -b .defpath %patch32 -p1 -b .stacksmash %patch33 -p1 -b .stacksmash-dyn +%patch34 -p1 -b .printffmt + +%patch40 -p1 -b .printftest +%patch41 -p1 -b .teststdout %ifnarch i386 x86_64 %patch20 -p1 -b .nostackprotector @@ -85,10 +100,14 @@ sed -i -e 's!^#define WANT_SSP$!// \0!g; sed -i -e 's!strip !: !g' Makefile -%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os +%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -O0 -g3 %global basemakeflags prefix=%_libdir/dietlibc BINDIR=%_bindir MAN1DIR=%_mandir/man1 COMMENT=: CFLAGS="$RPM_OPT_FLAGS %fixcflags" PDIET=%_libdir/dietlibc %global makeflags %basemakeflags +for i in `find test -name 'runtests.sh'`; do + ln -s %SOURCE10 `dirname $i`/runtests-X.sh +done + %build make %makeflags all %{?_smp_mflags} @@ -109,6 +128,15 @@ chmod a-x $RPM_BUILD_ROOT%_libdir/dietlibc/lib-*/*.o rm -f $RPM_BUILD_ROOT%_bindir/dnsd +%check +make %makeflags -C test all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) +make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) + +cd test +ulimit -m $[ 50*1024 ] -v $[ 100*1024 ] -d $[ 50*1024 ] +bash ./runtests-X.sh || : + + %clean rm -rf $RPM_BUILD_ROOT @@ -132,6 +160,12 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Wed Feb 13 2008 Enrico Scholz - 0.31-1.20080212 +- updated to CVS snapshot 20080212 +- fixed printf regression for '%+04i' style formats +- added %%check and run a testsuite; it does not succeed now so it is + for informational purposes only... + * Sat Sep 1 2007 Enrico Scholz - 0.31-1 - updated to 0.31 - removed the no-stack-protector bits for i386 and x86_64 archs From 9ad08dd3872fb08325cda77f08960801fcbb6c37 Mon Sep 17 00:00:00 2001 From: ensc Date: Wed, 13 Feb 2008 21:06:05 +0000 Subject: [PATCH 005/161] fixup status output; made it a bash script --- runtests-X.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runtests-X.sh b/runtests-X.sh index 24037c1..abfc78d 100644 --- a/runtests-X.sh +++ b/runtests-X.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash eval $(grep '^\(TESTPROGRAMS\|SUBDIRS\)=' runtests.sh) @@ -10,13 +10,14 @@ export RUNTEST_INDENT for p in $TESTPROGRAMS; do ! tty -s || printf '%*s%-20s' $RUNTEST_INDENT '' "$p" ./$p >/dev/null && res='OK' || { res='FAIL'; let ++rc; } + ! tty -s || printf '\r' - printf '\r%*s%-20s%s\n' $RUNTEST_INDENT '' "$p" "$res" + printf '%*s%-20s%s\n' $RUNTEST_INDENT '' "$p" "$res" done test $rc -eq 0 || \ printf "%*s--> %u tests failed\n" $RUNTEST_INDENT '' $rc - + for d in $SUBDIRS; do echo "--- entering directory $d ---" let RUNTEST_INDENT+=2 From b0593e5c27a5e7274ea1f92e6fe03d178d4294d9 Mon Sep 17 00:00:00 2001 From: ensc Date: Wed, 13 Feb 2008 21:07:14 +0000 Subject: [PATCH 006/161] use --with dynamic + --with ssp constructs --- dietlibc.spec | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 274202a..2677598 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -1,20 +1,21 @@ ## $Id: dietlibc.spec,v 1.3 2005/02/01 12:03:17 ensc Exp $ ## This package understands the following switches: +## --with[out] ssp ... enable/disable SSP; default depends +## on target architecture +## --with dynamic ... enable dynamic lib support -## Fedora Extras specific customization below... -## %global snapshot 20080212 -%ifarch %ix86 x86_64 arm -%global do_dyn 0 +%ifarch %ix86 x86_64 +%bcond_without ssp %else -%global do_dyn 0 +%bcond_with ssp %endif -%if %do_dyn -%global with_dyn 1 +%ifarch %ix86 x86_64 arm +%bcond_with dynamic %endif %ifarch %ix86 @@ -23,7 +24,6 @@ %global target_cpu %_target_cpu %endif - %{!?release_func:%global release_func() %1%{?dist}} Summary: Small libc implementation @@ -52,8 +52,8 @@ Patch34: dietlibc-0.31.20080212-printffmt.patch Patch40: dietlibc-0.31-printftest.patch Patch41: dietlibc-0.31.20080212-teststdout.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot -%{?with_dyn:Requires: dietlibc-lib = %version-%release} -%{!?with_dyn:Obsoletes: dietlibc-lib < %version-%release} +%{?with_dynamic:Requires: dietlibc-lib = %version-%release} +%{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} %package lib @@ -89,7 +89,7 @@ This package contains the dynamic libraries for dietlibc. %patch40 -p1 -b .printftest %patch41 -p1 -b .teststdout -%ifnarch i386 x86_64 +%if %{without ssp} %patch20 -p1 -b .nostackprotector sed -i -e 's!^#define WANT_SSP$!// \0!g; s!.*\(#define WANT_STACKGAP\).*!\1!g' dietfeatures.h @@ -100,7 +100,7 @@ sed -i -e 's!^#define WANT_SSP$!// \0!g; sed -i -e 's!strip !: !g' Makefile -%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -O0 -g3 +%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os %global basemakeflags prefix=%_libdir/dietlibc BINDIR=%_bindir MAN1DIR=%_mandir/man1 COMMENT=: CFLAGS="$RPM_OPT_FLAGS %fixcflags" PDIET=%_libdir/dietlibc %global makeflags %basemakeflags @@ -113,7 +113,7 @@ done make %makeflags all %{?_smp_mflags} # 'dyn' target is not SMP safe -%{?with_dyn:make %makeflags dyn} +%{?with_dynamic:make %makeflags dyn} %install @@ -129,8 +129,8 @@ rm -f $RPM_BUILD_ROOT%_bindir/dnsd %check -make %makeflags -C test all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) -make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) +make %makeflags -C test all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) -k || : +make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) || : cd test ulimit -m $[ 50*1024 ] -v $[ 100*1024 ] -d $[ 50*1024 ] @@ -142,14 +142,14 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -%{?with_dyn:%exclude %_libdir/dietlibc/*/*.so} +%{?with_dynamic:%exclude %_libdir/dietlibc/*/*.so} %doc AUTHOR BUGS CAVEAT CHANGES COPYING FAQ PORTING README* %doc SECURITY THANKS TODO %doc %_mandir/*/* %_bindir/* %_libdir/dietlibc -%if %do_dyn +%if %{with dynamic} %files lib %defattr(-,root,root,-) %config(noreplace) %_sysconfdir/* From fea4a802d0ecc1a8c108129fd13a4a89cd5a5af3 Mon Sep 17 00:00:00 2001 From: ensc Date: Wed, 13 Feb 2008 21:11:20 +0000 Subject: [PATCH 007/161] added temporary code to trace down ppc problems --- dietlibc.spec | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dietlibc.spec b/dietlibc.spec index 2677598..e0215c3 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -55,6 +55,9 @@ BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} +#### HACK!! +BuildRequires: strace + %package lib Summary: Dynamic libraries for dietlibc @@ -110,6 +113,13 @@ done %build +make %makeflags all %{?_smp_mflags} || : + + +### HACK: just for debugging ppc* issues +strace -f bin-ppc/diet true +objdump -dS bin-ppc/diet + make %makeflags all %{?_smp_mflags} # 'dyn' target is not SMP safe From 6aa347dbdead0519ee7dea6b0624c81822b3683c Mon Sep 17 00:00:00 2001 From: ensc Date: Wed, 13 Feb 2008 21:26:45 +0000 Subject: [PATCH 008/161] further tests... --- dietlibc.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index e0215c3..35595c5 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -117,7 +117,7 @@ make %makeflags all %{?_smp_mflags} || : ### HACK: just for debugging ppc* issues -strace -f bin-ppc/diet true +strace -f -s9999 bin-ppc/diet gcc -D__dietlibc__ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables -fno-stack-protector -Os -o bin-ppc/dnsd contrib/dnsd.c || : objdump -dS bin-ppc/diet make %makeflags all %{?_smp_mflags} From 0f8aeab54bc8edc17c8ed8d9fc31903b258d3fde Mon Sep 17 00:00:00 2001 From: ensc Date: Thu, 14 Feb 2008 11:49:42 +0000 Subject: [PATCH 009/161] further hacks... --- dietlibc.spec | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 35595c5..398a8bb 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -103,7 +103,7 @@ sed -i -e 's!^#define WANT_SSP$!// \0!g; sed -i -e 's!strip !: !g' Makefile -%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os +%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -g3 %global basemakeflags prefix=%_libdir/dietlibc BINDIR=%_bindir MAN1DIR=%_mandir/man1 COMMENT=: CFLAGS="$RPM_OPT_FLAGS %fixcflags" PDIET=%_libdir/dietlibc %global makeflags %basemakeflags @@ -113,13 +113,44 @@ done %build -make %makeflags all %{?_smp_mflags} || : +set +e +make %makeflags all %{?_smp_mflags} ### HACK: just for debugging ppc* issues -strace -f -s9999 bin-ppc/diet gcc -D__dietlibc__ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables -fno-stack-protector -Os -o bin-ppc/dnsd contrib/dnsd.c || : -objdump -dS bin-ppc/diet +objdir=bin-%{target_cpu} +objdump -dS $objdir/diet +strace -s9999 $objdir/diet gcc -D__dietlibc__ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables -fno-stack-protector -Os -o $objdir/dnsd contrib/dnsd.c + +cat >/tmp/gdb.cmd < Date: Thu, 14 Feb 2008 12:10:24 +0000 Subject: [PATCH 010/161] BR gdb --- dietlibc.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 398a8bb..3640366 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -56,7 +56,7 @@ BuildRoot: %_tmppath/%name-%version-%release-buildroot %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} #### HACK!! -BuildRequires: strace +BuildRequires: strace gdb %package lib From 0136367ad43917a0cabfd1416799cf951ab390bd Mon Sep 17 00:00:00 2001 From: ensc Date: Thu, 14 Feb 2008 16:31:20 +0000 Subject: [PATCH 011/161] added strlen patch; build testsuite with -fno-builtin --- dietlibc-0.31.20080212-strlen.patch | 229 ++++++++++++++++++++++++++++ dietlibc.spec | 8 +- 2 files changed, 235 insertions(+), 2 deletions(-) create mode 100644 dietlibc-0.31.20080212-strlen.patch diff --git a/dietlibc-0.31.20080212-strlen.patch b/dietlibc-0.31.20080212-strlen.patch new file mode 100644 index 0000000..c9712c7 --- /dev/null +++ b/dietlibc-0.31.20080212-strlen.patch @@ -0,0 +1,229 @@ +diff -upN dietlibc-0.31.20080212/x86_64/strlen.c.strlen dietlibc-0.31.20080212/x86_64/strlen.c +--- dietlibc-0.31.20080212/x86_64/strlen.c.strlen 2007-10-04 18:19:15.000000000 +0200 ++++ dietlibc-0.31.20080212/x86_64/strlen.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1 +0,0 @@ +-#include "alpha/strlen.c" +diff -upN dietlibc-0.31.20080212/test/string/strlen.c.strlen dietlibc-0.31.20080212/test/string/strlen.c +--- dietlibc-0.31.20080212/test/string/strlen.c.strlen 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080212/test/string/strlen.c 2008-02-14 17:23:25.000000000 +0100 +@@ -2,9 +2,24 @@ + #include + + int main() { +- const char* x="foo bar baz"; ++ /* make it large enough to test all possible alignments, number of trailing ++ * bytes and word sizes */ ++ char x[33]= { [0] = '\0' }; ++ ++ size_t i, j, k; + assert(strlen("")==0); +- assert(strlen(x)==11); +- assert(strlen(x+5)==6); ++ ++ /* run it twice; during first run, all trailing bytes are \0. In second run, ++ * they are initialized to non \0 */ ++ for (k=0; k<2; ++k) { ++ for (j=0; j<32; ++j) { ++ x[j] = j%10 + '0'; ++ x[j+1] = '\0'; ++ ++ for (i=0; i<=j; ++i) ++ assert(strlen(x+i)==j+1-i); ++ } ++ } ++ + return 0; + } +diff -upN dietlibc-0.31.20080212/test/strlen.c.strlen dietlibc-0.31.20080212/test/strlen.c +--- dietlibc-0.31.20080212/test/strlen.c.strlen 2007-11-17 15:29:53.000000000 +0100 ++++ dietlibc-0.31.20080212/test/strlen.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1,11 +0,0 @@ +-#include +-#include +- +-int main() { +- const char* x="foo bar baz"; +- size_t i; +- assert(strlen("")==0); +- for (i=0; i<11; ++i) +- assert(strlen(x+i)==11-i); +- return 0; +-} +diff -upN dietlibc-0.31.20080212/test/Makefile.strlen dietlibc-0.31.20080212/test/Makefile +--- dietlibc-0.31.20080212/test/Makefile.strlen 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080212/test/Makefile 2008-02-14 17:24:12.000000000 +0100 +@@ -13,7 +13,7 @@ gethostbyname_r getmntent getopt getpass + glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness \ + memccpy memchr memcmp memcpy 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 strlen strncat strncpy strptime strrchr \ ++speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr \ + strstr strtol sysenter ungetc waitpid + + test: $(TESTPROGRAMS) +diff -upN dietlibc-0.31.20080212/test/runtests.sh.strlen dietlibc-0.31.20080212/test/runtests.sh +--- dietlibc-0.31.20080212/test/runtests.sh.strlen 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080212/test/runtests.sh 2008-02-14 17:24:01.000000000 +0100 +@@ -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 memcpy 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 strlen strncat strncpy strptime strrchr strstr strtol sysenter ungetc waitpid" ++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 memcpy 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" + + STDIN="read1" + PASS="getpass" +diff -upN dietlibc-0.31.20080212/sparc64/strlen.c.strlen dietlibc-0.31.20080212/sparc64/strlen.c +--- dietlibc-0.31.20080212/sparc64/strlen.c.strlen 2007-10-04 18:19:15.000000000 +0200 ++++ dietlibc-0.31.20080212/sparc64/strlen.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1 +0,0 @@ +-#include "alpha/strlen.c" +diff -upN dietlibc-0.31.20080212/ppc64/strlen.c.strlen dietlibc-0.31.20080212/ppc64/strlen.c +--- dietlibc-0.31.20080212/ppc64/strlen.c.strlen 2007-10-04 18:19:15.000000000 +0200 ++++ dietlibc-0.31.20080212/ppc64/strlen.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1 +0,0 @@ +-#include "alpha/strlen.c" +diff -upN dietlibc-0.31.20080212/lib/strstr.c.strlen dietlibc-0.31.20080212/lib/strstr.c +--- dietlibc-0.31.20080212/lib/strstr.c.strlen 2003-08-19 21:34:18.000000000 +0200 ++++ dietlibc-0.31.20080212/lib/strstr.c 2008-02-14 16:40:23.000000000 +0100 +@@ -4,7 +4,7 @@ + char *strstr(const char *haystack, const char *needle) { + size_t nl=strlen(needle); + size_t hl=strlen(haystack); +- int i; ++ size_t i; + if (!nl) goto found; + if (nl>hl) return 0; + for (i=hl-nl+1; __likely(i); --i) { +diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/strlen.c +--- dietlibc-0.31.20080212/lib/strlen.c.strlen 2003-08-19 21:34:18.000000000 +0200 ++++ dietlibc-0.31.20080212/lib/strlen.c 2008-02-14 17:06:39.000000000 +0100 +@@ -1,6 +1,7 @@ + #include + #include "dietfeatures.h" + #include ++#include + + #ifdef WANT_SMALL_STRING_ROUTINES + size_t strlen(const char *s) { +@@ -10,38 +11,64 @@ size_t strlen(const char *s) { + return i; + } + #else +-static const unsigned long magic = 0x01010101; ++ ++#if __WORDSIZE == 64 ++typedef uint64_t word_t; ++static word_t const magic = 0x0101010101010101ull; ++#elif __WORDSIZE == 32 ++typedef uint32_t word_t; ++static word_t const magic = 0x01010101u; ++#else ++#error unsupported __WORDSIZE ++#endif + + size_t strlen(const char *s) + { + const char *t = s; +- unsigned long word; ++ word_t word; + + if (!s) return 0; + + /* Byte compare up until word boundary */ +- for (; ((unsigned long) t & 3); t++) ++ for (; ((unsigned long) t & (sizeof(magic)-1)); t++) + if (!*t) return t - s; + + /* Word compare */ + do { +- word = *((unsigned long *) t); t += 4; ++ word = *((word_t const *) t); t += sizeof word; + word = (word - magic) &~ word; + word &= (magic << 7); + } while (__likely(word == 0)); + +-#if BYTE_ORDER == LITTLE_ENDIAN +- /* word & 0x80808080 == word */ +- word = (word - 1) & (magic << 10); +- word += (word << 8) + (word << 16); +- t += word >> 26; ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++ ++ if (sizeof(word)==8) { ++ /* word & 0x8080808080808080 == word */ ++ word = (word - 1) & (magic << 8); ++ word += (word << 32); ++ word += (word << 16); ++ word += (word << 8); ++ t += word >> 56; ++ } else if (sizeof(word)==4) { ++ /* word & 0x80808080 == word */ ++ word = (word - 1) & (magic << 10); ++ word += (word << 8) + (word << 16); ++ t += word >> 26; ++ } ++ + #else +- if ((word & 0x80800000) == 0) { +- word <<= 16; ++ ++ if (sizeof(word)>=8 && (word & 0x8080808000000000ull) == 0) ++ t += 4; ++ ++ if (sizeof(word)>=4 && (word & 0x80800000u) == 0) + t += 2; +- } +- if ((word & 0x80000000) == 0) t += 1; +-#endif +- return ((const char *) t) - 4 - s; ++ ++ if (sizeof(word)>=2 && (word & 0x8000u) == 0) ++ t += 1; ++ ++#endif /* __BYTE_ORDER */ ++ ++ return t - sizeof(word) - s; + } +-#endif ++#endif /* WANT_SMALL_STRING_ROUTINES */ +diff -upN dietlibc-0.31.20080212/ia64/strlen.c.strlen dietlibc-0.31.20080212/ia64/strlen.c +--- dietlibc-0.31.20080212/ia64/strlen.c.strlen 2007-10-04 18:19:15.000000000 +0200 ++++ dietlibc-0.31.20080212/ia64/strlen.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1 +0,0 @@ +-#include "alpha/strlen.c" +diff -upN dietlibc-0.31.20080212/alpha/strlen.c.strlen dietlibc-0.31.20080212/alpha/strlen.c +--- dietlibc-0.31.20080212/alpha/strlen.c.strlen 2001-01-09 18:57:38.000000000 +0100 ++++ dietlibc-0.31.20080212/alpha/strlen.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1,32 +0,0 @@ +-#include +- +-static const unsigned long long magic = 0x0101010101010101LL; +- +-size_t strlen(const char *s) +-{ +- const char *t = s; +- unsigned long long word; +- +- if (!s) return 0; +- +- /* Byte compare up until 64 bit word boundary */ +- for (; ((unsigned long long) t & 7); t++) +- if (!*t) return t - s; +- +- /* Word compare */ +- do { +- word = *((unsigned long long *) t); t += 8; +- word = (word - magic) &~ word; +- word &= (magic << 7); +- } while (word == 0); +- +- /* word & 0x8080808080808080 == word */ +- word = (word - 1) & (magic << 8); +- word += (word << 32); +- word += (word << 16); +- word += (word << 8); +- t += word >> 56; +- return ((const char *) t) - 8 - s; +-} +- +- diff --git a/dietlibc.spec b/dietlibc.spec index 3640366..28854a3 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -51,6 +51,7 @@ Patch33: dietlibc-0.31-stacksmash-dyn.patch Patch34: dietlibc-0.31.20080212-printffmt.patch Patch40: dietlibc-0.31-printftest.patch Patch41: dietlibc-0.31.20080212-teststdout.patch +Patch42: dietlibc-0.31.20080212-strlen.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -91,6 +92,8 @@ This package contains the dynamic libraries for dietlibc. %patch40 -p1 -b .printftest %patch41 -p1 -b .teststdout +%patch42 -p1 -b .strlen + %if %{without ssp} %patch20 -p1 -b .nostackprotector @@ -104,7 +107,7 @@ sed -i -e 's!^#define WANT_SSP$!// \0!g; sed -i -e 's!strip !: !g' Makefile %global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -g3 -%global basemakeflags prefix=%_libdir/dietlibc BINDIR=%_bindir MAN1DIR=%_mandir/man1 COMMENT=: CFLAGS="$RPM_OPT_FLAGS %fixcflags" PDIET=%_libdir/dietlibc +%global basemakeflags prefix=%_libdir/dietlibc BINDIR=%_bindir MAN1DIR=%_mandir/man1 COMMENT=: CFLAGS="$RPM_OPT_FLAGS %fixcflags $XTRA_CFLAGS" PDIET=%_libdir/dietlibc %global makeflags %basemakeflags for i in `find test -name 'runtests.sh'`; do @@ -147,7 +150,7 @@ up info locals quit EOF -gdb --batch -x /tmp/gdb.cmd $objdir/diet +gdb --batch -x /tmp/gdb.cmd $objdir/diet < /dev/null set -e @@ -170,6 +173,7 @@ rm -f $RPM_BUILD_ROOT%_bindir/dnsd %check +XTRA_CFLAGS='-fno-builtin' make %makeflags -C test all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) -k || : make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) || : From 7e5d7168b5b943fd83ce5222d853e7ca45dafbdd Mon Sep 17 00:00:00 2001 From: ensc Date: Thu, 14 Feb 2008 19:03:48 +0000 Subject: [PATCH 012/161] fixed strlen patch --- dietlibc-0.31.20080212-strlen.patch | 107 ++++++++++++++++++---------- 1 file changed, 68 insertions(+), 39 deletions(-) diff --git a/dietlibc-0.31.20080212-strlen.patch b/dietlibc-0.31.20080212-strlen.patch index c9712c7..0b179ca 100644 --- a/dietlibc-0.31.20080212-strlen.patch +++ b/dietlibc-0.31.20080212-strlen.patch @@ -5,31 +5,42 @@ diff -upN dietlibc-0.31.20080212/x86_64/strlen.c.strlen dietlibc-0.31.20080212/x -#include "alpha/strlen.c" diff -upN dietlibc-0.31.20080212/test/string/strlen.c.strlen dietlibc-0.31.20080212/test/string/strlen.c --- dietlibc-0.31.20080212/test/string/strlen.c.strlen 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080212/test/string/strlen.c 2008-02-14 17:23:25.000000000 +0100 -@@ -2,9 +2,24 @@ ++++ dietlibc-0.31.20080212/test/string/strlen.c 2008-02-14 18:32:57.000000000 +0100 +@@ -1,10 +1,35 @@ + #include #include ++#include ++ ++/* make it large enough to test all possible alignments, number of trailing ++ * bytes and word sizes */ ++#define BUFLEN (__WORDSIZE/8 * 4) int main() { - const char* x="foo bar baz"; -+ /* make it large enough to test all possible alignments, number of trailing -+ * bytes and word sizes */ -+ char x[33]= { [0] = '\0' }; ++ /* will hold the string, the trailing zero and a test pattern */ ++ char buf[BUFLEN + 1 + __WORDSIZE/8]; ++ size_t len; + -+ size_t i, j, k; assert(strlen("")==0); - assert(strlen(x)==11); - assert(strlen(x+5)==6); + -+ /* run it twice; during first run, all trailing bytes are \0. In second run, -+ * they are initialized to non \0 */ -+ for (k=0; k<2; ++k) { -+ for (j=0; j<32; ++j) { -+ x[j] = j%10 + '0'; -+ x[j+1] = '\0'; ++ for (len=0; len #include "dietfeatures.h" @@ -105,7 +116,7 @@ diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/ #ifdef WANT_SMALL_STRING_ROUTINES size_t strlen(const char *s) { -@@ -10,38 +11,64 @@ size_t strlen(const char *s) { +@@ -10,38 +11,83 @@ size_t strlen(const char *s) { return i; } #else @@ -126,8 +137,10 @@ diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/ const char *t = s; - unsigned long word; + word_t word; ++ word_t mask; - if (!s) return 0; +- if (!s) return 0; ++ if (__unlikely(!s)) return 0; /* Byte compare up until word boundary */ - for (; ((unsigned long) t & 3); t++) @@ -148,44 +161,60 @@ diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/ - word += (word << 8) + (word << 16); - t += word >> 26; +#if __BYTE_ORDER == __LITTLE_ENDIAN -+ -+ if (sizeof(word)==8) { ++ switch (sizeof(word)) { ++ case 8: + /* word & 0x8080808080808080 == word */ + word = (word - 1) & (magic << 8); + word += (word << 32); + word += (word << 16); + word += (word << 8); + t += word >> 56; -+ } else if (sizeof(word)==4) { ++ break; ++ ++ case 4: + /* word & 0x80808080 == word */ + word = (word - 1) & (magic << 10); + word += (word << 8) + (word << 16); + t += word >> 26; ++ break; + } -+ #else - if ((word & 0x80800000) == 0) { - word <<= 16; +- t += 2; ++ /* results into 0x8080 0000 or 0x80808080 00000000 */ ++ mask = (magic << 7) & ~((1u<<(sizeof(magic)*8/2))-1); + -+ if (sizeof(word)>=8 && (word & 0x8080808000000000ull) == 0) -+ t += 4; ++ if (sizeof(word)>=8) { ++ if ((word & mask) == 0) { ++ t += 4; ++ word <<= 4*8; ++ } ++ ++ mask <<= 2*8; ++ } + -+ if (sizeof(word)>=4 && (word & 0x80800000u) == 0) - t += 2; -- } ++ if (sizeof(word)>=4) { ++ if ((word & mask) == 0) { ++ t += 2; ++ word <<= 2*8; ++ } ++ ++ mask <<= 1*8; ++ } ++ ++ if (sizeof(word)>=2) { ++ if ((word & mask) == 0) { ++ t += 1; ++ word <<= 1*8; ++ } + } - if ((word & 0x80000000) == 0) t += 1; --#endif + #endif - return ((const char *) t) - 4 - s; -+ -+ if (sizeof(word)>=2 && (word & 0x8000u) == 0) -+ t += 1; -+ -+#endif /* __BYTE_ORDER */ -+ + return t - sizeof(word) - s; } --#endif -+#endif /* WANT_SMALL_STRING_ROUTINES */ + #endif diff -upN dietlibc-0.31.20080212/ia64/strlen.c.strlen dietlibc-0.31.20080212/ia64/strlen.c --- dietlibc-0.31.20080212/ia64/strlen.c.strlen 2007-10-04 18:19:15.000000000 +0200 +++ dietlibc-0.31.20080212/ia64/strlen.c 1970-01-01 01:00:00.000000000 +0100 From 102859dd8cfd78565005e9a490579c097f2e810e Mon Sep 17 00:00:00 2001 From: ensc Date: Thu, 14 Feb 2008 20:29:33 +0000 Subject: [PATCH 013/161] further strlen fixes... --- dietlibc-0.31.20080212-strlen.patch | 42 ++++++++++++++++------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/dietlibc-0.31.20080212-strlen.patch b/dietlibc-0.31.20080212-strlen.patch index 0b179ca..e012463 100644 --- a/dietlibc-0.31.20080212-strlen.patch +++ b/dietlibc-0.31.20080212-strlen.patch @@ -5,7 +5,7 @@ diff -upN dietlibc-0.31.20080212/x86_64/strlen.c.strlen dietlibc-0.31.20080212/x -#include "alpha/strlen.c" diff -upN dietlibc-0.31.20080212/test/string/strlen.c.strlen dietlibc-0.31.20080212/test/string/strlen.c --- dietlibc-0.31.20080212/test/string/strlen.c.strlen 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080212/test/string/strlen.c 2008-02-14 18:32:57.000000000 +0100 ++++ dietlibc-0.31.20080212/test/string/strlen.c 2008-02-14 20:01:08.000000000 +0100 @@ -1,10 +1,35 @@ #include #include @@ -62,7 +62,7 @@ diff -upN dietlibc-0.31.20080212/test/strlen.c.strlen dietlibc-0.31.20080212/tes -} diff -upN dietlibc-0.31.20080212/test/Makefile.strlen dietlibc-0.31.20080212/test/Makefile --- dietlibc-0.31.20080212/test/Makefile.strlen 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080212/test/Makefile 2008-02-14 17:26:39.000000000 +0100 ++++ dietlibc-0.31.20080212/test/Makefile 2008-02-14 20:01:08.000000000 +0100 @@ -13,7 +13,7 @@ gethostbyname_r getmntent getopt getpass glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness \ memccpy memchr memcmp memcpy memrchr memusage mktime mmap_test pipe printf printftest \ @@ -74,7 +74,7 @@ diff -upN dietlibc-0.31.20080212/test/Makefile.strlen dietlibc-0.31.20080212/tes test: $(TESTPROGRAMS) diff -upN dietlibc-0.31.20080212/test/runtests.sh.strlen dietlibc-0.31.20080212/test/runtests.sh --- dietlibc-0.31.20080212/test/runtests.sh.strlen 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080212/test/runtests.sh 2008-02-14 17:26:39.000000000 +0100 ++++ dietlibc-0.31.20080212/test/runtests.sh 2008-02-14 20:01:08.000000000 +0100 @@ -1,6 +1,6 @@ SUBDIRS="dirent inet stdio string stdlib time" @@ -95,7 +95,7 @@ diff -upN dietlibc-0.31.20080212/ppc64/strlen.c.strlen dietlibc-0.31.20080212/pp -#include "alpha/strlen.c" diff -upN dietlibc-0.31.20080212/lib/strstr.c.strlen dietlibc-0.31.20080212/lib/strstr.c --- dietlibc-0.31.20080212/lib/strstr.c.strlen 2003-08-19 21:34:18.000000000 +0200 -+++ dietlibc-0.31.20080212/lib/strstr.c 2008-02-14 17:26:39.000000000 +0100 ++++ dietlibc-0.31.20080212/lib/strstr.c 2008-02-14 20:01:08.000000000 +0100 @@ -4,7 +4,7 @@ char *strstr(const char *haystack, const char *needle) { size_t nl=strlen(needle); @@ -107,7 +107,7 @@ diff -upN dietlibc-0.31.20080212/lib/strstr.c.strlen dietlibc-0.31.20080212/lib/ for (i=hl-nl+1; __likely(i); --i) { diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/strlen.c --- dietlibc-0.31.20080212/lib/strlen.c.strlen 2003-08-19 21:34:18.000000000 +0200 -+++ dietlibc-0.31.20080212/lib/strlen.c 2008-02-14 19:59:19.000000000 +0100 ++++ dietlibc-0.31.20080212/lib/strlen.c 2008-02-14 21:27:31.000000000 +0100 @@ -1,6 +1,7 @@ #include #include "dietfeatures.h" @@ -116,7 +116,7 @@ diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/ #ifdef WANT_SMALL_STRING_ROUTINES size_t strlen(const char *s) { -@@ -10,38 +11,83 @@ size_t strlen(const char *s) { +@@ -10,38 +11,87 @@ size_t strlen(const char *s) { return i; } #else @@ -124,13 +124,13 @@ diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/ + +#if __WORDSIZE == 64 +typedef uint64_t word_t; -+static word_t const magic = 0x0101010101010101ull; +#elif __WORDSIZE == 32 +typedef uint32_t word_t; -+static word_t const magic = 0x01010101u; +#else +#error unsupported __WORDSIZE +#endif ++ ++static word_t const magic = (word_t)(0x0101010101010101ull); size_t strlen(const char *s) { @@ -177,37 +177,41 @@ diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/ + word += (word << 8) + (word << 16); + t += word >> 26; + break; ++ ++ default: { char exc[sizeof(word)==8]; } + } #else - if ((word & 0x80800000) == 0) { - word <<= 16; - t += 2; -+ /* results into 0x8080 0000 or 0x80808080 00000000 */ -+ mask = (magic << 7) & ~((1u<<(sizeof(magic)*8/2))-1); ++ mask = (magic << 7); + -+ if (sizeof(word)>=8) { ++ switch (sizeof(word)) { ++ case 8: ++ mask <<= 4*8; + if ((word & mask) == 0) { + t += 4; + word <<= 4*8; + } -+ -+ mask <<= 2*8; -+ } ++ /* fallthrough */ + -+ if (sizeof(word)>=4) { ++ case 4: ++ mask <<= 2*8; + if ((word & mask) == 0) { + t += 2; + word <<= 2*8; + } -+ -+ mask <<= 1*8; -+ } ++ /* fallthrough */ + -+ if (sizeof(word)>=2) { ++ case 2: ++ mask <<= 1*8; + if ((word & mask) == 0) { + t += 1; + word <<= 1*8; + } ++ break; ++ ++ default: { char exc[sizeof(word)==8]; } } - if ((word & 0x80000000) == 0) t += 1; #endif From a263bc0007bbe3fa2cf097279ccc6744e0e5035a Mon Sep 17 00:00:00 2001 From: ensc Date: Thu, 14 Feb 2008 20:32:56 +0000 Subject: [PATCH 014/161] avoid compiler warnings --- dietlibc-0.31.20080212-strlen.patch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dietlibc-0.31.20080212-strlen.patch b/dietlibc-0.31.20080212-strlen.patch index e012463..eca2a3e 100644 --- a/dietlibc-0.31.20080212-strlen.patch +++ b/dietlibc-0.31.20080212-strlen.patch @@ -107,7 +107,7 @@ diff -upN dietlibc-0.31.20080212/lib/strstr.c.strlen dietlibc-0.31.20080212/lib/ for (i=hl-nl+1; __likely(i); --i) { diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/strlen.c --- dietlibc-0.31.20080212/lib/strlen.c.strlen 2003-08-19 21:34:18.000000000 +0200 -+++ dietlibc-0.31.20080212/lib/strlen.c 2008-02-14 21:27:31.000000000 +0100 ++++ dietlibc-0.31.20080212/lib/strlen.c 2008-02-14 21:31:09.000000000 +0100 @@ -1,6 +1,7 @@ #include #include "dietfeatures.h" @@ -116,7 +116,7 @@ diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/ #ifdef WANT_SMALL_STRING_ROUTINES size_t strlen(const char *s) { -@@ -10,38 +11,87 @@ size_t strlen(const char *s) { +@@ -10,38 +11,88 @@ size_t strlen(const char *s) { return i; } #else @@ -161,6 +161,7 @@ diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/ - word += (word << 8) + (word << 16); - t += word >> 26; +#if __BYTE_ORDER == __LITTLE_ENDIAN ++ (void)mask; + switch (sizeof(word)) { + case 8: + /* word & 0x8080808080808080 == word */ @@ -178,7 +179,7 @@ diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/ + t += word >> 26; + break; + -+ default: { char exc[sizeof(word)==8]; } ++ default: { char exc[sizeof(word)==8]; (void)exc; } + } #else - if ((word & 0x80800000) == 0) { @@ -211,7 +212,7 @@ diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/ + } + break; + -+ default: { char exc[sizeof(word)==8]; } ++ default: { char exc[sizeof(word)==8]; (void)exc; } } - if ((word & 0x80000000) == 0) t += 1; #endif From 9c4dfc92625ecab58f834f60679c0889eadddfc5 Mon Sep 17 00:00:00 2001 From: ensc Date: Thu, 14 Feb 2008 20:39:31 +0000 Subject: [PATCH 015/161] added ulong patch --- dietlibc-0.31.20080212-ulong.patch | 26 ++++++++++++++++++++++++++ dietlibc.spec | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 dietlibc-0.31.20080212-ulong.patch diff --git a/dietlibc-0.31.20080212-ulong.patch b/dietlibc-0.31.20080212-ulong.patch new file mode 100644 index 0000000..89bf8f7 --- /dev/null +++ b/dietlibc-0.31.20080212-ulong.patch @@ -0,0 +1,26 @@ +diff -upN dietlibc-0.31.20080212/lib/strcpy.c.~1~ dietlibc-0.31.20080212/lib/strcpy.c +--- dietlibc-0.31.20080212/lib/strcpy.c.~1~ 2003-12-21 13:06:36.000000000 +0100 ++++ dietlibc-0.31.20080212/lib/strcpy.c 2008-02-14 21:36:45.000000000 +0100 +@@ -25,7 +25,7 @@ strcpy (char *s1, const char *s2) + + while (1) { + l = *(const unsigned long *) s2; +- if (((l - MKW(0x1)) & ~l) & MKW(0x80)) { ++ if (((l - MKW(0x1ul)) & ~l) & MKW(0x80ul)) { + unsigned char c; + while ((*s1++ = (l & 0xff))) l>>=8; + return (res); +diff -upN dietlibc-0.31.20080212/lib/strcmp.c.~1~ dietlibc-0.31.20080212/lib/strcmp.c +--- dietlibc-0.31.20080212/lib/strcmp.c.~1~ 2003-12-21 13:06:36.000000000 +0100 ++++ dietlibc-0.31.20080212/lib/strcmp.c 2008-02-14 21:37:38.000000000 +0100 +@@ -31,8 +31,8 @@ strcmp (const char *s1, const char *s2) + while (1) { + l1 = *lx1++; + l2 = *lx2++; +- if ((((l1 - MKW(0x1)) & ~l1) & MKW(0x80)) || +- ((((l2 - MKW(0x1)) & ~l2) & MKW(0x80))) || l1 != l2) { ++ if ((((l1 - MKW(0x1ul)) & ~l1) & MKW(0x80ul)) || ++ ((((l2 - MKW(0x1ul)) & ~l2) & MKW(0x80ul))) || l1 != l2) { + unsigned char c1, c2; + while (1) { + c1 = l1 & 0xff; diff --git a/dietlibc.spec b/dietlibc.spec index 28854a3..01653d4 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -52,6 +52,7 @@ Patch34: dietlibc-0.31.20080212-printffmt.patch Patch40: dietlibc-0.31-printftest.patch Patch41: dietlibc-0.31.20080212-teststdout.patch Patch42: dietlibc-0.31.20080212-strlen.patch +Patch43: dietlibc-0.31.20080212-ulong.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -93,6 +94,7 @@ This package contains the dynamic libraries for dietlibc. %patch40 -p1 -b .printftest %patch41 -p1 -b .teststdout %patch42 -p1 -b .strlen +%patch43 -p1 -b .ulong %if %{without ssp} From f64111dd32521890a9585a80e93b44bb73e67dbf Mon Sep 17 00:00:00 2001 From: ensc Date: Thu, 14 Feb 2008 21:51:41 +0000 Subject: [PATCH 016/161] fixed big-endian problems in strcpy + strcmp --- dietlibc-0.31.20080212-strend.patch | 53 +++++++++++++++++++++++++++++ dietlibc.spec | 2 ++ 2 files changed, 55 insertions(+) create mode 100644 dietlibc-0.31.20080212-strend.patch diff --git a/dietlibc-0.31.20080212-strend.patch b/dietlibc-0.31.20080212-strend.patch new file mode 100644 index 0000000..2fad801 --- /dev/null +++ b/dietlibc-0.31.20080212-strend.patch @@ -0,0 +1,53 @@ +diff -upN dietlibc-0.31.20080212/lib/strcpy.c.~1~ dietlibc-0.31.20080212/lib/strcpy.c +--- dietlibc-0.31.20080212/lib/strcpy.c.~1~ 2008-02-14 21:51:56.000000000 +0100 ++++ dietlibc-0.31.20080212/lib/strcpy.c 2008-02-14 22:45:56.000000000 +0100 +@@ -26,8 +26,7 @@ strcpy (char *s1, const char *s2) + while (1) { + l = *(const unsigned long *) s2; + if (((l - MKW(0x1ul)) & ~l) & MKW(0x80ul)) { +- unsigned char c; +- while ((*s1++ = (l & 0xff))) l>>=8; ++ while ((*s1++ = GFC(l))) INCSTR(l); + return (res); + } + *(unsigned long *) s1 = l; +diff -upN dietlibc-0.31.20080212/lib/strcmp.c.~1~ dietlibc-0.31.20080212/lib/strcmp.c +--- dietlibc-0.31.20080212/lib/strcmp.c.~1~ 2008-02-14 21:51:56.000000000 +0100 ++++ dietlibc-0.31.20080212/lib/strcmp.c 2008-02-14 22:44:44.000000000 +0100 +@@ -35,12 +35,12 @@ strcmp (const char *s1, const char *s2) + ((((l2 - MKW(0x1ul)) & ~l2) & MKW(0x80ul))) || l1 != l2) { + unsigned char c1, c2; + while (1) { +- c1 = l1 & 0xff; +- c2 = l2 & 0xff; ++ c1 = GFC(l1); ++ c2 = GFC(l2); + if (!c1 || c1 != c2) + return (c1 - c2); +- l1 >>= 8; +- l2 >>= 8; ++ INCSTR(l1); ++ INCSTR(l2); + } + } + } +diff -upN dietlibc-0.31.20080212/dietstring.h.~1~ dietlibc-0.31.20080212/dietstring.h +--- dietlibc-0.31.20080212/dietstring.h.~1~ 2003-12-21 13:06:36.000000000 +0100 ++++ dietlibc-0.31.20080212/dietstring.h 2008-02-14 22:45:56.000000000 +0100 +@@ -11,6 +11,16 @@ + # define STRALIGN(x) (((unsigned long)x&3)?4-((unsigned long)x&3):0) + #endif + ++/* GFC(x) - returns first character */ ++/* INCSTR(x) - moves to next character */ ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++# define GFC(x) ((x)&0xff) ++# define INCSTR(x) do { x >>= 8; } while (0) ++#else ++# define GFC(x) (((x)>>(sizeof(x)-8))&0xff) ++# define INCSTR(x) do { x <<= 8; } while (0) ++#endif ++ + #define UNALIGNED(x,y) (((unsigned long)x & (sizeof (unsigned long)-1)) ^ ((unsigned long)y & (sizeof (unsigned long)-1))) + + #endif /* _DIET_STRING_H_ */ diff --git a/dietlibc.spec b/dietlibc.spec index 01653d4..43ee7cd 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -53,6 +53,7 @@ Patch40: dietlibc-0.31-printftest.patch Patch41: dietlibc-0.31.20080212-teststdout.patch Patch42: dietlibc-0.31.20080212-strlen.patch Patch43: dietlibc-0.31.20080212-ulong.patch +Patch44: dietlibc-0.31.20080212-strend.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -95,6 +96,7 @@ This package contains the dynamic libraries for dietlibc. %patch41 -p1 -b .teststdout %patch42 -p1 -b .strlen %patch43 -p1 -b .ulong +%patch44 -p1 -b .strend %if %{without ssp} From 6d8978bea8b47d757c41133c472aadf2eac9486d Mon Sep 17 00:00:00 2001 From: ensc Date: Thu, 14 Feb 2008 22:06:18 +0000 Subject: [PATCH 017/161] further fixes --- dietlibc-0.31.20080212-strend.patch | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/dietlibc-0.31.20080212-strend.patch b/dietlibc-0.31.20080212-strend.patch index 2fad801..6b77750 100644 --- a/dietlibc-0.31.20080212-strend.patch +++ b/dietlibc-0.31.20080212-strend.patch @@ -1,6 +1,6 @@ -diff -upN dietlibc-0.31.20080212/lib/strcpy.c.~1~ dietlibc-0.31.20080212/lib/strcpy.c ---- dietlibc-0.31.20080212/lib/strcpy.c.~1~ 2008-02-14 21:51:56.000000000 +0100 -+++ dietlibc-0.31.20080212/lib/strcpy.c 2008-02-14 22:45:56.000000000 +0100 +diff -upN dietlibc-0.31.20080212/lib/strcpy.c.strend dietlibc-0.31.20080212/lib/strcpy.c +--- dietlibc-0.31.20080212/lib/strcpy.c.strend 2008-02-14 22:48:00.000000000 +0100 ++++ dietlibc-0.31.20080212/lib/strcpy.c 2008-02-14 22:48:00.000000000 +0100 @@ -26,8 +26,7 @@ strcpy (char *s1, const char *s2) while (1) { l = *(const unsigned long *) s2; @@ -11,16 +11,16 @@ diff -upN dietlibc-0.31.20080212/lib/strcpy.c.~1~ dietlibc-0.31.20080212/lib/str return (res); } *(unsigned long *) s1 = l; -diff -upN dietlibc-0.31.20080212/lib/strcmp.c.~1~ dietlibc-0.31.20080212/lib/strcmp.c ---- dietlibc-0.31.20080212/lib/strcmp.c.~1~ 2008-02-14 21:51:56.000000000 +0100 -+++ dietlibc-0.31.20080212/lib/strcmp.c 2008-02-14 22:44:44.000000000 +0100 +diff -upN dietlibc-0.31.20080212/lib/strcmp.c.strend dietlibc-0.31.20080212/lib/strcmp.c +--- dietlibc-0.31.20080212/lib/strcmp.c.strend 2008-02-14 22:48:00.000000000 +0100 ++++ dietlibc-0.31.20080212/lib/strcmp.c 2008-02-14 23:02:14.000000000 +0100 @@ -35,12 +35,12 @@ strcmp (const char *s1, const char *s2) ((((l2 - MKW(0x1ul)) & ~l2) & MKW(0x80ul))) || l1 != l2) { unsigned char c1, c2; while (1) { - c1 = l1 & 0xff; - c2 = l2 & 0xff; -+ c1 = GFC(l1); ++ c1 = GFC(l1); + c2 = GFC(l2); if (!c1 || c1 != c2) return (c1 - c2); @@ -31,9 +31,9 @@ diff -upN dietlibc-0.31.20080212/lib/strcmp.c.~1~ dietlibc-0.31.20080212/lib/str } } } -diff -upN dietlibc-0.31.20080212/dietstring.h.~1~ dietlibc-0.31.20080212/dietstring.h ---- dietlibc-0.31.20080212/dietstring.h.~1~ 2003-12-21 13:06:36.000000000 +0100 -+++ dietlibc-0.31.20080212/dietstring.h 2008-02-14 22:45:56.000000000 +0100 +diff -upN dietlibc-0.31.20080212/dietstring.h.strend dietlibc-0.31.20080212/dietstring.h +--- dietlibc-0.31.20080212/dietstring.h.strend 2003-12-21 13:06:36.000000000 +0100 ++++ dietlibc-0.31.20080212/dietstring.h 2008-02-14 23:03:51.000000000 +0100 @@ -11,6 +11,16 @@ # define STRALIGN(x) (((unsigned long)x&3)?4-((unsigned long)x&3):0) #endif @@ -44,7 +44,7 @@ diff -upN dietlibc-0.31.20080212/dietstring.h.~1~ dietlibc-0.31.20080212/dietstr +# define GFC(x) ((x)&0xff) +# define INCSTR(x) do { x >>= 8; } while (0) +#else -+# define GFC(x) (((x)>>(sizeof(x)-8))&0xff) ++# define GFC(x) (((x)>>(sizeof(x)*8-8))&0xff) +# define INCSTR(x) do { x <<= 8; } while (0) +#endif + From a030bf001f5c5028c946c453a4709c967b1094dc Mon Sep 17 00:00:00 2001 From: ensc Date: Thu, 14 Feb 2008 22:15:07 +0000 Subject: [PATCH 018/161] ok; was hard work, but it should build now... --- dietlibc.spec | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 43ee7cd..ebe222b 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -120,44 +120,6 @@ done %build -set +e -make %makeflags all %{?_smp_mflags} - - -### HACK: just for debugging ppc* issues -objdir=bin-%{target_cpu} -objdump -dS $objdir/diet - -strace -s9999 $objdir/diet gcc -D__dietlibc__ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables -fno-stack-protector -Os -o $objdir/dnsd contrib/dnsd.c - -cat >/tmp/gdb.cmd < - 0.31-1 - updated to 0.31 From 443db2fb7ca93401f1dce76bb5b5b8d8870a4ffc Mon Sep 17 00:00:00 2001 From: ensc Date: Fri, 22 Feb 2008 16:27:57 +0000 Subject: [PATCH 019/161] - updated to CVS snapshot 20080221; removed most of the last patches as they are now in upstream --- dietlibc-0.31-printftest.patch | 46 ----- dietlibc-0.31.20080212-printffmt.patch | 33 ---- dietlibc-0.31.20080212-strend.patch | 53 ----- dietlibc-0.31.20080212-strlen.patch | 263 ------------------------- dietlibc-0.31.20080212-ulong.patch | 26 --- sources | 2 +- 6 files changed, 1 insertion(+), 422 deletions(-) delete mode 100644 dietlibc-0.31-printftest.patch delete mode 100644 dietlibc-0.31.20080212-printffmt.patch delete mode 100644 dietlibc-0.31.20080212-strend.patch delete mode 100644 dietlibc-0.31.20080212-strlen.patch delete mode 100644 dietlibc-0.31.20080212-ulong.patch diff --git a/dietlibc-0.31-printftest.patch b/dietlibc-0.31-printftest.patch deleted file mode 100644 index b0bb3b9..0000000 --- a/dietlibc-0.31-printftest.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff -up dietlibc-0.31.20080212/test/printf.c.~1~ dietlibc-0.31.20080212/test/printf.c ---- dietlibc-0.31.20080212/test/printf.c.~1~ 2004-01-07 16:06:48.000000000 +0100 -+++ dietlibc-0.31.20080212/test/printf.c 2008-02-13 17:25:35.000000000 +0100 -@@ -38,7 +38,8 @@ - #define TEST_SNPRINTF(EXP,SZ, ...) \ - { \ - volatile char * args[] = { EXP, #SZ }; \ -- int test_sz=MIN((SZ),sizeof(EXP))-1; \ -+ ssize_t test_sz=MIN((SZ),sizeof(EXP))-1; \ -+ (void)args; \ - TEST_INIT(EXP); \ - rc=snprintf(buf+ALGN,(SZ),__VA_ARGS__); \ - TEST_CHECK(EXP, test_sz); \ -@@ -80,6 +80,7 @@ int main() - - TEST("foobar", "%s", "foobar"); - TEST("01.23", "%05.2f", 1.23); -+ TEST("001.2", "%05.2g", 1.23); - - TEST("42", "%i", 42); - TEST("", "%.0i", 0); -@@ -111,6 +112,24 @@ int main() - - TEST("0x1", "%#x", 1); - -+ TEST("abcX", "%2sX", "abc"); -+ TEST("abcX", "%-2sX", "abc"); -+ -+ TEST("001234", "%.6u", 1234); -+ TEST("-001234", "%.6i", -1234); -+ TEST(" 1234", "%6u", 1234); -+ TEST(" -1234", "%6i", -1234); -+ TEST("001234", "%06u", 1234); -+ TEST("-01234", "%06i", -1234); -+ TEST("1234 ", "%-6u", 1234); -+ TEST("-1234 ", "%-6i", -1234); -+ TEST("1234", "%.6s", "1234"); -+ TEST(" 1234", "%6s", "1234"); -+ TEST("1234 ", "%-6s", "1234"); -+ TEST(" 01234", "%6.5u", 1234); -+ TEST("-01234", "%6.5i", -1234); -+ TEST(" 1234", "%6.5s", "1234"); -+ - #ifdef XSI_TESTS - setlocale(LC_ALL, "de_DE"); - diff --git a/dietlibc-0.31.20080212-printffmt.patch b/dietlibc-0.31.20080212-printffmt.patch deleted file mode 100644 index 1d95d07..0000000 --- a/dietlibc-0.31.20080212-printffmt.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff -up dietlibc-0.31.20080212/test/printf.c.~1~ dietlibc-0.31.20080212/test/printf.c -diff -up dietlibc-0.31.20080212/lib/__v_printf.c.~1~ dietlibc-0.31.20080212/lib/__v_printf.c ---- dietlibc-0.31.20080212/lib/__v_printf.c.~1~ 2008-02-13 15:42:52.000000000 +0100 -+++ dietlibc-0.31.20080212/lib/__v_printf.c 2008-02-13 17:26:13.000000000 +0100 -@@ -222,7 +222,7 @@ print_out: - - if (flag_dot && width==0) width=preci; - if (!flag_dot) preci=sz; -- if (!flag_left) { /* do left-side padding */ -+ if (!flag_left && padwith==' ') { /* do left-side padding with spaces */ - if (write_pad(&len,fn,width-preci,padwith)) - return -1; - } -@@ -230,6 +230,10 @@ print_out: - B_WRITE(fn,sign,todo); - len+=todo; - } -+ if (!flag_left && padwith!=' ') { /* do left-side padding with '0' */ -+ if (write_pad(&len,fn,width-preci,padwith)) -+ return -1; -+ } - /* do preci padding */ - if (write_pad(&len,fn,preci-sz,precpadwith)) - return -1; -@@ -385,7 +389,7 @@ num_printf: - - sz=strlen(s); - if (width>=8; -+ while ((*s1++ = GFC(l))) INCSTR(l); - return (res); - } - *(unsigned long *) s1 = l; -diff -upN dietlibc-0.31.20080212/lib/strcmp.c.strend dietlibc-0.31.20080212/lib/strcmp.c ---- dietlibc-0.31.20080212/lib/strcmp.c.strend 2008-02-14 22:48:00.000000000 +0100 -+++ dietlibc-0.31.20080212/lib/strcmp.c 2008-02-14 23:02:14.000000000 +0100 -@@ -35,12 +35,12 @@ strcmp (const char *s1, const char *s2) - ((((l2 - MKW(0x1ul)) & ~l2) & MKW(0x80ul))) || l1 != l2) { - unsigned char c1, c2; - while (1) { -- c1 = l1 & 0xff; -- c2 = l2 & 0xff; -+ c1 = GFC(l1); -+ c2 = GFC(l2); - if (!c1 || c1 != c2) - return (c1 - c2); -- l1 >>= 8; -- l2 >>= 8; -+ INCSTR(l1); -+ INCSTR(l2); - } - } - } -diff -upN dietlibc-0.31.20080212/dietstring.h.strend dietlibc-0.31.20080212/dietstring.h ---- dietlibc-0.31.20080212/dietstring.h.strend 2003-12-21 13:06:36.000000000 +0100 -+++ dietlibc-0.31.20080212/dietstring.h 2008-02-14 23:03:51.000000000 +0100 -@@ -11,6 +11,16 @@ - # define STRALIGN(x) (((unsigned long)x&3)?4-((unsigned long)x&3):0) - #endif - -+/* GFC(x) - returns first character */ -+/* INCSTR(x) - moves to next character */ -+#if __BYTE_ORDER == __LITTLE_ENDIAN -+# define GFC(x) ((x)&0xff) -+# define INCSTR(x) do { x >>= 8; } while (0) -+#else -+# define GFC(x) (((x)>>(sizeof(x)*8-8))&0xff) -+# define INCSTR(x) do { x <<= 8; } while (0) -+#endif -+ - #define UNALIGNED(x,y) (((unsigned long)x & (sizeof (unsigned long)-1)) ^ ((unsigned long)y & (sizeof (unsigned long)-1))) - - #endif /* _DIET_STRING_H_ */ diff --git a/dietlibc-0.31.20080212-strlen.patch b/dietlibc-0.31.20080212-strlen.patch deleted file mode 100644 index eca2a3e..0000000 --- a/dietlibc-0.31.20080212-strlen.patch +++ /dev/null @@ -1,263 +0,0 @@ -diff -upN dietlibc-0.31.20080212/x86_64/strlen.c.strlen dietlibc-0.31.20080212/x86_64/strlen.c ---- dietlibc-0.31.20080212/x86_64/strlen.c.strlen 2007-10-04 18:19:15.000000000 +0200 -+++ dietlibc-0.31.20080212/x86_64/strlen.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1 +0,0 @@ --#include "alpha/strlen.c" -diff -upN dietlibc-0.31.20080212/test/string/strlen.c.strlen dietlibc-0.31.20080212/test/string/strlen.c ---- dietlibc-0.31.20080212/test/string/strlen.c.strlen 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080212/test/string/strlen.c 2008-02-14 20:01:08.000000000 +0100 -@@ -1,10 +1,35 @@ - #include - #include -+#include -+ -+/* make it large enough to test all possible alignments, number of trailing -+ * bytes and word sizes */ -+#define BUFLEN (__WORDSIZE/8 * 4) - - int main() { -- const char* x="foo bar baz"; -+ /* will hold the string, the trailing zero and a test pattern */ -+ char buf[BUFLEN + 1 + __WORDSIZE/8]; -+ size_t len; -+ - assert(strlen("")==0); -- assert(strlen(x)==11); -- assert(strlen(x+5)==6); -+ -+ for (len=0; len --#include -- --int main() { -- const char* x="foo bar baz"; -- size_t i; -- assert(strlen("")==0); -- for (i=0; i<11; ++i) -- assert(strlen(x+i)==11-i); -- return 0; --} -diff -upN dietlibc-0.31.20080212/test/Makefile.strlen dietlibc-0.31.20080212/test/Makefile ---- dietlibc-0.31.20080212/test/Makefile.strlen 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080212/test/Makefile 2008-02-14 20:01:08.000000000 +0100 -@@ -13,7 +13,7 @@ gethostbyname_r getmntent getopt getpass - glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness \ - memccpy memchr memcmp memcpy 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 strlen strncat strncpy strptime strrchr \ -+speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr \ - strstr strtol sysenter ungetc waitpid - - test: $(TESTPROGRAMS) -diff -upN dietlibc-0.31.20080212/test/runtests.sh.strlen dietlibc-0.31.20080212/test/runtests.sh ---- dietlibc-0.31.20080212/test/runtests.sh.strlen 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080212/test/runtests.sh 2008-02-14 20:01:08.000000000 +0100 -@@ -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 memcpy 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 strlen strncat strncpy strptime strrchr strstr strtol sysenter ungetc waitpid" -+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 memcpy 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" - - STDIN="read1" - PASS="getpass" -diff -upN dietlibc-0.31.20080212/sparc64/strlen.c.strlen dietlibc-0.31.20080212/sparc64/strlen.c ---- dietlibc-0.31.20080212/sparc64/strlen.c.strlen 2007-10-04 18:19:15.000000000 +0200 -+++ dietlibc-0.31.20080212/sparc64/strlen.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1 +0,0 @@ --#include "alpha/strlen.c" -diff -upN dietlibc-0.31.20080212/ppc64/strlen.c.strlen dietlibc-0.31.20080212/ppc64/strlen.c ---- dietlibc-0.31.20080212/ppc64/strlen.c.strlen 2007-10-04 18:19:15.000000000 +0200 -+++ dietlibc-0.31.20080212/ppc64/strlen.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1 +0,0 @@ --#include "alpha/strlen.c" -diff -upN dietlibc-0.31.20080212/lib/strstr.c.strlen dietlibc-0.31.20080212/lib/strstr.c ---- dietlibc-0.31.20080212/lib/strstr.c.strlen 2003-08-19 21:34:18.000000000 +0200 -+++ dietlibc-0.31.20080212/lib/strstr.c 2008-02-14 20:01:08.000000000 +0100 -@@ -4,7 +4,7 @@ - char *strstr(const char *haystack, const char *needle) { - size_t nl=strlen(needle); - size_t hl=strlen(haystack); -- int i; -+ size_t i; - if (!nl) goto found; - if (nl>hl) return 0; - for (i=hl-nl+1; __likely(i); --i) { -diff -upN dietlibc-0.31.20080212/lib/strlen.c.strlen dietlibc-0.31.20080212/lib/strlen.c ---- dietlibc-0.31.20080212/lib/strlen.c.strlen 2003-08-19 21:34:18.000000000 +0200 -+++ dietlibc-0.31.20080212/lib/strlen.c 2008-02-14 21:31:09.000000000 +0100 -@@ -1,6 +1,7 @@ - #include - #include "dietfeatures.h" - #include -+#include - - #ifdef WANT_SMALL_STRING_ROUTINES - size_t strlen(const char *s) { -@@ -10,38 +11,88 @@ size_t strlen(const char *s) { - return i; - } - #else --static const unsigned long magic = 0x01010101; -+ -+#if __WORDSIZE == 64 -+typedef uint64_t word_t; -+#elif __WORDSIZE == 32 -+typedef uint32_t word_t; -+#else -+#error unsupported __WORDSIZE -+#endif -+ -+static word_t const magic = (word_t)(0x0101010101010101ull); - - size_t strlen(const char *s) - { - const char *t = s; -- unsigned long word; -+ word_t word; -+ word_t mask; - -- if (!s) return 0; -+ if (__unlikely(!s)) return 0; - - /* Byte compare up until word boundary */ -- for (; ((unsigned long) t & 3); t++) -+ for (; ((unsigned long) t & (sizeof(magic)-1)); t++) - if (!*t) return t - s; - - /* Word compare */ - do { -- word = *((unsigned long *) t); t += 4; -+ word = *((word_t const *) t); t += sizeof word; - word = (word - magic) &~ word; - word &= (magic << 7); - } while (__likely(word == 0)); - --#if BYTE_ORDER == LITTLE_ENDIAN -- /* word & 0x80808080 == word */ -- word = (word - 1) & (magic << 10); -- word += (word << 8) + (word << 16); -- t += word >> 26; -+#if __BYTE_ORDER == __LITTLE_ENDIAN -+ (void)mask; -+ switch (sizeof(word)) { -+ case 8: -+ /* word & 0x8080808080808080 == word */ -+ word = (word - 1) & (magic << 8); -+ word += (word << 32); -+ word += (word << 16); -+ word += (word << 8); -+ t += word >> 56; -+ break; -+ -+ case 4: -+ /* word & 0x80808080 == word */ -+ word = (word - 1) & (magic << 10); -+ word += (word << 8) + (word << 16); -+ t += word >> 26; -+ break; -+ -+ default: { char exc[sizeof(word)==8]; (void)exc; } -+ } - #else -- if ((word & 0x80800000) == 0) { -- word <<= 16; -- t += 2; -+ mask = (magic << 7); -+ -+ switch (sizeof(word)) { -+ case 8: -+ mask <<= 4*8; -+ if ((word & mask) == 0) { -+ t += 4; -+ word <<= 4*8; -+ } -+ /* fallthrough */ -+ -+ case 4: -+ mask <<= 2*8; -+ if ((word & mask) == 0) { -+ t += 2; -+ word <<= 2*8; -+ } -+ /* fallthrough */ -+ -+ case 2: -+ mask <<= 1*8; -+ if ((word & mask) == 0) { -+ t += 1; -+ word <<= 1*8; -+ } -+ break; -+ -+ default: { char exc[sizeof(word)==8]; (void)exc; } - } -- if ((word & 0x80000000) == 0) t += 1; - #endif -- return ((const char *) t) - 4 - s; -+ return t - sizeof(word) - s; - } - #endif -diff -upN dietlibc-0.31.20080212/ia64/strlen.c.strlen dietlibc-0.31.20080212/ia64/strlen.c ---- dietlibc-0.31.20080212/ia64/strlen.c.strlen 2007-10-04 18:19:15.000000000 +0200 -+++ dietlibc-0.31.20080212/ia64/strlen.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1 +0,0 @@ --#include "alpha/strlen.c" -diff -upN dietlibc-0.31.20080212/alpha/strlen.c.strlen dietlibc-0.31.20080212/alpha/strlen.c ---- dietlibc-0.31.20080212/alpha/strlen.c.strlen 2001-01-09 18:57:38.000000000 +0100 -+++ dietlibc-0.31.20080212/alpha/strlen.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1,32 +0,0 @@ --#include -- --static const unsigned long long magic = 0x0101010101010101LL; -- --size_t strlen(const char *s) --{ -- const char *t = s; -- unsigned long long word; -- -- if (!s) return 0; -- -- /* Byte compare up until 64 bit word boundary */ -- for (; ((unsigned long long) t & 7); t++) -- if (!*t) return t - s; -- -- /* Word compare */ -- do { -- word = *((unsigned long long *) t); t += 8; -- word = (word - magic) &~ word; -- word &= (magic << 7); -- } while (word == 0); -- -- /* word & 0x8080808080808080 == word */ -- word = (word - 1) & (magic << 8); -- word += (word << 32); -- word += (word << 16); -- word += (word << 8); -- t += word >> 56; -- return ((const char *) t) - 8 - s; --} -- -- diff --git a/dietlibc-0.31.20080212-ulong.patch b/dietlibc-0.31.20080212-ulong.patch deleted file mode 100644 index 89bf8f7..0000000 --- a/dietlibc-0.31.20080212-ulong.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -upN dietlibc-0.31.20080212/lib/strcpy.c.~1~ dietlibc-0.31.20080212/lib/strcpy.c ---- dietlibc-0.31.20080212/lib/strcpy.c.~1~ 2003-12-21 13:06:36.000000000 +0100 -+++ dietlibc-0.31.20080212/lib/strcpy.c 2008-02-14 21:36:45.000000000 +0100 -@@ -25,7 +25,7 @@ strcpy (char *s1, const char *s2) - - while (1) { - l = *(const unsigned long *) s2; -- if (((l - MKW(0x1)) & ~l) & MKW(0x80)) { -+ if (((l - MKW(0x1ul)) & ~l) & MKW(0x80ul)) { - unsigned char c; - while ((*s1++ = (l & 0xff))) l>>=8; - return (res); -diff -upN dietlibc-0.31.20080212/lib/strcmp.c.~1~ dietlibc-0.31.20080212/lib/strcmp.c ---- dietlibc-0.31.20080212/lib/strcmp.c.~1~ 2003-12-21 13:06:36.000000000 +0100 -+++ dietlibc-0.31.20080212/lib/strcmp.c 2008-02-14 21:37:38.000000000 +0100 -@@ -31,8 +31,8 @@ strcmp (const char *s1, const char *s2) - while (1) { - l1 = *lx1++; - l2 = *lx2++; -- if ((((l1 - MKW(0x1)) & ~l1) & MKW(0x80)) || -- ((((l2 - MKW(0x1)) & ~l2) & MKW(0x80))) || l1 != l2) { -+ if ((((l1 - MKW(0x1ul)) & ~l1) & MKW(0x80ul)) || -+ ((((l2 - MKW(0x1ul)) & ~l2) & MKW(0x80ul))) || l1 != l2) { - unsigned char c1, c2; - while (1) { - c1 = l1 & 0xff; diff --git a/sources b/sources index 91d1271..f816275 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -11c4b650b3644269a8d2a624fd9780ea dietlibc-0.31.20080212.tar.bz2 +4d42fda6c0f75195337e0753138e752c dietlibc-0.31.20080221.tar.bz2 From 2953d403af3107416ed27e3705703afd461c8e41 Mon Sep 17 00:00:00 2001 From: ensc Date: Fri, 22 Feb 2008 16:29:14 +0000 Subject: [PATCH 020/161] - updated to CVS snapshot 20080221; removed most of the last patches as they are now in upstream - moved files into platform neutral /usr/lib dir (not using %%_lib or %%_libdir macro) - added -devel subpackage due to multiarch issues; main package contains only the 'diet' binary plus some tools while -devel holds all the header and object files. --- dietlibc.spec | 58 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index ebe222b..6266aa2 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -6,7 +6,8 @@ ## --with dynamic ... enable dynamic lib support -%global snapshot 20080212 +%global snapshot 20080221 +%global pkglibdir %_prefix/lib/dietlibc %ifarch %ix86 x86_64 %bcond_without ssp @@ -48,18 +49,18 @@ Patch30: dietlibc-0.30-longdouble.patch Patch31: dietlibc-0.31-defpath.patch Patch32: dietlibc-0.31-stacksmash.patch Patch33: dietlibc-0.31-stacksmash-dyn.patch -Patch34: dietlibc-0.31.20080212-printffmt.patch -Patch40: dietlibc-0.31-printftest.patch Patch41: dietlibc-0.31.20080212-teststdout.patch -Patch42: dietlibc-0.31.20080212-strlen.patch -Patch43: dietlibc-0.31.20080212-ulong.patch -Patch44: dietlibc-0.31.20080212-strend.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} -#### HACK!! -BuildRequires: strace gdb +Requires: %name-devel = %version-%release + + +%package devel +Summary: dietlibc development files +Group: Development/Libraries +Requires: %name = %version-%release %package lib @@ -73,6 +74,12 @@ The diet libc is a libc that is optimized for small size. It can be used to create small statically linked binaries for Linux on alpha, arm, hppa, ia64, i386, mips, s390, sparc, sparc64, ppc and x86_64. +%description devel +The diet libc is a libc that is optimized for small size. It can be +used to create small statically linked binaries for Linux on alpha, +arm, hppa, ia64, i386, mips, s390, sparc, sparc64, ppc and x86_64. + +This package contains the header and object files for dietlibc. %description lib The diet libc is a libc that is optimized for small size. It can be @@ -90,13 +97,8 @@ This package contains the dynamic libraries for dietlibc. %patch31 -p1 -b .defpath %patch32 -p1 -b .stacksmash %patch33 -p1 -b .stacksmash-dyn -%patch34 -p1 -b .printffmt -%patch40 -p1 -b .printftest %patch41 -p1 -b .teststdout -%patch42 -p1 -b .strlen -%patch43 -p1 -b .ulong -%patch44 -p1 -b .strend %if %{without ssp} @@ -111,7 +113,7 @@ sed -i -e 's!^#define WANT_SSP$!// \0!g; sed -i -e 's!strip !: !g' Makefile %global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -g3 -%global basemakeflags prefix=%_libdir/dietlibc BINDIR=%_bindir MAN1DIR=%_mandir/man1 COMMENT=: CFLAGS="$RPM_OPT_FLAGS %fixcflags $XTRA_CFLAGS" PDIET=%_libdir/dietlibc +%global basemakeflags prefix=%pkglibdir BINDIR=%_bindir MAN1DIR=%_mandir/man1 COMMENT=: CFLAGS="$RPM_OPT_FLAGS %fixcflags $XTRA_CFLAGS" PDIET=%pkglibdir %global makeflags %basemakeflags for i in `find test -name 'runtests.sh'`; do @@ -132,9 +134,9 @@ rm -rf $RPM_BUILD_ROOT install -d -m755 $RPM_BUILD_ROOT/etc make %makeflags DESTDIR=$RPM_BUILD_ROOT install -ln -s lib-%_arch ${RPM_BUILD_ROOT}%_libdir/dietlibc/lib-%_arch-%_vendor +ln -s lib-%_arch ${RPM_BUILD_ROOT}%pkglibdir/lib-%_arch-%_vendor -chmod a-x $RPM_BUILD_ROOT%_libdir/dietlibc/lib-*/*.o +chmod a-x $RPM_BUILD_ROOT%pkglibdir/lib-*/*.o rm -f $RPM_BUILD_ROOT%_bindir/dnsd @@ -153,24 +155,38 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -%{?with_dynamic:%exclude %_libdir/dietlibc/*/*.so} %doc AUTHOR BUGS CAVEAT CHANGES COPYING FAQ PORTING README* %doc SECURITY THANKS TODO %doc %_mandir/*/* %_bindir/* -%_libdir/dietlibc + + +%files devel +%defattr(-,root,root,-) +%pkglibdir +%{?with_dynamic:%exclude %pkglibdir/*/*.so} + %if %{with dynamic} %files lib %defattr(-,root,root,-) %config(noreplace) %_sysconfdir/* -%dir %_libdir/dietlibc -%dir %_libdir/dietlibc/lib-* -%_libdir/dietlibc/lib-%target_cpu/*.so +%dir %pkglibdir +%dir %pkglibdir/lib-* +%pkglibdir/lib-%target_cpu/*.so %endif %changelog +* Fri Feb 22 2008 Enrico Scholz - 0.31-1.20080221 +- updated to CVS snapshot 20080221; removed most of the last patches + as they are now in upstream +- moved files into platform neutral /usr/lib dir (not using %%_lib or + %%_libdir macro) +- added -devel subpackage due to multiarch issues; main package contains + only the 'diet' binary plus some tools while -devel holds all the + header and object files. + * Wed Feb 13 2008 Enrico Scholz - 0.31-1.20080212 - updated to CVS snapshot 20080212 - fixed printf regression for '%+04i' style formats From 0b285b42278e82fc686c13a4a4123db4424f525a Mon Sep 17 00:00:00 2001 From: ensc Date: Fri, 22 Feb 2008 17:57:57 +0000 Subject: [PATCH 021/161] fixed optimized memcpy(3) --- dietlibc-0.31.20080221-memcpy.patch | 79 +++++++++++++++++++++++++++++ dietlibc.spec | 5 +- 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 dietlibc-0.31.20080221-memcpy.patch diff --git a/dietlibc-0.31.20080221-memcpy.patch b/dietlibc-0.31.20080221-memcpy.patch new file mode 100644 index 0000000..4167233 --- /dev/null +++ b/dietlibc-0.31.20080221-memcpy.patch @@ -0,0 +1,79 @@ +2008-02-22 Enrico Scholz + + - fixed memcpy(3) for unaligned buffers; previously, code like + + | test[15] = 'a'; + | test[31] = 'b'; + | memcpy(test+7, test+23, 9); + | assert(test[15]==test[31]); + + failed + + - added memcmpy(3) testcase for all (?) possible alignments + +--- dietlibc-0.31.20080221/lib/memcpy.c.memcpy 2003-12-21 13:06:36.000000000 +0100 ++++ dietlibc-0.31.20080221/lib/memcpy.c 2008-02-22 18:51:52.000000000 +0100 +@@ -28,6 +28,8 @@ memcpy (void *dst, const void *src, size + *c1++ = *c2++; + if (n == (size_t) - 1) + return (res); ++ dst = c1; ++ src = c2; + } + + lx1 = (unsigned long *) dst; +--- dietlibc-0.31.20080221/test/string/memcpy.c.memcpy 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080221/test/string/memcpy.c 2008-02-22 18:53:58.000000000 +0100 +@@ -1,11 +1,52 @@ + #include + #include ++#include ++ ++#define WO (__WORDSIZE/8) + + int main() { ++ size_t const LENS[] = { ++ 1, 2, 3, 4, 5, 6, 7, 8, ++ WO -3, WO -2, WO -1, WO, WO +1, WO +2, WO +3, WO +4, ++ WO*2-3, WO*2-2, WO*2-1, WO*2, WO*2+1, WO*2+2, WO*2+3, WO*2+4, ++ WO*3-3, WO*3-2, WO*3-1, WO*3, WO*3+1, WO*3+2, WO*3+3, WO*3+4, ++ (size_t)(-1) }; ++ ++ size_t i,j; ++ size_t const *len; + char test[100]="blubber"; ++ + assert(memcpy(test,"blubber",8)==test); + assert(!memcmp(test,"blubber",8)); + assert(memcpy(0,0,0)==0); + assert(memcpy(test,"foobar",3) && test[2]=='o'); ++ ++ /* test all possible alignments of src and destination in combination with ++ * some interesting lengths */ ++ for (len=LENS+0; *len!=(size_t)(-1); ++len) { ++ unsigned char src[WO * 5]; ++ ++ for (i=0; i<*len + WO; ++i) ++ src[i] = i; ++ ++ for (i=MIN(WO,*len); i>0;) { ++ --i; ++ ++ for (j=MIN(WO,*len); j>0;) { ++ unsigned char dst[WO * 5]; ++ size_t k; ++ --j; ++ ++ for (k=0; k<*len; ++k) ++ dst[j+k]=src[i+k]+1; ++ ++ assert(memcpy(dst+j, src+i, *len)==dst+j); ++ ++ for (k=0; k<*len; ++k) ++ assert(dst[j+k]==src[i+k]); ++ } ++ } ++ } ++ + return 0; + } diff --git a/dietlibc.spec b/dietlibc.spec index 6266aa2..d845ff2 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -50,6 +50,7 @@ Patch31: dietlibc-0.31-defpath.patch Patch32: dietlibc-0.31-stacksmash.patch Patch33: dietlibc-0.31-stacksmash-dyn.patch Patch41: dietlibc-0.31.20080212-teststdout.patch +Patch42: dietlibc-0.31.20080221-memcpy.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -99,6 +100,7 @@ This package contains the dynamic libraries for dietlibc. %patch33 -p1 -b .stacksmash-dyn %patch41 -p1 -b .teststdout +%patch42 -p1 -b .memcpy %if %{without ssp} @@ -141,7 +143,7 @@ rm -f $RPM_BUILD_ROOT%_bindir/dnsd %check -XTRA_CFLAGS='-fno-builtin' +XTRA_CFLAGS='-fno-builtin -g3 -O0' make %makeflags -C test all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) -k || : make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) || : @@ -186,6 +188,7 @@ rm -rf $RPM_BUILD_ROOT - added -devel subpackage due to multiarch issues; main package contains only the 'diet' binary plus some tools while -devel holds all the header and object files. +- fixed optimized memcpy(3) * Wed Feb 13 2008 Enrico Scholz - 0.31-1.20080212 - updated to CVS snapshot 20080212 From 06eb0c7bcf6a1554dc10a2e3b82885da36fc7f4b Mon Sep 17 00:00:00 2001 From: ensc Date: Fri, 22 Feb 2008 17:59:12 +0000 Subject: [PATCH 022/161] fixed CFLAGS for check --- dietlibc.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index d845ff2..d450414 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -143,7 +143,7 @@ rm -f $RPM_BUILD_ROOT%_bindir/dnsd %check -XTRA_CFLAGS='-fno-builtin -g3 -O0' +XTRA_CFLAGS='-fno-builtin' make %makeflags -C test all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) -k || : make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) || : From 5465f6e3468dacbe462279b2550b6261e73b86f0 Mon Sep 17 00:00:00 2001 From: ensc Date: Sat, 12 Apr 2008 09:04:48 +0000 Subject: [PATCH 023/161] updated to CVS snapshot 20080409 --- .cvsignore | 5 +---- dietlibc.spec | 9 +++++---- sources | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.cvsignore b/.cvsignore index 87e051f..842a349 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,4 +1 @@ -dietlibc-[0-9].[0-9][0-9] -dietlibc*.tar.bz2* -dietlibc*.rpm -i386 +dietlibc-0.31.20080409.tar.bz2 diff --git a/dietlibc.spec b/dietlibc.spec index d450414..ec324c1 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -6,7 +6,7 @@ ## --with dynamic ... enable dynamic lib support -%global snapshot 20080221 +%global snapshot 20080409 %global pkglibdir %_prefix/lib/dietlibc %ifarch %ix86 x86_64 @@ -16,7 +16,7 @@ %endif %ifarch %ix86 x86_64 arm -%bcond_with dynamic +%bcond_with dynamic\ %endif %ifarch %ix86 @@ -50,7 +50,6 @@ Patch31: dietlibc-0.31-defpath.patch Patch32: dietlibc-0.31-stacksmash.patch Patch33: dietlibc-0.31-stacksmash-dyn.patch Patch41: dietlibc-0.31.20080212-teststdout.patch -Patch42: dietlibc-0.31.20080221-memcpy.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -100,7 +99,6 @@ This package contains the dynamic libraries for dietlibc. %patch33 -p1 -b .stacksmash-dyn %patch41 -p1 -b .teststdout -%patch42 -p1 -b .memcpy %if %{without ssp} @@ -180,6 +178,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Thu Apr 10 2008 Enrico Scholz - 0.31-1.20080409 +- updated to CVS snapshot 20080409 + * Fri Feb 22 2008 Enrico Scholz - 0.31-1.20080221 - updated to CVS snapshot 20080221; removed most of the last patches as they are now in upstream diff --git a/sources b/sources index f816275..b84c684 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4d42fda6c0f75195337e0753138e752c dietlibc-0.31.20080221.tar.bz2 +8ab045af7ad246c930c4e1b0fca1063c dietlibc-0.31.20080409.tar.bz2 From 88839ec3c7bf7d41dc27125aeaab2655b7a6622d Mon Sep 17 00:00:00 2001 From: ensc Date: Sat, 12 Apr 2008 09:09:47 +0000 Subject: [PATCH 024/161] removed as now in upstream --- dietlibc-0.31.20080221-memcpy.patch | 79 ----------------------------- 1 file changed, 79 deletions(-) delete mode 100644 dietlibc-0.31.20080221-memcpy.patch diff --git a/dietlibc-0.31.20080221-memcpy.patch b/dietlibc-0.31.20080221-memcpy.patch deleted file mode 100644 index 4167233..0000000 --- a/dietlibc-0.31.20080221-memcpy.patch +++ /dev/null @@ -1,79 +0,0 @@ -2008-02-22 Enrico Scholz - - - fixed memcpy(3) for unaligned buffers; previously, code like - - | test[15] = 'a'; - | test[31] = 'b'; - | memcpy(test+7, test+23, 9); - | assert(test[15]==test[31]); - - failed - - - added memcmpy(3) testcase for all (?) possible alignments - ---- dietlibc-0.31.20080221/lib/memcpy.c.memcpy 2003-12-21 13:06:36.000000000 +0100 -+++ dietlibc-0.31.20080221/lib/memcpy.c 2008-02-22 18:51:52.000000000 +0100 -@@ -28,6 +28,8 @@ memcpy (void *dst, const void *src, size - *c1++ = *c2++; - if (n == (size_t) - 1) - return (res); -+ dst = c1; -+ src = c2; - } - - lx1 = (unsigned long *) dst; ---- dietlibc-0.31.20080221/test/string/memcpy.c.memcpy 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080221/test/string/memcpy.c 2008-02-22 18:53:58.000000000 +0100 -@@ -1,11 +1,52 @@ - #include - #include -+#include -+ -+#define WO (__WORDSIZE/8) - - int main() { -+ size_t const LENS[] = { -+ 1, 2, 3, 4, 5, 6, 7, 8, -+ WO -3, WO -2, WO -1, WO, WO +1, WO +2, WO +3, WO +4, -+ WO*2-3, WO*2-2, WO*2-1, WO*2, WO*2+1, WO*2+2, WO*2+3, WO*2+4, -+ WO*3-3, WO*3-2, WO*3-1, WO*3, WO*3+1, WO*3+2, WO*3+3, WO*3+4, -+ (size_t)(-1) }; -+ -+ size_t i,j; -+ size_t const *len; - char test[100]="blubber"; -+ - assert(memcpy(test,"blubber",8)==test); - assert(!memcmp(test,"blubber",8)); - assert(memcpy(0,0,0)==0); - assert(memcpy(test,"foobar",3) && test[2]=='o'); -+ -+ /* test all possible alignments of src and destination in combination with -+ * some interesting lengths */ -+ for (len=LENS+0; *len!=(size_t)(-1); ++len) { -+ unsigned char src[WO * 5]; -+ -+ for (i=0; i<*len + WO; ++i) -+ src[i] = i; -+ -+ for (i=MIN(WO,*len); i>0;) { -+ --i; -+ -+ for (j=MIN(WO,*len); j>0;) { -+ unsigned char dst[WO * 5]; -+ size_t k; -+ --j; -+ -+ for (k=0; k<*len; ++k) -+ dst[j+k]=src[i+k]+1; -+ -+ assert(memcpy(dst+j, src+i, *len)==dst+j); -+ -+ for (k=0; k<*len; ++k) -+ assert(dst[j+k]==src[i+k]); -+ } -+ } -+ } -+ - return 0; - } From 4927ab82085206938e126ab16a8485bb3891bbe6 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 13:20:03 +0000 Subject: [PATCH 025/161] This patch adds support for dynamic PAGE_SIZE values to 'dietlibc'. It is a little bit invasive in several aspects: it modifies the startup code. We need to know the position of the elf-info auxilary table which is located after 'environ'. We can not use 'environ' directly because it might be modified by the application. Hence, an additional __elfinfo variable is placed into .bss and filled in the startup code. Depending on platform, this adds 1-3 instructions and an additional pointer to .bss. I tested only the i386 and x86_64 modifications; it would be nice when people with corresponding hardware would test the other ones. I am especially uncertain regarding the parisc changes. The elf-info stuff (which might be interesting e.g. for dynamic linking or sysconf(_SC_CLK_TCK)) can be enabled without the dynamic pagesize too. it removes the 'PAGE_SIZE' macro from ; this will break compilation of existing userspace application which are using this deprecated macro I added a new internal 'dietpagesize.h' header which defines | __DIET_PAGE_SIZE | __DIET_PAGE_SHIFT macros. These return either builtin constants (when WANT_DYN_PAGESIZE is not selected), or values derived from __libc_getpagesize(). Every usage of PAGE_SIZE in dietlibc code was replaced by these macros. due to the previous point, the internal 'struct __dirstream' was modified. I replaced | getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1); with | getdents64(d->fd,(struct dirent64*)d->buf, __DIRSTREAM_BUF_SIZE-1); literally but I am not sure where the '-1' is coming from. There is one hunk, where this '-1' is missing so I think the '-1' should be removed from all calls to getdents64(). changes affect the *alloc() functions too; on x86_64 around 64 bytes where added to .text of alloc.o the new testprogramm requires a 'getconf' binary which returns the correct values for PAGE_SIZE and CLK_TCK --- dietlibc-0.31-pagesize.patch | 742 +++++++++++++++++++++++++++++++++++ 1 file changed, 742 insertions(+) create mode 100644 dietlibc-0.31-pagesize.patch diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch new file mode 100644 index 0000000..b29fbff --- /dev/null +++ b/dietlibc-0.31-pagesize.patch @@ -0,0 +1,742 @@ +diff -up dietlibc-0.31.20080409/lib/mmap64.c.pagesize dietlibc-0.31.20080409/lib/mmap64.c +--- dietlibc-0.31.20080409/lib/mmap64.c.pagesize 2004-12-13 11:21:31.000000000 +0100 ++++ dietlibc-0.31.20080409/lib/mmap64.c 2008-04-12 20:13:10.000000000 +0200 +@@ -4,16 +4,18 @@ + #include + #include + ++#include "../dietpagesize.h" ++ + #ifdef __NR_mmap2 + void*__mmap2(void*start,size_t length,int prot,int flags,int fd,off_t pgoffset); + + void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset); + void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) { +- if (offset&(PAGE_SIZE-1)) { ++ if (offset&(__DIET_PAGE_SIZE)) { + errno=-EINVAL; + return MAP_FAILED; + } +- return __mmap2(addr,len,prot,flags,fd,offset>>PAGE_SHIFT); ++ return __mmap2(addr,len,prot,flags,fd,offset>>__DIET_PAGE_SHIFT); + } + + void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) +diff -up dietlibc-0.31.20080409/lib/readdir64.c.pagesize dietlibc-0.31.20080409/lib/readdir64.c +--- dietlibc-0.31.20080409/lib/readdir64.c.pagesize 2004-03-02 22:27:19.000000000 +0100 ++++ dietlibc-0.31.20080409/lib/readdir64.c 2008-04-12 20:13:10.000000000 +0200 +@@ -14,7 +14,7 @@ + #ifndef WANT_LARGEFILE_BACKCOMPAT + struct dirent64* readdir64(DIR *d) { + if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) { +- int res=getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1); ++ int res=getdents64(d->fd,(struct dirent64*)d->buf, __DIRSTREAM_BUF_SIZE-1); + if (res<=0) return 0; + d->num=res; d->cur=0; + } +@@ -32,7 +32,7 @@ again: + if (!trygetdents64) { + #endif + if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { +- int res=getdents(d->fd,(struct dirent*)d->buf, sizeof (d->buf)-1); ++ int res=getdents(d->fd,(struct dirent*)d->buf, __DIRSTREAM_BUF_SIZE-1); + if (res<=0) return 0; + d->num=res; d->cur=0; + } +@@ -46,7 +46,7 @@ again: + #ifdef __NR_getdents64 + } + if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) { +- int res=getdents64(d->fd,(struct dirent64*)d->buf,sizeof (d->buf)); ++ int res=getdents64(d->fd,(struct dirent64*)d->buf,__DIRSTREAM_BUF_SIZE); + if (res<=0) { + if (errno==ENOSYS) { + trygetdents64=0; +diff -up dietlibc-0.31.20080409/lib/opendir.c.pagesize dietlibc-0.31.20080409/lib/opendir.c +--- dietlibc-0.31.20080409/lib/opendir.c.pagesize 2002-07-03 22:33:38.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/opendir.c 2008-04-12 20:13:10.000000000 +0200 +@@ -5,6 +5,8 @@ + #include + #include + ++#include "../dietpagesize.h" ++ + DIR* opendir ( const char* name ) { + int fd = open (name, O_RDONLY | O_DIRECTORY); + DIR* t = NULL; +@@ -12,7 +14,7 @@ DIR* opendir ( const char* name ) { + if ( fd >= 0 ) { + if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) + goto lose; +- t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, ++ t = (DIR *) mmap (NULL, __DIET_PAGE_SIZE, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (t == MAP_FAILED) + lose: +diff -up dietlibc-0.31.20080409/lib/readdir.c.pagesize dietlibc-0.31.20080409/lib/readdir.c +--- dietlibc-0.31.20080409/lib/readdir.c.pagesize 2002-07-03 22:33:38.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/readdir.c 2008-04-12 20:13:10.000000000 +0200 +@@ -5,7 +5,7 @@ + + struct dirent* readdir(DIR *d) { + if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { +- int res=getdents(d->fd,(struct dirent*)d->buf,sizeof (d->buf)-1); ++ int res=getdents(d->fd,(struct dirent*)d->buf,__DIRSTREAM_BUF_SIZE-1); + if (res<=0) return 0; + d->num=res; d->cur=0; + } +diff -up dietlibc-0.31.20080409/lib/closedir.c.pagesize dietlibc-0.31.20080409/lib/closedir.c +--- dietlibc-0.31.20080409/lib/closedir.c.pagesize 2002-07-03 22:33:37.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/closedir.c 2008-04-12 20:13:10.000000000 +0200 +@@ -4,8 +4,10 @@ + #include + #include + ++#include "../dietpagesize.h" ++ + int closedir (DIR* d) { + int res=close(d->fd); +- munmap (d, PAGE_SIZE); ++ munmap (d, __DIET_PAGE_SIZE); + return res; + } +diff -up dietlibc-0.31.20080409/lib/alloc.c.pagesize dietlibc-0.31.20080409/lib/alloc.c +--- dietlibc-0.31.20080409/lib/alloc.c.pagesize 2007-08-03 22:58:33.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/alloc.c 2008-04-12 20:13:10.000000000 +0200 +@@ -18,8 +18,7 @@ + #include + #include + +-#include /* for PAGE_SIZE */ +- ++#include "../dietpagesize.h" + + /* -- HELPER CODE --------------------------------------------------------- */ + +@@ -39,7 +38,7 @@ typedef struct { + #define BLOCK_START(b) (((void*)(b))-sizeof(__alloc_t)) + #define BLOCK_RET(b) (((void*)(b))+sizeof(__alloc_t)) + +-#define MEM_BLOCK_SIZE PAGE_SIZE ++#define MEM_BLOCK_SIZE __DIET_PAGE_SIZE + #define PAGE_ALIGN(s) (((s)+MEM_BLOCK_SIZE-1)&(unsigned long)(~(MEM_BLOCK_SIZE-1))) + + /* a simple mmap :) */ +diff -up dietlibc-0.31.20080409/ppc/start.S.pagesize dietlibc-0.31.20080409/ppc/start.S +--- dietlibc-0.31.20080409/ppc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/ppc/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -31,6 +31,12 @@ _start: + lis 14,environ@ha + stw 5,environ@l(14) + ++#ifdef WANT_ELFINFO ++ /* TODO: can we really assume that environ and __elfinfo are on the ++ same 16 bit page? */ ++ stw 5,__elfinfo@l(14) ++#endif ++ + #ifdef WANT_DYNAMIC + mr 6,7 + bl _dyn_start +diff -up dietlibc-0.31.20080409/dietfeatures.h.pagesize dietlibc-0.31.20080409/dietfeatures.h +--- dietlibc-0.31.20080409/dietfeatures.h.pagesize 2007-10-09 01:15:27.000000000 +0200 ++++ dietlibc-0.31.20080409/dietfeatures.h 2008-04-12 20:13:10.000000000 +0200 +@@ -126,6 +126,16 @@ + /* #define WANT_SSP_XOR */ + + ++/* Some platforms like x86_64, ppc* or mips do not have a fixed PAGE_SIZE. ++ * Select WANT_DYN_PAGESIZE to detect the current PAGE_SIZE at runtime. Else, ++ * define WANT_STATIC_PAGESIZE to a proper value (must be a power of 2) ++ * matching the configured pagesize of the kernel where your binaries are ++ * running on. ++ * ++ * Selecting WANT_DYN_PAGESIZE enlarges the startup code by around 1-3 ++ * instructions and might add an additional __elfinfo symbol */ ++#define WANT_DYN_PAGESIZE ++/* #define WANT_STATIC_PAGESIZE 0x10000UL */ + + + /* stop uncommenting here ;-) */ +@@ -157,4 +167,8 @@ + #endif + #endif + ++#ifdef WANT_DYN_PAGESIZE ++#define WANT_ELFINFO ++#endif ++ + #endif +diff -up dietlibc-0.31.20080409/test/Makefile.pagesize dietlibc-0.31.20080409/test/Makefile +--- dietlibc-0.31.20080409/test/Makefile.pagesize 2008-02-23 01:02:19.000000000 +0100 ++++ dietlibc-0.31.20080409/test/Makefile 2008-04-12 20:13:10.000000000 +0200 +@@ -14,7 +14,7 @@ glob grent hasmntopt hello iconv if_name + 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 sysenter ungetc waitpid ++strstr strtol sysconf sysenter ungetc waitpid + + test: $(TESTPROGRAMS) + +diff -up /dev/null dietlibc-0.31.20080409/test/sysconf.c +--- /dev/null 2008-03-18 07:40:22.289057188 +0100 ++++ dietlibc-0.31.20080409/test/sysconf.c 2008-04-12 20:19:28.000000000 +0200 +@@ -0,0 +1,80 @@ ++#include ++#include ++#include ++#include ++#include ++ ++#include "../dietpagesize.h" ++ ++static long exec_getconf(char const *var) ++{ ++ char buf[128]; ++ pid_t pid; ++ int fd[2]; ++ int status; ++ ssize_t l; ++ ++ if (pipe(fd)<0 || (pid = fork())<0) ++ abort(); ++ ++ if (pid==0) { ++ close(fd[0]); ++ ++ if (fd[1]!=1) { ++ dup2(fd[1], 1); ++ close(fd[1]); ++ } ++ ++ execlp("getconf", "getconf", var, NULL); ++ _exit(1); ++ } ++ ++ close(fd[1]); ++ l = read(fd[0], buf, sizeof(buf)-1); ++ if (l<0) { ++ perror("read()"); ++ goto err; ++ } else if (l==sizeof(buf)-1) ++ goto err; ++ close(fd[0]); ++ ++ buf[l] = '\0'; ++ ++ if (waitpid(pid, &status, 0)<0) ++ goto err; ++ ++ if (!WIFEXITED(status) || WEXITSTATUS(status)!=0) ++ goto err; ++ ++ return strtol(buf, NULL, 10); ++ ++err: ++ kill(pid, SIGKILL); ++ abort(); ++} ++ ++static unsigned int do_check(char const *var, long exp) ++{ ++ long cur = exec_getconf(var); ++ ++ if (cur!=exp) { ++ fprintf(stderr, "%s mismatch: got %ld, expected %ld\n", ++ cur, exp); ++ return 1; ++ } ++ ++ return 0; ++} ++ ++int main(int argc, char *argv[]) ++{ ++ unsigned int err = 0; ++ ++ assert(sysconf(_SC_PAGESIZE) == __DIET_PAGE_SIZE); ++ assert(__DIET_PAGE_SIZE == (1<<__DIET_PAGE_SHIFT)); ++ ++ err += do_check("PAGE_SIZE", sysconf(_SC_PAGESIZE)); ++ err += do_check("CLK_TCK", sysconf(_SC_CLK_TCK)); ++ ++ return err; ++} +diff -up dietlibc-0.31.20080409/test/runtests.sh.pagesize dietlibc-0.31.20080409/test/runtests.sh +--- dietlibc-0.31.20080409/test/runtests.sh.pagesize 2008-02-23 01:02:19.000000000 +0100 ++++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-12 20:13:10.000000000 +0200 +@@ -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 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 sysconf sysenter ungetc waitpid" + + STDIN="read1" + PASS="getpass" +diff -up dietlibc-0.31.20080409/sparc64/start.S.pagesize dietlibc-0.31.20080409/sparc64/start.S +--- dietlibc-0.31.20080409/sparc64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc64/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -25,6 +25,11 @@ _start: + or %o3, %lo(environ), %o3 + stx %o2, [%o3] + ++#ifdef WANT_ELFINFO ++ add %o3, %o3, 8 ++ stx %o2, [%o3] ++#endif ++ + /* 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 -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.20080409/libcruft/sysconf.c +--- dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize 2002-12-20 14:32:37.000000000 +0100 ++++ dietlibc-0.31.20080409/libcruft/sysconf.c 2008-04-12 20:13:10.000000000 +0200 +@@ -3,6 +3,8 @@ + #include + #include + ++#include "dietelfinfo.h" ++ + extern int __sc_nr_cpus(); + + long sysconf(int name) +@@ -16,6 +18,14 @@ long sysconf(int name) + return limit.rlim_cur; + } + case _SC_CLK_TCK: ++#ifdef WANT_ELFINFO ++ { ++ elf_addr_t *v = __get_elf_aux_value(AT_CLKTCK); ++ if (v) ++ return *v; ++ } ++#endif ++ + #ifdef __alpha__ + return 1024; + #else +@@ -23,11 +33,7 @@ long sysconf(int name) + #endif + + case _SC_PAGESIZE: +-#if ( defined(__alpha__) || defined(__sparc__) ) +- return 8192; +-#else +- return 4096; +-#endif ++ return __libc_getpagesize(); + + case _SC_ARG_MAX: + return ARG_MAX; +diff -up /dev/null dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c +--- /dev/null 2008-03-18 07:40:22.289057188 +0100 ++++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c 2008-04-12 20:13:10.000000000 +0200 +@@ -0,0 +1,25 @@ ++#include ++#include "../dietelfinfo.h" ++ ++elf_addr_t *__get_elf_aux_value(unsigned int tag) ++{ ++ extern char ** __elfinfo; ++ elf_addr_t *aux_ptr; ++ char ** tmp; ++ ++ /* External symbol points to 'environ' after startup. Now, go the end ++ * of 'environ'; the auxiliary ELF table is located immediately after ++ * this position */ ++ ++ /* operate on tmp instead of __elfinfo to be thread safe */ ++ tmp = __elfinfo; ++ while (*tmp) ++ ++tmp; ++ __elfinfo = tmp; ++ ++ for (aux_ptr = (elf_addr_t *)(tmp+1); aux_ptr[0]!=AT_NULL; aux_ptr += 2) ++ if (aux_ptr[0]==tag) ++ return aux_ptr+1; ++ ++ return NULL; ++} +diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20080409/libcruft/getpagesize.c +--- dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize 2002-02-23 23:18:42.000000000 +0100 ++++ dietlibc-0.31.20080409/libcruft/getpagesize.c 2008-04-12 20:15:33.000000000 +0200 +@@ -2,14 +2,25 @@ + #include + #include + +-#ifndef PAGE_SIZE +-#define PAGE_SIZE 4096 +-#endif ++#include "../dietelfinfo.h" ++#include "../dietpagesize.h" + +-size_t __libc_getpagesize(void); + size_t __libc_getpagesize(void) { +- return PAGE_SIZE; ++#ifdef WANT_DYN_PAGESIZE ++ static size_t pgsz; ++ ++ if (__unlikely(pgsz==0)) { ++ elf_addr_t *v = __get_elf_aux_value(AT_PAGESZ); ++ if (__likely(v)) ++ pgsz = *v; ++ else ++ pgsz = __DIET_PAGE_SIZE_PREDEF; ++ } ++ ++ return pgsz; ++#else ++ return __DIET_PAGE_SIZE_PREDEF; ++#endif + } + + size_t getpagesize(void) __attribute__((weak,alias("__libc_getpagesize"))); +- +diff -up /dev/null dietlibc-0.31.20080409/dietpagesize.h +--- /dev/null 2008-03-18 07:40:22.289057188 +0100 ++++ dietlibc-0.31.20080409/dietpagesize.h 2008-04-12 20:22:45.000000000 +0200 +@@ -0,0 +1,31 @@ ++#ifndef H_DIETLIBC_DIETPAGESIZE_H ++#define H_DIETLIBC_DIETPAGESIZE_H ++ ++#include ++#include "dietfeatures.h" ++ ++extern size_t __libc_getpagesize(void) __attribute__((__const__)) __pure; ++ ++#if defined(WANT_STATIC_PAGESIZE) ++# define __DIET_PAGE_SIZE_PREDEF (WANT_STATIC_PAGESIZE) ++# define __DIET_PAGE_SHIFT_PREDEF (ffs(__DIET_PAGE_SIZE_PREDEF)-1) ++#elif defined(__alpha__) || defined(__sparc__) ++# define __DIET_PAGE_SIZE_PREDEF (8192UL) ++# define __DIET_PAGE_SHIFT_PREDEF (13) ++#elif defined(__powerpc64__) ++# define __DIET_PAGE_SIZE_PREDEF (65536UL) ++# define __DIET_PAGE_SHIFT_PREDEF (16) ++#else ++# define __DIET_PAGE_SIZE_PREDEF (4096UL) ++# define __DIET_PAGE_SHIFT_PREDEF (12) ++#endif ++ ++#ifdef WANT_DYN_PAGESIZE ++# define __DIET_PAGE_SIZE (__libc_getpagesize()) ++# define __DIET_PAGE_SHIFT (ffs(__DIET_PAGE_SIZE)-1) ++#else ++# define __DIET_PAGE_SIZE __DIET_PAGE_SIZE_PREDEF ++# define __DIET_PAGE_SHIFT __DIET_PAGE_SHIFT_PREDEF ++#endif ++ ++#endif /* H_DIETLIBC_DIETPAGESIZE_H */ +diff -up dietlibc-0.31.20080409/s390x/start.S.pagesize dietlibc-0.31.20080409/s390x/start.S +--- dietlibc-0.31.20080409/s390x/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/s390x/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -26,6 +26,11 @@ _start: + larl %r13,environ + stg %r4,0(%r13) + ++#ifdef WANT_ELFINFO ++ ahi %r13, 8 /* TODO: does it really point to __elfinfo? */ ++ stg %r4,0(%r13) ++#endif ++ + /* call main or _dyn_start */ + #ifdef WANT_DYNAMIC + brasl %r14,_dyn_start +diff -up /dev/null dietlibc-0.31.20080409/dietelfinfo.h +--- /dev/null 2008-03-18 07:40:22.289057188 +0100 ++++ dietlibc-0.31.20080409/dietelfinfo.h 2008-04-12 20:13:10.000000000 +0200 +@@ -0,0 +1,9 @@ ++#include "dietfeatures.h" ++ ++#ifdef WANT_ELFINFO ++#include ++#include ++ ++elf_addr_t * __get_elf_aux_value(unsigned int tag) ++ __attribute__((__visibility__("hidden"),__const__)); ++#endif +diff -up dietlibc-0.31.20080409/ia64/start.S.pagesize dietlibc-0.31.20080409/ia64/start.S +--- dietlibc-0.31.20080409/ia64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/ia64/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -40,6 +40,11 @@ _start: + ;; + st8 [r14] = out2 /* store envp in environ */ + ++#ifdef WANT_ELFINFO ++ adds r14 = 8, r14 /* __elfinfo = environ + 8 */ ++ st8 [r14] = out2 /* store envp in __elfinfo */ ++#endif ++ + #ifdef WANT_DYNAMIC + /* FIXME: dl_init parameter ??? */ + br.call.sptk.few rp = _dyn_start +diff -up dietlibc-0.31.20080409/i386/start.S.pagesize dietlibc-0.31.20080409/i386/start.S +--- dietlibc-0.31.20080409/i386/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/i386/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -25,6 +25,10 @@ _start: + PIC_INIT /* non-PIC: this is an empty line */ + PUT_VAR %eax, environ, %ecx /* non-PIC: movl %eax,environ */ + ++#ifdef WANT_ELFINFO ++ PUT_VAR %eax, __elfinfo, %ecx ++#endif ++ + #ifdef PROFILING + pushl $_etext + pushl $.text +diff -up dietlibc-0.31.20080409/dietdirent.h.pagesize dietlibc-0.31.20080409/dietdirent.h +--- dietlibc-0.31.20080409/dietdirent.h.pagesize 2002-07-03 22:33:37.000000000 +0200 ++++ dietlibc-0.31.20080409/dietdirent.h 2008-04-12 20:13:10.000000000 +0200 +@@ -1,8 +1,12 @@ + #include + ++#include "dietpagesize.h" ++ + struct __dirstream { + int fd; +- char buf[PAGE_SIZE-(sizeof (int)*3)]; + unsigned int num; + unsigned int cur; ++ char buf[]; + }; /* stream data from opendir() */ ++ ++#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) +diff -up dietlibc-0.31.20080409/alpha/start.S.pagesize dietlibc-0.31.20080409/alpha/start.S +--- dietlibc-0.31.20080409/alpha/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/alpha/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -24,6 +24,10 @@ _start: + + stq $18, environ + ++#ifdef WANT_ELFINFO ++ stq $18, __elfinfo ++#endif ++ + #ifdef WANT_DYNAMIC + /* in v0 ($0) is the ld.so _fini pointer */ + mov $0, $19 /* mov v0(dynload) to a3 */ +diff -up dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize dietlibc-0.31.20080409/syscalls.s/environ.S +--- dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize 2004-09-28 02:01:30.000000000 +0200 ++++ dietlibc-0.31.20080409/syscalls.s/environ.S 2008-04-12 20:13:10.000000000 +0200 +@@ -1,6 +1,7 @@ + .section ".bss" + .align 8 + #include ++#include + + .type environ,object + .weak environ +@@ -15,3 +16,22 @@ environ: + #endif + .size environ,.-environ + .size __environ,.-__environ ++ ++/* __elfinfo will be a copy of __environ after startup. Later, it will be ++ updated by __get_elf_aux_value() to point to the terminating NULL of the ++ environment. ++ ++ Startup code assumes that __elfinfo is located immediately after ++ __environ. */ ++ ++#ifdef WANT_ELFINFO ++.type __elfinfo,object ++.weak __elfinfo ++__elfinfo: ++#if __WORDSIZE == 64 ++ .quad 0 ++#else ++ .long 0 ++#endif ++.size __elfinfo,.-__elfinfo ++#endif +diff -up dietlibc-0.31.20080409/arm/start.S.pagesize dietlibc-0.31.20080409/arm/start.S +--- dietlibc-0.31.20080409/arm/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/arm/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -23,11 +23,15 @@ _start: + #ifdef __DYN_LIB + ldr sl, .L4 + 1: add sl, pc, sl +- str a3, [sl, ip] @ environ = envp ++ str a3, [ip, sl]! @ environ = envp; ip = GOT(environ) + #else + str a3, [ip, #0] @ environ = envp + #endif + ++#ifdef WANT_ELFINFO ++ str a3, [ip, #4] @ __elfinfo = envp ++#endif ++ + #ifdef PROFILING + stmdb sp!, { r0 - r3 } + ldr r0, .L5 +@@ -70,6 +74,3 @@ _exit: + .L5: .word .text + .L6: .word _etext + #endif +- +- +- +diff -up dietlibc-0.31.20080409/parisc/start.S.pagesize dietlibc-0.31.20080409/parisc/start.S +--- dietlibc-0.31.20080409/parisc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/parisc/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -34,6 +34,11 @@ _start: + ldil LP%environ, %r19 + ldo RP%environ(%r19), %r19 + ++#ifdef WANT_ELFINFO ++ ldil LP%__elfinfo, %r19 ++ ldo RP%__elfinfo(%r19), %r19 ++#endif ++ + /* Expand the stack to store the 5th through 7th args */ + ldo 64(%sp), %sp + +diff -up dietlibc-0.31.20080409/include/sys/shm.h.pagesize dietlibc-0.31.20080409/include/sys/shm.h +--- dietlibc-0.31.20080409/include/sys/shm.h.pagesize 2005-09-21 09:33:08.000000000 +0200 ++++ dietlibc-0.31.20080409/include/sys/shm.h 2008-04-12 20:13:10.000000000 +0200 +@@ -60,15 +60,6 @@ struct shm_info { + unsigned long swap_successes; + }; + +-#if defined(__i386__) || defined(__mips__) || defined(__arm__) || defined(__powerpc__) || defined (__powerpc64__) || defined(__s390__) || defined(__hppa__) || defined(__x86_64__) || defined(__ia64__) +-#define PAGE_SIZE 4096UL +-#define PAGE_SHIFT 12 +-#elif defined(__alpha__) || defined(__sparc__) +-/* sun4* has 4k except sun4 architecture, sparc64 has 8k */ +-#define PAGE_SIZE 8192UL +-#define PAGE_SHIFT 13 +-#endif +- + 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 -up dietlibc-0.31.20080409/sparc/start.S.pagesize dietlibc-0.31.20080409/sparc/start.S +--- dietlibc-0.31.20080409/sparc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -25,6 +25,11 @@ _start: + or %o3, %lo(environ), %o3 + st %o2, [%o3] + ++#ifdef WANT_ELFINFO ++ add %o3, %o3, 4 ++ st %o2, [%o3] ++#endif ++ + /* 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 -up dietlibc-0.31.20080409/sparc/shmat.c.pagesize dietlibc-0.31.20080409/sparc/shmat.c +--- dietlibc-0.31.20080409/sparc/shmat.c.pagesize 2001-06-16 19:48:57.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc/shmat.c 2008-04-12 20:13:10.000000000 +0200 +@@ -3,17 +3,15 @@ + #include + #include + +-extern void* __ipc(); ++#include "../dietpagesize.h" + +-#ifndef PAGE_SIZE +-#define PAGE_SIZE 4096 +-#endif ++extern void* __ipc(); + + void* shmat(int shmid,const void* shmaddr,int shmflg) { + void* raddr; + register void* result; + result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr); +- if ((unsigned long)result <= -(unsigned long)PAGE_SIZE) ++ if ((unsigned long)result <= -(unsigned long)__DIET_PAGE_SIZE) + result=raddr; + return result; + } +diff -up dietlibc-0.31.20080409/ppc64/start.S.pagesize dietlibc-0.31.20080409/ppc64/start.S +--- dietlibc-0.31.20080409/ppc64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/ppc64/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -58,6 +58,12 @@ _start: + oris 14,14,environ@ha + std 5,environ@l(14) + ++#ifdef WANT_ELFINFO ++ /* TODO: can we really assume that environ and __elfinfo are on the ++ same 16 bit page? */ ++ std 5,__elfinfo@l(14) ++#endif ++ + #ifdef WANT_DYNAMIC + /* #warning dynamic */ + mr 6,7 +diff -up dietlibc-0.31.20080409/x86_64/start.S.pagesize dietlibc-0.31.20080409/x86_64/start.S +--- dietlibc-0.31.20080409/x86_64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/x86_64/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -12,12 +12,23 @@ _start: + + leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */ + ++ ++#ifdef WANT_ELFINFO ++#ifdef __DYN_LIB ++ movq environ@GOTPCREL(%rip), %rax ++#else ++ leaq environ(%rip), %rax ++#endif ++ movq %rdx, (%rax) /* environ */ ++ movq %rdx, 8(%rax) /* __elfinfo */ ++#else + #ifdef __DYN_LIB + movq environ@GOTPCREL(%rip), %rax + movq %rdx, (%rax) + #else + movq %rdx, environ(%rip) + #endif ++#endif + + #ifdef PROFILING + pushq %rdi /* save reg args */ +diff -up dietlibc-0.31.20080409/s390/start.S.pagesize dietlibc-0.31.20080409/s390/start.S +--- dietlibc-0.31.20080409/s390/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/s390/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -30,6 +30,11 @@ _start: + l %r1,8(%r13) + st %r4,0(%r1) + ++#ifdef WANT_ELFINFO ++ ahi %r1, 4 # TODO: does it really point to __elfinfo now? ++ st %r4,0(%r1) ++#endif ++ + /* call main or _dyn_start */ + l %r1,0(%r13) + basr %r14,%r1 +diff -up dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize dietlibc-0.31.20080409/dynlinker/ldso_start.S +--- dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize 2006-10-13 22:11:13.000000000 +0200 ++++ dietlibc-0.31.20080409/dynlinker/ldso_start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -86,6 +86,15 @@ __environ: + .long 0 + #endif + ++/* __elfinfo must follow __environ immediately */ ++.global __elfinfo ++__elfinfo: ++#if __WORDSIZE == 64 ++ .quad 0 ++#else ++ .long 0 ++#endif ++ + .global fini_entry + fini_entry: + .long 0 +diff -up dietlibc-0.31.20080409/mips/start.S.pagesize dietlibc-0.31.20080409/mips/start.S +--- dietlibc-0.31.20080409/mips/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 ++++ dietlibc-0.31.20080409/mips/start.S 2008-04-12 20:13:10.000000000 +0200 +@@ -47,6 +47,9 @@ __start: + #endif + add $a2, $a2, $a1 + sw $a2, environ ++#ifdef WANT_ELFINFO ++ sw $a2, __elfinfo ++#endif + jalr $25 + la $25, exit + move $4,$2 From ddfc4b59ef35362fcafb48cb1acfe16285f21924 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 13:43:05 +0000 Subject: [PATCH 026/161] This patch adds support for uppercase 'F' and 'G' printf format specifiers. It fixes handling of -INF values in __dtostr() too; previously, there was | unsigned int i; | if ((i=isinf(d))) return copystring(buf,maxlen,i>0?"inf":"-inf"); ~~~ which evaluated to true everytime. The copystring() function worked for 3-letter words only but not for '-inf'. The last argument of __dtostr() was changed from a boolean flag to a bitmask. Bit 0 encodes 'g' or 'f', and bit 1 lower-/uppercase. There should be probably added some macros for them; for now, these values are used directly. Please note that this might affect other applications (liblowfat?) too which are using __dtostr(). --- dietlibc-0.31-printFG.patch | 199 ++++++++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 dietlibc-0.31-printFG.patch diff --git a/dietlibc-0.31-printFG.patch b/dietlibc-0.31-printFG.patch new file mode 100644 index 0000000..9a11b80 --- /dev/null +++ b/dietlibc-0.31-printFG.patch @@ -0,0 +1,199 @@ +diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/lib/__dtostr.c +--- dietlibc-0.31.20080409/lib/__dtostr.c.printFG 2006-07-04 05:33:02.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/__dtostr.c 2008-04-13 14:41:48.000000000 +0200 +@@ -5,13 +5,15 @@ + + static int copystring(char* buf,int maxlen, const char* s) { + int i; +- for (i=0; i<3&&i0?"inf":"-inf"); +- if (isnan(d)) return copystring(buf,maxlen,"nan"); ++ if ((is_inf=isinf(d))) ++ return copystring(buf,maxlen, ++ (is_inf<0)? ++ (flags&0x02?"-INF":"-inf"): ++ (flags&0x02?"INF":"inf")); ++ if (isnan(d)) return copystring(buf,maxlen,flags&0x02?"NAN":"nan"); + e10=1+(long)(e*0.30102999566398119802); /* log10(2) */ + /* Wir iterieren von Links bis wir bei 0 sind oder maxlen erreicht + * ist. Wenn maxlen erreicht ist, machen wir das nochmal in +@@ -126,7 +133,7 @@ int __dtostr(double d,char *buf,unsigned + if (prec2 || prec>(unsigned int)(buf-oldbuf)+1) { /* more digits wanted */ + if (!maxlen) return 0; --maxlen; + *buf='.'; ++buf; +- if (g) { ++ if ((flags & 0x01)) { + if (prec2) prec=prec2; + prec-=buf-oldbuf-1; + } else { +diff -up dietlibc-0.31.20080409/lib/__v_printf.c.printFG dietlibc-0.31.20080409/lib/__v_printf.c +--- dietlibc-0.31.20080409/lib/__v_printf.c.printFG 2008-02-19 01:28:13.000000000 +0100 ++++ dietlibc-0.31.20080409/lib/__v_printf.c 2008-04-13 14:41:48.000000000 +0200 +@@ -346,45 +346,49 @@ num_printf: + #ifdef WANT_FLOATING_POINT_IN_PRINTF + /* print a floating point value */ + case 'f': ++ case 'F': + case 'g': ++ case 'G': + { +- int g=(ch=='g'); ++ int flags=(((ch&0x5f)=='G') ? 0x01 : 0x00) | ((ch&0x20) ? 0x00 : 0x02); + double d=va_arg(arg_ptr,double); + s=buf+1; + if (width==0) width=1; + if (!flag_dot) preci=6; + if (flag_sign || d < +0.0) flag_in_sign=1; + +- sz=__dtostr(d,s,sizeof(buf)-1,width,preci,g); ++ sz=__dtostr(d,s,sizeof(buf)-1,width,preci,flags); + +- if (flag_dot) { +- char *tmp; +- if ((tmp=strchr(s,'.'))) { +- if (preci || flag_hash) ++tmp; +- while (preci>0 && *++tmp) --preci; +- *tmp=0; +- } else if (flag_hash) { +- s[sz]='.'; +- s[++sz]='\0'; ++ if (!isnan(d) && !isinf(d)) { /* skip NaN + INF values */ ++ if (flag_dot) { ++ char *tmp; ++ if ((tmp=strchr(s,'.'))) { ++ if (preci || flag_hash) ++tmp; ++ while (preci>0 && *++tmp) --preci; ++ *tmp=0; ++ } else if (flag_hash) { ++ s[sz]='.'; ++ s[++sz]='\0'; ++ } + } +- } + +- if (g) { +- char *tmp,*tmp1; /* boy, is _this_ ugly! */ +- if ((tmp=strchr(s,'.'))) { +- tmp1=strchr(tmp,'e'); +- while (*tmp) ++tmp; +- if (tmp1) tmp=tmp1; +- while (*--tmp=='0') ; +- if (*tmp!='.') ++tmp; +- *tmp=0; +- if (tmp1) strcpy(tmp,tmp1); ++ if ((flags&0x01)) { ++ char *tmp,*tmp1; /* boy, is _this_ ugly! */ ++ if ((tmp=strchr(s,'.'))) { ++ tmp1=strchr(tmp,'e'); ++ while (*tmp) ++tmp; ++ if (tmp1) tmp=tmp1; ++ while (*--tmp=='0') ; ++ if (*tmp!='.') ++tmp; ++ *tmp=0; ++ if (tmp1) strcpy(tmp,tmp1); ++ } + } +- } + +- if ((flag_sign || flag_space) && d>=0) { +- *(--s)=(flag_sign)?'+':' '; +- ++sz; ++ if ((flag_sign || flag_space) && d>=0) { ++ *(--s)=(flag_sign)?'+':' '; ++ ++sz; ++ } + } + + sz=strlen(s); +diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/test/printf.c +--- dietlibc-0.31.20080409/test/printf.c.printFG 2008-02-19 01:28:13.000000000 +0100 ++++ dietlibc-0.31.20080409/test/printf.c 2008-04-13 14:52:36.000000000 +0200 +@@ -2,11 +2,24 @@ + #include + #include + #include ++#include ++#include + #include + #include + + #define ALGN 5 + ++#ifndef INFINITY ++# define INFINITY (DBL_MAX * DBL_MAX) ++#endif ++ ++#ifndef NAN ++# if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) ++# define NAN (__builtin_nan("")) ++# endif ++#endif ++ ++ + // https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=112986 + #if 0 + #undef assert +@@ -131,6 +144,23 @@ int main() + TEST("-01234", "%6.5i", -1234); + TEST(" 1234", "%6.5s", "1234"); + ++ TEST("inf", "%f", INFINITY); ++ TEST("-inf", "%f", -INFINITY); ++ TEST("INF", "%F", INFINITY); ++ TEST("-INF", "%F", -INFINITY); ++ ++ TEST("inf", "%g", INFINITY); ++ TEST("-inf", "%g", -INFINITY); ++ TEST("INF", "%G", INFINITY); ++ TEST("-INF", "%G", -INFINITY); ++ ++#ifdef NAN ++ TEST("nan", "%f", NAN); ++ TEST("NAN", "%F", NAN); ++ TEST("nan", "%g", NAN); ++ TEST("NAN", "%G", NAN); ++#endif ++ + #ifdef XSI_TESTS + setlocale(LC_ALL, "de_DE"); + +diff -up dietlibc-0.31.20080409/include/stdlib.h.printFG dietlibc-0.31.20080409/include/stdlib.h +--- dietlibc-0.31.20080409/include/stdlib.h.printFG 2007-09-20 20:51:18.000000000 +0200 ++++ dietlibc-0.31.20080409/include/stdlib.h 2008-04-13 14:41:48.000000000 +0200 +@@ -28,8 +28,12 @@ long double strtold(const char *nptr, ch + long int strtol(const char *nptr, char **endptr, int base) __THROW; + unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW; + ++/* HACK: used flags in __dtostr ++ 0x01 ... 'g' ++ 0x02 ... uppercase ++ Define some constants somewhere... */ + extern int __ltostr(char *s, unsigned int size, unsigned long i, unsigned int base, int UpCase) __THROW; +-extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int g) __THROW; ++extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int flags) __THROW; + + #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L + __extension__ long long int strtoll(const char *nptr, char **endptr, int base) __THROW; From 657cb3c7461e339f4631192690b553010b292832 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 13:45:58 +0000 Subject: [PATCH 027/161] This patch changes the used format for %x and %X specifiers in strptime(3) to match these specified by SUSv2. It adds support for '%F' in strftime(3) too. --- dietlibc-0.31-lcctime.patch | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 dietlibc-0.31-lcctime.patch diff --git a/dietlibc-0.31-lcctime.patch b/dietlibc-0.31-lcctime.patch new file mode 100644 index 0000000..a559e9c --- /dev/null +++ b/dietlibc-0.31-lcctime.patch @@ -0,0 +1,28 @@ +diff -up dietlibc-0.31.20080409/libugly/strftime.c.lcctime dietlibc-0.31.20080409/libugly/strftime.c +--- dietlibc-0.31.20080409/libugly/strftime.c.lcctime 2006-08-15 18:07:15.000000000 +0200 ++++ dietlibc-0.31.20080409/libugly/strftime.c 2008-04-13 13:20:41.000000000 +0200 +@@ -55,6 +55,7 @@ again: + case 'x': src = "%b %a %d"; goto _strf; + case 'X': src = "%k:%M:%S"; goto _strf; + case 'D': src = "%m/%d/%y"; goto _strf; ++ case 'F': src = "%Y-%m-%d"; goto _strf; + case 'T': src = "%H:%M:%S"; + _strf: p += strftime (p, (size_t)(dst+max-p), src, tm); break; + case 'a': src = sweekdays [tm->tm_wday]; goto _str; +diff -up dietlibc-0.31.20080409/libugly/strptime.c.lcctime dietlibc-0.31.20080409/libugly/strptime.c +--- dietlibc-0.31.20080409/libugly/strptime.c.lcctime 2007-08-03 22:58:33.000000000 +0200 ++++ dietlibc-0.31.20080409/libugly/strptime.c 2008-04-13 13:13:12.000000000 +0200 +@@ -119,10 +119,11 @@ char* strptime(const char* s,const char* + ++s; + break; + case 'x': +- s=strptime(s,"%b %a %d",tm); ++ /* see SUSv2, Ch.7 "LC_TIME Category in the POSIX Locale" */ ++ s=strptime(s,"%m/%d/%y",tm); + break; + case 'X': +- s=strptime(s,"%k:%M:%S",tm); ++ s=strptime(s,"%H:%M:%S",tm); + break; + case 'y': + i=getint(&s,2); From 7c0cc8d8355f3e4036b243b64074db82f24e9c0f Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 13:48:16 +0000 Subject: [PATCH 028/161] The tst-fseek testsuite is bogus on 64 bit platforms because the *stat64 functions/structures are not available there. This patch defines '_FILE_OFFSET_BITS 64' and uses the plain *stat instead of. --- dietlibc-0.31-stat64.patch | 88 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 dietlibc-0.31-stat64.patch diff --git a/dietlibc-0.31-stat64.patch b/dietlibc-0.31-stat64.patch new file mode 100644 index 0000000..d043d84 --- /dev/null +++ b/dietlibc-0.31-stat64.patch @@ -0,0 +1,88 @@ +diff -up dietlibc-0.31.20080409/test/stdio/tst-fseek.c.stat64 dietlibc-0.31.20080409/test/stdio/tst-fseek.c +--- dietlibc-0.31.20080409/test/stdio/tst-fseek.c.stat64 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/stdio/tst-fseek.c 2008-04-12 21:17:47.000000000 +0200 +@@ -19,6 +19,7 @@ + 02111-1307 USA. */ + + #define _GNU_SOURCE ++#define _FILE_OFFSET_BITS 64 + #include + #include + #include +@@ -38,8 +39,8 @@ main (void) + const char outstr[] = "hello world!\n"; + char strbuf[sizeof outstr]; + char buf[200]; +- struct stat64 st1; +- struct stat64 st2; ++ struct stat st1; ++ struct stat st2; + int result = 0; + + tmpdir = getenv ("TMPDIR"); +@@ -315,9 +316,9 @@ main (void) + } + + /* Check the access time. */ +- if (fstat64 (fd, &st1) < 0) ++ if (fstat (fd, &st1) < 0) + { +- printf ("%d: fstat64() before fseeko() failed\n\n", __LINE__); ++ printf ("%d: fstat() before fseeko() failed\n\n", __LINE__); + result = 1; + } + else +@@ -338,9 +339,9 @@ main (void) + sleep (1); + t = time (NULL); + +- if (fstat64 (fd, &st2) < 0) ++ if (fstat (fd, &st2) < 0) + { +- printf ("%d: fstat64() after fseeko() failed\n\n", __LINE__); ++ printf ("%d: fstat() after fseeko() failed\n\n", __LINE__); + result = 1; + } + if (st1.st_ctime >= t) +@@ -424,9 +425,9 @@ main (void) + printf ("%d: fopen() failed\n\n", __LINE__); + result = 1; + } +- else if (fstat64 (fileno (fp), &st1) < 0) ++ else if (fstat (fileno (fp), &st1) < 0) + { +- printf ("%d: fstat64() before fseeko() failed\n\n", __LINE__); ++ printf ("%d: fstat() before fseeko() failed\n\n", __LINE__); + result = 1; + } + else if (fseeko (fp, 0, SEEK_END) != 0) +@@ -436,7 +437,7 @@ main (void) + } + else if (ftello (fp) != st1.st_size) + { +- printf ("%d: fstat64 st_size %zd ftello %zd\n", __LINE__, ++ printf ("%d: fstat st_size %zd ftello %zd\n", __LINE__, + (size_t) st1.st_size, (size_t) ftello (fp)); + result = 1; + } +@@ -451,9 +452,9 @@ main (void) + printf ("%d: fopen() failed\n\n", __LINE__); + result = 1; + } +- else if (fstat64 (fileno (fp), &st1) < 0) ++ else if (fstat (fileno (fp), &st1) < 0) + { +- printf ("%d: fstat64() before fgetc() failed\n\n", __LINE__); ++ printf ("%d: fstat() before fgetc() failed\n\n", __LINE__); + result = 1; + } + else if (fgetc (fp) == EOF) +@@ -468,7 +469,7 @@ main (void) + } + else if (ftello (fp) != st1.st_size) + { +- printf ("%d: fstat64 st_size %zd ftello %zd\n", __LINE__, ++ printf ("%d: fstat st_size %zd ftello %zd\n", __LINE__, + (size_t) st1.st_size, (size_t) ftello (fp)); + result = 1; + } From bc919cc87ee9198e13cb55dbe49ffe40baaafcca Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 14:01:03 +0000 Subject: [PATCH 029/161] This patch fixes/enhances the testsuite: I removed the checks which called endmntent() multiple times resp. with a NULL pointer. Behavior in first case is undefined and latter causes a segfault (I could not find documentation that this is allowed). Hence, it does not make sense to test this. test 'malloc(0)' only, when WANT_MALLOC_ZERO is set the '%Zu' printf format specifier is bogus (from libc5 ages). I replaced it with the '%zu' one. Please note, that this test still fails because it uses glibc specific features. removed tests which set a non-C locale. Broken usage of 'strptime()' result was fixed too. This test should succeed now. this test was added while working on the '%F/%G' patch and verifies the isinf() + isnan() functions. Please see http://cvs.fedora.redhat.com/viewcvs/rpms/dietlibc/devel/runtests-X.sh?root =extras&view=markup for tests which are known to be broken. --- dietlibc-0.31-testsuite.patch | 176 ++++++++++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 dietlibc-0.31-testsuite.patch diff --git a/dietlibc-0.31-testsuite.patch b/dietlibc-0.31-testsuite.patch new file mode 100644 index 0000000..59ea16d --- /dev/null +++ b/dietlibc-0.31-testsuite.patch @@ -0,0 +1,176 @@ +diff -up dietlibc-0.31.20080409/test/getmntent.c.testsuite dietlibc-0.31.20080409/test/getmntent.c +--- dietlibc-0.31.20080409/test/getmntent.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/getmntent.c 2008-04-13 15:49:19.000000000 +0200 +@@ -33,10 +33,6 @@ while ((e = getmntent(fstab))) { + + printf("closing /etc/fstab\n"); + assert ( 1 == endmntent(fstab)); +- printf("closing /etc/fstab again\n"); +- assert ( 1 == endmntent(fstab)); /* endmntent must always return 1 */ +- printf("entmntent(0)\n"); +- assert ( 1 == endmntent(0)); /* causes a segfault with diet libc */ ++ + return 0; + } +- +diff -up dietlibc-0.31.20080409/test/runtests.sh.testsuite dietlibc-0.31.20080409/test/runtests.sh +--- dietlibc-0.31.20080409/test/runtests.sh.testsuite 2008-04-13 14:54:58.000000000 +0200 ++++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 14:54:58.000000000 +0200 +@@ -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 sysconf sysenter ungetc waitpid" ++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 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" + + STDIN="read1" + PASS="getpass" +diff -up dietlibc-0.31.20080409/test/Makefile.testsuite dietlibc-0.31.20080409/test/Makefile +--- dietlibc-0.31.20080409/test/Makefile.testsuite 2008-04-13 14:54:58.000000000 +0200 ++++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 14:54:58.000000000 +0200 +@@ -10,7 +10,7 @@ LCOMPAT=-lcompat + TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty 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 \ ++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 \ +diff -up dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-malloc.c +--- dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/stdlib/tst-malloc.c 2008-04-13 14:54:58.000000000 +0200 +@@ -21,13 +21,15 @@ + #include + #include + ++#include "../../dietfeatures.h" ++ + static int errors = 0; + + static void + merror (const char *msg) + { + ++errors; +- printf ("Error: %s\n", msg); ++ fprintf (stderr, "Error: %s\n", msg); + } + + int +@@ -56,9 +58,11 @@ main (void) + if (p != NULL) + merror ("realloc (p, 0) failed."); + ++#ifdef WANT_MALLOC_ZERO + p = malloc (0); + if (p == NULL) + merror ("malloc (0) failed."); ++#endif + + p = realloc (p, 0); + if (p != NULL) +diff -up dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strftime.c +--- dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/time/tst-strftime.c 2008-04-13 14:54:58.000000000 +0200 +@@ -49,18 +49,18 @@ int main (void) { + + if (res == 0) + { +- printf ("%Zu: %s: res == 0 despite size == %Zu\n", ++ printf ("%zu: %s: res == 0 despite size == %zu\n", + cnt, tests[cnt].fmt, size); + result = 1; + } + else if (size < tests[cnt].min) + { +- printf ("%Zu: %s: size == %Zu was enough\n", ++ printf ("%zu: %s: size == %zu was enough\n", + cnt, tests[cnt].fmt, size); + result = 1; + } + else +- printf ("%Zu: %s: size == %Zu: OK\n", cnt, tests[cnt].fmt, size); ++ printf ("%zu: %s: size == %zu: OK\n", cnt, tests[cnt].fmt, size); + + free (buf); + } +diff -up dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strptime.c +--- dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/time/tst-strptime.c 2008-04-13 14:54:58.000000000 +0200 +@@ -41,10 +41,12 @@ static const struct + { "C", "03/03/00", "%D", 5, 62, 2, 3 }, + { "C", "9/9/99", "%x", 4, 251, 8, 9 }, + { "C", "19990502123412", "%Y%m%d%H%M%S", 0, 121, 4, 2 }, ++#if 0 /* dietlibc does not support %U/%W/%j and non-POSIX locales */ + { "C", "2001 20 Mon", "%Y %U %a", 1, 140, 4, 21 }, + { "C", "2001 21 Mon", "%Y %W %a", 1, 140, 4, 21 }, + { "ja_JP.EUC-JP", "2001 20 \xb7\xee", "%Y %U %a", 1, 140, 4, 21 }, + { "ja_JP.EUC-JP", "2001 21 \xb7\xee", "%Y %W %a", 1, 140, 4, 21 }, ++#endif + }; + + +@@ -72,9 +74,16 @@ test_tm (void) + + for (i = 0; i < sizeof (tm_tests) / sizeof (tm_tests[0]); ++i) + { ++ char *pres; + memset (&tm, '\0', sizeof (tm)); +- +- if (strptime (tm_tests[i].input, tm_tests[i].format, &tm) != '\0') ++ ++ pres = strptime (tm_tests[i].input, tm_tests[i].format, &tm); ++ if (!pres) ++ { ++ fprintf(stderr, "failed to parse '%s'\n", day_tests[i].input); ++ result = 1; ++ } ++ else if (*pres != '\0') + { + printf ("not all of `%s' read\n", tm_tests[i].input); + result = 1; +@@ -118,6 +127,7 @@ int main (void) { + + for (i = 0; i < sizeof (day_tests) / sizeof (day_tests[0]); ++i) + { ++ char *pres; + memset (&tm, '\0', sizeof (tm)); + + if (setlocale (LC_ALL, day_tests[i].locale) == NULL) +@@ -125,7 +135,14 @@ int main (void) { + printf ("cannot set locale %s: %m\n", day_tests[i].locale); + } + +- if (*strptime (day_tests[i].input, day_tests[i].format, &tm) != '\0') ++ pres = strptime (day_tests[i].input, day_tests[i].format, &tm); ++ if (!pres) ++ { ++ fprintf(stderr, "failed to parse '%s' for locale '%s'\n", ++ day_tests[i].input, day_tests[i].locale); ++ result = 1; ++ } ++ else if (*pres != '\0') + { + printf ("not all of `%s' read\n", day_tests[i].input); + result = 1; +diff -up /dev/null dietlibc-0.31.20080409/test/math.c +--- /dev/null 2008-03-18 07:40:22.289057188 +0100 ++++ dietlibc-0.31.20080409/test/math.c 2008-04-13 14:54:58.000000000 +0200 +@@ -0,0 +1,18 @@ ++#include ++#include ++#include ++ ++int main() ++{ ++#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) ++ assert(isinf(__builtin_inff())==1); ++ assert(isinf(-__builtin_inff())==-1); ++ assert(isnan(__builtin_nan(""))); ++#endif ++ ++ assert(isinf((DBL_MAX * DBL_MAX))==1); ++ assert(isinf(-(DBL_MAX * DBL_MAX))==-1); ++ //assert(isnan(nan(""))); ++ ++ return 0; ++} From 25b8a8926ac38d5960b2bc9c5ee0594c2b5fb6df Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 14:02:33 +0000 Subject: [PATCH 030/161] registered test which are known to be broken resp. which test for features known to be broken. --- runtests-X.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/runtests-X.sh b/runtests-X.sh index abfc78d..d5b8a65 100644 --- a/runtests-X.sh +++ b/runtests-X.sh @@ -2,14 +2,57 @@ eval $(grep '^\(TESTPROGRAMS\|SUBDIRS\)=' runtests.sh) +FAILURES_BOGUS=( + ":stdlib:tst-environ" # test uses environ function in unsupported ways (dup keys) + ":stdlib:tst-rand48" # platform dependent; does not give reliable results + ":stdlib:tst-strtod" # must be investigated further... + ":time:tst-mktime" # dietlibc does not support $TZ env + ":time:tst-posixtz" # dietlibc does not support $TZ env + ":time:tst-strftime" # dietlibc does not support glibc specific format specifications +) + +FAILURES_KNOWN=( + ":sendfile" # stdin/stdout not supported; test must be wrapped + ":stdio:tstdiomisc" # scanf(3) fails on some constructs + ":stdio:tst-fphex" # printf(3) does not support %a specifiers + ":stdio:tst-printf" # printf(3) does not support some floating point ops + ":stdio:tst-sscanf" # scanf(3) fails on double input + ":stdlib:test-canon" # realpath(3) is broken... +) + +function is_in() { + local val=$1 + local i + shift + + for i; do + test x"$i" != x"$val" || return 0 + done + return 1 +} + rc=0 : ${RUNTEST_INDENT=0} export RUNTEST_INDENT +export RUNTEST_NS for p in $TESTPROGRAMS; do ! tty -s || printf '%*s%-20s' $RUNTEST_INDENT '' "$p" - ./$p >/dev/null && res='OK' || { res='FAIL'; let ++rc; } + + is_in "$RUNTEST_NS:$p" "${FAILURES_BOGUS[@]}" && fail_bogus=true || fail_bogus=false + is_in "$RUNTEST_NS:$p" "${FAILURES_KNOWN[@]}" && fail_known=true || fail_known=false + ./$p >/dev/null && failed=false || failed=true + + case $failed:$fail_known:$fail_bogus in + (false:false:*) res='OK';; + (false:true:true) res='OK (bogus)';; + (false:true:false) res="OK (unexpected)"; let ++rc;; + (true:*:true) res='FAIL (bogus)';; + (true:true:*) res="FAIL (known)";; + (true:false:*) res='FAIL'; let ++rc;; + esac + ! tty -s || printf '\r' printf '%*s%-20s%s\n' $RUNTEST_INDENT '' "$p" "$res" @@ -21,7 +64,12 @@ test $rc -eq 0 || \ for d in $SUBDIRS; do echo "--- entering directory $d ---" let RUNTEST_INDENT+=2 + old_ns=$RUNTEST_NS + RUNTEST_NS=$RUNTEST_NS:$d + cd $d && bash ./runtests-X.sh || let ++rc + + RUNTEST_NS=$old_ns let RUNTEST_INDENT-=2 cd $OLDPWD || exit 1 From 1fee7d679bb2cc4b9f75e71d3e8b20ddef5a81a0 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 14:14:48 +0000 Subject: [PATCH 031/161] - whitespace cleanups - use gnu-style - added __pure attribute to __get_elf_aux_value() --- dietlibc-0.31-pagesize.patch | 224 +++++++++++++++++------------------ 1 file changed, 112 insertions(+), 112 deletions(-) diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index b29fbff..06745d9 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -1,6 +1,6 @@ diff -up dietlibc-0.31.20080409/lib/mmap64.c.pagesize dietlibc-0.31.20080409/lib/mmap64.c --- dietlibc-0.31.20080409/lib/mmap64.c.pagesize 2004-12-13 11:21:31.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/mmap64.c 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/mmap64.c 2008-04-13 16:03:45.000000000 +0200 @@ -4,16 +4,18 @@ #include #include @@ -24,7 +24,7 @@ diff -up dietlibc-0.31.20080409/lib/mmap64.c.pagesize dietlibc-0.31.20080409/lib void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) diff -up dietlibc-0.31.20080409/lib/readdir64.c.pagesize dietlibc-0.31.20080409/lib/readdir64.c --- dietlibc-0.31.20080409/lib/readdir64.c.pagesize 2004-03-02 22:27:19.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/readdir64.c 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/readdir64.c 2008-04-13 16:03:45.000000000 +0200 @@ -14,7 +14,7 @@ #ifndef WANT_LARGEFILE_BACKCOMPAT struct dirent64* readdir64(DIR *d) { @@ -54,7 +54,7 @@ diff -up dietlibc-0.31.20080409/lib/readdir64.c.pagesize dietlibc-0.31.20080409/ trygetdents64=0; diff -up dietlibc-0.31.20080409/lib/opendir.c.pagesize dietlibc-0.31.20080409/lib/opendir.c --- dietlibc-0.31.20080409/lib/opendir.c.pagesize 2002-07-03 22:33:38.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/opendir.c 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/opendir.c 2008-04-13 16:03:45.000000000 +0200 @@ -5,6 +5,8 @@ #include #include @@ -75,7 +75,7 @@ diff -up dietlibc-0.31.20080409/lib/opendir.c.pagesize dietlibc-0.31.20080409/li lose: diff -up dietlibc-0.31.20080409/lib/readdir.c.pagesize dietlibc-0.31.20080409/lib/readdir.c --- dietlibc-0.31.20080409/lib/readdir.c.pagesize 2002-07-03 22:33:38.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/readdir.c 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/readdir.c 2008-04-13 16:03:45.000000000 +0200 @@ -5,7 +5,7 @@ struct dirent* readdir(DIR *d) { @@ -87,7 +87,7 @@ diff -up dietlibc-0.31.20080409/lib/readdir.c.pagesize dietlibc-0.31.20080409/li } diff -up dietlibc-0.31.20080409/lib/closedir.c.pagesize dietlibc-0.31.20080409/lib/closedir.c --- dietlibc-0.31.20080409/lib/closedir.c.pagesize 2002-07-03 22:33:37.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/closedir.c 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/closedir.c 2008-04-13 16:03:45.000000000 +0200 @@ -4,8 +4,10 @@ #include #include @@ -102,7 +102,7 @@ diff -up dietlibc-0.31.20080409/lib/closedir.c.pagesize dietlibc-0.31.20080409/l } diff -up dietlibc-0.31.20080409/lib/alloc.c.pagesize dietlibc-0.31.20080409/lib/alloc.c --- dietlibc-0.31.20080409/lib/alloc.c.pagesize 2007-08-03 22:58:33.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/alloc.c 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/alloc.c 2008-04-13 16:03:45.000000000 +0200 @@ -18,8 +18,7 @@ #include #include @@ -124,7 +124,7 @@ diff -up dietlibc-0.31.20080409/lib/alloc.c.pagesize dietlibc-0.31.20080409/lib/ /* a simple mmap :) */ diff -up dietlibc-0.31.20080409/ppc/start.S.pagesize dietlibc-0.31.20080409/ppc/start.S --- dietlibc-0.31.20080409/ppc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ppc/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/ppc/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -31,6 +31,12 @@ _start: lis 14,environ@ha stw 5,environ@l(14) @@ -140,7 +140,7 @@ diff -up dietlibc-0.31.20080409/ppc/start.S.pagesize dietlibc-0.31.20080409/ppc/ bl _dyn_start diff -up dietlibc-0.31.20080409/dietfeatures.h.pagesize dietlibc-0.31.20080409/dietfeatures.h --- dietlibc-0.31.20080409/dietfeatures.h.pagesize 2007-10-09 01:15:27.000000000 +0200 -+++ dietlibc-0.31.20080409/dietfeatures.h 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/dietfeatures.h 2008-04-13 16:03:45.000000000 +0200 @@ -126,6 +126,16 @@ /* #define WANT_SSP_XOR */ @@ -169,7 +169,7 @@ diff -up dietlibc-0.31.20080409/dietfeatures.h.pagesize dietlibc-0.31.20080409/d #endif diff -up dietlibc-0.31.20080409/test/Makefile.pagesize dietlibc-0.31.20080409/test/Makefile --- dietlibc-0.31.20080409/test/Makefile.pagesize 2008-02-23 01:02:19.000000000 +0100 -+++ dietlibc-0.31.20080409/test/Makefile 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 16:03:45.000000000 +0200 @@ -14,7 +14,7 @@ glob grent hasmntopt hello iconv if_name memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest \ protoent prototypes putenv pwent rand48 read1 readdir regex select sendfile servent siglist \ @@ -181,7 +181,7 @@ diff -up dietlibc-0.31.20080409/test/Makefile.pagesize dietlibc-0.31.20080409/te diff -up /dev/null dietlibc-0.31.20080409/test/sysconf.c --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/test/sysconf.c 2008-04-12 20:19:28.000000000 +0200 ++++ dietlibc-0.31.20080409/test/sysconf.c 2008-04-13 16:09:57.000000000 +0200 @@ -0,0 +1,80 @@ +#include +#include @@ -193,79 +193,79 @@ diff -up /dev/null dietlibc-0.31.20080409/test/sysconf.c + +static long exec_getconf(char const *var) +{ -+ char buf[128]; -+ pid_t pid; -+ int fd[2]; -+ int status; -+ ssize_t l; ++ char buf[128]; ++ pid_t pid; ++ int fd[2]; ++ int status; ++ ssize_t l; + -+ if (pipe(fd)<0 || (pid = fork())<0) -+ abort(); ++ if (pipe(fd)<0 || (pid = fork())<0) ++ abort(); + -+ if (pid==0) { -+ close(fd[0]); -+ -+ if (fd[1]!=1) { -+ dup2(fd[1], 1); -+ close(fd[1]); -+ } ++ if (pid==0) { ++ close(fd[0]); + -+ execlp("getconf", "getconf", var, NULL); -+ _exit(1); -+ } ++ if (fd[1]!=1) { ++ dup2(fd[1], 1); ++ close(fd[1]); ++ } + -+ close(fd[1]); -+ l = read(fd[0], buf, sizeof(buf)-1); -+ if (l<0) { -+ perror("read()"); -+ goto err; -+ } else if (l==sizeof(buf)-1) -+ goto err; -+ close(fd[0]); ++ execlp("getconf", "getconf", var, NULL); ++ _exit(1); ++ } + -+ buf[l] = '\0'; -+ -+ if (waitpid(pid, &status, 0)<0) -+ goto err; ++ close(fd[1]); ++ l = read(fd[0], buf, sizeof(buf)-1); ++ if (l<0) { ++ perror("read()"); ++ goto err; ++ } else if (l==sizeof(buf)-1) ++ goto err; ++ close(fd[0]); + -+ if (!WIFEXITED(status) || WEXITSTATUS(status)!=0) -+ goto err; ++ buf[l] = '\0'; + -+ return strtol(buf, NULL, 10); ++ if (waitpid(pid, &status, 0)<0) ++ goto err; + -+err: -+ kill(pid, SIGKILL); -+ abort(); ++ if (!WIFEXITED(status) || WEXITSTATUS(status)!=0) ++ goto err; ++ ++ return strtol(buf, NULL, 10); ++ ++ err: ++ kill(pid, SIGKILL); ++ abort(); +} + +static unsigned int do_check(char const *var, long exp) +{ -+ long cur = exec_getconf(var); ++ long cur = exec_getconf(var); + -+ if (cur!=exp) { -+ fprintf(stderr, "%s mismatch: got %ld, expected %ld\n", -+ cur, exp); -+ return 1; -+ } ++ if (cur!=exp) { ++ fprintf(stderr, "%s mismatch: got %ld, expected %ld\n", ++ cur, exp); ++ return 1; ++ } + -+ return 0; ++ return 0; +} + +int main(int argc, char *argv[]) +{ -+ unsigned int err = 0; ++ unsigned int err = 0; + -+ assert(sysconf(_SC_PAGESIZE) == __DIET_PAGE_SIZE); -+ assert(__DIET_PAGE_SIZE == (1<<__DIET_PAGE_SHIFT)); ++ assert(sysconf(_SC_PAGESIZE) == __DIET_PAGE_SIZE); ++ assert(__DIET_PAGE_SIZE == (1<<__DIET_PAGE_SHIFT)); + -+ err += do_check("PAGE_SIZE", sysconf(_SC_PAGESIZE)); -+ err += do_check("CLK_TCK", sysconf(_SC_CLK_TCK)); ++ err += do_check("PAGE_SIZE", sysconf(_SC_PAGESIZE)); ++ err += do_check("CLK_TCK", sysconf(_SC_CLK_TCK)); + -+ return err; ++ return err; +} diff -up dietlibc-0.31.20080409/test/runtests.sh.pagesize dietlibc-0.31.20080409/test/runtests.sh --- dietlibc-0.31.20080409/test/runtests.sh.pagesize 2008-02-23 01:02:19.000000000 +0100 -+++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 16:03:45.000000000 +0200 @@ -1,6 +1,6 @@ SUBDIRS="dirent inet stdio string stdlib time" @@ -276,7 +276,7 @@ diff -up dietlibc-0.31.20080409/test/runtests.sh.pagesize dietlibc-0.31.20080409 PASS="getpass" diff -up dietlibc-0.31.20080409/sparc64/start.S.pagesize dietlibc-0.31.20080409/sparc64/start.S --- dietlibc-0.31.20080409/sparc64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc64/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc64/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -25,6 +25,11 @@ _start: or %o3, %lo(environ), %o3 stx %o2, [%o3] @@ -291,7 +291,7 @@ diff -up dietlibc-0.31.20080409/sparc64/start.S.pagesize dietlibc-0.31.20080409/ registered with atexit(). If we are statically linked, this will diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.20080409/libcruft/sysconf.c --- dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize 2002-12-20 14:32:37.000000000 +0100 -+++ dietlibc-0.31.20080409/libcruft/sysconf.c 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/libcruft/sysconf.c 2008-04-13 16:08:03.000000000 +0200 @@ -3,6 +3,8 @@ #include #include @@ -306,11 +306,11 @@ diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.200804 } case _SC_CLK_TCK: +#ifdef WANT_ELFINFO -+ { -+ elf_addr_t *v = __get_elf_aux_value(AT_CLKTCK); -+ if (v) -+ return *v; -+ } ++ { ++ elf_addr_t *v = __get_elf_aux_value(AT_CLKTCK); ++ if (v) ++ return *v; ++ } +#endif + #ifdef __alpha__ @@ -331,36 +331,36 @@ diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.200804 return ARG_MAX; diff -up /dev/null dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c 2008-04-13 16:06:57.000000000 +0200 @@ -0,0 +1,25 @@ +#include +#include "../dietelfinfo.h" + +elf_addr_t *__get_elf_aux_value(unsigned int tag) +{ -+ extern char ** __elfinfo; -+ elf_addr_t *aux_ptr; -+ char ** tmp; ++ extern char ** __elfinfo; ++ elf_addr_t *aux_ptr; ++ char ** tmp; + -+ /* External symbol points to 'environ' after startup. Now, go the end -+ * of 'environ'; the auxiliary ELF table is located immediately after -+ * this position */ ++ /* External symbol points to 'environ' after startup. Now, go the end ++ * of 'environ'; the auxiliary ELF table is located immediately after ++ * this position */ + -+ /* operate on tmp instead of __elfinfo to be thread safe */ -+ tmp = __elfinfo; -+ while (*tmp) -+ ++tmp; -+ __elfinfo = tmp; ++ /* operate on tmp instead of __elfinfo to be thread safe */ ++ tmp = __elfinfo; ++ while (*tmp) ++ ++tmp; ++ __elfinfo = tmp; + -+ for (aux_ptr = (elf_addr_t *)(tmp+1); aux_ptr[0]!=AT_NULL; aux_ptr += 2) -+ if (aux_ptr[0]==tag) -+ return aux_ptr+1; ++ for (aux_ptr = (elf_addr_t *)(tmp+1); aux_ptr[0]!=AT_NULL; aux_ptr += 2) ++ if (aux_ptr[0]==tag) ++ return aux_ptr+1; + -+ return NULL; ++ return NULL; +} diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20080409/libcruft/getpagesize.c --- dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize 2002-02-23 23:18:42.000000000 +0100 -+++ dietlibc-0.31.20080409/libcruft/getpagesize.c 2008-04-12 20:15:33.000000000 +0200 ++++ dietlibc-0.31.20080409/libcruft/getpagesize.c 2008-04-13 16:07:23.000000000 +0200 @@ -2,14 +2,25 @@ #include #include @@ -375,19 +375,19 @@ diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20 size_t __libc_getpagesize(void) { - return PAGE_SIZE; +#ifdef WANT_DYN_PAGESIZE -+ static size_t pgsz; ++ static size_t pgsz; + -+ if (__unlikely(pgsz==0)) { -+ elf_addr_t *v = __get_elf_aux_value(AT_PAGESZ); -+ if (__likely(v)) -+ pgsz = *v; -+ else -+ pgsz = __DIET_PAGE_SIZE_PREDEF; -+ } ++ if (__unlikely(pgsz==0)) { ++ elf_addr_t *v = __get_elf_aux_value(AT_PAGESZ); ++ if (__likely(v)) ++ pgsz = *v; ++ else ++ pgsz = __DIET_PAGE_SIZE_PREDEF; ++ } + -+ return pgsz; ++ return pgsz; +#else -+ return __DIET_PAGE_SIZE_PREDEF; ++ return __DIET_PAGE_SIZE_PREDEF; +#endif } @@ -395,7 +395,7 @@ diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20 - diff -up /dev/null dietlibc-0.31.20080409/dietpagesize.h --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/dietpagesize.h 2008-04-12 20:22:45.000000000 +0200 ++++ dietlibc-0.31.20080409/dietpagesize.h 2008-04-13 16:03:45.000000000 +0200 @@ -0,0 +1,31 @@ +#ifndef H_DIETLIBC_DIETPAGESIZE_H +#define H_DIETLIBC_DIETPAGESIZE_H @@ -430,7 +430,7 @@ diff -up /dev/null dietlibc-0.31.20080409/dietpagesize.h +#endif /* H_DIETLIBC_DIETPAGESIZE_H */ diff -up dietlibc-0.31.20080409/s390x/start.S.pagesize dietlibc-0.31.20080409/s390x/start.S --- dietlibc-0.31.20080409/s390x/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/s390x/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/s390x/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -26,6 +26,11 @@ _start: larl %r13,environ stg %r4,0(%r13) @@ -445,7 +445,7 @@ diff -up dietlibc-0.31.20080409/s390x/start.S.pagesize dietlibc-0.31.20080409/s3 brasl %r14,_dyn_start diff -up /dev/null dietlibc-0.31.20080409/dietelfinfo.h --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/dietelfinfo.h 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/dietelfinfo.h 2008-04-13 16:04:33.000000000 +0200 @@ -0,0 +1,9 @@ +#include "dietfeatures.h" + @@ -454,11 +454,11 @@ diff -up /dev/null dietlibc-0.31.20080409/dietelfinfo.h +#include + +elf_addr_t * __get_elf_aux_value(unsigned int tag) -+ __attribute__((__visibility__("hidden"),__const__)); ++ __attribute__((__visibility__("hidden"),__const__)) __pure; +#endif diff -up dietlibc-0.31.20080409/ia64/start.S.pagesize dietlibc-0.31.20080409/ia64/start.S --- dietlibc-0.31.20080409/ia64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ia64/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/ia64/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -40,6 +40,11 @@ _start: ;; st8 [r14] = out2 /* store envp in environ */ @@ -473,7 +473,7 @@ diff -up dietlibc-0.31.20080409/ia64/start.S.pagesize dietlibc-0.31.20080409/ia6 br.call.sptk.few rp = _dyn_start diff -up dietlibc-0.31.20080409/i386/start.S.pagesize dietlibc-0.31.20080409/i386/start.S --- dietlibc-0.31.20080409/i386/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/i386/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/i386/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -25,6 +25,10 @@ _start: PIC_INIT /* non-PIC: this is an empty line */ PUT_VAR %eax, environ, %ecx /* non-PIC: movl %eax,environ */ @@ -487,7 +487,7 @@ diff -up dietlibc-0.31.20080409/i386/start.S.pagesize dietlibc-0.31.20080409/i38 pushl $.text diff -up dietlibc-0.31.20080409/dietdirent.h.pagesize dietlibc-0.31.20080409/dietdirent.h --- dietlibc-0.31.20080409/dietdirent.h.pagesize 2002-07-03 22:33:37.000000000 +0200 -+++ dietlibc-0.31.20080409/dietdirent.h 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/dietdirent.h 2008-04-13 16:03:45.000000000 +0200 @@ -1,8 +1,12 @@ #include @@ -504,7 +504,7 @@ diff -up dietlibc-0.31.20080409/dietdirent.h.pagesize dietlibc-0.31.20080409/die +#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) diff -up dietlibc-0.31.20080409/alpha/start.S.pagesize dietlibc-0.31.20080409/alpha/start.S --- dietlibc-0.31.20080409/alpha/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/alpha/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/alpha/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -24,6 +24,10 @@ _start: stq $18, environ @@ -518,7 +518,7 @@ diff -up dietlibc-0.31.20080409/alpha/start.S.pagesize dietlibc-0.31.20080409/al mov $0, $19 /* mov v0(dynload) to a3 */ diff -up dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize dietlibc-0.31.20080409/syscalls.s/environ.S --- dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize 2004-09-28 02:01:30.000000000 +0200 -+++ dietlibc-0.31.20080409/syscalls.s/environ.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/syscalls.s/environ.S 2008-04-13 16:03:45.000000000 +0200 @@ -1,6 +1,7 @@ .section ".bss" .align 8 @@ -552,7 +552,7 @@ diff -up dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize dietlibc-0.31.2008 +#endif diff -up dietlibc-0.31.20080409/arm/start.S.pagesize dietlibc-0.31.20080409/arm/start.S --- dietlibc-0.31.20080409/arm/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/arm/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/arm/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -23,11 +23,15 @@ _start: #ifdef __DYN_LIB ldr sl, .L4 @@ -579,7 +579,7 @@ diff -up dietlibc-0.31.20080409/arm/start.S.pagesize dietlibc-0.31.20080409/arm/ - diff -up dietlibc-0.31.20080409/parisc/start.S.pagesize dietlibc-0.31.20080409/parisc/start.S --- dietlibc-0.31.20080409/parisc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/parisc/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/parisc/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -34,6 +34,11 @@ _start: ldil LP%environ, %r19 ldo RP%environ(%r19), %r19 @@ -594,7 +594,7 @@ diff -up dietlibc-0.31.20080409/parisc/start.S.pagesize dietlibc-0.31.20080409/p diff -up dietlibc-0.31.20080409/include/sys/shm.h.pagesize dietlibc-0.31.20080409/include/sys/shm.h --- dietlibc-0.31.20080409/include/sys/shm.h.pagesize 2005-09-21 09:33:08.000000000 +0200 -+++ dietlibc-0.31.20080409/include/sys/shm.h 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/include/sys/shm.h 2008-04-13 16:03:45.000000000 +0200 @@ -60,15 +60,6 @@ struct shm_info { unsigned long swap_successes; }; @@ -613,7 +613,7 @@ diff -up dietlibc-0.31.20080409/include/sys/shm.h.pagesize dietlibc-0.31.2008040 extern int shmdt (const void *shmaddr) __THROW; diff -up dietlibc-0.31.20080409/sparc/start.S.pagesize dietlibc-0.31.20080409/sparc/start.S --- dietlibc-0.31.20080409/sparc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -25,6 +25,11 @@ _start: or %o3, %lo(environ), %o3 st %o2, [%o3] @@ -628,7 +628,7 @@ diff -up dietlibc-0.31.20080409/sparc/start.S.pagesize dietlibc-0.31.20080409/sp registered with atexit(). If we are statically linked, this will diff -up dietlibc-0.31.20080409/sparc/shmat.c.pagesize dietlibc-0.31.20080409/sparc/shmat.c --- dietlibc-0.31.20080409/sparc/shmat.c.pagesize 2001-06-16 19:48:57.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc/shmat.c 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc/shmat.c 2008-04-13 16:03:45.000000000 +0200 @@ -3,17 +3,15 @@ #include #include @@ -652,7 +652,7 @@ diff -up dietlibc-0.31.20080409/sparc/shmat.c.pagesize dietlibc-0.31.20080409/sp } diff -up dietlibc-0.31.20080409/ppc64/start.S.pagesize dietlibc-0.31.20080409/ppc64/start.S --- dietlibc-0.31.20080409/ppc64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ppc64/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/ppc64/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -58,6 +58,12 @@ _start: oris 14,14,environ@ha std 5,environ@l(14) @@ -668,7 +668,7 @@ diff -up dietlibc-0.31.20080409/ppc64/start.S.pagesize dietlibc-0.31.20080409/pp mr 6,7 diff -up dietlibc-0.31.20080409/x86_64/start.S.pagesize dietlibc-0.31.20080409/x86_64/start.S --- dietlibc-0.31.20080409/x86_64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/x86_64/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/x86_64/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -12,12 +12,23 @@ _start: leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */ @@ -695,7 +695,7 @@ diff -up dietlibc-0.31.20080409/x86_64/start.S.pagesize dietlibc-0.31.20080409/x pushq %rdi /* save reg args */ diff -up dietlibc-0.31.20080409/s390/start.S.pagesize dietlibc-0.31.20080409/s390/start.S --- dietlibc-0.31.20080409/s390/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/s390/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/s390/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -30,6 +30,11 @@ _start: l %r1,8(%r13) st %r4,0(%r1) @@ -710,7 +710,7 @@ diff -up dietlibc-0.31.20080409/s390/start.S.pagesize dietlibc-0.31.20080409/s39 basr %r14,%r1 diff -up dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize dietlibc-0.31.20080409/dynlinker/ldso_start.S --- dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize 2006-10-13 22:11:13.000000000 +0200 -+++ dietlibc-0.31.20080409/dynlinker/ldso_start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/dynlinker/ldso_start.S 2008-04-13 16:03:45.000000000 +0200 @@ -86,6 +86,15 @@ __environ: .long 0 #endif @@ -729,7 +729,7 @@ diff -up dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize dietlibc-0.31.20 .long 0 diff -up dietlibc-0.31.20080409/mips/start.S.pagesize dietlibc-0.31.20080409/mips/start.S --- dietlibc-0.31.20080409/mips/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/mips/start.S 2008-04-12 20:13:10.000000000 +0200 ++++ dietlibc-0.31.20080409/mips/start.S 2008-04-13 16:03:45.000000000 +0200 @@ -47,6 +47,9 @@ __start: #endif add $a2, $a2, $a1 From de70f517d9970ea898693c9c2ce415de44ccbfa6 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 14:18:39 +0000 Subject: [PATCH 032/161] - added patch for dynamic PAGE_SIZE support - fixed/enhanced testsuite and removed the '|| :' in %%check - improved/fixed floating point support *printf(3) --- dietlibc.spec | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index ec324c1..4ca67e8 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -30,7 +30,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.31 -Release: %release_func 1%{?snapshot:.%snapshot} +Release: %release_func 2%{?snapshot:.%snapshot} License: GPL Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -50,6 +50,11 @@ Patch31: dietlibc-0.31-defpath.patch Patch32: dietlibc-0.31-stacksmash.patch Patch33: dietlibc-0.31-stacksmash-dyn.patch Patch41: dietlibc-0.31.20080212-teststdout.patch +Patch43: dietlibc-0.31-pagesize.patch +Patch44: dietlibc-0.31-printFG.patch +Patch45: dietlibc-0.31-stat64.patch +Patch46: dietlibc-0.31-testsuite.patch +Patch47: dietlibc-0.31-lcctime.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -99,6 +104,11 @@ This package contains the dynamic libraries for dietlibc. %patch33 -p1 -b .stacksmash-dyn %patch41 -p1 -b .teststdout +%patch43 -p1 -b .pagesize +%patch44 -p1 -b .printFG +%patch45 -p1 -b .stat64 +%patch46 -p1 -b .testsuite +%patch47 -p1 -b .lcctime %if %{without ssp} @@ -110,6 +120,14 @@ sed -i -e 's!^#define WANT_SSP$!// \0!g; %global xtra_fixcflags %nil %endif +%ifarch %ix86 +sed -i \ + -e '/#define WANT_DYN_PAGESIZE/{c\' \ + -e '#define WANT_ELFINFO' \ + -e '}' \ + dietfeatures.h +%endif + sed -i -e 's!strip !: !g' Makefile %global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -g3 @@ -147,7 +165,7 @@ make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) cd test ulimit -m $[ 50*1024 ] -v $[ 100*1024 ] -d $[ 50*1024 ] -bash ./runtests-X.sh || : +bash ./runtests-X.sh %clean @@ -178,6 +196,11 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun Apr 13 2008 Enrico Scholz - 0.31-2.20080409 +- added patch for dynamic PAGE_SIZE support +- fixed/enhanced testsuite and removed the '|| :' in %%check +- improved/fixed floating point support *printf(3) + * Thu Apr 10 2008 Enrico Scholz - 0.31-1.20080409 - updated to CVS snapshot 20080409 From 0cd7732adf7af7b8c708906fff67a6ed6e82b310 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 17:09:02 +0000 Subject: [PATCH 033/161] lib/alloc.c: return value of__ind_shift() depends on PAGE_SIZE --- dietlibc-0.31-pagesize.patch | 77 ++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index 06745d9..6077d15 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -1,6 +1,6 @@ diff -up dietlibc-0.31.20080409/lib/mmap64.c.pagesize dietlibc-0.31.20080409/lib/mmap64.c --- dietlibc-0.31.20080409/lib/mmap64.c.pagesize 2004-12-13 11:21:31.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/mmap64.c 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/mmap64.c 2008-04-13 18:57:47.000000000 +0200 @@ -4,16 +4,18 @@ #include #include @@ -24,7 +24,7 @@ diff -up dietlibc-0.31.20080409/lib/mmap64.c.pagesize dietlibc-0.31.20080409/lib void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) diff -up dietlibc-0.31.20080409/lib/readdir64.c.pagesize dietlibc-0.31.20080409/lib/readdir64.c --- dietlibc-0.31.20080409/lib/readdir64.c.pagesize 2004-03-02 22:27:19.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/readdir64.c 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/readdir64.c 2008-04-13 18:57:47.000000000 +0200 @@ -14,7 +14,7 @@ #ifndef WANT_LARGEFILE_BACKCOMPAT struct dirent64* readdir64(DIR *d) { @@ -54,7 +54,7 @@ diff -up dietlibc-0.31.20080409/lib/readdir64.c.pagesize dietlibc-0.31.20080409/ trygetdents64=0; diff -up dietlibc-0.31.20080409/lib/opendir.c.pagesize dietlibc-0.31.20080409/lib/opendir.c --- dietlibc-0.31.20080409/lib/opendir.c.pagesize 2002-07-03 22:33:38.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/opendir.c 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/opendir.c 2008-04-13 18:57:47.000000000 +0200 @@ -5,6 +5,8 @@ #include #include @@ -75,7 +75,7 @@ diff -up dietlibc-0.31.20080409/lib/opendir.c.pagesize dietlibc-0.31.20080409/li lose: diff -up dietlibc-0.31.20080409/lib/readdir.c.pagesize dietlibc-0.31.20080409/lib/readdir.c --- dietlibc-0.31.20080409/lib/readdir.c.pagesize 2002-07-03 22:33:38.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/readdir.c 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/readdir.c 2008-04-13 18:57:47.000000000 +0200 @@ -5,7 +5,7 @@ struct dirent* readdir(DIR *d) { @@ -87,7 +87,7 @@ diff -up dietlibc-0.31.20080409/lib/readdir.c.pagesize dietlibc-0.31.20080409/li } diff -up dietlibc-0.31.20080409/lib/closedir.c.pagesize dietlibc-0.31.20080409/lib/closedir.c --- dietlibc-0.31.20080409/lib/closedir.c.pagesize 2002-07-03 22:33:37.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/closedir.c 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/closedir.c 2008-04-13 18:57:47.000000000 +0200 @@ -4,8 +4,10 @@ #include #include @@ -102,7 +102,7 @@ diff -up dietlibc-0.31.20080409/lib/closedir.c.pagesize dietlibc-0.31.20080409/l } diff -up dietlibc-0.31.20080409/lib/alloc.c.pagesize dietlibc-0.31.20080409/lib/alloc.c --- dietlibc-0.31.20080409/lib/alloc.c.pagesize 2007-08-03 22:58:33.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/alloc.c 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/alloc.c 2008-04-13 18:57:47.000000000 +0200 @@ -18,8 +18,7 @@ #include #include @@ -122,9 +122,20 @@ diff -up dietlibc-0.31.20080409/lib/alloc.c.pagesize dietlibc-0.31.20080409/lib/ #define PAGE_ALIGN(s) (((s)+MEM_BLOCK_SIZE-1)&(unsigned long)(~(MEM_BLOCK_SIZE-1))) /* a simple mmap :) */ +@@ -66,7 +65,9 @@ static __alloc_t* __small_mem[8]; + + #define FIRST_SMALL(p) (((unsigned long)(p))&(~(MEM_BLOCK_SIZE-1))) + +-static inline int __ind_shift() { return (MEM_BLOCK_SIZE==4096)?4:5; } ++static inline int __ind_shift() { ++ return __DIET_PAGE_SHIFT - sizeof(__small_mem)/sizeof(__small_mem[0]); ++} + + static size_t REGPARM(1) get_index(size_t _size) { + register size_t idx=0; diff -up dietlibc-0.31.20080409/ppc/start.S.pagesize dietlibc-0.31.20080409/ppc/start.S --- dietlibc-0.31.20080409/ppc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ppc/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/ppc/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -31,6 +31,12 @@ _start: lis 14,environ@ha stw 5,environ@l(14) @@ -140,7 +151,7 @@ diff -up dietlibc-0.31.20080409/ppc/start.S.pagesize dietlibc-0.31.20080409/ppc/ bl _dyn_start diff -up dietlibc-0.31.20080409/dietfeatures.h.pagesize dietlibc-0.31.20080409/dietfeatures.h --- dietlibc-0.31.20080409/dietfeatures.h.pagesize 2007-10-09 01:15:27.000000000 +0200 -+++ dietlibc-0.31.20080409/dietfeatures.h 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/dietfeatures.h 2008-04-13 18:57:47.000000000 +0200 @@ -126,6 +126,16 @@ /* #define WANT_SSP_XOR */ @@ -169,7 +180,7 @@ diff -up dietlibc-0.31.20080409/dietfeatures.h.pagesize dietlibc-0.31.20080409/d #endif diff -up dietlibc-0.31.20080409/test/Makefile.pagesize dietlibc-0.31.20080409/test/Makefile --- dietlibc-0.31.20080409/test/Makefile.pagesize 2008-02-23 01:02:19.000000000 +0100 -+++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 18:57:47.000000000 +0200 @@ -14,7 +14,7 @@ glob grent hasmntopt hello iconv if_name memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest \ protoent prototypes putenv pwent rand48 read1 readdir regex select sendfile servent siglist \ @@ -181,7 +192,7 @@ diff -up dietlibc-0.31.20080409/test/Makefile.pagesize dietlibc-0.31.20080409/te diff -up /dev/null dietlibc-0.31.20080409/test/sysconf.c --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/test/sysconf.c 2008-04-13 16:09:57.000000000 +0200 ++++ dietlibc-0.31.20080409/test/sysconf.c 2008-04-13 18:57:47.000000000 +0200 @@ -0,0 +1,80 @@ +#include +#include @@ -265,7 +276,7 @@ diff -up /dev/null dietlibc-0.31.20080409/test/sysconf.c +} diff -up dietlibc-0.31.20080409/test/runtests.sh.pagesize dietlibc-0.31.20080409/test/runtests.sh --- dietlibc-0.31.20080409/test/runtests.sh.pagesize 2008-02-23 01:02:19.000000000 +0100 -+++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 18:57:47.000000000 +0200 @@ -1,6 +1,6 @@ SUBDIRS="dirent inet stdio string stdlib time" @@ -276,7 +287,7 @@ diff -up dietlibc-0.31.20080409/test/runtests.sh.pagesize dietlibc-0.31.20080409 PASS="getpass" diff -up dietlibc-0.31.20080409/sparc64/start.S.pagesize dietlibc-0.31.20080409/sparc64/start.S --- dietlibc-0.31.20080409/sparc64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc64/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc64/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -25,6 +25,11 @@ _start: or %o3, %lo(environ), %o3 stx %o2, [%o3] @@ -291,7 +302,7 @@ diff -up dietlibc-0.31.20080409/sparc64/start.S.pagesize dietlibc-0.31.20080409/ registered with atexit(). If we are statically linked, this will diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.20080409/libcruft/sysconf.c --- dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize 2002-12-20 14:32:37.000000000 +0100 -+++ dietlibc-0.31.20080409/libcruft/sysconf.c 2008-04-13 16:08:03.000000000 +0200 ++++ dietlibc-0.31.20080409/libcruft/sysconf.c 2008-04-13 18:57:47.000000000 +0200 @@ -3,6 +3,8 @@ #include #include @@ -331,7 +342,7 @@ diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.200804 return ARG_MAX; diff -up /dev/null dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c 2008-04-13 16:06:57.000000000 +0200 ++++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c 2008-04-13 18:57:47.000000000 +0200 @@ -0,0 +1,25 @@ +#include +#include "../dietelfinfo.h" @@ -360,7 +371,7 @@ diff -up /dev/null dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c +} diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20080409/libcruft/getpagesize.c --- dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize 2002-02-23 23:18:42.000000000 +0100 -+++ dietlibc-0.31.20080409/libcruft/getpagesize.c 2008-04-13 16:07:23.000000000 +0200 ++++ dietlibc-0.31.20080409/libcruft/getpagesize.c 2008-04-13 18:57:47.000000000 +0200 @@ -2,14 +2,25 @@ #include #include @@ -395,7 +406,7 @@ diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20 - diff -up /dev/null dietlibc-0.31.20080409/dietpagesize.h --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/dietpagesize.h 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/dietpagesize.h 2008-04-13 18:57:47.000000000 +0200 @@ -0,0 +1,31 @@ +#ifndef H_DIETLIBC_DIETPAGESIZE_H +#define H_DIETLIBC_DIETPAGESIZE_H @@ -430,7 +441,7 @@ diff -up /dev/null dietlibc-0.31.20080409/dietpagesize.h +#endif /* H_DIETLIBC_DIETPAGESIZE_H */ diff -up dietlibc-0.31.20080409/s390x/start.S.pagesize dietlibc-0.31.20080409/s390x/start.S --- dietlibc-0.31.20080409/s390x/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/s390x/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/s390x/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -26,6 +26,11 @@ _start: larl %r13,environ stg %r4,0(%r13) @@ -445,7 +456,7 @@ diff -up dietlibc-0.31.20080409/s390x/start.S.pagesize dietlibc-0.31.20080409/s3 brasl %r14,_dyn_start diff -up /dev/null dietlibc-0.31.20080409/dietelfinfo.h --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/dietelfinfo.h 2008-04-13 16:04:33.000000000 +0200 ++++ dietlibc-0.31.20080409/dietelfinfo.h 2008-04-13 18:57:47.000000000 +0200 @@ -0,0 +1,9 @@ +#include "dietfeatures.h" + @@ -458,7 +469,7 @@ diff -up /dev/null dietlibc-0.31.20080409/dietelfinfo.h +#endif diff -up dietlibc-0.31.20080409/ia64/start.S.pagesize dietlibc-0.31.20080409/ia64/start.S --- dietlibc-0.31.20080409/ia64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ia64/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/ia64/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -40,6 +40,11 @@ _start: ;; st8 [r14] = out2 /* store envp in environ */ @@ -473,7 +484,7 @@ diff -up dietlibc-0.31.20080409/ia64/start.S.pagesize dietlibc-0.31.20080409/ia6 br.call.sptk.few rp = _dyn_start diff -up dietlibc-0.31.20080409/i386/start.S.pagesize dietlibc-0.31.20080409/i386/start.S --- dietlibc-0.31.20080409/i386/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/i386/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/i386/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -25,6 +25,10 @@ _start: PIC_INIT /* non-PIC: this is an empty line */ PUT_VAR %eax, environ, %ecx /* non-PIC: movl %eax,environ */ @@ -487,7 +498,7 @@ diff -up dietlibc-0.31.20080409/i386/start.S.pagesize dietlibc-0.31.20080409/i38 pushl $.text diff -up dietlibc-0.31.20080409/dietdirent.h.pagesize dietlibc-0.31.20080409/dietdirent.h --- dietlibc-0.31.20080409/dietdirent.h.pagesize 2002-07-03 22:33:37.000000000 +0200 -+++ dietlibc-0.31.20080409/dietdirent.h 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/dietdirent.h 2008-04-13 18:57:47.000000000 +0200 @@ -1,8 +1,12 @@ #include @@ -504,7 +515,7 @@ diff -up dietlibc-0.31.20080409/dietdirent.h.pagesize dietlibc-0.31.20080409/die +#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) diff -up dietlibc-0.31.20080409/alpha/start.S.pagesize dietlibc-0.31.20080409/alpha/start.S --- dietlibc-0.31.20080409/alpha/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/alpha/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/alpha/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -24,6 +24,10 @@ _start: stq $18, environ @@ -518,7 +529,7 @@ diff -up dietlibc-0.31.20080409/alpha/start.S.pagesize dietlibc-0.31.20080409/al mov $0, $19 /* mov v0(dynload) to a3 */ diff -up dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize dietlibc-0.31.20080409/syscalls.s/environ.S --- dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize 2004-09-28 02:01:30.000000000 +0200 -+++ dietlibc-0.31.20080409/syscalls.s/environ.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/syscalls.s/environ.S 2008-04-13 18:57:47.000000000 +0200 @@ -1,6 +1,7 @@ .section ".bss" .align 8 @@ -552,7 +563,7 @@ diff -up dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize dietlibc-0.31.2008 +#endif diff -up dietlibc-0.31.20080409/arm/start.S.pagesize dietlibc-0.31.20080409/arm/start.S --- dietlibc-0.31.20080409/arm/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/arm/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/arm/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -23,11 +23,15 @@ _start: #ifdef __DYN_LIB ldr sl, .L4 @@ -579,7 +590,7 @@ diff -up dietlibc-0.31.20080409/arm/start.S.pagesize dietlibc-0.31.20080409/arm/ - diff -up dietlibc-0.31.20080409/parisc/start.S.pagesize dietlibc-0.31.20080409/parisc/start.S --- dietlibc-0.31.20080409/parisc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/parisc/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/parisc/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -34,6 +34,11 @@ _start: ldil LP%environ, %r19 ldo RP%environ(%r19), %r19 @@ -594,7 +605,7 @@ diff -up dietlibc-0.31.20080409/parisc/start.S.pagesize dietlibc-0.31.20080409/p diff -up dietlibc-0.31.20080409/include/sys/shm.h.pagesize dietlibc-0.31.20080409/include/sys/shm.h --- dietlibc-0.31.20080409/include/sys/shm.h.pagesize 2005-09-21 09:33:08.000000000 +0200 -+++ dietlibc-0.31.20080409/include/sys/shm.h 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/include/sys/shm.h 2008-04-13 18:57:47.000000000 +0200 @@ -60,15 +60,6 @@ struct shm_info { unsigned long swap_successes; }; @@ -613,7 +624,7 @@ diff -up dietlibc-0.31.20080409/include/sys/shm.h.pagesize dietlibc-0.31.2008040 extern int shmdt (const void *shmaddr) __THROW; diff -up dietlibc-0.31.20080409/sparc/start.S.pagesize dietlibc-0.31.20080409/sparc/start.S --- dietlibc-0.31.20080409/sparc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -25,6 +25,11 @@ _start: or %o3, %lo(environ), %o3 st %o2, [%o3] @@ -628,7 +639,7 @@ diff -up dietlibc-0.31.20080409/sparc/start.S.pagesize dietlibc-0.31.20080409/sp registered with atexit(). If we are statically linked, this will diff -up dietlibc-0.31.20080409/sparc/shmat.c.pagesize dietlibc-0.31.20080409/sparc/shmat.c --- dietlibc-0.31.20080409/sparc/shmat.c.pagesize 2001-06-16 19:48:57.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc/shmat.c 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc/shmat.c 2008-04-13 18:57:47.000000000 +0200 @@ -3,17 +3,15 @@ #include #include @@ -652,7 +663,7 @@ diff -up dietlibc-0.31.20080409/sparc/shmat.c.pagesize dietlibc-0.31.20080409/sp } diff -up dietlibc-0.31.20080409/ppc64/start.S.pagesize dietlibc-0.31.20080409/ppc64/start.S --- dietlibc-0.31.20080409/ppc64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ppc64/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/ppc64/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -58,6 +58,12 @@ _start: oris 14,14,environ@ha std 5,environ@l(14) @@ -668,7 +679,7 @@ diff -up dietlibc-0.31.20080409/ppc64/start.S.pagesize dietlibc-0.31.20080409/pp mr 6,7 diff -up dietlibc-0.31.20080409/x86_64/start.S.pagesize dietlibc-0.31.20080409/x86_64/start.S --- dietlibc-0.31.20080409/x86_64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/x86_64/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/x86_64/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -12,12 +12,23 @@ _start: leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */ @@ -695,7 +706,7 @@ diff -up dietlibc-0.31.20080409/x86_64/start.S.pagesize dietlibc-0.31.20080409/x pushq %rdi /* save reg args */ diff -up dietlibc-0.31.20080409/s390/start.S.pagesize dietlibc-0.31.20080409/s390/start.S --- dietlibc-0.31.20080409/s390/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/s390/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/s390/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -30,6 +30,11 @@ _start: l %r1,8(%r13) st %r4,0(%r1) @@ -710,7 +721,7 @@ diff -up dietlibc-0.31.20080409/s390/start.S.pagesize dietlibc-0.31.20080409/s39 basr %r14,%r1 diff -up dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize dietlibc-0.31.20080409/dynlinker/ldso_start.S --- dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize 2006-10-13 22:11:13.000000000 +0200 -+++ dietlibc-0.31.20080409/dynlinker/ldso_start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/dynlinker/ldso_start.S 2008-04-13 18:57:47.000000000 +0200 @@ -86,6 +86,15 @@ __environ: .long 0 #endif @@ -729,7 +740,7 @@ diff -up dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize dietlibc-0.31.20 .long 0 diff -up dietlibc-0.31.20080409/mips/start.S.pagesize dietlibc-0.31.20080409/mips/start.S --- dietlibc-0.31.20080409/mips/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/mips/start.S 2008-04-13 16:03:45.000000000 +0200 ++++ dietlibc-0.31.20080409/mips/start.S 2008-04-13 18:57:47.000000000 +0200 @@ -47,6 +47,9 @@ __start: #endif add $a2, $a2, $a1 From 4dc3f7fcbb0fa7f1e226ca881adbf6b18873800e Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 17:09:37 +0000 Subject: [PATCH 034/161] added debugging code for PPC --- dietlibc.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 4ca67e8..3ed0e8a 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -164,7 +164,13 @@ make %makeflags -C test all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) - make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) || : cd test -ulimit -m $[ 50*1024 ] -v $[ 100*1024 ] -d $[ 50*1024 ] +ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] + +readelf -a ./ftw || : +objdump -d ./ftw || : +./ftw || : +dmesg | tail || : + bash ./runtests-X.sh From c6571b4fbaa5151f5822e8bc42a968e0cc3f43ac Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 17:10:42 +0000 Subject: [PATCH 035/161] added 'gethostbyname' to list of bogus checks --- runtests-X.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtests-X.sh b/runtests-X.sh index d5b8a65..eaa2d93 100644 --- a/runtests-X.sh +++ b/runtests-X.sh @@ -3,6 +3,8 @@ eval $(grep '^\(TESTPROGRAMS\|SUBDIRS\)=' runtests.sh) FAILURES_BOGUS=( + ":gethostbyname" # network test; net might not be available in test environment + ":stdlib:tst-environ" # test uses environ function in unsupported ways (dup keys) ":stdlib:tst-rand48" # platform dependent; does not give reliable results ":stdlib:tst-strtod" # must be investigated further... From 066ee97d8dbbdc2ff5d15f9204824a4dff5f4761 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 17:31:51 +0000 Subject: [PATCH 036/161] further debugging... --- dietlibc.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 3ed0e8a..d65d307 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -60,7 +60,7 @@ BuildRoot: %_tmppath/%name-%version-%release-buildroot %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} Requires: %name-devel = %version-%release - +BuildRequires: gdb %package devel Summary: dietlibc development files @@ -168,9 +168,11 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] readelf -a ./ftw || : objdump -d ./ftw || : -./ftw || : +gdb ./ftw -ex 'r' -ex 'bt' -ex 'info registers' -ex 'info locals' -ex 'q' || : dmesg | tail || : +sleep 60 + bash ./runtests-X.sh From 667117c38e9a88558b5a2b297df2eaacc4d5f179 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 18:21:22 +0000 Subject: [PATCH 037/161] added sanity check to detect broken headers at compile time --- dietlibc-0.31-pagesize.patch | 74 +++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index 6077d15..5484678 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -1,6 +1,6 @@ diff -up dietlibc-0.31.20080409/lib/mmap64.c.pagesize dietlibc-0.31.20080409/lib/mmap64.c --- dietlibc-0.31.20080409/lib/mmap64.c.pagesize 2004-12-13 11:21:31.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/mmap64.c 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/mmap64.c 2008-04-13 19:57:13.000000000 +0200 @@ -4,16 +4,18 @@ #include #include @@ -24,7 +24,7 @@ diff -up dietlibc-0.31.20080409/lib/mmap64.c.pagesize dietlibc-0.31.20080409/lib void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) diff -up dietlibc-0.31.20080409/lib/readdir64.c.pagesize dietlibc-0.31.20080409/lib/readdir64.c --- dietlibc-0.31.20080409/lib/readdir64.c.pagesize 2004-03-02 22:27:19.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/readdir64.c 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/readdir64.c 2008-04-13 19:57:13.000000000 +0200 @@ -14,7 +14,7 @@ #ifndef WANT_LARGEFILE_BACKCOMPAT struct dirent64* readdir64(DIR *d) { @@ -54,7 +54,7 @@ diff -up dietlibc-0.31.20080409/lib/readdir64.c.pagesize dietlibc-0.31.20080409/ trygetdents64=0; diff -up dietlibc-0.31.20080409/lib/opendir.c.pagesize dietlibc-0.31.20080409/lib/opendir.c --- dietlibc-0.31.20080409/lib/opendir.c.pagesize 2002-07-03 22:33:38.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/opendir.c 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/opendir.c 2008-04-13 19:57:13.000000000 +0200 @@ -5,6 +5,8 @@ #include #include @@ -75,7 +75,7 @@ diff -up dietlibc-0.31.20080409/lib/opendir.c.pagesize dietlibc-0.31.20080409/li lose: diff -up dietlibc-0.31.20080409/lib/readdir.c.pagesize dietlibc-0.31.20080409/lib/readdir.c --- dietlibc-0.31.20080409/lib/readdir.c.pagesize 2002-07-03 22:33:38.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/readdir.c 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/readdir.c 2008-04-13 19:57:13.000000000 +0200 @@ -5,7 +5,7 @@ struct dirent* readdir(DIR *d) { @@ -87,7 +87,7 @@ diff -up dietlibc-0.31.20080409/lib/readdir.c.pagesize dietlibc-0.31.20080409/li } diff -up dietlibc-0.31.20080409/lib/closedir.c.pagesize dietlibc-0.31.20080409/lib/closedir.c --- dietlibc-0.31.20080409/lib/closedir.c.pagesize 2002-07-03 22:33:37.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/closedir.c 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/closedir.c 2008-04-13 19:57:13.000000000 +0200 @@ -4,8 +4,10 @@ #include #include @@ -102,7 +102,7 @@ diff -up dietlibc-0.31.20080409/lib/closedir.c.pagesize dietlibc-0.31.20080409/l } diff -up dietlibc-0.31.20080409/lib/alloc.c.pagesize dietlibc-0.31.20080409/lib/alloc.c --- dietlibc-0.31.20080409/lib/alloc.c.pagesize 2007-08-03 22:58:33.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/alloc.c 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/alloc.c 2008-04-13 19:57:13.000000000 +0200 @@ -18,8 +18,7 @@ #include #include @@ -135,7 +135,7 @@ diff -up dietlibc-0.31.20080409/lib/alloc.c.pagesize dietlibc-0.31.20080409/lib/ register size_t idx=0; diff -up dietlibc-0.31.20080409/ppc/start.S.pagesize dietlibc-0.31.20080409/ppc/start.S --- dietlibc-0.31.20080409/ppc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ppc/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/ppc/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -31,6 +31,12 @@ _start: lis 14,environ@ha stw 5,environ@l(14) @@ -151,7 +151,7 @@ diff -up dietlibc-0.31.20080409/ppc/start.S.pagesize dietlibc-0.31.20080409/ppc/ bl _dyn_start diff -up dietlibc-0.31.20080409/dietfeatures.h.pagesize dietlibc-0.31.20080409/dietfeatures.h --- dietlibc-0.31.20080409/dietfeatures.h.pagesize 2007-10-09 01:15:27.000000000 +0200 -+++ dietlibc-0.31.20080409/dietfeatures.h 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/dietfeatures.h 2008-04-13 19:57:13.000000000 +0200 @@ -126,6 +126,16 @@ /* #define WANT_SSP_XOR */ @@ -180,7 +180,7 @@ diff -up dietlibc-0.31.20080409/dietfeatures.h.pagesize dietlibc-0.31.20080409/d #endif diff -up dietlibc-0.31.20080409/test/Makefile.pagesize dietlibc-0.31.20080409/test/Makefile --- dietlibc-0.31.20080409/test/Makefile.pagesize 2008-02-23 01:02:19.000000000 +0100 -+++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 19:57:13.000000000 +0200 @@ -14,7 +14,7 @@ glob grent hasmntopt hello iconv if_name memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest \ protoent prototypes putenv pwent rand48 read1 readdir regex select sendfile servent siglist \ @@ -192,7 +192,7 @@ diff -up dietlibc-0.31.20080409/test/Makefile.pagesize dietlibc-0.31.20080409/te diff -up /dev/null dietlibc-0.31.20080409/test/sysconf.c --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/test/sysconf.c 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/test/sysconf.c 2008-04-13 19:57:13.000000000 +0200 @@ -0,0 +1,80 @@ +#include +#include @@ -276,7 +276,7 @@ diff -up /dev/null dietlibc-0.31.20080409/test/sysconf.c +} diff -up dietlibc-0.31.20080409/test/runtests.sh.pagesize dietlibc-0.31.20080409/test/runtests.sh --- dietlibc-0.31.20080409/test/runtests.sh.pagesize 2008-02-23 01:02:19.000000000 +0100 -+++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 19:57:13.000000000 +0200 @@ -1,6 +1,6 @@ SUBDIRS="dirent inet stdio string stdlib time" @@ -287,7 +287,7 @@ diff -up dietlibc-0.31.20080409/test/runtests.sh.pagesize dietlibc-0.31.20080409 PASS="getpass" diff -up dietlibc-0.31.20080409/sparc64/start.S.pagesize dietlibc-0.31.20080409/sparc64/start.S --- dietlibc-0.31.20080409/sparc64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc64/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc64/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -25,6 +25,11 @@ _start: or %o3, %lo(environ), %o3 stx %o2, [%o3] @@ -302,7 +302,7 @@ diff -up dietlibc-0.31.20080409/sparc64/start.S.pagesize dietlibc-0.31.20080409/ registered with atexit(). If we are statically linked, this will diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.20080409/libcruft/sysconf.c --- dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize 2002-12-20 14:32:37.000000000 +0100 -+++ dietlibc-0.31.20080409/libcruft/sysconf.c 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/libcruft/sysconf.c 2008-04-13 19:57:13.000000000 +0200 @@ -3,6 +3,8 @@ #include #include @@ -342,7 +342,7 @@ diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.200804 return ARG_MAX; diff -up /dev/null dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c 2008-04-13 20:06:45.000000000 +0200 @@ -0,0 +1,25 @@ +#include +#include "../dietelfinfo.h" @@ -371,7 +371,7 @@ diff -up /dev/null dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c +} diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20080409/libcruft/getpagesize.c --- dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize 2002-02-23 23:18:42.000000000 +0100 -+++ dietlibc-0.31.20080409/libcruft/getpagesize.c 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/libcruft/getpagesize.c 2008-04-13 19:57:13.000000000 +0200 @@ -2,14 +2,25 @@ #include #include @@ -406,7 +406,7 @@ diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20 - diff -up /dev/null dietlibc-0.31.20080409/dietpagesize.h --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/dietpagesize.h 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/dietpagesize.h 2008-04-13 19:57:13.000000000 +0200 @@ -0,0 +1,31 @@ +#ifndef H_DIETLIBC_DIETPAGESIZE_H +#define H_DIETLIBC_DIETPAGESIZE_H @@ -441,7 +441,7 @@ diff -up /dev/null dietlibc-0.31.20080409/dietpagesize.h +#endif /* H_DIETLIBC_DIETPAGESIZE_H */ diff -up dietlibc-0.31.20080409/s390x/start.S.pagesize dietlibc-0.31.20080409/s390x/start.S --- dietlibc-0.31.20080409/s390x/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/s390x/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/s390x/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -26,6 +26,11 @@ _start: larl %r13,environ stg %r4,0(%r13) @@ -456,20 +456,26 @@ diff -up dietlibc-0.31.20080409/s390x/start.S.pagesize dietlibc-0.31.20080409/s3 brasl %r14,_dyn_start diff -up /dev/null dietlibc-0.31.20080409/dietelfinfo.h --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/dietelfinfo.h 2008-04-13 18:57:47.000000000 +0200 -@@ -0,0 +1,9 @@ ++++ dietlibc-0.31.20080409/dietelfinfo.h 2008-04-13 20:11:55.000000000 +0200 +@@ -0,0 +1,15 @@ +#include "dietfeatures.h" + +#ifdef WANT_ELFINFO +#include +#include + ++#if defined(__powerpc64__) || defined(__x86_64__) ++struct __diet_elf_sanity_check { int f : sizeof(elf_addr_t)==8; }; ++#elif defined(__i386__) || defined(__arm__) || defined(__powerpc__) ++struct __diet_elf_sanity_check { int f : sizeof(elf_addr_t)==4; }; ++#endif ++ +elf_addr_t * __get_elf_aux_value(unsigned int tag) + __attribute__((__visibility__("hidden"),__const__)) __pure; +#endif diff -up dietlibc-0.31.20080409/ia64/start.S.pagesize dietlibc-0.31.20080409/ia64/start.S --- dietlibc-0.31.20080409/ia64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ia64/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/ia64/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -40,6 +40,11 @@ _start: ;; st8 [r14] = out2 /* store envp in environ */ @@ -484,7 +490,7 @@ diff -up dietlibc-0.31.20080409/ia64/start.S.pagesize dietlibc-0.31.20080409/ia6 br.call.sptk.few rp = _dyn_start diff -up dietlibc-0.31.20080409/i386/start.S.pagesize dietlibc-0.31.20080409/i386/start.S --- dietlibc-0.31.20080409/i386/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/i386/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/i386/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -25,6 +25,10 @@ _start: PIC_INIT /* non-PIC: this is an empty line */ PUT_VAR %eax, environ, %ecx /* non-PIC: movl %eax,environ */ @@ -498,7 +504,7 @@ diff -up dietlibc-0.31.20080409/i386/start.S.pagesize dietlibc-0.31.20080409/i38 pushl $.text diff -up dietlibc-0.31.20080409/dietdirent.h.pagesize dietlibc-0.31.20080409/dietdirent.h --- dietlibc-0.31.20080409/dietdirent.h.pagesize 2002-07-03 22:33:37.000000000 +0200 -+++ dietlibc-0.31.20080409/dietdirent.h 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/dietdirent.h 2008-04-13 19:57:13.000000000 +0200 @@ -1,8 +1,12 @@ #include @@ -515,7 +521,7 @@ diff -up dietlibc-0.31.20080409/dietdirent.h.pagesize dietlibc-0.31.20080409/die +#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) diff -up dietlibc-0.31.20080409/alpha/start.S.pagesize dietlibc-0.31.20080409/alpha/start.S --- dietlibc-0.31.20080409/alpha/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/alpha/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/alpha/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -24,6 +24,10 @@ _start: stq $18, environ @@ -529,7 +535,7 @@ diff -up dietlibc-0.31.20080409/alpha/start.S.pagesize dietlibc-0.31.20080409/al mov $0, $19 /* mov v0(dynload) to a3 */ diff -up dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize dietlibc-0.31.20080409/syscalls.s/environ.S --- dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize 2004-09-28 02:01:30.000000000 +0200 -+++ dietlibc-0.31.20080409/syscalls.s/environ.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/syscalls.s/environ.S 2008-04-13 19:57:13.000000000 +0200 @@ -1,6 +1,7 @@ .section ".bss" .align 8 @@ -563,7 +569,7 @@ diff -up dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize dietlibc-0.31.2008 +#endif diff -up dietlibc-0.31.20080409/arm/start.S.pagesize dietlibc-0.31.20080409/arm/start.S --- dietlibc-0.31.20080409/arm/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/arm/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/arm/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -23,11 +23,15 @@ _start: #ifdef __DYN_LIB ldr sl, .L4 @@ -590,7 +596,7 @@ diff -up dietlibc-0.31.20080409/arm/start.S.pagesize dietlibc-0.31.20080409/arm/ - diff -up dietlibc-0.31.20080409/parisc/start.S.pagesize dietlibc-0.31.20080409/parisc/start.S --- dietlibc-0.31.20080409/parisc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/parisc/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/parisc/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -34,6 +34,11 @@ _start: ldil LP%environ, %r19 ldo RP%environ(%r19), %r19 @@ -605,7 +611,7 @@ diff -up dietlibc-0.31.20080409/parisc/start.S.pagesize dietlibc-0.31.20080409/p diff -up dietlibc-0.31.20080409/include/sys/shm.h.pagesize dietlibc-0.31.20080409/include/sys/shm.h --- dietlibc-0.31.20080409/include/sys/shm.h.pagesize 2005-09-21 09:33:08.000000000 +0200 -+++ dietlibc-0.31.20080409/include/sys/shm.h 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/include/sys/shm.h 2008-04-13 19:57:13.000000000 +0200 @@ -60,15 +60,6 @@ struct shm_info { unsigned long swap_successes; }; @@ -624,7 +630,7 @@ diff -up dietlibc-0.31.20080409/include/sys/shm.h.pagesize dietlibc-0.31.2008040 extern int shmdt (const void *shmaddr) __THROW; diff -up dietlibc-0.31.20080409/sparc/start.S.pagesize dietlibc-0.31.20080409/sparc/start.S --- dietlibc-0.31.20080409/sparc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -25,6 +25,11 @@ _start: or %o3, %lo(environ), %o3 st %o2, [%o3] @@ -639,7 +645,7 @@ diff -up dietlibc-0.31.20080409/sparc/start.S.pagesize dietlibc-0.31.20080409/sp registered with atexit(). If we are statically linked, this will diff -up dietlibc-0.31.20080409/sparc/shmat.c.pagesize dietlibc-0.31.20080409/sparc/shmat.c --- dietlibc-0.31.20080409/sparc/shmat.c.pagesize 2001-06-16 19:48:57.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc/shmat.c 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc/shmat.c 2008-04-13 19:57:13.000000000 +0200 @@ -3,17 +3,15 @@ #include #include @@ -663,7 +669,7 @@ diff -up dietlibc-0.31.20080409/sparc/shmat.c.pagesize dietlibc-0.31.20080409/sp } diff -up dietlibc-0.31.20080409/ppc64/start.S.pagesize dietlibc-0.31.20080409/ppc64/start.S --- dietlibc-0.31.20080409/ppc64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ppc64/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/ppc64/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -58,6 +58,12 @@ _start: oris 14,14,environ@ha std 5,environ@l(14) @@ -679,7 +685,7 @@ diff -up dietlibc-0.31.20080409/ppc64/start.S.pagesize dietlibc-0.31.20080409/pp mr 6,7 diff -up dietlibc-0.31.20080409/x86_64/start.S.pagesize dietlibc-0.31.20080409/x86_64/start.S --- dietlibc-0.31.20080409/x86_64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/x86_64/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/x86_64/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -12,12 +12,23 @@ _start: leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */ @@ -706,7 +712,7 @@ diff -up dietlibc-0.31.20080409/x86_64/start.S.pagesize dietlibc-0.31.20080409/x pushq %rdi /* save reg args */ diff -up dietlibc-0.31.20080409/s390/start.S.pagesize dietlibc-0.31.20080409/s390/start.S --- dietlibc-0.31.20080409/s390/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/s390/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/s390/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -30,6 +30,11 @@ _start: l %r1,8(%r13) st %r4,0(%r1) @@ -721,7 +727,7 @@ diff -up dietlibc-0.31.20080409/s390/start.S.pagesize dietlibc-0.31.20080409/s39 basr %r14,%r1 diff -up dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize dietlibc-0.31.20080409/dynlinker/ldso_start.S --- dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize 2006-10-13 22:11:13.000000000 +0200 -+++ dietlibc-0.31.20080409/dynlinker/ldso_start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/dynlinker/ldso_start.S 2008-04-13 19:57:13.000000000 +0200 @@ -86,6 +86,15 @@ __environ: .long 0 #endif @@ -740,7 +746,7 @@ diff -up dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize dietlibc-0.31.20 .long 0 diff -up dietlibc-0.31.20080409/mips/start.S.pagesize dietlibc-0.31.20080409/mips/start.S --- dietlibc-0.31.20080409/mips/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/mips/start.S 2008-04-13 18:57:47.000000000 +0200 ++++ dietlibc-0.31.20080409/mips/start.S 2008-04-13 19:57:13.000000000 +0200 @@ -47,6 +47,9 @@ __start: #endif add $a2, $a2, $a1 From 722e943974903cc2091c47a4ef7a5737b73f4445 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 18:22:34 +0000 Subject: [PATCH 038/161] more debugging... --- dietlibc.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index d65d307..b01a9da 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -140,6 +140,8 @@ done %build +echo '#include ' | gcc -E - -dD || : + make %makeflags all %{?_smp_mflags} # 'dyn' target is not SMP safe @@ -168,7 +170,7 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] readelf -a ./ftw || : objdump -d ./ftw || : -gdb ./ftw -ex 'r' -ex 'bt' -ex 'info registers' -ex 'info locals' -ex 'q' || : +gdb ./ftw -ex 'r' -ex 'bt' -ex 'info registers' -ex 'info locals' -ex 'p environ' -ex 'print __elfinfo' -ex 'q' || : dmesg | tail || : sleep 60 From 401d33c3b0eed50ebc96f3aa4c52cfbeaddc20be Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 20:35:27 +0000 Subject: [PATCH 039/161] declares an implicitly used function --- dietlibc-0.31-implicitfunc.patch | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 dietlibc-0.31-implicitfunc.patch diff --git a/dietlibc-0.31-implicitfunc.patch b/dietlibc-0.31-implicitfunc.patch new file mode 100644 index 0000000..4fe19f8 --- /dev/null +++ b/dietlibc-0.31-implicitfunc.patch @@ -0,0 +1,12 @@ +diff -up dietlibc-0.31.20080409/lib/signalfd.c.implicitfunc dietlibc-0.31.20080409/lib/signalfd.c +--- dietlibc-0.31.20080409/lib/signalfd.c.implicitfunc 2008-02-19 01:28:13.000000000 +0100 ++++ dietlibc-0.31.20080409/lib/signalfd.c 2008-04-13 22:30:48.000000000 +0200 +@@ -1,6 +1,8 @@ + #include + #include + ++extern int __signalfd(int fd, const sigset_t *mask, int flags); ++ + int signalfd(int fd,const sigset_t* mask,int flags) { + if (flags) { /* bizarre glibc bullshit */ + errno=EINVAL; From 66676e2784fd8028a4d8117c14fb9634d4a3204b Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 20:36:32 +0000 Subject: [PATCH 040/161] define and use a custom __diet_elf_addr_t datatype instead of elf_addr_t which disappeared in linux 2.6.25 --- dietlibc-0.31-pagesize.patch | 102 ++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 48 deletions(-) diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index 5484678..b0709b5 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -1,6 +1,6 @@ diff -up dietlibc-0.31.20080409/lib/mmap64.c.pagesize dietlibc-0.31.20080409/lib/mmap64.c --- dietlibc-0.31.20080409/lib/mmap64.c.pagesize 2004-12-13 11:21:31.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/mmap64.c 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/mmap64.c 2008-04-13 22:19:49.000000000 +0200 @@ -4,16 +4,18 @@ #include #include @@ -24,7 +24,7 @@ diff -up dietlibc-0.31.20080409/lib/mmap64.c.pagesize dietlibc-0.31.20080409/lib void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) diff -up dietlibc-0.31.20080409/lib/readdir64.c.pagesize dietlibc-0.31.20080409/lib/readdir64.c --- dietlibc-0.31.20080409/lib/readdir64.c.pagesize 2004-03-02 22:27:19.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/readdir64.c 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/readdir64.c 2008-04-13 22:19:49.000000000 +0200 @@ -14,7 +14,7 @@ #ifndef WANT_LARGEFILE_BACKCOMPAT struct dirent64* readdir64(DIR *d) { @@ -54,7 +54,7 @@ diff -up dietlibc-0.31.20080409/lib/readdir64.c.pagesize dietlibc-0.31.20080409/ trygetdents64=0; diff -up dietlibc-0.31.20080409/lib/opendir.c.pagesize dietlibc-0.31.20080409/lib/opendir.c --- dietlibc-0.31.20080409/lib/opendir.c.pagesize 2002-07-03 22:33:38.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/opendir.c 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/opendir.c 2008-04-13 22:19:49.000000000 +0200 @@ -5,6 +5,8 @@ #include #include @@ -75,7 +75,7 @@ diff -up dietlibc-0.31.20080409/lib/opendir.c.pagesize dietlibc-0.31.20080409/li lose: diff -up dietlibc-0.31.20080409/lib/readdir.c.pagesize dietlibc-0.31.20080409/lib/readdir.c --- dietlibc-0.31.20080409/lib/readdir.c.pagesize 2002-07-03 22:33:38.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/readdir.c 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/readdir.c 2008-04-13 22:19:49.000000000 +0200 @@ -5,7 +5,7 @@ struct dirent* readdir(DIR *d) { @@ -87,7 +87,7 @@ diff -up dietlibc-0.31.20080409/lib/readdir.c.pagesize dietlibc-0.31.20080409/li } diff -up dietlibc-0.31.20080409/lib/closedir.c.pagesize dietlibc-0.31.20080409/lib/closedir.c --- dietlibc-0.31.20080409/lib/closedir.c.pagesize 2002-07-03 22:33:37.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/closedir.c 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/closedir.c 2008-04-13 22:19:49.000000000 +0200 @@ -4,8 +4,10 @@ #include #include @@ -102,7 +102,7 @@ diff -up dietlibc-0.31.20080409/lib/closedir.c.pagesize dietlibc-0.31.20080409/l } diff -up dietlibc-0.31.20080409/lib/alloc.c.pagesize dietlibc-0.31.20080409/lib/alloc.c --- dietlibc-0.31.20080409/lib/alloc.c.pagesize 2007-08-03 22:58:33.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/alloc.c 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/alloc.c 2008-04-13 22:19:49.000000000 +0200 @@ -18,8 +18,7 @@ #include #include @@ -135,7 +135,7 @@ diff -up dietlibc-0.31.20080409/lib/alloc.c.pagesize dietlibc-0.31.20080409/lib/ register size_t idx=0; diff -up dietlibc-0.31.20080409/ppc/start.S.pagesize dietlibc-0.31.20080409/ppc/start.S --- dietlibc-0.31.20080409/ppc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ppc/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/ppc/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -31,6 +31,12 @@ _start: lis 14,environ@ha stw 5,environ@l(14) @@ -151,7 +151,7 @@ diff -up dietlibc-0.31.20080409/ppc/start.S.pagesize dietlibc-0.31.20080409/ppc/ bl _dyn_start diff -up dietlibc-0.31.20080409/dietfeatures.h.pagesize dietlibc-0.31.20080409/dietfeatures.h --- dietlibc-0.31.20080409/dietfeatures.h.pagesize 2007-10-09 01:15:27.000000000 +0200 -+++ dietlibc-0.31.20080409/dietfeatures.h 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/dietfeatures.h 2008-04-13 22:19:49.000000000 +0200 @@ -126,6 +126,16 @@ /* #define WANT_SSP_XOR */ @@ -180,7 +180,7 @@ diff -up dietlibc-0.31.20080409/dietfeatures.h.pagesize dietlibc-0.31.20080409/d #endif diff -up dietlibc-0.31.20080409/test/Makefile.pagesize dietlibc-0.31.20080409/test/Makefile --- dietlibc-0.31.20080409/test/Makefile.pagesize 2008-02-23 01:02:19.000000000 +0100 -+++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 22:19:49.000000000 +0200 @@ -14,7 +14,7 @@ glob grent hasmntopt hello iconv if_name memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest \ protoent prototypes putenv pwent rand48 read1 readdir regex select sendfile servent siglist \ @@ -192,7 +192,7 @@ diff -up dietlibc-0.31.20080409/test/Makefile.pagesize dietlibc-0.31.20080409/te diff -up /dev/null dietlibc-0.31.20080409/test/sysconf.c --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/test/sysconf.c 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/test/sysconf.c 2008-04-13 22:19:49.000000000 +0200 @@ -0,0 +1,80 @@ +#include +#include @@ -276,7 +276,7 @@ diff -up /dev/null dietlibc-0.31.20080409/test/sysconf.c +} diff -up dietlibc-0.31.20080409/test/runtests.sh.pagesize dietlibc-0.31.20080409/test/runtests.sh --- dietlibc-0.31.20080409/test/runtests.sh.pagesize 2008-02-23 01:02:19.000000000 +0100 -+++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 22:19:49.000000000 +0200 @@ -1,6 +1,6 @@ SUBDIRS="dirent inet stdio string stdlib time" @@ -287,7 +287,7 @@ diff -up dietlibc-0.31.20080409/test/runtests.sh.pagesize dietlibc-0.31.20080409 PASS="getpass" diff -up dietlibc-0.31.20080409/sparc64/start.S.pagesize dietlibc-0.31.20080409/sparc64/start.S --- dietlibc-0.31.20080409/sparc64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc64/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc64/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -25,6 +25,11 @@ _start: or %o3, %lo(environ), %o3 stx %o2, [%o3] @@ -302,12 +302,13 @@ diff -up dietlibc-0.31.20080409/sparc64/start.S.pagesize dietlibc-0.31.20080409/ registered with atexit(). If we are statically linked, this will diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.20080409/libcruft/sysconf.c --- dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize 2002-12-20 14:32:37.000000000 +0100 -+++ dietlibc-0.31.20080409/libcruft/sysconf.c 2008-04-13 19:57:13.000000000 +0200 -@@ -3,6 +3,8 @@ ++++ dietlibc-0.31.20080409/libcruft/sysconf.c 2008-04-13 22:19:49.000000000 +0200 +@@ -3,6 +3,9 @@ #include #include +#include "dietelfinfo.h" ++#include "dietpagesize.h" + extern int __sc_nr_cpus(); @@ -318,7 +319,7 @@ diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.200804 case _SC_CLK_TCK: +#ifdef WANT_ELFINFO + { -+ elf_addr_t *v = __get_elf_aux_value(AT_CLKTCK); ++ __diet_elf_addr_t *v = __get_elf_aux_value(AT_CLKTCK); + if (v) + return *v; + } @@ -342,15 +343,15 @@ diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.200804 return ARG_MAX; diff -up /dev/null dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c 2008-04-13 20:06:45.000000000 +0200 ++++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c 2008-04-13 22:19:49.000000000 +0200 @@ -0,0 +1,25 @@ +#include +#include "../dietelfinfo.h" + -+elf_addr_t *__get_elf_aux_value(unsigned int tag) ++__diet_elf_addr_t *__get_elf_aux_value(unsigned int tag) +{ + extern char ** __elfinfo; -+ elf_addr_t *aux_ptr; ++ __diet_elf_addr_t *aux_ptr; + char ** tmp; + + /* External symbol points to 'environ' after startup. Now, go the end @@ -363,7 +364,7 @@ diff -up /dev/null dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c + ++tmp; + __elfinfo = tmp; + -+ for (aux_ptr = (elf_addr_t *)(tmp+1); aux_ptr[0]!=AT_NULL; aux_ptr += 2) ++ for (aux_ptr = (__diet_elf_addr_t *)(tmp+1); aux_ptr[0]!=AT_NULL; aux_ptr += 2) + if (aux_ptr[0]==tag) + return aux_ptr+1; + @@ -371,7 +372,7 @@ diff -up /dev/null dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c +} diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20080409/libcruft/getpagesize.c --- dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize 2002-02-23 23:18:42.000000000 +0100 -+++ dietlibc-0.31.20080409/libcruft/getpagesize.c 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/libcruft/getpagesize.c 2008-04-13 22:19:49.000000000 +0200 @@ -2,14 +2,25 @@ #include #include @@ -389,7 +390,7 @@ diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20 + static size_t pgsz; + + if (__unlikely(pgsz==0)) { -+ elf_addr_t *v = __get_elf_aux_value(AT_PAGESZ); ++ __diet_elf_addr_t *v = __get_elf_aux_value(AT_PAGESZ); + if (__likely(v)) + pgsz = *v; + else @@ -406,7 +407,7 @@ diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20 - diff -up /dev/null dietlibc-0.31.20080409/dietpagesize.h --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/dietpagesize.h 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/dietpagesize.h 2008-04-13 22:19:49.000000000 +0200 @@ -0,0 +1,31 @@ +#ifndef H_DIETLIBC_DIETPAGESIZE_H +#define H_DIETLIBC_DIETPAGESIZE_H @@ -441,7 +442,7 @@ diff -up /dev/null dietlibc-0.31.20080409/dietpagesize.h +#endif /* H_DIETLIBC_DIETPAGESIZE_H */ diff -up dietlibc-0.31.20080409/s390x/start.S.pagesize dietlibc-0.31.20080409/s390x/start.S --- dietlibc-0.31.20080409/s390x/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/s390x/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/s390x/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -26,6 +26,11 @@ _start: larl %r13,environ stg %r4,0(%r13) @@ -456,26 +457,31 @@ diff -up dietlibc-0.31.20080409/s390x/start.S.pagesize dietlibc-0.31.20080409/s3 brasl %r14,_dyn_start diff -up /dev/null dietlibc-0.31.20080409/dietelfinfo.h --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/dietelfinfo.h 2008-04-13 20:11:55.000000000 +0200 -@@ -0,0 +1,15 @@ ++++ dietlibc-0.31.20080409/dietelfinfo.h 2008-04-13 22:21:09.000000000 +0200 +@@ -0,0 +1,20 @@ +#include "dietfeatures.h" + +#ifdef WANT_ELFINFO -+#include -+#include ++#include ++#include ++#include + -+#if defined(__powerpc64__) || defined(__x86_64__) -+struct __diet_elf_sanity_check { int f : sizeof(elf_addr_t)==8; }; -+#elif defined(__i386__) || defined(__arm__) || defined(__powerpc__) -+struct __diet_elf_sanity_check { int f : sizeof(elf_addr_t)==4; }; -+#endif ++/* TODO: exported interface from has been changed in 2.6.25 so ++ * the 'elf_addr_t' type is not available anymore. Hence, derive it from ++ * __WORDSIZE__. */ + -+elf_addr_t * __get_elf_aux_value(unsigned int tag) ++#if __WORDSIZE == 64 ++typedef uint64_t __diet_elf_addr_t; ++#elif __WORDSIZE == 32 ++typedef uint32_t __diet_elf_addr_t; ++#endif ++ ++__diet_elf_addr_t * __get_elf_aux_value(unsigned int tag) + __attribute__((__visibility__("hidden"),__const__)) __pure; +#endif diff -up dietlibc-0.31.20080409/ia64/start.S.pagesize dietlibc-0.31.20080409/ia64/start.S --- dietlibc-0.31.20080409/ia64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ia64/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/ia64/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -40,6 +40,11 @@ _start: ;; st8 [r14] = out2 /* store envp in environ */ @@ -490,7 +496,7 @@ diff -up dietlibc-0.31.20080409/ia64/start.S.pagesize dietlibc-0.31.20080409/ia6 br.call.sptk.few rp = _dyn_start diff -up dietlibc-0.31.20080409/i386/start.S.pagesize dietlibc-0.31.20080409/i386/start.S --- dietlibc-0.31.20080409/i386/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/i386/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/i386/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -25,6 +25,10 @@ _start: PIC_INIT /* non-PIC: this is an empty line */ PUT_VAR %eax, environ, %ecx /* non-PIC: movl %eax,environ */ @@ -504,7 +510,7 @@ diff -up dietlibc-0.31.20080409/i386/start.S.pagesize dietlibc-0.31.20080409/i38 pushl $.text diff -up dietlibc-0.31.20080409/dietdirent.h.pagesize dietlibc-0.31.20080409/dietdirent.h --- dietlibc-0.31.20080409/dietdirent.h.pagesize 2002-07-03 22:33:37.000000000 +0200 -+++ dietlibc-0.31.20080409/dietdirent.h 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/dietdirent.h 2008-04-13 22:19:49.000000000 +0200 @@ -1,8 +1,12 @@ #include @@ -521,7 +527,7 @@ diff -up dietlibc-0.31.20080409/dietdirent.h.pagesize dietlibc-0.31.20080409/die +#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) diff -up dietlibc-0.31.20080409/alpha/start.S.pagesize dietlibc-0.31.20080409/alpha/start.S --- dietlibc-0.31.20080409/alpha/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/alpha/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/alpha/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -24,6 +24,10 @@ _start: stq $18, environ @@ -535,7 +541,7 @@ diff -up dietlibc-0.31.20080409/alpha/start.S.pagesize dietlibc-0.31.20080409/al mov $0, $19 /* mov v0(dynload) to a3 */ diff -up dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize dietlibc-0.31.20080409/syscalls.s/environ.S --- dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize 2004-09-28 02:01:30.000000000 +0200 -+++ dietlibc-0.31.20080409/syscalls.s/environ.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/syscalls.s/environ.S 2008-04-13 22:19:49.000000000 +0200 @@ -1,6 +1,7 @@ .section ".bss" .align 8 @@ -569,7 +575,7 @@ diff -up dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize dietlibc-0.31.2008 +#endif diff -up dietlibc-0.31.20080409/arm/start.S.pagesize dietlibc-0.31.20080409/arm/start.S --- dietlibc-0.31.20080409/arm/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/arm/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/arm/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -23,11 +23,15 @@ _start: #ifdef __DYN_LIB ldr sl, .L4 @@ -596,7 +602,7 @@ diff -up dietlibc-0.31.20080409/arm/start.S.pagesize dietlibc-0.31.20080409/arm/ - diff -up dietlibc-0.31.20080409/parisc/start.S.pagesize dietlibc-0.31.20080409/parisc/start.S --- dietlibc-0.31.20080409/parisc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/parisc/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/parisc/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -34,6 +34,11 @@ _start: ldil LP%environ, %r19 ldo RP%environ(%r19), %r19 @@ -611,7 +617,7 @@ diff -up dietlibc-0.31.20080409/parisc/start.S.pagesize dietlibc-0.31.20080409/p diff -up dietlibc-0.31.20080409/include/sys/shm.h.pagesize dietlibc-0.31.20080409/include/sys/shm.h --- dietlibc-0.31.20080409/include/sys/shm.h.pagesize 2005-09-21 09:33:08.000000000 +0200 -+++ dietlibc-0.31.20080409/include/sys/shm.h 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/include/sys/shm.h 2008-04-13 22:19:49.000000000 +0200 @@ -60,15 +60,6 @@ struct shm_info { unsigned long swap_successes; }; @@ -630,7 +636,7 @@ diff -up dietlibc-0.31.20080409/include/sys/shm.h.pagesize dietlibc-0.31.2008040 extern int shmdt (const void *shmaddr) __THROW; diff -up dietlibc-0.31.20080409/sparc/start.S.pagesize dietlibc-0.31.20080409/sparc/start.S --- dietlibc-0.31.20080409/sparc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -25,6 +25,11 @@ _start: or %o3, %lo(environ), %o3 st %o2, [%o3] @@ -645,7 +651,7 @@ diff -up dietlibc-0.31.20080409/sparc/start.S.pagesize dietlibc-0.31.20080409/sp registered with atexit(). If we are statically linked, this will diff -up dietlibc-0.31.20080409/sparc/shmat.c.pagesize dietlibc-0.31.20080409/sparc/shmat.c --- dietlibc-0.31.20080409/sparc/shmat.c.pagesize 2001-06-16 19:48:57.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc/shmat.c 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/sparc/shmat.c 2008-04-13 22:19:49.000000000 +0200 @@ -3,17 +3,15 @@ #include #include @@ -669,7 +675,7 @@ diff -up dietlibc-0.31.20080409/sparc/shmat.c.pagesize dietlibc-0.31.20080409/sp } diff -up dietlibc-0.31.20080409/ppc64/start.S.pagesize dietlibc-0.31.20080409/ppc64/start.S --- dietlibc-0.31.20080409/ppc64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ppc64/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/ppc64/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -58,6 +58,12 @@ _start: oris 14,14,environ@ha std 5,environ@l(14) @@ -685,7 +691,7 @@ diff -up dietlibc-0.31.20080409/ppc64/start.S.pagesize dietlibc-0.31.20080409/pp mr 6,7 diff -up dietlibc-0.31.20080409/x86_64/start.S.pagesize dietlibc-0.31.20080409/x86_64/start.S --- dietlibc-0.31.20080409/x86_64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/x86_64/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/x86_64/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -12,12 +12,23 @@ _start: leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */ @@ -712,7 +718,7 @@ diff -up dietlibc-0.31.20080409/x86_64/start.S.pagesize dietlibc-0.31.20080409/x pushq %rdi /* save reg args */ diff -up dietlibc-0.31.20080409/s390/start.S.pagesize dietlibc-0.31.20080409/s390/start.S --- dietlibc-0.31.20080409/s390/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/s390/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/s390/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -30,6 +30,11 @@ _start: l %r1,8(%r13) st %r4,0(%r1) @@ -727,7 +733,7 @@ diff -up dietlibc-0.31.20080409/s390/start.S.pagesize dietlibc-0.31.20080409/s39 basr %r14,%r1 diff -up dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize dietlibc-0.31.20080409/dynlinker/ldso_start.S --- dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize 2006-10-13 22:11:13.000000000 +0200 -+++ dietlibc-0.31.20080409/dynlinker/ldso_start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/dynlinker/ldso_start.S 2008-04-13 22:19:49.000000000 +0200 @@ -86,6 +86,15 @@ __environ: .long 0 #endif @@ -746,7 +752,7 @@ diff -up dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize dietlibc-0.31.20 .long 0 diff -up dietlibc-0.31.20080409/mips/start.S.pagesize dietlibc-0.31.20080409/mips/start.S --- dietlibc-0.31.20080409/mips/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/mips/start.S 2008-04-13 19:57:13.000000000 +0200 ++++ dietlibc-0.31.20080409/mips/start.S 2008-04-13 22:19:49.000000000 +0200 @@ -47,6 +47,9 @@ __start: #endif add $a2, $a2, $a1 From c8fe5dc9284ce2fdca91aee70e2ba0175ace9cb4 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 20:37:13 +0000 Subject: [PATCH 041/161] added a missing '#include ' --- dietlibc-0.31-printFG.patch | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/dietlibc-0.31-printFG.patch b/dietlibc-0.31-printFG.patch index 9a11b80..f8996d1 100644 --- a/dietlibc-0.31-printFG.patch +++ b/dietlibc-0.31-printFG.patch @@ -1,6 +1,6 @@ diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/lib/__dtostr.c --- dietlibc-0.31.20080409/lib/__dtostr.c.printFG 2006-07-04 05:33:02.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/__dtostr.c 2008-04-13 14:41:48.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/__dtostr.c 2008-04-13 22:26:13.000000000 +0200 @@ -5,13 +5,15 @@ static int copystring(char* buf,int maxlen, const char* s) { @@ -51,8 +51,16 @@ diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/li } else { diff -up dietlibc-0.31.20080409/lib/__v_printf.c.printFG dietlibc-0.31.20080409/lib/__v_printf.c --- dietlibc-0.31.20080409/lib/__v_printf.c.printFG 2008-02-19 01:28:13.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/__v_printf.c 2008-04-13 14:41:48.000000000 +0200 -@@ -346,45 +346,49 @@ num_printf: ++++ dietlibc-0.31.20080409/lib/__v_printf.c 2008-04-13 22:26:32.000000000 +0200 +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + #include "dietstdio.h" + #include "dietwarning.h" + +@@ -346,45 +347,49 @@ num_printf: #ifdef WANT_FLOATING_POINT_IN_PRINTF /* print a floating point value */ case 'f': @@ -130,7 +138,7 @@ diff -up dietlibc-0.31.20080409/lib/__v_printf.c.printFG dietlibc-0.31.20080409/ sz=strlen(s); diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/test/printf.c --- dietlibc-0.31.20080409/test/printf.c.printFG 2008-02-19 01:28:13.000000000 +0100 -+++ dietlibc-0.31.20080409/test/printf.c 2008-04-13 14:52:36.000000000 +0200 ++++ dietlibc-0.31.20080409/test/printf.c 2008-04-13 22:26:13.000000000 +0200 @@ -2,11 +2,24 @@ #include #include @@ -182,7 +190,7 @@ diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/tes diff -up dietlibc-0.31.20080409/include/stdlib.h.printFG dietlibc-0.31.20080409/include/stdlib.h --- dietlibc-0.31.20080409/include/stdlib.h.printFG 2007-09-20 20:51:18.000000000 +0200 -+++ dietlibc-0.31.20080409/include/stdlib.h 2008-04-13 14:41:48.000000000 +0200 ++++ dietlibc-0.31.20080409/include/stdlib.h 2008-04-13 22:26:13.000000000 +0200 @@ -28,8 +28,12 @@ long double strtold(const char *nptr, ch long int strtol(const char *nptr, char **endptr, int base) __THROW; unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW; From d49ea1924d89958bfbea94662cb86fa96baa545f Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 20:38:13 +0000 Subject: [PATCH 042/161] added -implicitfunc patch --- dietlibc.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index b01a9da..ff6bbc9 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -55,6 +55,7 @@ Patch44: dietlibc-0.31-printFG.patch Patch45: dietlibc-0.31-stat64.patch Patch46: dietlibc-0.31-testsuite.patch Patch47: dietlibc-0.31-lcctime.patch +Patch48: dietlibc-0.31-implicitfunc.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -109,6 +110,7 @@ This package contains the dynamic libraries for dietlibc. %patch45 -p1 -b .stat64 %patch46 -p1 -b .testsuite %patch47 -p1 -b .lcctime +%patch48 -p1 -b .implicitfunc %if %{without ssp} @@ -130,7 +132,7 @@ sed -i \ sed -i -e 's!strip !: !g' Makefile -%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -g3 +%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -g3 -Werror-implicit-function-declaration %global basemakeflags prefix=%pkglibdir BINDIR=%_bindir MAN1DIR=%_mandir/man1 COMMENT=: CFLAGS="$RPM_OPT_FLAGS %fixcflags $XTRA_CFLAGS" PDIET=%pkglibdir %global makeflags %basemakeflags @@ -140,8 +142,6 @@ done %build -echo '#include ' | gcc -E - -dD || : - make %makeflags all %{?_smp_mflags} # 'dyn' target is not SMP safe From 2148489018e502f653cbba98223cfb7cdc4777ec Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 21:20:45 +0000 Subject: [PATCH 043/161] SUSv2 says about abort(3): The abort() function shall not return. Hence, add an __attribute__((__noreturn__)) --- dietlibc-0.31-noreturn.patch | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 dietlibc-0.31-noreturn.patch diff --git a/dietlibc-0.31-noreturn.patch b/dietlibc-0.31-noreturn.patch new file mode 100644 index 0000000..6b7dc69 --- /dev/null +++ b/dietlibc-0.31-noreturn.patch @@ -0,0 +1,12 @@ +diff -up dietlibc-0.31.20080409/include/stdlib.h.noreturn dietlibc-0.31.20080409/include/stdlib.h +--- dietlibc-0.31.20080409/include/stdlib.h.noreturn 2008-04-13 22:56:59.000000000 +0200 ++++ dietlibc-0.31.20080409/include/stdlib.h 2008-04-13 22:57:54.000000000 +0200 +@@ -47,7 +47,7 @@ double atof(const char *nptr) __THROW; + __extension__ long long int atoll(const char *nptr); + + void exit(int status) __THROW __attribute__((__noreturn__)); +-void abort(void) __THROW; ++void abort(void) __THROW __attribute__((__noreturn__)); + + extern int rand(void) __THROW; + extern int rand_r(unsigned int *seed) __THROW; From 63100c2fd34678fc1235ef37db8753e57c32f0ab Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 21:21:56 +0000 Subject: [PATCH 044/161] fixed other issues preventing an -Werror-implicit-function-declaration build --- dietlibc-0.31-implicitfunc.patch | 33 +++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/dietlibc-0.31-implicitfunc.patch b/dietlibc-0.31-implicitfunc.patch index 4fe19f8..d9dace4 100644 --- a/dietlibc-0.31-implicitfunc.patch +++ b/dietlibc-0.31-implicitfunc.patch @@ -1,6 +1,6 @@ diff -up dietlibc-0.31.20080409/lib/signalfd.c.implicitfunc dietlibc-0.31.20080409/lib/signalfd.c --- dietlibc-0.31.20080409/lib/signalfd.c.implicitfunc 2008-02-19 01:28:13.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/signalfd.c 2008-04-13 22:30:48.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/signalfd.c 2008-04-13 22:52:10.000000000 +0200 @@ -1,6 +1,8 @@ #include #include @@ -10,3 +10,34 @@ diff -up dietlibc-0.31.20080409/lib/signalfd.c.implicitfunc dietlibc-0.31.200804 int signalfd(int fd,const sigset_t* mask,int flags) { if (flags) { /* bizarre glibc bullshit */ errno=EINVAL; +diff -up dietlibc-0.31.20080409/test/stdlib/tst-calloc.c.implicitfunc dietlibc-0.31.20080409/test/stdlib/tst-calloc.c +--- dietlibc-0.31.20080409/test/stdlib/tst-calloc.c.implicitfunc 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/stdlib/tst-calloc.c 2008-04-13 22:52:10.000000000 +0200 +@@ -17,6 +17,8 @@ + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + ++#define _BSD_SOURCE ++ + #include + #include + #include +diff -up dietlibc-0.31.20080409/test/stdlib/testsort.c.implicitfunc dietlibc-0.31.20080409/test/stdlib/testsort.c +--- dietlibc-0.31.20080409/test/stdlib/testsort.c.implicitfunc 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/stdlib/testsort.c 2008-04-13 22:52:10.000000000 +0200 +@@ -1,3 +1,5 @@ ++#define _BSD_SOURCE ++ + #include + #include + #include +diff -up dietlibc-0.31.20080409/test/getservbyname.c.implicitfunc dietlibc-0.31.20080409/test/getservbyname.c +--- dietlibc-0.31.20080409/test/getservbyname.c.implicitfunc 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/getservbyname.c 2008-04-13 22:53:38.000000000 +0200 +@@ -1,5 +1,6 @@ + #include + #include ++#include + + int main(int argc,char *argv[]) { + struct servent* se; From 585d8348aeb33029ffaf0dff63959dabd4679565 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 21:22:31 +0000 Subject: [PATCH 045/161] fixed a printf() statement --- dietlibc-0.31-pagesize.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index b0709b5..e105859 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -255,7 +255,7 @@ diff -up /dev/null dietlibc-0.31.20080409/test/sysconf.c + + if (cur!=exp) { + fprintf(stderr, "%s mismatch: got %ld, expected %ld\n", -+ cur, exp); ++ var, cur, exp); + return 1; + } + From 1a844ca2106e412a0d16962f27840080efda3916 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 21:23:19 +0000 Subject: [PATCH 046/161] fixed a lot of borken printf(3) format specifiers --- dietlibc-0.31-testsuite.patch | 207 ++++++++++++++++++++++++++++++++-- 1 file changed, 198 insertions(+), 9 deletions(-) diff --git a/dietlibc-0.31-testsuite.patch b/dietlibc-0.31-testsuite.patch index 59ea16d..5aa54d9 100644 --- a/dietlibc-0.31-testsuite.patch +++ b/dietlibc-0.31-testsuite.patch @@ -1,6 +1,6 @@ diff -up dietlibc-0.31.20080409/test/getmntent.c.testsuite dietlibc-0.31.20080409/test/getmntent.c --- dietlibc-0.31.20080409/test/getmntent.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/getmntent.c 2008-04-13 15:49:19.000000000 +0200 ++++ dietlibc-0.31.20080409/test/getmntent.c 2008-04-13 23:16:30.000000000 +0200 @@ -33,10 +33,6 @@ while ((e = getmntent(fstab))) { printf("closing /etc/fstab\n"); @@ -13,9 +13,41 @@ diff -up dietlibc-0.31.20080409/test/getmntent.c.testsuite dietlibc-0.31.2008040 return 0; } - +diff -up dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite dietlibc-0.31.20080409/test/stdio/tst-fphex.c +--- dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/stdio/tst-fphex.c 2008-04-13 23:16:30.000000000 +0200 +@@ -37,7 +37,7 @@ int main (int argc, char **argv) { + int n = snprintf (buf, sizeof buf, t->fmt, t->value); + if (n != strlen (t->expect) || strcmp (buf, t->expect) != 0) + { +- printf ("%s\tExpected \"%s\" (%u)\n\tGot \"%s\" (%d, %u)\n", ++ printf ("%s\tExpected \"%s\" (%zu)\n\tGot \"%s\" (%d, %zu)\n", + t->fmt, t->expect, strlen (t->expect), buf, n, strlen (buf)); + result = 1; + } +diff -up dietlibc-0.31.20080409/test/byteswap.c.testsuite dietlibc-0.31.20080409/test/byteswap.c +--- dietlibc-0.31.20080409/test/byteswap.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/byteswap.c 2008-04-13 23:16:30.000000000 +0200 +@@ -9,12 +9,12 @@ int main() { + snprintf(buf,100,"%x %x", bswap_16(0x1234), bswap_16(0x5678)); + assert(strcmp(buf, "3412 7856") == 0); + +- printf("%lx\n",bswap_32(0x12345678)); +- snprintf(buf,100,"%lx", bswap_32(0x12345678)); ++ printf("%x\n",(unsigned int)bswap_32(0x12345678)); ++ snprintf(buf,100,"%x", (unsigned int)bswap_32(0x12345678)); + assert(strcmp(buf, "78563412") == 0); + +- printf("%qx\n",bswap_64(0x123456789ABCDEFull)); +- snprintf(buf,100,"%qx", bswap_64(0x123456789ABCDEFull)); ++ printf("%llx\n",(unsigned long long)bswap_64(0x123456789ABCDEFull)); ++ snprintf(buf,100,"%llx", (unsigned long long)bswap_64(0x123456789ABCDEFull)); + assert(strcmp(buf, "efcdab8967452301") == 0); + return 0; + } diff -up dietlibc-0.31.20080409/test/runtests.sh.testsuite dietlibc-0.31.20080409/test/runtests.sh ---- dietlibc-0.31.20080409/test/runtests.sh.testsuite 2008-04-13 14:54:58.000000000 +0200 -+++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 14:54:58.000000000 +0200 +--- dietlibc-0.31.20080409/test/runtests.sh.testsuite 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 23:16:30.000000000 +0200 @@ -1,6 +1,6 @@ SUBDIRS="dirent inet stdio string stdlib time" @@ -24,9 +56,39 @@ diff -up dietlibc-0.31.20080409/test/runtests.sh.testsuite dietlibc-0.31.2008040 STDIN="read1" PASS="getpass" +diff -up dietlibc-0.31.20080409/test/cycles.c.testsuite dietlibc-0.31.20080409/test/cycles.c +--- dietlibc-0.31.20080409/test/cycles.c.testsuite 2004-08-24 12:10:48.000000000 +0200 ++++ dietlibc-0.31.20080409/test/cycles.c 2008-04-13 23:16:30.000000000 +0200 +@@ -24,7 +24,7 @@ int main(int argc,char* argv[]) { + if (!fork()) { execve(argv[1],argv+1,environ); exit(1); } + wait(0); + RDTSC(b); +- printf("%llu cycles\n",b-a); ++ printf("%llu cycles\n",(unsigned long long)(b-a)); + + return 0; + } +diff -up dietlibc-0.31.20080409/test/sysenter.c.testsuite dietlibc-0.31.20080409/test/sysenter.c +--- dietlibc-0.31.20080409/test/sysenter.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/sysenter.c 2008-04-13 23:16:30.000000000 +0200 +@@ -11,11 +11,11 @@ int main() { + int i; + for (i=0; environ[i]; ++i) ; + for (x=(struct elf_aux*)(environ+i+1); x->type; ++x) { +- printf("%d %x\n",x->type,x->value); ++ printf("%ld %lx\n",x->type,x->value); + if (x->type==AT_PAGESZ) +- printf("pagesize %d\n",x->value); ++ printf("pagesize %ld\n",x->value); + else if (x->type==AT_SYSINFO) +- printf("vsyscall %p\n",x->value); ++ printf("vsyscall %p\n",(void *)x->value); + } + return 0; + } diff -up dietlibc-0.31.20080409/test/Makefile.testsuite dietlibc-0.31.20080409/test/Makefile ---- dietlibc-0.31.20080409/test/Makefile.testsuite 2008-04-13 14:54:58.000000000 +0200 -+++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 14:54:58.000000000 +0200 +--- dietlibc-0.31.20080409/test/Makefile.testsuite 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 23:16:30.000000000 +0200 @@ -10,7 +10,7 @@ LCOMPAT=-lcompat TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty flush fnmatch \ fputc ftw fwrite getaddrinfo getenv getgrnam gethostbyaddr gethostbyname \ @@ -36,9 +98,44 @@ diff -up dietlibc-0.31.20080409/test/Makefile.testsuite dietlibc-0.31.20080409/t 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 \ +diff -up dietlibc-0.31.20080409/test/bsearch.c.testsuite dietlibc-0.31.20080409/test/bsearch.c +--- dietlibc-0.31.20080409/test/bsearch.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/bsearch.c 2008-04-13 23:16:30.000000000 +0200 +@@ -35,7 +35,7 @@ int main() { + die("bsearch returned NULL\n"); + } + if (k != array+i) die("bsearch found wrong element\n"); +- printf("%d\n",k-array); ++ printf("%ld\n",k-array); + } + } + return 0; +diff -up dietlibc-0.31.20080409/test/printftest.c.testsuite dietlibc-0.31.20080409/test/printftest.c +--- dietlibc-0.31.20080409/test/printftest.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/printftest.c 2008-04-13 23:16:50.000000000 +0200 +@@ -101,8 +101,8 @@ int main() + printf("#%i#\n",18); + printf("#%d#\n",18); + printf("#%u#\n",18); +- printf("#%lu#\n",18); +- printf("#%li#\n",18); ++ printf("#%lu#\n",18l); ++ printf("#%li#\n",18l); + printf("#%-+#06d#\n", -123); + printf("#%-+#6d#\n", -123); + printf("#%+#06d#\n", -123); +@@ -142,7 +142,7 @@ int main() + buf); + memset(buf2,0,sizeof(buf)); + i=snprintf(buf2, 256, "%.9999u", 10); +- printf("%i %i\n",i,strlen(buf2)); ++ printf("%i %li\n",i,strlen(buf2)); + + printf ("snprintf (\"%%.999999u\", 10) == %d\n", + snprintf(buf2, sizeof(buf2), "%.999999u", 10)); diff -up dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-malloc.c --- dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdlib/tst-malloc.c 2008-04-13 14:54:58.000000000 +0200 ++++ dietlibc-0.31.20080409/test/stdlib/tst-malloc.c 2008-04-13 23:16:30.000000000 +0200 @@ -21,13 +21,15 @@ #include #include @@ -68,9 +165,51 @@ diff -up dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite dietlibc-0.31 p = realloc (p, 0); if (p != NULL) +diff -up dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-strtod.c +--- dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/stdlib/tst-strtod.c 2008-04-13 23:16:30.000000000 +0200 +@@ -149,10 +149,10 @@ main (int argc, char ** argv) + } + + const char input2[] = "+1.000000000116415321826934814453125"; +- if (strtold (input2, NULL) != +1.000000000116415321826934814453125) ++ if (strtold (input2, NULL) != +1.000000000116415321826934814453125L) + { + printf ("input2: %La != %La\n", strtold (input2, NULL), +- +1.000000000116415321826934814453125); ++ +1.000000000116415321826934814453125L); + status = 1; + } + +diff -up dietlibc-0.31.20080409/test/rand48.c.testsuite dietlibc-0.31.20080409/test/rand48.c +--- dietlibc-0.31.20080409/test/rand48.c.testsuite 2002-05-29 15:20:40.000000000 +0200 ++++ dietlibc-0.31.20080409/test/rand48.c 2008-04-13 23:16:30.000000000 +0200 +@@ -6,16 +6,16 @@ main (void) + { + static unsigned short data[7] = { 1, 2, 3, 4, 5, 6, 7 }; + +- printf ("one %X\n", mrand48 ()); +- printf ("two %X\n", mrand48 ()); +- printf ("three %X\n", mrand48 ()); ++ printf ("one %lX\n", mrand48 ()); ++ printf ("two %lX\n", mrand48 ()); ++ printf ("three %lX\n", mrand48 ()); + + lcong48 (data); + printf ("after lcong48:\n"); + +- printf ("one %X\n", mrand48 ()); +- printf ("two %X\n", mrand48 ()); +- printf ("three %X\n", mrand48 ()); ++ printf ("one %lX\n", mrand48 ()); ++ printf ("two %lX\n", mrand48 ()); ++ printf ("three %lX\n", mrand48 ()); + + return 0; + } diff -up dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strftime.c --- dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/time/tst-strftime.c 2008-04-13 14:54:58.000000000 +0200 ++++ dietlibc-0.31.20080409/test/time/tst-strftime.c 2008-04-13 23:16:30.000000000 +0200 @@ -49,18 +49,18 @@ int main (void) { if (res == 0) @@ -95,7 +234,7 @@ diff -up dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite dietlibc-0.31 } diff -up dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strptime.c --- dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/time/tst-strptime.c 2008-04-13 14:54:58.000000000 +0200 ++++ dietlibc-0.31.20080409/test/time/tst-strptime.c 2008-04-13 23:16:30.000000000 +0200 @@ -41,10 +41,12 @@ static const struct { "C", "03/03/00", "%D", 5, 62, 2, 3 }, { "C", "9/9/99", "%x", 4, 251, 8, 9 }, @@ -152,9 +291,43 @@ diff -up dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite dietlibc-0.31 { printf ("not all of `%s' read\n", day_tests[i].input); result = 1; +diff -up dietlibc-0.31.20080409/test/mktime.c.testsuite dietlibc-0.31.20080409/test/mktime.c +--- dietlibc-0.31.20080409/test/mktime.c.testsuite 2004-03-27 01:47:00.000000000 +0100 ++++ dietlibc-0.31.20080409/test/mktime.c 2008-04-13 23:16:30.000000000 +0200 +@@ -9,15 +9,15 @@ int main() { + t.tm_mday=29; + t.tm_mon=2; + t.tm_year=100; +- printf("%d\n",mktime(&t)); ++ printf("%ld\n",(long)mktime(&t)); + t.tm_mday=1; + t.tm_mon=3; + t.tm_year=102; +- printf("%d\n",mktime(&t)); ++ printf("%ld\n",(long)mktime(&t)); + t.tm_mday=1; + t.tm_mon=6; + t.tm_year=102; +- printf("%d\n",mktime(&t)); ++ printf("%ld\n",(long)mktime(&t)); + return 0; + } + +diff -up dietlibc-0.31.20080409/test/asprintf.c.testsuite dietlibc-0.31.20080409/test/asprintf.c +--- dietlibc-0.31.20080409/test/asprintf.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/asprintf.c 2008-04-13 23:16:30.000000000 +0200 +@@ -13,7 +13,7 @@ int main(int argc, char **argv) { + assert(strlen(path) == asprintlen); + + printf("%s\n", path); +- asprintlen=asprintf(&path, "/proc" "/%d/stat", strlen(argv[1])); ++ asprintlen=asprintf(&path, "/proc" "/%zu/stat", strlen(argv[1])); + assert(strlen(path) == asprintlen); + printf("%s\n", path); + diff -up /dev/null dietlibc-0.31.20080409/test/math.c --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/test/math.c 2008-04-13 14:54:58.000000000 +0200 ++++ dietlibc-0.31.20080409/test/math.c 2008-04-13 23:16:30.000000000 +0200 @@ -0,0 +1,18 @@ +#include +#include @@ -174,3 +347,19 @@ diff -up /dev/null dietlibc-0.31.20080409/test/math.c + + return 0; +} +diff -up dietlibc-0.31.20080409/test/speed.c.testsuite dietlibc-0.31.20080409/test/speed.c +--- dietlibc-0.31.20080409/test/speed.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/speed.c 2008-04-13 23:16:30.000000000 +0200 +@@ -7,10 +7,10 @@ int main() { + int i; + time_t t; + +- printf("%d\n", time(0)); ++ printf("%ld\n", (long)time(0)); + for (i=0; i<10000000; ++i) + t=time(0); + +- printf("%d\n", time(0)); ++ printf("%ld\n", (long)time(0)); + return 0; + } From 318d905e03dff9283dff9287714e12b5954c635c Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 21:24:13 +0000 Subject: [PATCH 047/161] added -noreturn patch deactivated some debug code --- dietlibc.spec | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index ff6bbc9..11bba9c 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -56,6 +56,7 @@ Patch45: dietlibc-0.31-stat64.patch Patch46: dietlibc-0.31-testsuite.patch Patch47: dietlibc-0.31-lcctime.patch Patch48: dietlibc-0.31-implicitfunc.patch +Patch49: dietlibc-0.31-noreturn.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -111,6 +112,7 @@ This package contains the dynamic libraries for dietlibc. %patch46 -p1 -b .testsuite %patch47 -p1 -b .lcctime %patch48 -p1 -b .implicitfunc +%patch49 -p1 -b .noreturn %if %{without ssp} @@ -168,14 +170,14 @@ make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) cd test ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -readelf -a ./ftw || : -objdump -d ./ftw || : -gdb ./ftw -ex 'r' -ex 'bt' -ex 'info registers' -ex 'info locals' -ex 'p environ' -ex 'print __elfinfo' -ex 'q' || : -dmesg | tail || : +if false; then + readelf -a ./ftw || : + objdump -d ./ftw || : + gdb ./ftw -ex 'r' -ex 'bt' -ex 'info registers' -ex 'info locals' -ex 'p environ' -ex 'print __elfinfo' -ex 'q' || : + dmesg | tail || : +fi -sleep 60 - -bash ./runtests-X.sh +bash ./runtests-X.sh || { sleep 60 ; false; } %clean From 538991a0f92ede9e4f2df22b465cdd9815283642 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 21:39:16 +0000 Subject: [PATCH 048/161] use a better definition for INFINITY whitespace cleanup --- dietlibc-0.31-printFG.patch | 78 ++++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 23 deletions(-) diff --git a/dietlibc-0.31-printFG.patch b/dietlibc-0.31-printFG.patch index f8996d1..5e9736d 100644 --- a/dietlibc-0.31-printFG.patch +++ b/dietlibc-0.31-printFG.patch @@ -1,6 +1,6 @@ diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/lib/__dtostr.c --- dietlibc-0.31.20080409/lib/__dtostr.c.printFG 2006-07-04 05:33:02.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/__dtostr.c 2008-04-13 22:26:13.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/__dtostr.c 2008-04-13 23:34:48.000000000 +0200 @@ -5,13 +5,15 @@ static int copystring(char* buf,int maxlen, const char* s) { @@ -51,7 +51,7 @@ diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/li } else { diff -up dietlibc-0.31.20080409/lib/__v_printf.c.printFG dietlibc-0.31.20080409/lib/__v_printf.c --- dietlibc-0.31.20080409/lib/__v_printf.c.printFG 2008-02-19 01:28:13.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/__v_printf.c 2008-04-13 22:26:32.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/__v_printf.c 2008-04-13 23:34:48.000000000 +0200 @@ -4,6 +4,7 @@ #include #include @@ -138,8 +138,8 @@ diff -up dietlibc-0.31.20080409/lib/__v_printf.c.printFG dietlibc-0.31.20080409/ sz=strlen(s); diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/test/printf.c --- dietlibc-0.31.20080409/test/printf.c.printFG 2008-02-19 01:28:13.000000000 +0100 -+++ dietlibc-0.31.20080409/test/printf.c 2008-04-13 22:26:13.000000000 +0200 -@@ -2,11 +2,24 @@ ++++ dietlibc-0.31.20080409/test/printf.c 2008-04-13 23:36:42.000000000 +0200 +@@ -2,11 +2,26 @@ #include #include #include @@ -151,7 +151,9 @@ diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/tes #define ALGN 5 +#ifndef INFINITY -+# define INFINITY (DBL_MAX * DBL_MAX) ++# if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) ++# define INFINITY (__builtin_inf()) ++# endif +#endif + +#ifndef NAN @@ -164,33 +166,63 @@ diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/tes // https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=112986 #if 0 #undef assert -@@ -131,6 +144,23 @@ int main() +@@ -60,7 +75,7 @@ + TEST_SNPRINTF(EXP, 0, __VA_ARGS__); \ + TEST_SNPRINTF(EXP, sizeof(EXP)+ALGN, __VA_ARGS__); \ + TEST_SNPRINTF_NULL(EXP, __VA_ARGS__) +- ++ + + int main() + { +@@ -101,7 +116,7 @@ int main() + TEST("42.23", "%5.2f", 42.23); + TEST("42.23", "%5.4g", 42.23); + TEST(" 42.2", "%5.3g", 42.23); +- ++ + TEST(" 1", "%*i", 4, 1); + TEST(" 1", "%4i", 1); + TEST("1 ", "%-4i", 1); +@@ -131,13 +146,32 @@ int main() TEST("-01234", "%6.5i", -1234); TEST(" 1234", "%6.5s", "1234"); -+ TEST("inf", "%f", INFINITY); -+ TEST("-inf", "%f", -INFINITY); -+ TEST("INF", "%F", INFINITY); -+ TEST("-INF", "%F", -INFINITY); ++#ifdef INFINITY ++ TEST("inf", "%f", INFINITY); ++ TEST("-inf", "%f", -INFINITY); ++ TEST("INF", "%F", INFINITY); ++ TEST("-INF", "%F", -INFINITY); + -+ TEST("inf", "%g", INFINITY); -+ TEST("-inf", "%g", -INFINITY); -+ TEST("INF", "%G", INFINITY); -+ TEST("-INF", "%G", -INFINITY); -+ -+#ifdef NAN -+ TEST("nan", "%f", NAN); -+ TEST("NAN", "%F", NAN); -+ TEST("nan", "%g", NAN); -+ TEST("NAN", "%G", NAN); ++ TEST("inf", "%g", INFINITY); ++ TEST("-inf", "%g", -INFINITY); ++ TEST("INF", "%G", INFINITY); ++ TEST("-INF", "%G", -INFINITY); +#endif -+ ++ ++#ifdef NAN ++ TEST("nan", "%f", NAN); ++ TEST("NAN", "%F", NAN); ++ TEST("nan", "%g", NAN); ++ TEST("NAN", "%G", NAN); ++#endif ++ #ifdef XSI_TESTS setlocale(LC_ALL, "de_DE"); - +- ++ + TEST("1.234", "%'u", 1234); + TEST("2 1", "%2$u %1$u", 1, 2); + #endif +- +- ++ ++ + return EXIT_SUCCESS; + } diff -up dietlibc-0.31.20080409/include/stdlib.h.printFG dietlibc-0.31.20080409/include/stdlib.h --- dietlibc-0.31.20080409/include/stdlib.h.printFG 2007-09-20 20:51:18.000000000 +0200 -+++ dietlibc-0.31.20080409/include/stdlib.h 2008-04-13 22:26:13.000000000 +0200 ++++ dietlibc-0.31.20080409/include/stdlib.h 2008-04-13 23:34:48.000000000 +0200 @@ -28,8 +28,12 @@ long double strtold(const char *nptr, ch long int strtol(const char *nptr, char **endptr, int base) __THROW; unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW; From 005894e4000b13a91648d25c2031da988fa324c4 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 21:54:21 +0000 Subject: [PATCH 049/161] disabled -inf testcases for now --- dietlibc-0.31-printFG.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dietlibc-0.31-printFG.patch b/dietlibc-0.31-printFG.patch index 5e9736d..b480128 100644 --- a/dietlibc-0.31-printFG.patch +++ b/dietlibc-0.31-printFG.patch @@ -190,14 +190,14 @@ diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/tes +#ifdef INFINITY + TEST("inf", "%f", INFINITY); -+ TEST("-inf", "%f", -INFINITY); ++ //TEST("-inf", "%f", -INFINITY); + TEST("INF", "%F", INFINITY); -+ TEST("-INF", "%F", -INFINITY); ++ //TEST("-INF", "%F", -INFINITY); + + TEST("inf", "%g", INFINITY); -+ TEST("-inf", "%g", -INFINITY); ++ //TEST("-inf", "%g", -INFINITY); + TEST("INF", "%G", INFINITY); -+ TEST("-INF", "%G", -INFINITY); ++ //TEST("-INF", "%G", -INFINITY); +#endif + +#ifdef NAN From d23740c86936291fc40dd47ba6f0266934a3d8b4 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 21:55:08 +0000 Subject: [PATCH 050/161] added other INFINITY testcases --- dietlibc-0.31-testsuite.patch | 46 +++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/dietlibc-0.31-testsuite.patch b/dietlibc-0.31-testsuite.patch index 5aa54d9..18783e0 100644 --- a/dietlibc-0.31-testsuite.patch +++ b/dietlibc-0.31-testsuite.patch @@ -1,6 +1,6 @@ diff -up dietlibc-0.31.20080409/test/getmntent.c.testsuite dietlibc-0.31.20080409/test/getmntent.c --- dietlibc-0.31.20080409/test/getmntent.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/getmntent.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/getmntent.c 2008-04-13 23:51:41.000000000 +0200 @@ -33,10 +33,6 @@ while ((e = getmntent(fstab))) { printf("closing /etc/fstab\n"); @@ -15,7 +15,7 @@ diff -up dietlibc-0.31.20080409/test/getmntent.c.testsuite dietlibc-0.31.2008040 - diff -up dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite dietlibc-0.31.20080409/test/stdio/tst-fphex.c --- dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdio/tst-fphex.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/stdio/tst-fphex.c 2008-04-13 23:51:41.000000000 +0200 @@ -37,7 +37,7 @@ int main (int argc, char **argv) { int n = snprintf (buf, sizeof buf, t->fmt, t->value); if (n != strlen (t->expect) || strcmp (buf, t->expect) != 0) @@ -27,7 +27,7 @@ diff -up dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite dietlibc-0.31.2 } diff -up dietlibc-0.31.20080409/test/byteswap.c.testsuite dietlibc-0.31.20080409/test/byteswap.c --- dietlibc-0.31.20080409/test/byteswap.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/byteswap.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/byteswap.c 2008-04-13 23:51:41.000000000 +0200 @@ -9,12 +9,12 @@ int main() { snprintf(buf,100,"%x %x", bswap_16(0x1234), bswap_16(0x5678)); assert(strcmp(buf, "3412 7856") == 0); @@ -46,8 +46,8 @@ diff -up dietlibc-0.31.20080409/test/byteswap.c.testsuite dietlibc-0.31.20080409 return 0; } diff -up dietlibc-0.31.20080409/test/runtests.sh.testsuite dietlibc-0.31.20080409/test/runtests.sh ---- dietlibc-0.31.20080409/test/runtests.sh.testsuite 2008-04-13 23:16:30.000000000 +0200 -+++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 23:16:30.000000000 +0200 +--- dietlibc-0.31.20080409/test/runtests.sh.testsuite 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 23:51:41.000000000 +0200 @@ -1,6 +1,6 @@ SUBDIRS="dirent inet stdio string stdlib time" @@ -58,7 +58,7 @@ diff -up dietlibc-0.31.20080409/test/runtests.sh.testsuite dietlibc-0.31.2008040 PASS="getpass" diff -up dietlibc-0.31.20080409/test/cycles.c.testsuite dietlibc-0.31.20080409/test/cycles.c --- dietlibc-0.31.20080409/test/cycles.c.testsuite 2004-08-24 12:10:48.000000000 +0200 -+++ dietlibc-0.31.20080409/test/cycles.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/cycles.c 2008-04-13 23:51:41.000000000 +0200 @@ -24,7 +24,7 @@ int main(int argc,char* argv[]) { if (!fork()) { execve(argv[1],argv+1,environ); exit(1); } wait(0); @@ -70,7 +70,7 @@ diff -up dietlibc-0.31.20080409/test/cycles.c.testsuite dietlibc-0.31.20080409/t } diff -up dietlibc-0.31.20080409/test/sysenter.c.testsuite dietlibc-0.31.20080409/test/sysenter.c --- dietlibc-0.31.20080409/test/sysenter.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/sysenter.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/sysenter.c 2008-04-13 23:51:41.000000000 +0200 @@ -11,11 +11,11 @@ int main() { int i; for (i=0; environ[i]; ++i) ; @@ -87,8 +87,8 @@ diff -up dietlibc-0.31.20080409/test/sysenter.c.testsuite dietlibc-0.31.20080409 return 0; } diff -up dietlibc-0.31.20080409/test/Makefile.testsuite dietlibc-0.31.20080409/test/Makefile ---- dietlibc-0.31.20080409/test/Makefile.testsuite 2008-04-13 23:16:30.000000000 +0200 -+++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 23:16:30.000000000 +0200 +--- dietlibc-0.31.20080409/test/Makefile.testsuite 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 23:51:41.000000000 +0200 @@ -10,7 +10,7 @@ LCOMPAT=-lcompat TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty flush fnmatch \ fputc ftw fwrite getaddrinfo getenv getgrnam gethostbyaddr gethostbyname \ @@ -100,7 +100,7 @@ diff -up dietlibc-0.31.20080409/test/Makefile.testsuite dietlibc-0.31.20080409/t speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr \ diff -up dietlibc-0.31.20080409/test/bsearch.c.testsuite dietlibc-0.31.20080409/test/bsearch.c --- dietlibc-0.31.20080409/test/bsearch.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/bsearch.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/bsearch.c 2008-04-13 23:51:41.000000000 +0200 @@ -35,7 +35,7 @@ int main() { die("bsearch returned NULL\n"); } @@ -112,7 +112,7 @@ diff -up dietlibc-0.31.20080409/test/bsearch.c.testsuite dietlibc-0.31.20080409/ return 0; diff -up dietlibc-0.31.20080409/test/printftest.c.testsuite dietlibc-0.31.20080409/test/printftest.c --- dietlibc-0.31.20080409/test/printftest.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/printftest.c 2008-04-13 23:16:50.000000000 +0200 ++++ dietlibc-0.31.20080409/test/printftest.c 2008-04-13 23:51:41.000000000 +0200 @@ -101,8 +101,8 @@ int main() printf("#%i#\n",18); printf("#%d#\n",18); @@ -135,7 +135,7 @@ diff -up dietlibc-0.31.20080409/test/printftest.c.testsuite dietlibc-0.31.200804 snprintf(buf2, sizeof(buf2), "%.999999u", 10)); diff -up dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-malloc.c --- dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdlib/tst-malloc.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/stdlib/tst-malloc.c 2008-04-13 23:51:41.000000000 +0200 @@ -21,13 +21,15 @@ #include #include @@ -167,7 +167,7 @@ diff -up dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite dietlibc-0.31 if (p != NULL) diff -up dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-strtod.c --- dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdlib/tst-strtod.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/stdlib/tst-strtod.c 2008-04-13 23:51:41.000000000 +0200 @@ -149,10 +149,10 @@ main (int argc, char ** argv) } @@ -183,7 +183,7 @@ diff -up dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite dietlibc-0.31 diff -up dietlibc-0.31.20080409/test/rand48.c.testsuite dietlibc-0.31.20080409/test/rand48.c --- dietlibc-0.31.20080409/test/rand48.c.testsuite 2002-05-29 15:20:40.000000000 +0200 -+++ dietlibc-0.31.20080409/test/rand48.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/rand48.c 2008-04-13 23:51:41.000000000 +0200 @@ -6,16 +6,16 @@ main (void) { static unsigned short data[7] = { 1, 2, 3, 4, 5, 6, 7 }; @@ -209,7 +209,7 @@ diff -up dietlibc-0.31.20080409/test/rand48.c.testsuite dietlibc-0.31.20080409/t } diff -up dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strftime.c --- dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/time/tst-strftime.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/time/tst-strftime.c 2008-04-13 23:51:41.000000000 +0200 @@ -49,18 +49,18 @@ int main (void) { if (res == 0) @@ -234,7 +234,7 @@ diff -up dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite dietlibc-0.31 } diff -up dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strptime.c --- dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/time/tst-strptime.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/time/tst-strptime.c 2008-04-13 23:51:41.000000000 +0200 @@ -41,10 +41,12 @@ static const struct { "C", "03/03/00", "%D", 5, 62, 2, 3 }, { "C", "9/9/99", "%x", 4, 251, 8, 9 }, @@ -293,7 +293,7 @@ diff -up dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite dietlibc-0.31 result = 1; diff -up dietlibc-0.31.20080409/test/mktime.c.testsuite dietlibc-0.31.20080409/test/mktime.c --- dietlibc-0.31.20080409/test/mktime.c.testsuite 2004-03-27 01:47:00.000000000 +0100 -+++ dietlibc-0.31.20080409/test/mktime.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/mktime.c 2008-04-13 23:51:41.000000000 +0200 @@ -9,15 +9,15 @@ int main() { t.tm_mday=29; t.tm_mon=2; @@ -315,7 +315,7 @@ diff -up dietlibc-0.31.20080409/test/mktime.c.testsuite dietlibc-0.31.20080409/t diff -up dietlibc-0.31.20080409/test/asprintf.c.testsuite dietlibc-0.31.20080409/test/asprintf.c --- dietlibc-0.31.20080409/test/asprintf.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/asprintf.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/asprintf.c 2008-04-13 23:51:41.000000000 +0200 @@ -13,7 +13,7 @@ int main(int argc, char **argv) { assert(strlen(path) == asprintlen); @@ -327,8 +327,8 @@ diff -up dietlibc-0.31.20080409/test/asprintf.c.testsuite dietlibc-0.31.20080409 diff -up /dev/null dietlibc-0.31.20080409/test/math.c --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/test/math.c 2008-04-13 23:16:30.000000000 +0200 -@@ -0,0 +1,18 @@ ++++ dietlibc-0.31.20080409/test/math.c 2008-04-13 23:51:57.000000000 +0200 +@@ -0,0 +1,22 @@ +#include +#include +#include @@ -338,6 +338,10 @@ diff -up /dev/null dietlibc-0.31.20080409/test/math.c +#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) + assert(isinf(__builtin_inff())==1); + assert(isinf(-__builtin_inff())==-1); ++ ++ assert(isinf(__builtin_inf())==1); ++ assert(isinf(-__builtin_inf())==-1); ++ + assert(isnan(__builtin_nan(""))); +#endif + @@ -349,7 +353,7 @@ diff -up /dev/null dietlibc-0.31.20080409/test/math.c +} diff -up dietlibc-0.31.20080409/test/speed.c.testsuite dietlibc-0.31.20080409/test/speed.c --- dietlibc-0.31.20080409/test/speed.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/speed.c 2008-04-13 23:16:30.000000000 +0200 ++++ dietlibc-0.31.20080409/test/speed.c 2008-04-13 23:51:41.000000000 +0200 @@ -7,10 +7,10 @@ int main() { int i; time_t t; From 881b9971c981b198dbbc1ac3a1268e346ca454cd Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 22:52:24 +0000 Subject: [PATCH 051/161] - do not test for signess of isinf(3); C99 guarantees values of 0 and not 0 and does not differ between positive and negative inf. 'isinf(3)' is a builtin in gcc 4.3 and previous check won't work anymore. Instead of, test whether value is lesser or greater than zero. - renabled the INF testsuite --- dietlibc-0.31-printFG.patch | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/dietlibc-0.31-printFG.patch b/dietlibc-0.31-printFG.patch index b480128..5da6b17 100644 --- a/dietlibc-0.31-printFG.patch +++ b/dietlibc-0.31-printFG.patch @@ -1,6 +1,6 @@ diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/lib/__dtostr.c --- dietlibc-0.31.20080409/lib/__dtostr.c.printFG 2006-07-04 05:33:02.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/__dtostr.c 2008-04-13 23:34:48.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/__dtostr.c 2008-04-14 00:36:10.000000000 +0200 @@ -5,13 +5,15 @@ static int copystring(char* buf,int maxlen, const char* s) { @@ -20,27 +20,22 @@ diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/li #if 1 union { unsigned long long l; -@@ -31,12 +33,17 @@ int __dtostr(double d,char *buf,unsigned - signed long e10; - /* step 3: calculate 10^e10 */ - unsigned int i; -+ int is_inf; - double backup=d; +@@ -35,8 +37,12 @@ int __dtostr(double d,char *buf,unsigned double tmp; char *oldbuf=buf; - if ((i=isinf(d))) return copystring(buf,maxlen,i>0?"inf":"-inf"); - if (isnan(d)) return copystring(buf,maxlen,"nan"); -+ if ((is_inf=isinf(d))) ++ if (isinf(d)) + return copystring(buf,maxlen, -+ (is_inf<0)? ++ (d<0)? + (flags&0x02?"-INF":"-inf"): + (flags&0x02?"INF":"inf")); + if (isnan(d)) return copystring(buf,maxlen,flags&0x02?"NAN":"nan"); e10=1+(long)(e*0.30102999566398119802); /* log10(2) */ /* Wir iterieren von Links bis wir bei 0 sind oder maxlen erreicht * ist. Wenn maxlen erreicht ist, machen wir das nochmal in -@@ -126,7 +133,7 @@ int __dtostr(double d,char *buf,unsigned +@@ -126,7 +132,7 @@ int __dtostr(double d,char *buf,unsigned if (prec2 || prec>(unsigned int)(buf-oldbuf)+1) { /* more digits wanted */ if (!maxlen) return 0; --maxlen; *buf='.'; ++buf; @@ -51,7 +46,7 @@ diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/li } else { diff -up dietlibc-0.31.20080409/lib/__v_printf.c.printFG dietlibc-0.31.20080409/lib/__v_printf.c --- dietlibc-0.31.20080409/lib/__v_printf.c.printFG 2008-02-19 01:28:13.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/__v_printf.c 2008-04-13 23:34:48.000000000 +0200 ++++ dietlibc-0.31.20080409/lib/__v_printf.c 2008-04-14 00:36:10.000000000 +0200 @@ -4,6 +4,7 @@ #include #include @@ -138,7 +133,7 @@ diff -up dietlibc-0.31.20080409/lib/__v_printf.c.printFG dietlibc-0.31.20080409/ sz=strlen(s); diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/test/printf.c --- dietlibc-0.31.20080409/test/printf.c.printFG 2008-02-19 01:28:13.000000000 +0100 -+++ dietlibc-0.31.20080409/test/printf.c 2008-04-13 23:36:42.000000000 +0200 ++++ dietlibc-0.31.20080409/test/printf.c 2008-04-14 00:36:10.000000000 +0200 @@ -2,11 +2,26 @@ #include #include @@ -190,14 +185,14 @@ diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/tes +#ifdef INFINITY + TEST("inf", "%f", INFINITY); -+ //TEST("-inf", "%f", -INFINITY); ++ TEST("-inf", "%f", -INFINITY); + TEST("INF", "%F", INFINITY); -+ //TEST("-INF", "%F", -INFINITY); ++ TEST("-INF", "%F", -INFINITY); + + TEST("inf", "%g", INFINITY); -+ //TEST("-inf", "%g", -INFINITY); ++ TEST("-inf", "%g", -INFINITY); + TEST("INF", "%G", INFINITY); -+ //TEST("-INF", "%G", -INFINITY); ++ TEST("-INF", "%G", -INFINITY); +#endif + +#ifdef NAN @@ -222,7 +217,7 @@ diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/tes } diff -up dietlibc-0.31.20080409/include/stdlib.h.printFG dietlibc-0.31.20080409/include/stdlib.h --- dietlibc-0.31.20080409/include/stdlib.h.printFG 2007-09-20 20:51:18.000000000 +0200 -+++ dietlibc-0.31.20080409/include/stdlib.h 2008-04-13 23:34:48.000000000 +0200 ++++ dietlibc-0.31.20080409/include/stdlib.h 2008-04-14 00:36:10.000000000 +0200 @@ -28,8 +28,12 @@ long double strtold(const char *nptr, ch long int strtol(const char *nptr, char **endptr, int base) __THROW; unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW; From 3b7df881970596c40894c70cc799b534d8646862 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 22:55:07 +0000 Subject: [PATCH 052/161] - fixed tests using isinf(); the math.c test checks the dietlibc implementation of isinf() (which differs between positive and negative inf). All other tests use boolean retval only and test for the signess of the values --- dietlibc-0.31-testsuite.patch | 87 +++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 30 deletions(-) diff --git a/dietlibc-0.31-testsuite.patch b/dietlibc-0.31-testsuite.patch index 18783e0..bd5f24d 100644 --- a/dietlibc-0.31-testsuite.patch +++ b/dietlibc-0.31-testsuite.patch @@ -1,6 +1,6 @@ diff -up dietlibc-0.31.20080409/test/getmntent.c.testsuite dietlibc-0.31.20080409/test/getmntent.c --- dietlibc-0.31.20080409/test/getmntent.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/getmntent.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/getmntent.c 2008-04-14 00:41:17.000000000 +0200 @@ -33,10 +33,6 @@ while ((e = getmntent(fstab))) { printf("closing /etc/fstab\n"); @@ -15,7 +15,7 @@ diff -up dietlibc-0.31.20080409/test/getmntent.c.testsuite dietlibc-0.31.2008040 - diff -up dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite dietlibc-0.31.20080409/test/stdio/tst-fphex.c --- dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdio/tst-fphex.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/stdio/tst-fphex.c 2008-04-14 00:41:17.000000000 +0200 @@ -37,7 +37,7 @@ int main (int argc, char **argv) { int n = snprintf (buf, sizeof buf, t->fmt, t->value); if (n != strlen (t->expect) || strcmp (buf, t->expect) != 0) @@ -25,9 +25,29 @@ diff -up dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite dietlibc-0.31.2 t->fmt, t->expect, strlen (t->expect), buf, n, strlen (buf)); result = 1; } +diff -up dietlibc-0.31.20080409/test/stdio/tstscanf.c.testsuite dietlibc-0.31.20080409/test/stdio/tstscanf.c +--- dietlibc-0.31.20080409/test/stdio/tstscanf.c.testsuite 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.31.20080409/test/stdio/tstscanf.c 2008-04-14 00:47:36.000000000 +0200 +@@ -338,14 +338,14 @@ main (int argc, char **argv) + int res; + + res = sscanf ("-InF", "%f", &value); +- if (res != 1 || isinf (value) != -1) ++ if (res != 1 || !isinf (value) || !(value<0)) + { + fputs ("test failed!\n", stdout); + result = 1; + } + + res = sscanf ("+InfiNiTY", "%f", &value); +- if (res != 1 || isinf (value) != 1) ++ if (res != 1 || !isinf (value) || !(value>0)) + { + fputs ("test failed!\n", stdout); + result = 1; diff -up dietlibc-0.31.20080409/test/byteswap.c.testsuite dietlibc-0.31.20080409/test/byteswap.c --- dietlibc-0.31.20080409/test/byteswap.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/byteswap.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/byteswap.c 2008-04-14 00:41:17.000000000 +0200 @@ -9,12 +9,12 @@ int main() { snprintf(buf,100,"%x %x", bswap_16(0x1234), bswap_16(0x5678)); assert(strcmp(buf, "3412 7856") == 0); @@ -46,8 +66,8 @@ diff -up dietlibc-0.31.20080409/test/byteswap.c.testsuite dietlibc-0.31.20080409 return 0; } diff -up dietlibc-0.31.20080409/test/runtests.sh.testsuite dietlibc-0.31.20080409/test/runtests.sh ---- dietlibc-0.31.20080409/test/runtests.sh.testsuite 2008-04-13 23:51:41.000000000 +0200 -+++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 23:51:41.000000000 +0200 +--- dietlibc-0.31.20080409/test/runtests.sh.testsuite 2008-04-14 00:41:17.000000000 +0200 ++++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-14 00:41:17.000000000 +0200 @@ -1,6 +1,6 @@ SUBDIRS="dirent inet stdio string stdlib time" @@ -58,7 +78,7 @@ diff -up dietlibc-0.31.20080409/test/runtests.sh.testsuite dietlibc-0.31.2008040 PASS="getpass" diff -up dietlibc-0.31.20080409/test/cycles.c.testsuite dietlibc-0.31.20080409/test/cycles.c --- dietlibc-0.31.20080409/test/cycles.c.testsuite 2004-08-24 12:10:48.000000000 +0200 -+++ dietlibc-0.31.20080409/test/cycles.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/cycles.c 2008-04-14 00:41:17.000000000 +0200 @@ -24,7 +24,7 @@ int main(int argc,char* argv[]) { if (!fork()) { execve(argv[1],argv+1,environ); exit(1); } wait(0); @@ -70,7 +90,7 @@ diff -up dietlibc-0.31.20080409/test/cycles.c.testsuite dietlibc-0.31.20080409/t } diff -up dietlibc-0.31.20080409/test/sysenter.c.testsuite dietlibc-0.31.20080409/test/sysenter.c --- dietlibc-0.31.20080409/test/sysenter.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/sysenter.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/sysenter.c 2008-04-14 00:41:17.000000000 +0200 @@ -11,11 +11,11 @@ int main() { int i; for (i=0; environ[i]; ++i) ; @@ -87,8 +107,8 @@ diff -up dietlibc-0.31.20080409/test/sysenter.c.testsuite dietlibc-0.31.20080409 return 0; } diff -up dietlibc-0.31.20080409/test/Makefile.testsuite dietlibc-0.31.20080409/test/Makefile ---- dietlibc-0.31.20080409/test/Makefile.testsuite 2008-04-13 23:51:41.000000000 +0200 -+++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 23:51:41.000000000 +0200 +--- dietlibc-0.31.20080409/test/Makefile.testsuite 2008-04-14 00:41:17.000000000 +0200 ++++ dietlibc-0.31.20080409/test/Makefile 2008-04-14 00:41:17.000000000 +0200 @@ -10,7 +10,7 @@ LCOMPAT=-lcompat TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty flush fnmatch \ fputc ftw fwrite getaddrinfo getenv getgrnam gethostbyaddr gethostbyname \ @@ -100,7 +120,7 @@ diff -up dietlibc-0.31.20080409/test/Makefile.testsuite dietlibc-0.31.20080409/t speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr \ diff -up dietlibc-0.31.20080409/test/bsearch.c.testsuite dietlibc-0.31.20080409/test/bsearch.c --- dietlibc-0.31.20080409/test/bsearch.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/bsearch.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/bsearch.c 2008-04-14 00:41:17.000000000 +0200 @@ -35,7 +35,7 @@ int main() { die("bsearch returned NULL\n"); } @@ -112,7 +132,7 @@ diff -up dietlibc-0.31.20080409/test/bsearch.c.testsuite dietlibc-0.31.20080409/ return 0; diff -up dietlibc-0.31.20080409/test/printftest.c.testsuite dietlibc-0.31.20080409/test/printftest.c --- dietlibc-0.31.20080409/test/printftest.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/printftest.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/printftest.c 2008-04-14 00:41:17.000000000 +0200 @@ -101,8 +101,8 @@ int main() printf("#%i#\n",18); printf("#%d#\n",18); @@ -135,7 +155,7 @@ diff -up dietlibc-0.31.20080409/test/printftest.c.testsuite dietlibc-0.31.200804 snprintf(buf2, sizeof(buf2), "%.999999u", 10)); diff -up dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-malloc.c --- dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdlib/tst-malloc.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/stdlib/tst-malloc.c 2008-04-14 00:41:17.000000000 +0200 @@ -21,13 +21,15 @@ #include #include @@ -167,7 +187,7 @@ diff -up dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite dietlibc-0.31 if (p != NULL) diff -up dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-strtod.c --- dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdlib/tst-strtod.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/stdlib/tst-strtod.c 2008-04-14 00:41:17.000000000 +0200 @@ -149,10 +149,10 @@ main (int argc, char ** argv) } @@ -183,7 +203,7 @@ diff -up dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite dietlibc-0.31 diff -up dietlibc-0.31.20080409/test/rand48.c.testsuite dietlibc-0.31.20080409/test/rand48.c --- dietlibc-0.31.20080409/test/rand48.c.testsuite 2002-05-29 15:20:40.000000000 +0200 -+++ dietlibc-0.31.20080409/test/rand48.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/rand48.c 2008-04-14 00:41:17.000000000 +0200 @@ -6,16 +6,16 @@ main (void) { static unsigned short data[7] = { 1, 2, 3, 4, 5, 6, 7 }; @@ -209,7 +229,7 @@ diff -up dietlibc-0.31.20080409/test/rand48.c.testsuite dietlibc-0.31.20080409/t } diff -up dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strftime.c --- dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/time/tst-strftime.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/time/tst-strftime.c 2008-04-14 00:41:17.000000000 +0200 @@ -49,18 +49,18 @@ int main (void) { if (res == 0) @@ -234,7 +254,7 @@ diff -up dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite dietlibc-0.31 } diff -up dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strptime.c --- dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/time/tst-strptime.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/time/tst-strptime.c 2008-04-14 00:41:17.000000000 +0200 @@ -41,10 +41,12 @@ static const struct { "C", "03/03/00", "%D", 5, 62, 2, 3 }, { "C", "9/9/99", "%x", 4, 251, 8, 9 }, @@ -293,7 +313,7 @@ diff -up dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite dietlibc-0.31 result = 1; diff -up dietlibc-0.31.20080409/test/mktime.c.testsuite dietlibc-0.31.20080409/test/mktime.c --- dietlibc-0.31.20080409/test/mktime.c.testsuite 2004-03-27 01:47:00.000000000 +0100 -+++ dietlibc-0.31.20080409/test/mktime.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/mktime.c 2008-04-14 00:41:17.000000000 +0200 @@ -9,15 +9,15 @@ int main() { t.tm_mday=29; t.tm_mon=2; @@ -315,7 +335,7 @@ diff -up dietlibc-0.31.20080409/test/mktime.c.testsuite dietlibc-0.31.20080409/t diff -up dietlibc-0.31.20080409/test/asprintf.c.testsuite dietlibc-0.31.20080409/test/asprintf.c --- dietlibc-0.31.20080409/test/asprintf.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/asprintf.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/asprintf.c 2008-04-14 00:41:17.000000000 +0200 @@ -13,7 +13,7 @@ int main(int argc, char **argv) { assert(strlen(path) == asprintlen); @@ -327,33 +347,40 @@ diff -up dietlibc-0.31.20080409/test/asprintf.c.testsuite dietlibc-0.31.20080409 diff -up /dev/null dietlibc-0.31.20080409/test/math.c --- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/test/math.c 2008-04-13 23:51:57.000000000 +0200 -@@ -0,0 +1,22 @@ ++++ dietlibc-0.31.20080409/test/math.c 2008-04-14 00:46:45.000000000 +0200 +@@ -0,0 +1,29 @@ +#include +#include +#include + +int main() +{ ++ extern int __isinf(double d); ++ extern int __isnan(double d); ++ +#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) -+ assert(isinf(__builtin_inff())==1); -+ assert(isinf(-__builtin_inff())==-1); ++ assert(__isinf(__builtin_inff()) == +1); ++ assert(__isinf(-__builtin_inff()) == -1); + -+ assert(isinf(__builtin_inf())==1); -+ assert(isinf(-__builtin_inf())==-1); ++ assert(__isinf(__builtin_inf()) == +1); ++ assert(__isinf(-__builtin_inf()) == -1); + -+ assert(isnan(__builtin_nan(""))); ++ assert(__isnan(__builtin_nan(""))); +#endif + -+ assert(isinf((DBL_MAX * DBL_MAX))==1); -+ assert(isinf(-(DBL_MAX * DBL_MAX))==-1); -+ //assert(isnan(nan(""))); ++ assert(__isinf((DBL_MAX * DBL_MAX)) == +1); ++ assert(__isinf(-(DBL_MAX * DBL_MAX)) == -1); + -+ return 0; ++ assert(isinf((DBL_MAX * DBL_MAX))); ++ assert(isinf(-(DBL_MAX * DBL_MAX))); ++ ++ //assert(isnan(nan(""))); ++ ++ return 0; +} diff -up dietlibc-0.31.20080409/test/speed.c.testsuite dietlibc-0.31.20080409/test/speed.c --- dietlibc-0.31.20080409/test/speed.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/speed.c 2008-04-13 23:51:41.000000000 +0200 ++++ dietlibc-0.31.20080409/test/speed.c 2008-04-14 00:41:17.000000000 +0200 @@ -7,10 +7,10 @@ int main() { int i; time_t t; From a63829de79a650df3bc19f7f5031c1a6a0199c62 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 13 Apr 2008 22:57:58 +0000 Subject: [PATCH 053/161] - removed debug stuff from specfile - updated patches to work with new isinf() behavior of gcc 4.3 --- dietlibc.spec | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 11bba9c..0cca379 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -30,7 +30,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.31 -Release: %release_func 2%{?snapshot:.%snapshot} +Release: %release_func 3%{?snapshot:.%snapshot} License: GPL Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -170,14 +170,7 @@ make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) cd test ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -if false; then - readelf -a ./ftw || : - objdump -d ./ftw || : - gdb ./ftw -ex 'r' -ex 'bt' -ex 'info registers' -ex 'info locals' -ex 'p environ' -ex 'print __elfinfo' -ex 'q' || : - dmesg | tail || : -fi - -bash ./runtests-X.sh || { sleep 60 ; false; } +bash ./runtests-X.sh %clean @@ -208,6 +201,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Mon Apr 14 2008 Enrico Scholz - 0.31-3.20080409 +- removed debug stuff from specfile +- updated patches to work with new isinf() behavior of gcc 4.3 + * Sun Apr 13 2008 Enrico Scholz - 0.31-2.20080409 - added patch for dynamic PAGE_SIZE support - fixed/enhanced testsuite and removed the '|| :' in %%check From a977bf906b960f44d5a7000f8ec25a538c1d422b Mon Sep 17 00:00:00 2001 From: ensc Date: Sat, 19 Apr 2008 16:25:25 +0000 Subject: [PATCH 054/161] moved calculation of __elfinto into start.S; user could do e.g. '*environ = NULL' which breaks the current deferred calculation in __libc_getpagesize() do not return a predefined PAGE_SIZE when __elfinfo code fails --- dietlibc-0.31-pagesize.patch | 294 ++++++++++++++++++----------------- 1 file changed, 154 insertions(+), 140 deletions(-) diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index e105859..7a9f71e 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -1,6 +1,5 @@ -diff -up dietlibc-0.31.20080409/lib/mmap64.c.pagesize dietlibc-0.31.20080409/lib/mmap64.c ---- dietlibc-0.31.20080409/lib/mmap64.c.pagesize 2004-12-13 11:21:31.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/mmap64.c 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/lib/mmap64.c.pagesize ++++ dietlibc-0.31.20080409/lib/mmap64.c @@ -4,16 +4,18 @@ #include #include @@ -22,9 +21,8 @@ diff -up dietlibc-0.31.20080409/lib/mmap64.c.pagesize dietlibc-0.31.20080409/lib } void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) -diff -up dietlibc-0.31.20080409/lib/readdir64.c.pagesize dietlibc-0.31.20080409/lib/readdir64.c ---- dietlibc-0.31.20080409/lib/readdir64.c.pagesize 2004-03-02 22:27:19.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/readdir64.c 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/lib/readdir64.c.pagesize ++++ dietlibc-0.31.20080409/lib/readdir64.c @@ -14,7 +14,7 @@ #ifndef WANT_LARGEFILE_BACKCOMPAT struct dirent64* readdir64(DIR *d) { @@ -52,9 +50,8 @@ diff -up dietlibc-0.31.20080409/lib/readdir64.c.pagesize dietlibc-0.31.20080409/ if (res<=0) { if (errno==ENOSYS) { trygetdents64=0; -diff -up dietlibc-0.31.20080409/lib/opendir.c.pagesize dietlibc-0.31.20080409/lib/opendir.c ---- dietlibc-0.31.20080409/lib/opendir.c.pagesize 2002-07-03 22:33:38.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/opendir.c 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/lib/opendir.c.pagesize ++++ dietlibc-0.31.20080409/lib/opendir.c @@ -5,6 +5,8 @@ #include #include @@ -73,9 +70,8 @@ diff -up dietlibc-0.31.20080409/lib/opendir.c.pagesize dietlibc-0.31.20080409/li MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (t == MAP_FAILED) lose: -diff -up dietlibc-0.31.20080409/lib/readdir.c.pagesize dietlibc-0.31.20080409/lib/readdir.c ---- dietlibc-0.31.20080409/lib/readdir.c.pagesize 2002-07-03 22:33:38.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/readdir.c 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/lib/readdir.c.pagesize ++++ dietlibc-0.31.20080409/lib/readdir.c @@ -5,7 +5,7 @@ struct dirent* readdir(DIR *d) { @@ -85,9 +81,8 @@ diff -up dietlibc-0.31.20080409/lib/readdir.c.pagesize dietlibc-0.31.20080409/li if (res<=0) return 0; d->num=res; d->cur=0; } -diff -up dietlibc-0.31.20080409/lib/closedir.c.pagesize dietlibc-0.31.20080409/lib/closedir.c ---- dietlibc-0.31.20080409/lib/closedir.c.pagesize 2002-07-03 22:33:37.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/closedir.c 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/lib/closedir.c.pagesize ++++ dietlibc-0.31.20080409/lib/closedir.c @@ -4,8 +4,10 @@ #include #include @@ -100,9 +95,8 @@ diff -up dietlibc-0.31.20080409/lib/closedir.c.pagesize dietlibc-0.31.20080409/l + munmap (d, __DIET_PAGE_SIZE); return res; } -diff -up dietlibc-0.31.20080409/lib/alloc.c.pagesize dietlibc-0.31.20080409/lib/alloc.c ---- dietlibc-0.31.20080409/lib/alloc.c.pagesize 2007-08-03 22:58:33.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/alloc.c 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/lib/alloc.c.pagesize ++++ dietlibc-0.31.20080409/lib/alloc.c @@ -18,8 +18,7 @@ #include #include @@ -133,25 +127,25 @@ diff -up dietlibc-0.31.20080409/lib/alloc.c.pagesize dietlibc-0.31.20080409/lib/ static size_t REGPARM(1) get_index(size_t _size) { register size_t idx=0; -diff -up dietlibc-0.31.20080409/ppc/start.S.pagesize dietlibc-0.31.20080409/ppc/start.S ---- dietlibc-0.31.20080409/ppc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ppc/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -31,6 +31,12 @@ _start: +--- dietlibc-0.31.20080409/ppc/start.S.pagesize ++++ dietlibc-0.31.20080409/ppc/start.S +@@ -31,6 +31,14 @@ _start: lis 14,environ@ha stw 5,environ@l(14) +#ifdef WANT_ELFINFO -+ /* TODO: can we really assume that environ and __elfinfo are on the -+ same 16 bit page? */ ++1: lwzu 15,4(5) ++ cmpwi 15,0 ++ bne 1b ++ + stw 5,__elfinfo@l(14) +#endif + #ifdef WANT_DYNAMIC mr 6,7 bl _dyn_start -diff -up dietlibc-0.31.20080409/dietfeatures.h.pagesize dietlibc-0.31.20080409/dietfeatures.h ---- dietlibc-0.31.20080409/dietfeatures.h.pagesize 2007-10-09 01:15:27.000000000 +0200 -+++ dietlibc-0.31.20080409/dietfeatures.h 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/dietfeatures.h.pagesize ++++ dietlibc-0.31.20080409/dietfeatures.h @@ -126,6 +126,16 @@ /* #define WANT_SSP_XOR */ @@ -178,9 +172,8 @@ diff -up dietlibc-0.31.20080409/dietfeatures.h.pagesize dietlibc-0.31.20080409/d +#endif + #endif -diff -up dietlibc-0.31.20080409/test/Makefile.pagesize dietlibc-0.31.20080409/test/Makefile ---- dietlibc-0.31.20080409/test/Makefile.pagesize 2008-02-23 01:02:19.000000000 +0100 -+++ dietlibc-0.31.20080409/test/Makefile 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/test/Makefile.pagesize ++++ dietlibc-0.31.20080409/test/Makefile @@ -14,7 +14,7 @@ glob grent hasmntopt hello iconv if_name memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest \ protoent prototypes putenv pwent rand48 read1 readdir regex select sendfile servent siglist \ @@ -190,9 +183,8 @@ diff -up dietlibc-0.31.20080409/test/Makefile.pagesize dietlibc-0.31.20080409/te test: $(TESTPROGRAMS) -diff -up /dev/null dietlibc-0.31.20080409/test/sysconf.c ---- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/test/sysconf.c 2008-04-13 22:19:49.000000000 +0200 +--- /dev/null ++++ dietlibc-0.31.20080409/test/sysconf.c @@ -0,0 +1,80 @@ +#include +#include @@ -274,9 +266,8 @@ diff -up /dev/null dietlibc-0.31.20080409/test/sysconf.c + + return err; +} -diff -up dietlibc-0.31.20080409/test/runtests.sh.pagesize dietlibc-0.31.20080409/test/runtests.sh ---- dietlibc-0.31.20080409/test/runtests.sh.pagesize 2008-02-23 01:02:19.000000000 +0100 -+++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/test/runtests.sh.pagesize ++++ dietlibc-0.31.20080409/test/runtests.sh @@ -1,6 +1,6 @@ SUBDIRS="dirent inet stdio string stdlib time" @@ -285,14 +276,19 @@ diff -up dietlibc-0.31.20080409/test/runtests.sh.pagesize dietlibc-0.31.20080409 STDIN="read1" PASS="getpass" -diff -up dietlibc-0.31.20080409/sparc64/start.S.pagesize dietlibc-0.31.20080409/sparc64/start.S ---- dietlibc-0.31.20080409/sparc64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc64/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -25,6 +25,11 @@ _start: +--- dietlibc-0.31.20080409/sparc64/start.S.pagesize ++++ dietlibc-0.31.20080409/sparc64/start.S +@@ -25,6 +25,17 @@ _start: or %o3, %lo(environ), %o3 stx %o2, [%o3] +#ifdef WANT_ELFINFO ++# error "VERIFY ME!" ++1: add %o2, %o2, 8 ++ ldx [%o2-8], %o4 ++ orcc %o4, %o4, %o4 ++ bne 1b ++ + add %o3, %o3, 8 + stx %o2, [%o3] +#endif @@ -300,9 +296,8 @@ diff -up dietlibc-0.31.20080409/sparc64/start.S.pagesize dietlibc-0.31.20080409/ /* 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 -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.20080409/libcruft/sysconf.c ---- dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize 2002-12-20 14:32:37.000000000 +0100 -+++ dietlibc-0.31.20080409/libcruft/sysconf.c 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize ++++ dietlibc-0.31.20080409/libcruft/sysconf.c @@ -3,6 +3,9 @@ #include #include @@ -313,7 +308,7 @@ diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.200804 extern int __sc_nr_cpus(); long sysconf(int name) -@@ -16,6 +18,14 @@ long sysconf(int name) +@@ -16,6 +19,14 @@ long sysconf(int name) return limit.rlim_cur; } case _SC_CLK_TCK: @@ -328,7 +323,7 @@ diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.200804 #ifdef __alpha__ return 1024; #else -@@ -23,11 +33,7 @@ long sysconf(int name) +@@ -23,11 +34,7 @@ long sysconf(int name) #endif case _SC_PAGESIZE: @@ -341,39 +336,26 @@ diff -up dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize dietlibc-0.31.200804 case _SC_ARG_MAX: return ARG_MAX; -diff -up /dev/null dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c ---- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c 2008-04-13 22:19:49.000000000 +0200 -@@ -0,0 +1,25 @@ +--- /dev/null ++++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c +@@ -0,0 +1,14 @@ +#include +#include "../dietelfinfo.h" + +__diet_elf_addr_t *__get_elf_aux_value(unsigned int tag) +{ -+ extern char ** __elfinfo; -+ __diet_elf_addr_t *aux_ptr; -+ char ** tmp; ++ extern __diet_elf_addr_t const * const __elfinfo; ++ __diet_elf_addr_t *aux_ptr; + -+ /* External symbol points to 'environ' after startup. Now, go the end -+ * of 'environ'; the auxiliary ELF table is located immediately after -+ * this position */ -+ -+ /* operate on tmp instead of __elfinfo to be thread safe */ -+ tmp = __elfinfo; -+ while (*tmp) -+ ++tmp; -+ __elfinfo = tmp; -+ -+ for (aux_ptr = (__diet_elf_addr_t *)(tmp+1); aux_ptr[0]!=AT_NULL; aux_ptr += 2) ++ for (aux_ptr = __elfinfo; aux_ptr[0]!=AT_NULL; aux_ptr += 2) + if (aux_ptr[0]==tag) + return aux_ptr+1; + + return NULL; +} -diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20080409/libcruft/getpagesize.c ---- dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize 2002-02-23 23:18:42.000000000 +0100 -+++ dietlibc-0.31.20080409/libcruft/getpagesize.c 2008-04-13 22:19:49.000000000 +0200 -@@ -2,14 +2,25 @@ +--- dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize ++++ dietlibc-0.31.20080409/libcruft/getpagesize.c +@@ -2,14 +2,23 @@ #include #include @@ -393,8 +375,6 @@ diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20 + __diet_elf_addr_t *v = __get_elf_aux_value(AT_PAGESZ); + if (__likely(v)) + pgsz = *v; -+ else -+ pgsz = __DIET_PAGE_SIZE_PREDEF; + } + + return pgsz; @@ -405,9 +385,8 @@ diff -up dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize dietlibc-0.31.20 size_t getpagesize(void) __attribute__((weak,alias("__libc_getpagesize"))); - -diff -up /dev/null dietlibc-0.31.20080409/dietpagesize.h ---- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/dietpagesize.h 2008-04-13 22:19:49.000000000 +0200 +--- /dev/null ++++ dietlibc-0.31.20080409/dietpagesize.h @@ -0,0 +1,31 @@ +#ifndef H_DIETLIBC_DIETPAGESIZE_H +#define H_DIETLIBC_DIETPAGESIZE_H @@ -440,24 +419,28 @@ diff -up /dev/null dietlibc-0.31.20080409/dietpagesize.h +#endif + +#endif /* H_DIETLIBC_DIETPAGESIZE_H */ -diff -up dietlibc-0.31.20080409/s390x/start.S.pagesize dietlibc-0.31.20080409/s390x/start.S ---- dietlibc-0.31.20080409/s390x/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/s390x/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -26,6 +26,11 @@ _start: +--- dietlibc-0.31.20080409/s390x/start.S.pagesize ++++ dietlibc-0.31.20080409/s390x/start.S +@@ -26,6 +26,17 @@ _start: larl %r13,environ stg %r4,0(%r13) +#ifdef WANT_ELFINFO -+ ahi %r13, 8 /* TODO: does it really point to __elfinfo? */ ++# error "VERIFY ME!" ++1: aghi %r4, 8 # increment envp ++ lg %r12, -8(0,%r4) # load envp[-1] into %r12 ++ ogr %r12, %r12 # test %r12 for NULL ++ brc 1, 1b ++ ++ aghi %r13, 8 + stg %r4,0(%r13) +#endif + /* call main or _dyn_start */ #ifdef WANT_DYNAMIC brasl %r14,_dyn_start -diff -up /dev/null dietlibc-0.31.20080409/dietelfinfo.h ---- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/dietelfinfo.h 2008-04-13 22:21:09.000000000 +0200 +--- /dev/null ++++ dietlibc-0.31.20080409/dietelfinfo.h @@ -0,0 +1,20 @@ +#include "dietfeatures.h" + @@ -479,14 +462,18 @@ diff -up /dev/null dietlibc-0.31.20080409/dietelfinfo.h +__diet_elf_addr_t * __get_elf_aux_value(unsigned int tag) + __attribute__((__visibility__("hidden"),__const__)) __pure; +#endif -diff -up dietlibc-0.31.20080409/ia64/start.S.pagesize dietlibc-0.31.20080409/ia64/start.S ---- dietlibc-0.31.20080409/ia64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ia64/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -40,6 +40,11 @@ _start: +--- dietlibc-0.31.20080409/ia64/start.S.pagesize ++++ dietlibc-0.31.20080409/ia64/start.S +@@ -40,6 +40,16 @@ _start: ;; st8 [r14] = out2 /* store envp in environ */ +#ifdef WANT_ELFINFO ++# error "MAKE ME IE64 CODE!" ++1: ld8 r9 = [out2], 8 /* load *envp and increment it */ ++ orr r9 = r9, r9 /* test for NULL */ ++ bne 1b ++ + adds r14 = 8, r14 /* __elfinfo = environ + 8 */ + st8 [r14] = out2 /* store envp in __elfinfo */ +#endif @@ -494,23 +481,24 @@ diff -up dietlibc-0.31.20080409/ia64/start.S.pagesize dietlibc-0.31.20080409/ia6 #ifdef WANT_DYNAMIC /* FIXME: dl_init parameter ??? */ br.call.sptk.few rp = _dyn_start -diff -up dietlibc-0.31.20080409/i386/start.S.pagesize dietlibc-0.31.20080409/i386/start.S ---- dietlibc-0.31.20080409/i386/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/i386/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -25,6 +25,10 @@ _start: +--- dietlibc-0.31.20080409/i386/start.S.pagesize ++++ dietlibc-0.31.20080409/i386/start.S +@@ -25,6 +25,13 @@ _start: PIC_INIT /* non-PIC: this is an empty line */ PUT_VAR %eax, environ, %ecx /* non-PIC: movl %eax,environ */ +#ifdef WANT_ELFINFO ++1: add $4, %eax /* increment envp */ ++ cmpl $0, -4(%eax) /* load envp[-1] */ ++ jne 1b /* ... until envp[-1]==NULL */ + PUT_VAR %eax, __elfinfo, %ecx +#endif + #ifdef PROFILING pushl $_etext pushl $.text -diff -up dietlibc-0.31.20080409/dietdirent.h.pagesize dietlibc-0.31.20080409/dietdirent.h ---- dietlibc-0.31.20080409/dietdirent.h.pagesize 2002-07-03 22:33:37.000000000 +0200 -+++ dietlibc-0.31.20080409/dietdirent.h 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/dietdirent.h.pagesize ++++ dietlibc-0.31.20080409/dietdirent.h @@ -1,8 +1,12 @@ #include @@ -525,23 +513,26 @@ diff -up dietlibc-0.31.20080409/dietdirent.h.pagesize dietlibc-0.31.20080409/die }; /* stream data from opendir() */ + +#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) -diff -up dietlibc-0.31.20080409/alpha/start.S.pagesize dietlibc-0.31.20080409/alpha/start.S ---- dietlibc-0.31.20080409/alpha/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/alpha/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -24,6 +24,10 @@ _start: +--- dietlibc-0.31.20080409/alpha/start.S.pagesize ++++ dietlibc-0.31.20080409/alpha/start.S +@@ -24,6 +24,15 @@ _start: stq $18, environ +#ifdef WANT_ELFINFO ++# error "MAKE ME alpha ASSEMBLER!" ++1: ldq $19, $18 ; load *envp into $19 ++ addq $18, 1, $18 ; increment *envp ++ orr $19, $19, $19 ++ jne 1b + stq $18, __elfinfo +#endif + #ifdef WANT_DYNAMIC /* in v0 ($0) is the ld.so _fini pointer */ mov $0, $19 /* mov v0(dynload) to a3 */ -diff -up dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize dietlibc-0.31.20080409/syscalls.s/environ.S ---- dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize 2004-09-28 02:01:30.000000000 +0200 -+++ dietlibc-0.31.20080409/syscalls.s/environ.S 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize ++++ dietlibc-0.31.20080409/syscalls.s/environ.S @@ -1,6 +1,7 @@ .section ".bss" .align 8 @@ -573,10 +564,9 @@ diff -up dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize dietlibc-0.31.2008 +#endif +.size __elfinfo,.-__elfinfo +#endif -diff -up dietlibc-0.31.20080409/arm/start.S.pagesize dietlibc-0.31.20080409/arm/start.S ---- dietlibc-0.31.20080409/arm/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/arm/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -23,11 +23,15 @@ _start: +--- dietlibc-0.31.20080409/arm/start.S.pagesize ++++ dietlibc-0.31.20080409/arm/start.S +@@ -23,11 +23,18 @@ _start: #ifdef __DYN_LIB ldr sl, .L4 1: add sl, pc, sl @@ -587,27 +577,34 @@ diff -up dietlibc-0.31.20080409/arm/start.S.pagesize dietlibc-0.31.20080409/arm/ #endif +#ifdef WANT_ELFINFO ++1: ldr r5, [a3], #4 @ load *envp and increment it ++ orr r5, r5, r5 @ read value==0? ++ bne 1b + str a3, [ip, #4] @ __elfinfo = envp +#endif + #ifdef PROFILING stmdb sp!, { r0 - r3 } ldr r0, .L5 -@@ -70,6 +74,3 @@ _exit: +@@ -70,6 +77,3 @@ _exit: .L5: .word .text .L6: .word _etext #endif - - - -diff -up dietlibc-0.31.20080409/parisc/start.S.pagesize dietlibc-0.31.20080409/parisc/start.S ---- dietlibc-0.31.20080409/parisc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/parisc/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -34,6 +34,11 @@ _start: +--- dietlibc-0.31.20080409/parisc/start.S.pagesize ++++ dietlibc-0.31.20080409/parisc/start.S +@@ -34,6 +34,16 @@ _start: ldil LP%environ, %r19 ldo RP%environ(%r19), %r19 +#ifdef WANT_ELFINFO ++# error "MAKE ME PARISC CODE!" ++1: add %r20, %r19, %r19 ; envp += 4 ++ ldw -4(0,%r19), %r21 ; load envp[-4] into %r21 ++ comibf =,0, 0,%21,1b ; compare %21 with 0 without nullification ++ + ldil LP%__elfinfo, %r19 + ldo RP%__elfinfo(%r19), %r19 +#endif @@ -615,9 +612,8 @@ diff -up dietlibc-0.31.20080409/parisc/start.S.pagesize dietlibc-0.31.20080409/p /* Expand the stack to store the 5th through 7th args */ ldo 64(%sp), %sp -diff -up dietlibc-0.31.20080409/include/sys/shm.h.pagesize dietlibc-0.31.20080409/include/sys/shm.h ---- dietlibc-0.31.20080409/include/sys/shm.h.pagesize 2005-09-21 09:33:08.000000000 +0200 -+++ dietlibc-0.31.20080409/include/sys/shm.h 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/include/sys/shm.h.pagesize ++++ dietlibc-0.31.20080409/include/sys/shm.h @@ -60,15 +60,6 @@ struct shm_info { unsigned long swap_successes; }; @@ -634,14 +630,19 @@ diff -up dietlibc-0.31.20080409/include/sys/shm.h.pagesize dietlibc-0.31.2008040 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 -up dietlibc-0.31.20080409/sparc/start.S.pagesize dietlibc-0.31.20080409/sparc/start.S ---- dietlibc-0.31.20080409/sparc/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -25,6 +25,11 @@ _start: +--- dietlibc-0.31.20080409/sparc/start.S.pagesize ++++ dietlibc-0.31.20080409/sparc/start.S +@@ -25,6 +25,17 @@ _start: or %o3, %lo(environ), %o3 st %o2, [%o3] +#ifdef WANT_ELFINFO ++# error "VERIFY ME!" ++1: add %o2, %o2, 4 ++ ld [%o2-4], %o4 ++ orcc %o4, %o4, %o4 ++ bne 1b ++ + add %o3, %o3, 4 + st %o2, [%o3] +#endif @@ -649,9 +650,8 @@ diff -up dietlibc-0.31.20080409/sparc/start.S.pagesize dietlibc-0.31.20080409/sp /* 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 -up dietlibc-0.31.20080409/sparc/shmat.c.pagesize dietlibc-0.31.20080409/sparc/shmat.c ---- dietlibc-0.31.20080409/sparc/shmat.c.pagesize 2001-06-16 19:48:57.000000000 +0200 -+++ dietlibc-0.31.20080409/sparc/shmat.c 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/sparc/shmat.c.pagesize ++++ dietlibc-0.31.20080409/sparc/shmat.c @@ -3,17 +3,15 @@ #include #include @@ -673,26 +673,26 @@ diff -up dietlibc-0.31.20080409/sparc/shmat.c.pagesize dietlibc-0.31.20080409/sp result=raddr; return result; } -diff -up dietlibc-0.31.20080409/ppc64/start.S.pagesize dietlibc-0.31.20080409/ppc64/start.S ---- dietlibc-0.31.20080409/ppc64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/ppc64/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -58,6 +58,12 @@ _start: +--- dietlibc-0.31.20080409/ppc64/start.S.pagesize ++++ dietlibc-0.31.20080409/ppc64/start.S +@@ -58,6 +58,14 @@ _start: oris 14,14,environ@ha std 5,environ@l(14) +#ifdef WANT_ELFINFO -+ /* TODO: can we really assume that environ and __elfinfo are on the -+ same 16 bit page? */ ++1: ldu 15,8(5) ++ cmpdi 15,0 ++ bne 1b ++ + std 5,__elfinfo@l(14) +#endif + #ifdef WANT_DYNAMIC /* #warning dynamic */ mr 6,7 -diff -up dietlibc-0.31.20080409/x86_64/start.S.pagesize dietlibc-0.31.20080409/x86_64/start.S ---- dietlibc-0.31.20080409/x86_64/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/x86_64/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -12,12 +12,23 @@ _start: +--- dietlibc-0.31.20080409/x86_64/start.S.pagesize ++++ dietlibc-0.31.20080409/x86_64/start.S +@@ -12,12 +12,28 @@ _start: leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */ @@ -703,7 +703,12 @@ diff -up dietlibc-0.31.20080409/x86_64/start.S.pagesize dietlibc-0.31.20080409/x +#else + leaq environ(%rip), %rax +#endif -+ movq %rdx, (%rax) /* environ */ ++ movq %rdx, (%rax) /* environ */ ++ ++1: add $8, %rdx /* increment envp */ ++ cmpq $0, -8(%rdx) /* load envp[-1] */ ++ jne 1b /* ... until envp[-1]==NULL */ ++ + movq %rdx, 8(%rax) /* __elfinfo */ +#else #ifdef __DYN_LIB @@ -716,24 +721,28 @@ diff -up dietlibc-0.31.20080409/x86_64/start.S.pagesize dietlibc-0.31.20080409/x #ifdef PROFILING pushq %rdi /* save reg args */ -diff -up dietlibc-0.31.20080409/s390/start.S.pagesize dietlibc-0.31.20080409/s390/start.S ---- dietlibc-0.31.20080409/s390/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/s390/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -30,6 +30,11 @@ _start: +--- dietlibc-0.31.20080409/s390/start.S.pagesize ++++ dietlibc-0.31.20080409/s390/start.S +@@ -30,6 +30,17 @@ _start: l %r1,8(%r13) st %r4,0(%r1) +#ifdef WANT_ELFINFO -+ ahi %r1, 4 # TODO: does it really point to __elfinfo now? ++# error "VERIFY ME!" ++1: ahi %r4, 4 # increment envp ++ l %r12, -4(0,%r4) # load envp[-1] into %r12 ++ or %r12, %r12 # test %r12 for NULL ++ brc 1, 1b ++ ++ ahi %r1, 4 + st %r4,0(%r1) +#endif + /* call main or _dyn_start */ l %r1,0(%r13) basr %r14,%r1 -diff -up dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize dietlibc-0.31.20080409/dynlinker/ldso_start.S ---- dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize 2006-10-13 22:11:13.000000000 +0200 -+++ dietlibc-0.31.20080409/dynlinker/ldso_start.S 2008-04-13 22:19:49.000000000 +0200 +--- dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize ++++ dietlibc-0.31.20080409/dynlinker/ldso_start.S @@ -86,6 +86,15 @@ __environ: .long 0 #endif @@ -750,14 +759,19 @@ diff -up dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize dietlibc-0.31.20 .global fini_entry fini_entry: .long 0 -diff -up dietlibc-0.31.20080409/mips/start.S.pagesize dietlibc-0.31.20080409/mips/start.S ---- dietlibc-0.31.20080409/mips/start.S.pagesize 2006-04-04 07:35:14.000000000 +0200 -+++ dietlibc-0.31.20080409/mips/start.S 2008-04-13 22:19:49.000000000 +0200 -@@ -47,6 +47,9 @@ __start: +--- dietlibc-0.31.20080409/mips/start.S.pagesize ++++ dietlibc-0.31.20080409/mips/start.S +@@ -47,6 +47,15 @@ __start: #endif add $a2, $a2, $a1 sw $a2, environ +#ifdef WANT_ELFINFO ++# error "MAKE ME MIPS CODE!" ++1: addu $a2, $a2, 4 /* increment envp */ ++ lw $4, -4($a2) /* load envp[-1]; TODO: is $4 a proper ++ temporary register? */ ++ bnz 1b /* ... until envp[-1]==NULL ++ TODO: use proper 'bnz' operation */ + sw $a2, __elfinfo +#endif jalr $25 From cb070230849b36da96b9dc5850e77e4f0ce07aa1 Mon Sep 17 00:00:00 2001 From: ensc Date: Sat, 19 Apr 2008 16:26:41 +0000 Subject: [PATCH 055/161] added changelog entry --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 0cca379..7c4194a 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -30,7 +30,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.31 -Release: %release_func 3%{?snapshot:.%snapshot} +Release: %release_func 4%{?snapshot:.%snapshot} License: GPL Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -201,6 +201,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Apr 19 2008 Enrico Scholz - 0.31-4.20080409 +- update -pagesize patch + * Mon Apr 14 2008 Enrico Scholz - 0.31-3.20080409 - removed debug stuff from specfile - updated patches to work with new isinf() behavior of gcc 4.3 From 0e0e2afde7c2ad6f56a64269d9918ba2376aa536 Mon Sep 17 00:00:00 2001 From: ensc Date: Sat, 19 Apr 2008 17:14:18 +0000 Subject: [PATCH 056/161] fixed post-increment issue on ppc* die when AT_PAGESZ entry is empty --- dietlibc-0.31-pagesize.patch | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index 7a9f71e..62a0790 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -129,12 +129,13 @@ register size_t idx=0; --- dietlibc-0.31.20080409/ppc/start.S.pagesize +++ dietlibc-0.31.20080409/ppc/start.S -@@ -31,6 +31,14 @@ _start: +@@ -31,6 +31,15 @@ _start: lis 14,environ@ha stw 5,environ@l(14) +#ifdef WANT_ELFINFO -+1: lwzu 15,4(5) ++1: lwzu 15,0(5) ++ addi 5, 5, 4 + cmpwi 15,0 + bne 1b + @@ -355,7 +356,7 @@ +} --- dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize +++ dietlibc-0.31.20080409/libcruft/getpagesize.c -@@ -2,14 +2,23 @@ +@@ -2,14 +2,22 @@ #include #include @@ -373,8 +374,7 @@ + + if (__unlikely(pgsz==0)) { + __diet_elf_addr_t *v = __get_elf_aux_value(AT_PAGESZ); -+ if (__likely(v)) -+ pgsz = *v; ++ pgsz = *v; /* causes segfault when 'v==NULL' */ + } + + return pgsz; @@ -675,12 +675,13 @@ } --- dietlibc-0.31.20080409/ppc64/start.S.pagesize +++ dietlibc-0.31.20080409/ppc64/start.S -@@ -58,6 +58,14 @@ _start: +@@ -58,6 +58,15 @@ _start: oris 14,14,environ@ha std 5,environ@l(14) +#ifdef WANT_ELFINFO -+1: ldu 15,8(5) ++1: ldu 15,0(5) ++ addi 5, 5, 8 + cmpdi 15,0 + bne 1b + From 6b900f5b03544ed53a65b6c0ec3cfe9ba7843f13 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 18 May 2008 09:44:21 +0000 Subject: [PATCH 057/161] fixed __signalfd() prototype --- dietlibc-0.31-implicitfunc.patch | 2 +- dietlibc.spec | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dietlibc-0.31-implicitfunc.patch b/dietlibc-0.31-implicitfunc.patch index d9dace4..26647df 100644 --- a/dietlibc-0.31-implicitfunc.patch +++ b/dietlibc-0.31-implicitfunc.patch @@ -5,7 +5,7 @@ diff -up dietlibc-0.31.20080409/lib/signalfd.c.implicitfunc dietlibc-0.31.200804 #include #include -+extern int __signalfd(int fd, const sigset_t *mask, int flags); ++extern int __signalfd(int fd, const sigset_t *mask, size_t flags); + int signalfd(int fd,const sigset_t* mask,int flags) { if (flags) { /* bizarre glibc bullshit */ diff --git a/dietlibc.spec b/dietlibc.spec index 7c4194a..6de0312 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -30,7 +30,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.31 -Release: %release_func 4%{?snapshot:.%snapshot} +Release: %release_func 5%{?snapshot:.%snapshot} License: GPL Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -201,6 +201,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun May 18 2008 Enrico Scholz - 0.31-5.20080409 +- fixed __signalfd() prototype + * Sat Apr 19 2008 Enrico Scholz - 0.31-4.20080409 - update -pagesize patch From c0c3c48d6137bbb20e4cb23ced3b0aeccdf04f15 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 18 May 2008 09:48:16 +0000 Subject: [PATCH 058/161] include --- dietlibc-0.31-implicitfunc.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dietlibc-0.31-implicitfunc.patch b/dietlibc-0.31-implicitfunc.patch index 26647df..541303d 100644 --- a/dietlibc-0.31-implicitfunc.patch +++ b/dietlibc-0.31-implicitfunc.patch @@ -1,9 +1,10 @@ diff -up dietlibc-0.31.20080409/lib/signalfd.c.implicitfunc dietlibc-0.31.20080409/lib/signalfd.c --- dietlibc-0.31.20080409/lib/signalfd.c.implicitfunc 2008-02-19 01:28:13.000000000 +0100 +++ dietlibc-0.31.20080409/lib/signalfd.c 2008-04-13 22:52:10.000000000 +0200 -@@ -1,6 +1,8 @@ +@@ -1,6 +1,9 @@ #include #include ++#include +extern int __signalfd(int fd, const sigset_t *mask, size_t flags); + From 1c0742353d4d05c80b3ea7bb2b84ea880dcc74dc Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 18 May 2008 10:12:53 +0000 Subject: [PATCH 059/161] use patches from git repository; rediffed against 20080517 --- dietlibc-0.28-setpriority.patch | 19 +- dietlibc-0.29-scall.patch | 27 +- dietlibc-0.30-longdouble.patch | 22 +- dietlibc-0.31-defpath.patch | 20 +- dietlibc-0.31-implicitfunc.patch | 72 +- dietlibc-0.31-lcctime.patch | 32 +- dietlibc-0.31-noreturn.patch | 25 +- dietlibc-0.31-pagesize.patch | 1387 +++++++++++++---------- dietlibc-0.31-printFG.patch | 101 +- dietlibc-0.31-stacksmash-dyn.patch | 21 +- dietlibc-0.31-stacksmash.patch | 60 +- dietlibc-0.31-stat64.patch | 88 -- dietlibc-0.31-testsuite.patch | 513 +++++---- dietlibc-0.31.20080212-teststdout.patch | 59 +- 14 files changed, 1396 insertions(+), 1050 deletions(-) delete mode 100644 dietlibc-0.31-stat64.patch diff --git a/dietlibc-0.28-setpriority.patch b/dietlibc-0.28-setpriority.patch index 30090ed..248d18a 100644 --- a/dietlibc-0.28-setpriority.patch +++ b/dietlibc-0.28-setpriority.patch @@ -1,5 +1,17 @@ ---- dietlibc-0.28-unpatched/lib/__nice.c 2005-02-13 18:01:18.966469056 -0500 -+++ dietlibc-0.28/lib/__nice.c 2005-02-13 18:17:04.381744088 -0500 +From ab91f175a8c77f275c9fa917dfe7cbc9b6262e1c Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 17:49:05 +0200 +Subject: [PATCH] Return new nice value for nice(2) + +Changed nice(2) to return the new nice value instead of 0/-1. +--- + lib/__nice.c | 8 ++++++-- + 1 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/lib/__nice.c b/lib/__nice.c +index d751104..8e205c0 100644 +--- a/lib/__nice.c ++++ b/lib/__nice.c @@ -1,9 +1,13 @@ #include "syscalls.h" -#include @@ -16,3 +28,6 @@ + return getpriority(PRIO_PROCESS,0); } #endif +-- +1.5.4.5 + diff --git a/dietlibc-0.29-scall.patch b/dietlibc-0.29-scall.patch index ee07d62..526306b 100644 --- a/dietlibc-0.29-scall.patch +++ b/dietlibc-0.29-scall.patch @@ -1,12 +1,20 @@ -2005-04-24 Enrico Scholz - * libcompat/syscall.S: catch the case when syscall(2) is not - implemented for the actual arch instead of jumping to the next - function and executing the wrong code +From 406e0419735c9e9c00290d437e9f42f88c3ae6d2 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 17:50:24 +0200 +Subject: [PATCH] Sanity checks for syscall availability ---- dietlibc-0.29/libcompat/syscall.S.scall -+++ dietlibc-0.29/libcompat/syscall.S -@@ -120,6 +120,12 @@ - nop +Catch the case when syscall(2) is not implemented for the actual arch +instead of jumping to the next function and executing the wrong code +--- + libcompat/syscall.S | 8 +++++++- + 1 files changed, 7 insertions(+), 1 deletions(-) + +diff --git a/libcompat/syscall.S b/libcompat/syscall.S +index c9f72bb..6b6a8aa 100644 +--- a/libcompat/syscall.S ++++ b/libcompat/syscall.S +@@ -130,6 +130,12 @@ syscall: + b __unified_syscall #else - /* arch not implemented yet */ @@ -19,3 +27,6 @@ +#endif #endif .size syscall, . - syscall +-- +1.5.4.5 + diff --git a/dietlibc-0.30-longdouble.patch b/dietlibc-0.30-longdouble.patch index 04c675e..9defbe7 100644 --- a/dietlibc-0.30-longdouble.patch +++ b/dietlibc-0.30-longdouble.patch @@ -1,6 +1,19 @@ ---- dietlibc-0.30/libm/gamma.c~ 2005-03-15 08:51:23.000000000 +0000 -+++ dietlibc-0.30/libm/gamma.c 2006-12-28 14:36:58.000000000 +0000 -@@ -33,19 +33,19 @@ Return value gamma returns a value in +From ba4e9f8557b25e4fbb6886e7c54a2ca75ca57368 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 17:54:03 +0200 +Subject: [PATCH] Workaround PPC build issues + +Fixes https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=182118 and +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27054 +--- + libm/gamma.c | 26 +++++++++++++------------- + 1 files changed, 13 insertions(+), 13 deletions(-) + +diff --git a/libm/gamma.c b/libm/gamma.c +index 9682f35..370bec6 100644 +--- a/libm/gamma.c ++++ b/libm/gamma.c +@@ -33,19 +33,19 @@ Return value gamma returns a value in range (-0.1208, +oo). For a input #include #include @@ -33,3 +46,6 @@ static const double coeff[] = { B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 }; int signgam; +-- +1.5.4.5 + diff --git a/dietlibc-0.31-defpath.patch b/dietlibc-0.31-defpath.patch index c0878da..1543af1 100644 --- a/dietlibc-0.31-defpath.patch +++ b/dietlibc-0.31-defpath.patch @@ -1,6 +1,17 @@ -diff -up dietlibc-0.31/include/paths.h.~1~ dietlibc-0.31/include/paths.h ---- dietlibc-0.31/include/paths.h.defpath -+++ dietlibc-0.31/include/paths.h +From 66528a176d332bb8de4ddf324754089e59139424 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 18:00:19 +0200 +Subject: [PATCH] Security fix for proper $PATH + +Removed '.' from the default $PATH. +--- + include/paths.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/include/paths.h b/include/paths.h +index 553b4fa..9bf216f 100644 +--- a/include/paths.h ++++ b/include/paths.h @@ -2,7 +2,7 @@ #define _PATHS_H @@ -10,3 +21,6 @@ diff -up dietlibc-0.31/include/paths.h.~1~ dietlibc-0.31/include/paths.h #define _PATH_DEVNULL "/dev/null" +-- +1.5.4.5 + diff --git a/dietlibc-0.31-implicitfunc.patch b/dietlibc-0.31-implicitfunc.patch index 541303d..bcd7057 100644 --- a/dietlibc-0.31-implicitfunc.patch +++ b/dietlibc-0.31-implicitfunc.patch @@ -1,19 +1,41 @@ -diff -up dietlibc-0.31.20080409/lib/signalfd.c.implicitfunc dietlibc-0.31.20080409/lib/signalfd.c ---- dietlibc-0.31.20080409/lib/signalfd.c.implicitfunc 2008-02-19 01:28:13.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/signalfd.c 2008-04-13 22:52:10.000000000 +0200 -@@ -1,6 +1,9 @@ - #include - #include -+#include +From 5c0e868e1a9266d580c95411c3b2f0272dfa14ab Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 17:43:08 +0200 +Subject: [PATCH] Fixes for -Werror-no-implicit-functions + +Some fixes for issues preventing builds with +'-Werror-implicit-function-declaration'. +--- + test/getservbyname.c | 1 + + test/stdlib/testsort.c | 2 ++ + test/stdlib/tst-calloc.c | 2 ++ + 3 files changed, 5 insertions(+), 0 deletions(-) + +diff --git a/test/getservbyname.c b/test/getservbyname.c +index b70ca19..caf1c9f 100644 +--- a/test/getservbyname.c ++++ b/test/getservbyname.c +@@ -1,5 +1,6 @@ + #include + #include ++#include -+extern int __signalfd(int fd, const sigset_t *mask, size_t flags); + int main(int argc,char *argv[]) { + struct servent* se; +diff --git a/test/stdlib/testsort.c b/test/stdlib/testsort.c +index aa4332a..5a92bc0 100644 +--- a/test/stdlib/testsort.c ++++ b/test/stdlib/testsort.c +@@ -1,3 +1,5 @@ ++#define _BSD_SOURCE + - int signalfd(int fd,const sigset_t* mask,int flags) { - if (flags) { /* bizarre glibc bullshit */ - errno=EINVAL; -diff -up dietlibc-0.31.20080409/test/stdlib/tst-calloc.c.implicitfunc dietlibc-0.31.20080409/test/stdlib/tst-calloc.c ---- dietlibc-0.31.20080409/test/stdlib/tst-calloc.c.implicitfunc 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdlib/tst-calloc.c 2008-04-13 22:52:10.000000000 +0200 + #include + #include + #include +diff --git a/test/stdlib/tst-calloc.c b/test/stdlib/tst-calloc.c +index a9b9e2a..049117b 100644 +--- a/test/stdlib/tst-calloc.c ++++ b/test/stdlib/tst-calloc.c @@ -17,6 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ @@ -23,22 +45,6 @@ diff -up dietlibc-0.31.20080409/test/stdlib/tst-calloc.c.implicitfunc dietlibc-0 #include #include #include -diff -up dietlibc-0.31.20080409/test/stdlib/testsort.c.implicitfunc dietlibc-0.31.20080409/test/stdlib/testsort.c ---- dietlibc-0.31.20080409/test/stdlib/testsort.c.implicitfunc 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdlib/testsort.c 2008-04-13 22:52:10.000000000 +0200 -@@ -1,3 +1,5 @@ -+#define _BSD_SOURCE -+ - #include - #include - #include -diff -up dietlibc-0.31.20080409/test/getservbyname.c.implicitfunc dietlibc-0.31.20080409/test/getservbyname.c ---- dietlibc-0.31.20080409/test/getservbyname.c.implicitfunc 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/getservbyname.c 2008-04-13 22:53:38.000000000 +0200 -@@ -1,5 +1,6 @@ - #include - #include -+#include - - int main(int argc,char *argv[]) { - struct servent* se; +-- +1.5.4.5 + diff --git a/dietlibc-0.31-lcctime.patch b/dietlibc-0.31-lcctime.patch index a559e9c..572c7ed 100644 --- a/dietlibc-0.31-lcctime.patch +++ b/dietlibc-0.31-lcctime.patch @@ -1,6 +1,20 @@ -diff -up dietlibc-0.31.20080409/libugly/strftime.c.lcctime dietlibc-0.31.20080409/libugly/strftime.c ---- dietlibc-0.31.20080409/libugly/strftime.c.lcctime 2006-08-15 18:07:15.000000000 +0200 -+++ dietlibc-0.31.20080409/libugly/strftime.c 2008-04-13 13:20:41.000000000 +0200 +From aac35698d1b84f6370d37860c9e889c34cd6a21c Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 17:42:20 +0200 +Subject: [PATCH] Fixes/enhancements in str?time() functions + +This patch changes the used format for %x and %X specifiers in +strptime(3) to match these specified by SUSv2. It adds support +for '%F' in strftime(3) too. +--- + libugly/strftime.c | 1 + + libugly/strptime.c | 5 +++-- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/libugly/strftime.c b/libugly/strftime.c +index 56ae082..cf16f37 100644 +--- a/libugly/strftime.c ++++ b/libugly/strftime.c @@ -55,6 +55,7 @@ again: case 'x': src = "%b %a %d"; goto _strf; case 'X': src = "%k:%M:%S"; goto _strf; @@ -9,10 +23,11 @@ diff -up dietlibc-0.31.20080409/libugly/strftime.c.lcctime dietlibc-0.31.2008040 case 'T': src = "%H:%M:%S"; _strf: p += strftime (p, (size_t)(dst+max-p), src, tm); break; case 'a': src = sweekdays [tm->tm_wday]; goto _str; -diff -up dietlibc-0.31.20080409/libugly/strptime.c.lcctime dietlibc-0.31.20080409/libugly/strptime.c ---- dietlibc-0.31.20080409/libugly/strptime.c.lcctime 2007-08-03 22:58:33.000000000 +0200 -+++ dietlibc-0.31.20080409/libugly/strptime.c 2008-04-13 13:13:12.000000000 +0200 -@@ -119,10 +119,11 @@ char* strptime(const char* s,const char* +diff --git a/libugly/strptime.c b/libugly/strptime.c +index 6ac5340..32dc2a7 100644 +--- a/libugly/strptime.c ++++ b/libugly/strptime.c +@@ -119,10 +119,11 @@ char* strptime(const char* s,const char* format, struct tm* tm) { ++s; break; case 'x': @@ -26,3 +41,6 @@ diff -up dietlibc-0.31.20080409/libugly/strptime.c.lcctime dietlibc-0.31.2008040 break; case 'y': i=getint(&s,2); +-- +1.5.4.5 + diff --git a/dietlibc-0.31-noreturn.patch b/dietlibc-0.31-noreturn.patch index 6b7dc69..d3f9a51 100644 --- a/dietlibc-0.31-noreturn.patch +++ b/dietlibc-0.31-noreturn.patch @@ -1,6 +1,22 @@ -diff -up dietlibc-0.31.20080409/include/stdlib.h.noreturn dietlibc-0.31.20080409/include/stdlib.h ---- dietlibc-0.31.20080409/include/stdlib.h.noreturn 2008-04-13 22:56:59.000000000 +0200 -+++ dietlibc-0.31.20080409/include/stdlib.h 2008-04-13 22:57:54.000000000 +0200 +From e96b03324e5395ff3c0041c249bfed9aa1bdb8b5 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 17:43:42 +0200 +Subject: [PATCH] __noreturn__ annotation for abort(3) + +SUSv2 says about abort(3): + + The abort() function shall not return. + +Hence, an '__attribute__((__noreturn__))' should be added to the +abort(3) declaration. +--- + include/stdlib.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/include/stdlib.h b/include/stdlib.h +index 34f3a7f..0cea604 100644 +--- a/include/stdlib.h ++++ b/include/stdlib.h @@ -47,7 +47,7 @@ double atof(const char *nptr) __THROW; __extension__ long long int atoll(const char *nptr); @@ -10,3 +26,6 @@ diff -up dietlibc-0.31.20080409/include/stdlib.h.noreturn dietlibc-0.31.20080409 extern int rand(void) __THROW; extern int rand_r(unsigned int *seed) __THROW; +-- +1.5.4.5 + diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index 62a0790..666eaae 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -1,102 +1,354 @@ ---- dietlibc-0.31.20080409/lib/mmap64.c.pagesize -+++ dietlibc-0.31.20080409/lib/mmap64.c -@@ -4,16 +4,18 @@ - #include - #include +From bbeb245bbb5bc919f8f4d2049ba463ed349ef759 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 17:35:14 +0200 +Subject: [PATCH] Support for dynamic PAGE_SIZE + +This patch adds support for dynamic PAGE_SIZE values. It +is a little bit invasive in several aspects: + +* it modifies the startup code. We need to know the position of + the elf-info auxilary table which is located after 'environ'. + We can not use 'environ' directly because it might be modified + by the application. + + Hence, an additional __elfinfo variable is placed into .bss and + filled in the startup code. Depending on platform, this adds + 4-8 instructions and an additional pointer to .bss. + + I tested only the i386 and x86_64 modifications; it would be + nice when people with corresponding hardware would test the + other ones. I am especially uncertain regarding the parisc + changes. + + The elf-info stuff (which might be interesting e.g. for dynamic + linking or sysconf(_SC_CLK_TCK)) can be enabled without the + dynamic pagesize too. + +* it removes the 'PAGE_SIZE' macro from ; this will + break compilation of existing userspace application which are + using this deprecated macro + +* I added a new internal 'dietpagesize.h' header which defines + + | __DIET_PAGE_SIZE + | __DIET_PAGE_SHIFT + + macros. These return either builtin constants (when + WANT_DYN_PAGESIZE is not selected), or values derived from + __libc_getpagesize(). + + Every usage of PAGE_SIZE in dietlibc code was replaced by these + macros. + +* due to the previous point, the internal 'struct __dirstream' + was modified. I replaced + + | getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1); + + with + + | getdents64(d->fd,(struct dirent64*)d->buf, __DIRSTREAM_BUF_SIZE-1); + + literally but I am not sure where the '-1' is coming from. + There is one hunk, where this '-1' is missing so I think the + '-1' should be removed from all calls to getdents64(). + +* changes affect the *alloc() functions too; on x86_64 around 64 + bytes were added to .text of alloc.o + +* the new testprogramm requires a 'getconf' binary which returns + the correct values for PAGE_SIZE and CLK_TCK + +Patch seems to work fine on i386, x86_64, ppc and ppc64. Things +went a little bit complicated with linux 2.6.25; previous kernels +exported a elf_addr_t type in which is used in the +auxilary elf-info table. Now, this is not available anymore and I +use a type derived from __WORD_SIZE. +--- + alpha/start.S | 9 ++++ + arm/start.S | 12 ++++-- + dietdirent.h | 6 ++- + dietelfinfo.h | 20 ++++++++++ + dietfeatures.h | 14 +++++++ + dietpagesize.h | 31 +++++++++++++++ + dynlinker/ldso_start.S | 9 ++++ + i386/start.S | 7 +++ + ia64/start.S | 10 +++++ + include/sys/shm.h | 9 ---- + lib/alloc.c | 9 ++-- + lib/closedir.c | 4 +- + lib/mmap64.c | 6 ++- + lib/opendir.c | 4 +- + lib/readdir.c | 2 +- + lib/readdir64.c | 6 +- + libcruft/__get_elf_aux_value.c | 14 +++++++ + libcruft/getpagesize.c | 20 +++++++--- + libcruft/sysconf.c | 17 ++++++-- + mips/start.S | 9 ++++ + parisc/start.S | 10 +++++ + ppc/start.S | 9 ++++ + ppc64/start.S | 9 ++++ + s390/start.S | 11 +++++ + s390x/start.S | 11 +++++ + sparc/shmat.c | 8 +-- + sparc/start.S | 11 +++++ + sparc64/start.S | 11 +++++ + syscalls.s/environ.S | 20 ++++++++++ + test/Makefile | 2 +- + test/runtests.sh | 2 +- + test/sysconf.c | 80 ++++++++++++++++++++++++++++++++++++++++ + x86_64/start.S | 16 ++++++++ + 33 files changed, 374 insertions(+), 44 deletions(-) + create mode 100644 dietelfinfo.h + create mode 100644 dietpagesize.h + create mode 100644 libcruft/__get_elf_aux_value.c + create mode 100644 test/sysconf.c + +diff --git a/alpha/start.S b/alpha/start.S +index 7e7cf9b..e5e64a1 100644 +--- a/alpha/start.S ++++ b/alpha/start.S +@@ -24,6 +24,15 @@ _start: -+#include "../dietpagesize.h" + stq $18, environ + ++#ifdef WANT_ELFINFO ++# error "MAKE ME alpha ASSEMBLER!" ++1: ldq $19, $18 ; load *envp into $19 ++ addq $18, 1, $18 ; increment *envp ++ orr $19, $19, $19 ++ jne 1b ++ stq $18, __elfinfo ++#endif + - #ifdef __NR_mmap2 - void*__mmap2(void*start,size_t length,int prot,int flags,int fd,off_t pgoffset); - - void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset); - void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) { -- if (offset&(PAGE_SIZE-1)) { -+ if (offset&(__DIET_PAGE_SIZE)) { - errno=-EINVAL; - return MAP_FAILED; - } -- return __mmap2(addr,len,prot,flags,fd,offset>>PAGE_SHIFT); -+ return __mmap2(addr,len,prot,flags,fd,offset>>__DIET_PAGE_SHIFT); - } - - void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) ---- dietlibc-0.31.20080409/lib/readdir64.c.pagesize -+++ dietlibc-0.31.20080409/lib/readdir64.c -@@ -14,7 +14,7 @@ - #ifndef WANT_LARGEFILE_BACKCOMPAT - struct dirent64* readdir64(DIR *d) { - if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) { -- int res=getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1); -+ int res=getdents64(d->fd,(struct dirent64*)d->buf, __DIRSTREAM_BUF_SIZE-1); - if (res<=0) return 0; - d->num=res; d->cur=0; - } -@@ -32,7 +32,7 @@ again: - if (!trygetdents64) { + #ifdef WANT_DYNAMIC + /* in v0 ($0) is the ld.so _fini pointer */ + mov $0, $19 /* mov v0(dynload) to a3 */ +diff --git a/arm/start.S b/arm/start.S +index fcd3d7c..e7e3be7 100644 +--- a/arm/start.S ++++ b/arm/start.S +@@ -23,11 +23,18 @@ _start: + #ifdef __DYN_LIB + ldr sl, .L4 + 1: add sl, pc, sl +- str a3, [sl, ip] @ environ = envp ++ str a3, [ip, sl]! @ environ = envp; ip = GOT(environ) + #else + str a3, [ip, #0] @ environ = envp #endif - if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { -- int res=getdents(d->fd,(struct dirent*)d->buf, sizeof (d->buf)-1); -+ int res=getdents(d->fd,(struct dirent*)d->buf, __DIRSTREAM_BUF_SIZE-1); - if (res<=0) return 0; - d->num=res; d->cur=0; - } -@@ -46,7 +46,7 @@ again: - #ifdef __NR_getdents64 - } - if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) { -- int res=getdents64(d->fd,(struct dirent64*)d->buf,sizeof (d->buf)); -+ int res=getdents64(d->fd,(struct dirent64*)d->buf,__DIRSTREAM_BUF_SIZE); - if (res<=0) { - if (errno==ENOSYS) { - trygetdents64=0; ---- dietlibc-0.31.20080409/lib/opendir.c.pagesize -+++ dietlibc-0.31.20080409/lib/opendir.c -@@ -5,6 +5,8 @@ - #include - #include -+#include "../dietpagesize.h" ++#ifdef WANT_ELFINFO ++1: ldr r5, [a3], #4 @ load *envp and increment it ++ orr r5, r5, r5 @ read value==0? ++ bne 1b ++ str a3, [ip, #4] @ __elfinfo = envp ++#endif + - DIR* opendir ( const char* name ) { - int fd = open (name, O_RDONLY | O_DIRECTORY); - DIR* t = NULL; -@@ -12,7 +14,7 @@ DIR* opendir ( const char* name ) { - if ( fd >= 0 ) { - if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) - goto lose; -- t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, -+ t = (DIR *) mmap (NULL, __DIET_PAGE_SIZE, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (t == MAP_FAILED) - lose: ---- dietlibc-0.31.20080409/lib/readdir.c.pagesize -+++ dietlibc-0.31.20080409/lib/readdir.c -@@ -5,7 +5,7 @@ + #ifdef PROFILING + stmdb sp!, { r0 - r3 } + ldr r0, .L5 +@@ -70,6 +77,3 @@ _exit: + .L5: .word .text + .L6: .word _etext + #endif +- +- +- +diff --git a/dietdirent.h b/dietdirent.h +index dbd7206..c9c7127 100644 +--- a/dietdirent.h ++++ b/dietdirent.h +@@ -1,8 +1,12 @@ + #include - struct dirent* readdir(DIR *d) { - if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { -- int res=getdents(d->fd,(struct dirent*)d->buf,sizeof (d->buf)-1); -+ int res=getdents(d->fd,(struct dirent*)d->buf,__DIRSTREAM_BUF_SIZE-1); - if (res<=0) return 0; - d->num=res; d->cur=0; - } ---- dietlibc-0.31.20080409/lib/closedir.c.pagesize -+++ dietlibc-0.31.20080409/lib/closedir.c -@@ -4,8 +4,10 @@ - #include - #include - -+#include "../dietpagesize.h" ++#include "dietpagesize.h" + - int closedir (DIR* d) { - int res=close(d->fd); -- munmap (d, PAGE_SIZE); -+ munmap (d, __DIET_PAGE_SIZE); - return res; - } ---- dietlibc-0.31.20080409/lib/alloc.c.pagesize -+++ dietlibc-0.31.20080409/lib/alloc.c + struct __dirstream { + int fd; +- char buf[PAGE_SIZE-(sizeof (int)*3)]; + unsigned int num; + unsigned int cur; ++ char buf[]; + }; /* stream data from opendir() */ ++ ++#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) +diff --git a/dietelfinfo.h b/dietelfinfo.h +new file mode 100644 +index 0000000..f18627b +--- /dev/null ++++ b/dietelfinfo.h +@@ -0,0 +1,20 @@ ++#include "dietfeatures.h" ++ ++#ifdef WANT_ELFINFO ++#include ++#include ++#include ++ ++/* TODO: exported interface from has been changed in 2.6.25 so ++ * the 'elf_addr_t' type is not available anymore. Hence, derive it from ++ * __WORDSIZE__. */ ++ ++#if __WORDSIZE == 64 ++typedef uint64_t __diet_elf_addr_t; ++#elif __WORDSIZE == 32 ++typedef uint32_t __diet_elf_addr_t; ++#endif ++ ++__diet_elf_addr_t * __get_elf_aux_value(unsigned int tag) ++ __attribute__((__visibility__("hidden"),__const__)) __pure; ++#endif +diff --git a/dietfeatures.h b/dietfeatures.h +index 5ad8f38..2993b9e 100644 +--- a/dietfeatures.h ++++ b/dietfeatures.h +@@ -126,6 +126,16 @@ + /* #define WANT_SSP_XOR */ + + ++/* Some platforms like x86_64, ppc* or mips do not have a fixed PAGE_SIZE. ++ * Select WANT_DYN_PAGESIZE to detect the current PAGE_SIZE at runtime. Else, ++ * define WANT_STATIC_PAGESIZE to a proper value (must be a power of 2) ++ * matching the configured pagesize of the kernel where your binaries are ++ * running on. ++ * ++ * Selecting WANT_DYN_PAGESIZE enlarges the startup code by around 1-3 ++ * instructions and might add an additional __elfinfo symbol */ ++#define WANT_DYN_PAGESIZE ++/* #define WANT_STATIC_PAGESIZE 0x10000UL */ + + + /* stop uncommenting here ;-) */ +@@ -157,4 +167,8 @@ + #endif + #endif + ++#ifdef WANT_DYN_PAGESIZE ++#define WANT_ELFINFO ++#endif ++ + #endif +diff --git a/dietpagesize.h b/dietpagesize.h +new file mode 100644 +index 0000000..8ce6ce7 +--- /dev/null ++++ b/dietpagesize.h +@@ -0,0 +1,31 @@ ++#ifndef H_DIETLIBC_DIETPAGESIZE_H ++#define H_DIETLIBC_DIETPAGESIZE_H ++ ++#include ++#include "dietfeatures.h" ++ ++extern size_t __libc_getpagesize(void) __attribute__((__const__)) __pure; ++ ++#if defined(WANT_STATIC_PAGESIZE) ++# define __DIET_PAGE_SIZE_PREDEF (WANT_STATIC_PAGESIZE) ++# define __DIET_PAGE_SHIFT_PREDEF (ffs(__DIET_PAGE_SIZE_PREDEF)-1) ++#elif defined(__alpha__) || defined(__sparc__) ++# define __DIET_PAGE_SIZE_PREDEF (8192UL) ++# define __DIET_PAGE_SHIFT_PREDEF (13) ++#elif defined(__powerpc64__) ++# define __DIET_PAGE_SIZE_PREDEF (65536UL) ++# define __DIET_PAGE_SHIFT_PREDEF (16) ++#else ++# define __DIET_PAGE_SIZE_PREDEF (4096UL) ++# define __DIET_PAGE_SHIFT_PREDEF (12) ++#endif ++ ++#ifdef WANT_DYN_PAGESIZE ++# define __DIET_PAGE_SIZE (__libc_getpagesize()) ++# define __DIET_PAGE_SHIFT (ffs(__DIET_PAGE_SIZE)-1) ++#else ++# define __DIET_PAGE_SIZE __DIET_PAGE_SIZE_PREDEF ++# define __DIET_PAGE_SHIFT __DIET_PAGE_SHIFT_PREDEF ++#endif ++ ++#endif /* H_DIETLIBC_DIETPAGESIZE_H */ +diff --git a/dynlinker/ldso_start.S b/dynlinker/ldso_start.S +index ca278d7..7234f69 100644 +--- a/dynlinker/ldso_start.S ++++ b/dynlinker/ldso_start.S +@@ -86,6 +86,15 @@ __environ: + .long 0 + #endif + ++/* __elfinfo must follow __environ immediately */ ++.global __elfinfo ++__elfinfo: ++#if __WORDSIZE == 64 ++ .quad 0 ++#else ++ .long 0 ++#endif ++ + .global fini_entry + fini_entry: + .long 0 +diff --git a/i386/start.S b/i386/start.S +index 94a4f73..0c2c71d 100644 +--- a/i386/start.S ++++ b/i386/start.S +@@ -25,6 +25,13 @@ _start: + PIC_INIT /* non-PIC: this is an empty line */ + PUT_VAR %eax, environ, %ecx /* non-PIC: movl %eax,environ */ + ++#ifdef WANT_ELFINFO ++1: add $4, %eax /* increment envp */ ++ cmpl $0, -4(%eax) /* load envp[-1] */ ++ jne 1b /* ... until envp[-1]==NULL */ ++ PUT_VAR %eax, __elfinfo, %ecx ++#endif ++ + #ifdef PROFILING + pushl $_etext + pushl $.text +diff --git a/ia64/start.S b/ia64/start.S +index 50fd015..bac10cb 100644 +--- a/ia64/start.S ++++ b/ia64/start.S +@@ -40,6 +40,16 @@ _start: + ;; + st8 [r14] = out2 /* store envp in environ */ + ++#ifdef WANT_ELFINFO ++# error "MAKE ME IE64 CODE!" ++1: ld8 r9 = [out2], 8 /* load *envp and increment it */ ++ orr r9 = r9, r9 /* test for NULL */ ++ bne 1b ++ ++ adds r14 = 8, r14 /* __elfinfo = environ + 8 */ ++ st8 [r14] = out2 /* store envp in __elfinfo */ ++#endif ++ + #ifdef WANT_DYNAMIC + /* FIXME: dl_init parameter ??? */ + br.call.sptk.few rp = _dyn_start +diff --git a/include/sys/shm.h b/include/sys/shm.h +index 9b2d04d..70bb17e 100644 +--- a/include/sys/shm.h ++++ b/include/sys/shm.h +@@ -60,15 +60,6 @@ struct shm_info { + unsigned long swap_successes; + }; + +-#if defined(__i386__) || defined(__mips__) || defined(__arm__) || defined(__powerpc__) || defined (__powerpc64__) || defined(__s390__) || defined(__hppa__) || defined(__x86_64__) || defined(__ia64__) +-#define PAGE_SIZE 4096UL +-#define PAGE_SHIFT 12 +-#elif defined(__alpha__) || defined(__sparc__) +-/* sun4* has 4k except sun4 architecture, sparc64 has 8k */ +-#define PAGE_SIZE 8192UL +-#define PAGE_SHIFT 13 +-#endif +- + 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/lib/alloc.c b/lib/alloc.c +index 9690565..3f0cedb 100644 +--- a/lib/alloc.c ++++ b/lib/alloc.c @@ -18,8 +18,7 @@ #include #include @@ -127,8 +379,253 @@ static size_t REGPARM(1) get_index(size_t _size) { register size_t idx=0; ---- dietlibc-0.31.20080409/ppc/start.S.pagesize -+++ dietlibc-0.31.20080409/ppc/start.S +diff --git a/lib/closedir.c b/lib/closedir.c +index 3aade81..21de234 100644 +--- a/lib/closedir.c ++++ b/lib/closedir.c +@@ -4,8 +4,10 @@ + #include + #include + ++#include "../dietpagesize.h" ++ + int closedir (DIR* d) { + int res=close(d->fd); +- munmap (d, PAGE_SIZE); ++ munmap (d, __DIET_PAGE_SIZE); + return res; + } +diff --git a/lib/mmap64.c b/lib/mmap64.c +index 0ab29a6..5012394 100644 +--- a/lib/mmap64.c ++++ b/lib/mmap64.c +@@ -4,16 +4,18 @@ + #include + #include + ++#include "../dietpagesize.h" ++ + #ifdef __NR_mmap2 + void*__mmap2(void*start,size_t length,int prot,int flags,int fd,off_t pgoffset); + + void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset); + void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) { +- if (offset&(PAGE_SIZE-1)) { ++ if (offset&(__DIET_PAGE_SIZE)) { + errno=-EINVAL; + return MAP_FAILED; + } +- return __mmap2(addr,len,prot,flags,fd,offset>>PAGE_SHIFT); ++ return __mmap2(addr,len,prot,flags,fd,offset>>__DIET_PAGE_SHIFT); + } + + void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) +diff --git a/lib/opendir.c b/lib/opendir.c +index 2530d1a..0b49638 100644 +--- a/lib/opendir.c ++++ b/lib/opendir.c +@@ -5,6 +5,8 @@ + #include + #include + ++#include "../dietpagesize.h" ++ + DIR* opendir ( const char* name ) { + int fd = open (name, O_RDONLY | O_DIRECTORY); + DIR* t = NULL; +@@ -12,7 +14,7 @@ DIR* opendir ( const char* name ) { + if ( fd >= 0 ) { + if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) + goto lose; +- t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, ++ t = (DIR *) mmap (NULL, __DIET_PAGE_SIZE, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (t == MAP_FAILED) + lose: +diff --git a/lib/readdir.c b/lib/readdir.c +index ed885a5..d80a406 100644 +--- a/lib/readdir.c ++++ b/lib/readdir.c +@@ -5,7 +5,7 @@ + + struct dirent* readdir(DIR *d) { + if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { +- int res=getdents(d->fd,(struct dirent*)d->buf,sizeof (d->buf)-1); ++ int res=getdents(d->fd,(struct dirent*)d->buf,__DIRSTREAM_BUF_SIZE-1); + if (res<=0) return 0; + d->num=res; d->cur=0; + } +diff --git a/lib/readdir64.c b/lib/readdir64.c +index 924f0a8..06d073b 100644 +--- a/lib/readdir64.c ++++ b/lib/readdir64.c +@@ -14,7 +14,7 @@ + #ifndef WANT_LARGEFILE_BACKCOMPAT + struct dirent64* readdir64(DIR *d) { + if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) { +- int res=getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1); ++ int res=getdents64(d->fd,(struct dirent64*)d->buf, __DIRSTREAM_BUF_SIZE-1); + if (res<=0) return 0; + d->num=res; d->cur=0; + } +@@ -32,7 +32,7 @@ again: + if (!trygetdents64) { + #endif + if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { +- int res=getdents(d->fd,(struct dirent*)d->buf, sizeof (d->buf)-1); ++ int res=getdents(d->fd,(struct dirent*)d->buf, __DIRSTREAM_BUF_SIZE-1); + if (res<=0) return 0; + d->num=res; d->cur=0; + } +@@ -46,7 +46,7 @@ again: + #ifdef __NR_getdents64 + } + if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) { +- int res=getdents64(d->fd,(struct dirent64*)d->buf,sizeof (d->buf)); ++ int res=getdents64(d->fd,(struct dirent64*)d->buf,__DIRSTREAM_BUF_SIZE); + if (res<=0) { + if (errno==ENOSYS) { + trygetdents64=0; +diff --git a/libcruft/__get_elf_aux_value.c b/libcruft/__get_elf_aux_value.c +new file mode 100644 +index 0000000..6ddddb4 +--- /dev/null ++++ b/libcruft/__get_elf_aux_value.c +@@ -0,0 +1,14 @@ ++#include ++#include "../dietelfinfo.h" ++ ++__diet_elf_addr_t *__get_elf_aux_value(unsigned int tag) ++{ ++ extern __diet_elf_addr_t const * const __elfinfo; ++ __diet_elf_addr_t *aux_ptr; ++ ++ for (aux_ptr = __elfinfo; aux_ptr[0]!=AT_NULL; aux_ptr += 2) ++ if (aux_ptr[0]==tag) ++ return aux_ptr+1; ++ ++ return NULL; ++} +diff --git a/libcruft/getpagesize.c b/libcruft/getpagesize.c +index 536d3dc..80f476b 100644 +--- a/libcruft/getpagesize.c ++++ b/libcruft/getpagesize.c +@@ -2,14 +2,22 @@ + #include + #include + +-#ifndef PAGE_SIZE +-#define PAGE_SIZE 4096 +-#endif ++#include "../dietelfinfo.h" ++#include "../dietpagesize.h" + +-size_t __libc_getpagesize(void); + size_t __libc_getpagesize(void) { +- return PAGE_SIZE; ++#ifdef WANT_DYN_PAGESIZE ++ static size_t pgsz; ++ ++ if (__unlikely(pgsz==0)) { ++ __diet_elf_addr_t *v = __get_elf_aux_value(AT_PAGESZ); ++ pgsz = *v; /* causes segfault when 'v==NULL' */ ++ } ++ ++ return pgsz; ++#else ++ return __DIET_PAGE_SIZE_PREDEF; ++#endif + } + + size_t getpagesize(void) __attribute__((weak,alias("__libc_getpagesize"))); +- +diff --git a/libcruft/sysconf.c b/libcruft/sysconf.c +index e9c15cb..b98195c 100644 +--- a/libcruft/sysconf.c ++++ b/libcruft/sysconf.c +@@ -3,6 +3,9 @@ + #include + #include + ++#include "dietelfinfo.h" ++#include "dietpagesize.h" ++ + extern int __sc_nr_cpus(); + + long sysconf(int name) +@@ -16,6 +19,14 @@ long sysconf(int name) + return limit.rlim_cur; + } + case _SC_CLK_TCK: ++#ifdef WANT_ELFINFO ++ { ++ __diet_elf_addr_t *v = __get_elf_aux_value(AT_CLKTCK); ++ if (v) ++ return *v; ++ } ++#endif ++ + #ifdef __alpha__ + return 1024; + #else +@@ -23,11 +34,7 @@ long sysconf(int name) + #endif + + case _SC_PAGESIZE: +-#if ( defined(__alpha__) || defined(__sparc__) ) +- return 8192; +-#else +- return 4096; +-#endif ++ return __libc_getpagesize(); + + case _SC_ARG_MAX: + return ARG_MAX; +diff --git a/mips/start.S b/mips/start.S +index 57144b3..002fcf8 100644 +--- a/mips/start.S ++++ b/mips/start.S +@@ -47,6 +47,15 @@ __start: + #endif + add $a2, $a2, $a1 + sw $a2, environ ++#ifdef WANT_ELFINFO ++# error "MAKE ME MIPS CODE!" ++1: addu $a2, $a2, 4 /* increment envp */ ++ lw $4, -4($a2) /* load envp[-1]; TODO: is $4 a proper ++ temporary register? */ ++ bnz 1b /* ... until envp[-1]==NULL ++ TODO: use proper 'bnz' operation */ ++ sw $a2, __elfinfo ++#endif + jalr $25 + la $25, exit + move $4,$2 +diff --git a/parisc/start.S b/parisc/start.S +index 69d9cce..0f064be 100644 +--- a/parisc/start.S ++++ b/parisc/start.S +@@ -34,6 +34,16 @@ _start: + ldil LP%environ, %r19 + ldo RP%environ(%r19), %r19 + ++#ifdef WANT_ELFINFO ++# error "MAKE ME PARISC CODE!" ++1: add %r20, %r19, %r19 ; envp += 4 ++ ldw -4(0,%r19), %r21 ; load envp[-4] into %r21 ++ comibf =,0, 0,%21,1b ; compare %21 with 0 without nullification ++ ++ ldil LP%__elfinfo, %r19 ++ ldo RP%__elfinfo(%r19), %r19 ++#endif ++ + /* Expand the stack to store the 5th through 7th args */ + ldo 64(%sp), %sp + +diff --git a/ppc/start.S b/ppc/start.S +index 771f1ad..eb62efb 100644 +--- a/ppc/start.S ++++ b/ppc/start.S @@ -31,6 +31,15 @@ _start: lis 14,environ@ha stw 5,environ@l(14) @@ -145,37 +642,179 @@ #ifdef WANT_DYNAMIC mr 6,7 bl _dyn_start ---- dietlibc-0.31.20080409/dietfeatures.h.pagesize -+++ dietlibc-0.31.20080409/dietfeatures.h -@@ -126,6 +126,16 @@ - /* #define WANT_SSP_XOR */ +diff --git a/ppc64/start.S b/ppc64/start.S +index a9208ff..46b4bf0 100644 +--- a/ppc64/start.S ++++ b/ppc64/start.S +@@ -58,6 +58,15 @@ _start: + oris 14,14,environ@ha + std 5,environ@l(14) - -+/* Some platforms like x86_64, ppc* or mips do not have a fixed PAGE_SIZE. -+ * Select WANT_DYN_PAGESIZE to detect the current PAGE_SIZE at runtime. Else, -+ * define WANT_STATIC_PAGESIZE to a proper value (must be a power of 2) -+ * matching the configured pagesize of the kernel where your binaries are -+ * running on. -+ * -+ * Selecting WANT_DYN_PAGESIZE enlarges the startup code by around 1-3 -+ * instructions and might add an additional __elfinfo symbol */ -+#define WANT_DYN_PAGESIZE -+/* #define WANT_STATIC_PAGESIZE 0x10000UL */ - - - /* stop uncommenting here ;-) */ -@@ -157,4 +167,8 @@ - #endif - #endif - -+#ifdef WANT_DYN_PAGESIZE -+#define WANT_ELFINFO ++#ifdef WANT_ELFINFO ++1: ldu 15,0(5) ++ addi 5, 5, 8 ++ cmpdi 15,0 ++ bne 1b ++ ++ std 5,__elfinfo@l(14) +#endif + + #ifdef WANT_DYNAMIC + /* #warning dynamic */ + mr 6,7 +diff --git a/s390/start.S b/s390/start.S +index c0f971f..d071564 100644 +--- a/s390/start.S ++++ b/s390/start.S +@@ -30,6 +30,17 @@ _start: + l %r1,8(%r13) + st %r4,0(%r1) + ++#ifdef WANT_ELFINFO ++# error "VERIFY ME!" ++1: ahi %r4, 4 # increment envp ++ l %r12, -4(0,%r4) # load envp[-1] into %r12 ++ or %r12, %r12 # test %r12 for NULL ++ brc 1, 1b ++ ++ ahi %r1, 4 ++ st %r4,0(%r1) ++#endif ++ + /* call main or _dyn_start */ + l %r1,0(%r13) + basr %r14,%r1 +diff --git a/s390x/start.S b/s390x/start.S +index 25895a6..db71fc9 100644 +--- a/s390x/start.S ++++ b/s390x/start.S +@@ -26,6 +26,17 @@ _start: + larl %r13,environ + stg %r4,0(%r13) + ++#ifdef WANT_ELFINFO ++# error "VERIFY ME!" ++1: aghi %r4, 8 # increment envp ++ lg %r12, -8(0,%r4) # load envp[-1] into %r12 ++ ogr %r12, %r12 # test %r12 for NULL ++ brc 1, 1b ++ ++ aghi %r13, 8 ++ stg %r4,0(%r13) ++#endif ++ + /* call main or _dyn_start */ + #ifdef WANT_DYNAMIC + brasl %r14,_dyn_start +diff --git a/sparc/shmat.c b/sparc/shmat.c +index b7dce2e..ce3bfcb 100644 +--- a/sparc/shmat.c ++++ b/sparc/shmat.c +@@ -3,17 +3,15 @@ + #include + #include + +-extern void* __ipc(); ++#include "../dietpagesize.h" + +-#ifndef PAGE_SIZE +-#define PAGE_SIZE 4096 +-#endif ++extern void* __ipc(); + + void* shmat(int shmid,const void* shmaddr,int shmflg) { + void* raddr; + register void* result; + result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr); +- if ((unsigned long)result <= -(unsigned long)PAGE_SIZE) ++ if ((unsigned long)result <= -(unsigned long)__DIET_PAGE_SIZE) + result=raddr; + return result; + } +diff --git a/sparc/start.S b/sparc/start.S +index a7841e3..6037eae 100644 +--- a/sparc/start.S ++++ b/sparc/start.S +@@ -25,6 +25,17 @@ _start: + or %o3, %lo(environ), %o3 + st %o2, [%o3] + ++#ifdef WANT_ELFINFO ++# error "VERIFY ME!" ++1: add %o2, %o2, 4 ++ ld [%o2-4], %o4 ++ orcc %o4, %o4, %o4 ++ bne 1b ++ ++ add %o3, %o3, 4 ++ st %o2, [%o3] ++#endif ++ + /* 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/sparc64/start.S b/sparc64/start.S +index a79c4e7..f0e7d82 100644 +--- a/sparc64/start.S ++++ b/sparc64/start.S +@@ -25,6 +25,17 @@ _start: + or %o3, %lo(environ), %o3 + stx %o2, [%o3] + ++#ifdef WANT_ELFINFO ++# error "VERIFY ME!" ++1: add %o2, %o2, 8 ++ ldx [%o2-8], %o4 ++ orcc %o4, %o4, %o4 ++ bne 1b ++ ++ add %o3, %o3, 8 ++ stx %o2, [%o3] ++#endif ++ + /* 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/environ.S b/syscalls.s/environ.S +index a4dd95e..78a17de 100644 +--- a/syscalls.s/environ.S ++++ b/syscalls.s/environ.S +@@ -1,6 +1,7 @@ + .section ".bss" + .align 8 + #include ++#include + + .type environ,object + .weak environ +@@ -15,3 +16,22 @@ environ: #endif ---- dietlibc-0.31.20080409/test/Makefile.pagesize -+++ dietlibc-0.31.20080409/test/Makefile -@@ -14,7 +14,7 @@ glob grent hasmntopt hello iconv if_name + .size environ,.-environ + .size __environ,.-__environ ++ ++/* __elfinfo will be a copy of __environ after startup. Later, it will be ++ updated by __get_elf_aux_value() to point to the terminating NULL of the ++ environment. ++ ++ Startup code assumes that __elfinfo is located immediately after ++ __environ. */ ++ ++#ifdef WANT_ELFINFO ++.type __elfinfo,object ++.weak __elfinfo ++__elfinfo: ++#if __WORDSIZE == 64 ++ .quad 0 ++#else ++ .long 0 ++#endif ++.size __elfinfo,.-__elfinfo ++#endif +diff --git a/test/Makefile b/test/Makefile +index eea0075..ff416cf 100644 +--- a/test/Makefile ++++ b/test/Makefile +@@ -14,7 +14,7 @@ glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testhar 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 \ @@ -184,8 +823,23 @@ test: $(TESTPROGRAMS) +diff --git a/test/runtests.sh b/test/runtests.sh +index 6d89efb..908caa5 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 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 sysconf sysenter ungetc waitpid" + + STDIN="read1" + PASS="getpass" +diff --git a/test/sysconf.c b/test/sysconf.c +new file mode 100644 +index 0000000..32263a5 --- /dev/null -+++ dietlibc-0.31.20080409/test/sysconf.c ++++ b/test/sysconf.c @@ -0,0 +1,80 @@ +#include +#include @@ -267,432 +921,10 @@ + + return err; +} ---- dietlibc-0.31.20080409/test/runtests.sh.pagesize -+++ dietlibc-0.31.20080409/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 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 sysconf sysenter ungetc waitpid" - - STDIN="read1" - PASS="getpass" ---- dietlibc-0.31.20080409/sparc64/start.S.pagesize -+++ dietlibc-0.31.20080409/sparc64/start.S -@@ -25,6 +25,17 @@ _start: - or %o3, %lo(environ), %o3 - stx %o2, [%o3] - -+#ifdef WANT_ELFINFO -+# error "VERIFY ME!" -+1: add %o2, %o2, 8 -+ ldx [%o2-8], %o4 -+ orcc %o4, %o4, %o4 -+ bne 1b -+ -+ add %o3, %o3, 8 -+ stx %o2, [%o3] -+#endif -+ - /* 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 ---- dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize -+++ dietlibc-0.31.20080409/libcruft/sysconf.c -@@ -3,6 +3,9 @@ - #include - #include - -+#include "dietelfinfo.h" -+#include "dietpagesize.h" -+ - extern int __sc_nr_cpus(); - - long sysconf(int name) -@@ -16,6 +19,14 @@ long sysconf(int name) - return limit.rlim_cur; - } - case _SC_CLK_TCK: -+#ifdef WANT_ELFINFO -+ { -+ __diet_elf_addr_t *v = __get_elf_aux_value(AT_CLKTCK); -+ if (v) -+ return *v; -+ } -+#endif -+ - #ifdef __alpha__ - return 1024; - #else -@@ -23,11 +34,7 @@ long sysconf(int name) - #endif - - case _SC_PAGESIZE: --#if ( defined(__alpha__) || defined(__sparc__) ) -- return 8192; --#else -- return 4096; --#endif -+ return __libc_getpagesize(); - - case _SC_ARG_MAX: - return ARG_MAX; ---- /dev/null -+++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c -@@ -0,0 +1,14 @@ -+#include -+#include "../dietelfinfo.h" -+ -+__diet_elf_addr_t *__get_elf_aux_value(unsigned int tag) -+{ -+ extern __diet_elf_addr_t const * const __elfinfo; -+ __diet_elf_addr_t *aux_ptr; -+ -+ for (aux_ptr = __elfinfo; aux_ptr[0]!=AT_NULL; aux_ptr += 2) -+ if (aux_ptr[0]==tag) -+ return aux_ptr+1; -+ -+ return NULL; -+} ---- dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize -+++ dietlibc-0.31.20080409/libcruft/getpagesize.c -@@ -2,14 +2,22 @@ - #include - #include - --#ifndef PAGE_SIZE --#define PAGE_SIZE 4096 --#endif -+#include "../dietelfinfo.h" -+#include "../dietpagesize.h" - --size_t __libc_getpagesize(void); - size_t __libc_getpagesize(void) { -- return PAGE_SIZE; -+#ifdef WANT_DYN_PAGESIZE -+ static size_t pgsz; -+ -+ if (__unlikely(pgsz==0)) { -+ __diet_elf_addr_t *v = __get_elf_aux_value(AT_PAGESZ); -+ pgsz = *v; /* causes segfault when 'v==NULL' */ -+ } -+ -+ return pgsz; -+#else -+ return __DIET_PAGE_SIZE_PREDEF; -+#endif - } - - size_t getpagesize(void) __attribute__((weak,alias("__libc_getpagesize"))); -- ---- /dev/null -+++ dietlibc-0.31.20080409/dietpagesize.h -@@ -0,0 +1,31 @@ -+#ifndef H_DIETLIBC_DIETPAGESIZE_H -+#define H_DIETLIBC_DIETPAGESIZE_H -+ -+#include -+#include "dietfeatures.h" -+ -+extern size_t __libc_getpagesize(void) __attribute__((__const__)) __pure; -+ -+#if defined(WANT_STATIC_PAGESIZE) -+# define __DIET_PAGE_SIZE_PREDEF (WANT_STATIC_PAGESIZE) -+# define __DIET_PAGE_SHIFT_PREDEF (ffs(__DIET_PAGE_SIZE_PREDEF)-1) -+#elif defined(__alpha__) || defined(__sparc__) -+# define __DIET_PAGE_SIZE_PREDEF (8192UL) -+# define __DIET_PAGE_SHIFT_PREDEF (13) -+#elif defined(__powerpc64__) -+# define __DIET_PAGE_SIZE_PREDEF (65536UL) -+# define __DIET_PAGE_SHIFT_PREDEF (16) -+#else -+# define __DIET_PAGE_SIZE_PREDEF (4096UL) -+# define __DIET_PAGE_SHIFT_PREDEF (12) -+#endif -+ -+#ifdef WANT_DYN_PAGESIZE -+# define __DIET_PAGE_SIZE (__libc_getpagesize()) -+# define __DIET_PAGE_SHIFT (ffs(__DIET_PAGE_SIZE)-1) -+#else -+# define __DIET_PAGE_SIZE __DIET_PAGE_SIZE_PREDEF -+# define __DIET_PAGE_SHIFT __DIET_PAGE_SHIFT_PREDEF -+#endif -+ -+#endif /* H_DIETLIBC_DIETPAGESIZE_H */ ---- dietlibc-0.31.20080409/s390x/start.S.pagesize -+++ dietlibc-0.31.20080409/s390x/start.S -@@ -26,6 +26,17 @@ _start: - larl %r13,environ - stg %r4,0(%r13) - -+#ifdef WANT_ELFINFO -+# error "VERIFY ME!" -+1: aghi %r4, 8 # increment envp -+ lg %r12, -8(0,%r4) # load envp[-1] into %r12 -+ ogr %r12, %r12 # test %r12 for NULL -+ brc 1, 1b -+ -+ aghi %r13, 8 -+ stg %r4,0(%r13) -+#endif -+ - /* call main or _dyn_start */ - #ifdef WANT_DYNAMIC - brasl %r14,_dyn_start ---- /dev/null -+++ dietlibc-0.31.20080409/dietelfinfo.h -@@ -0,0 +1,20 @@ -+#include "dietfeatures.h" -+ -+#ifdef WANT_ELFINFO -+#include -+#include -+#include -+ -+/* TODO: exported interface from has been changed in 2.6.25 so -+ * the 'elf_addr_t' type is not available anymore. Hence, derive it from -+ * __WORDSIZE__. */ -+ -+#if __WORDSIZE == 64 -+typedef uint64_t __diet_elf_addr_t; -+#elif __WORDSIZE == 32 -+typedef uint32_t __diet_elf_addr_t; -+#endif -+ -+__diet_elf_addr_t * __get_elf_aux_value(unsigned int tag) -+ __attribute__((__visibility__("hidden"),__const__)) __pure; -+#endif ---- dietlibc-0.31.20080409/ia64/start.S.pagesize -+++ dietlibc-0.31.20080409/ia64/start.S -@@ -40,6 +40,16 @@ _start: - ;; - st8 [r14] = out2 /* store envp in environ */ - -+#ifdef WANT_ELFINFO -+# error "MAKE ME IE64 CODE!" -+1: ld8 r9 = [out2], 8 /* load *envp and increment it */ -+ orr r9 = r9, r9 /* test for NULL */ -+ bne 1b -+ -+ adds r14 = 8, r14 /* __elfinfo = environ + 8 */ -+ st8 [r14] = out2 /* store envp in __elfinfo */ -+#endif -+ - #ifdef WANT_DYNAMIC - /* FIXME: dl_init parameter ??? */ - br.call.sptk.few rp = _dyn_start ---- dietlibc-0.31.20080409/i386/start.S.pagesize -+++ dietlibc-0.31.20080409/i386/start.S -@@ -25,6 +25,13 @@ _start: - PIC_INIT /* non-PIC: this is an empty line */ - PUT_VAR %eax, environ, %ecx /* non-PIC: movl %eax,environ */ - -+#ifdef WANT_ELFINFO -+1: add $4, %eax /* increment envp */ -+ cmpl $0, -4(%eax) /* load envp[-1] */ -+ jne 1b /* ... until envp[-1]==NULL */ -+ PUT_VAR %eax, __elfinfo, %ecx -+#endif -+ - #ifdef PROFILING - pushl $_etext - pushl $.text ---- dietlibc-0.31.20080409/dietdirent.h.pagesize -+++ dietlibc-0.31.20080409/dietdirent.h -@@ -1,8 +1,12 @@ - #include - -+#include "dietpagesize.h" -+ - struct __dirstream { - int fd; -- char buf[PAGE_SIZE-(sizeof (int)*3)]; - unsigned int num; - unsigned int cur; -+ char buf[]; - }; /* stream data from opendir() */ -+ -+#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) ---- dietlibc-0.31.20080409/alpha/start.S.pagesize -+++ dietlibc-0.31.20080409/alpha/start.S -@@ -24,6 +24,15 @@ _start: - - stq $18, environ - -+#ifdef WANT_ELFINFO -+# error "MAKE ME alpha ASSEMBLER!" -+1: ldq $19, $18 ; load *envp into $19 -+ addq $18, 1, $18 ; increment *envp -+ orr $19, $19, $19 -+ jne 1b -+ stq $18, __elfinfo -+#endif -+ - #ifdef WANT_DYNAMIC - /* in v0 ($0) is the ld.so _fini pointer */ - mov $0, $19 /* mov v0(dynload) to a3 */ ---- dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize -+++ dietlibc-0.31.20080409/syscalls.s/environ.S -@@ -1,6 +1,7 @@ - .section ".bss" - .align 8 - #include -+#include - - .type environ,object - .weak environ -@@ -15,3 +16,22 @@ environ: - #endif - .size environ,.-environ - .size __environ,.-__environ -+ -+/* __elfinfo will be a copy of __environ after startup. Later, it will be -+ updated by __get_elf_aux_value() to point to the terminating NULL of the -+ environment. -+ -+ Startup code assumes that __elfinfo is located immediately after -+ __environ. */ -+ -+#ifdef WANT_ELFINFO -+.type __elfinfo,object -+.weak __elfinfo -+__elfinfo: -+#if __WORDSIZE == 64 -+ .quad 0 -+#else -+ .long 0 -+#endif -+.size __elfinfo,.-__elfinfo -+#endif ---- dietlibc-0.31.20080409/arm/start.S.pagesize -+++ dietlibc-0.31.20080409/arm/start.S -@@ -23,11 +23,18 @@ _start: - #ifdef __DYN_LIB - ldr sl, .L4 - 1: add sl, pc, sl -- str a3, [sl, ip] @ environ = envp -+ str a3, [ip, sl]! @ environ = envp; ip = GOT(environ) - #else - str a3, [ip, #0] @ environ = envp - #endif - -+#ifdef WANT_ELFINFO -+1: ldr r5, [a3], #4 @ load *envp and increment it -+ orr r5, r5, r5 @ read value==0? -+ bne 1b -+ str a3, [ip, #4] @ __elfinfo = envp -+#endif -+ - #ifdef PROFILING - stmdb sp!, { r0 - r3 } - ldr r0, .L5 -@@ -70,6 +77,3 @@ _exit: - .L5: .word .text - .L6: .word _etext - #endif -- -- -- ---- dietlibc-0.31.20080409/parisc/start.S.pagesize -+++ dietlibc-0.31.20080409/parisc/start.S -@@ -34,6 +34,16 @@ _start: - ldil LP%environ, %r19 - ldo RP%environ(%r19), %r19 - -+#ifdef WANT_ELFINFO -+# error "MAKE ME PARISC CODE!" -+1: add %r20, %r19, %r19 ; envp += 4 -+ ldw -4(0,%r19), %r21 ; load envp[-4] into %r21 -+ comibf =,0, 0,%21,1b ; compare %21 with 0 without nullification -+ -+ ldil LP%__elfinfo, %r19 -+ ldo RP%__elfinfo(%r19), %r19 -+#endif -+ - /* Expand the stack to store the 5th through 7th args */ - ldo 64(%sp), %sp - ---- dietlibc-0.31.20080409/include/sys/shm.h.pagesize -+++ dietlibc-0.31.20080409/include/sys/shm.h -@@ -60,15 +60,6 @@ struct shm_info { - unsigned long swap_successes; - }; - --#if defined(__i386__) || defined(__mips__) || defined(__arm__) || defined(__powerpc__) || defined (__powerpc64__) || defined(__s390__) || defined(__hppa__) || defined(__x86_64__) || defined(__ia64__) --#define PAGE_SIZE 4096UL --#define PAGE_SHIFT 12 --#elif defined(__alpha__) || defined(__sparc__) --/* sun4* has 4k except sun4 architecture, sparc64 has 8k */ --#define PAGE_SIZE 8192UL --#define PAGE_SHIFT 13 --#endif -- - 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; ---- dietlibc-0.31.20080409/sparc/start.S.pagesize -+++ dietlibc-0.31.20080409/sparc/start.S -@@ -25,6 +25,17 @@ _start: - or %o3, %lo(environ), %o3 - st %o2, [%o3] - -+#ifdef WANT_ELFINFO -+# error "VERIFY ME!" -+1: add %o2, %o2, 4 -+ ld [%o2-4], %o4 -+ orcc %o4, %o4, %o4 -+ bne 1b -+ -+ add %o3, %o3, 4 -+ st %o2, [%o3] -+#endif -+ - /* 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 ---- dietlibc-0.31.20080409/sparc/shmat.c.pagesize -+++ dietlibc-0.31.20080409/sparc/shmat.c -@@ -3,17 +3,15 @@ - #include - #include - --extern void* __ipc(); -+#include "../dietpagesize.h" - --#ifndef PAGE_SIZE --#define PAGE_SIZE 4096 --#endif -+extern void* __ipc(); - - void* shmat(int shmid,const void* shmaddr,int shmflg) { - void* raddr; - register void* result; - result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr); -- if ((unsigned long)result <= -(unsigned long)PAGE_SIZE) -+ if ((unsigned long)result <= -(unsigned long)__DIET_PAGE_SIZE) - result=raddr; - return result; - } ---- dietlibc-0.31.20080409/ppc64/start.S.pagesize -+++ dietlibc-0.31.20080409/ppc64/start.S -@@ -58,6 +58,15 @@ _start: - oris 14,14,environ@ha - std 5,environ@l(14) - -+#ifdef WANT_ELFINFO -+1: ldu 15,0(5) -+ addi 5, 5, 8 -+ cmpdi 15,0 -+ bne 1b -+ -+ std 5,__elfinfo@l(14) -+#endif -+ - #ifdef WANT_DYNAMIC - /* #warning dynamic */ - mr 6,7 ---- dietlibc-0.31.20080409/x86_64/start.S.pagesize -+++ dietlibc-0.31.20080409/x86_64/start.S +diff --git a/x86_64/start.S b/x86_64/start.S +index adc461a..3915e33 100644 +--- a/x86_64/start.S ++++ b/x86_64/start.S @@ -12,12 +12,28 @@ _start: leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */ @@ -722,59 +954,6 @@ #ifdef PROFILING pushq %rdi /* save reg args */ ---- dietlibc-0.31.20080409/s390/start.S.pagesize -+++ dietlibc-0.31.20080409/s390/start.S -@@ -30,6 +30,17 @@ _start: - l %r1,8(%r13) - st %r4,0(%r1) - -+#ifdef WANT_ELFINFO -+# error "VERIFY ME!" -+1: ahi %r4, 4 # increment envp -+ l %r12, -4(0,%r4) # load envp[-1] into %r12 -+ or %r12, %r12 # test %r12 for NULL -+ brc 1, 1b -+ -+ ahi %r1, 4 -+ st %r4,0(%r1) -+#endif -+ - /* call main or _dyn_start */ - l %r1,0(%r13) - basr %r14,%r1 ---- dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize -+++ dietlibc-0.31.20080409/dynlinker/ldso_start.S -@@ -86,6 +86,15 @@ __environ: - .long 0 - #endif - -+/* __elfinfo must follow __environ immediately */ -+.global __elfinfo -+__elfinfo: -+#if __WORDSIZE == 64 -+ .quad 0 -+#else -+ .long 0 -+#endif -+ - .global fini_entry - fini_entry: - .long 0 ---- dietlibc-0.31.20080409/mips/start.S.pagesize -+++ dietlibc-0.31.20080409/mips/start.S -@@ -47,6 +47,15 @@ __start: - #endif - add $a2, $a2, $a1 - sw $a2, environ -+#ifdef WANT_ELFINFO -+# error "MAKE ME MIPS CODE!" -+1: addu $a2, $a2, 4 /* increment envp */ -+ lw $4, -4($a2) /* load envp[-1]; TODO: is $4 a proper -+ temporary register? */ -+ bnz 1b /* ... until envp[-1]==NULL -+ TODO: use proper 'bnz' operation */ -+ sw $a2, __elfinfo -+#endif - jalr $25 - la $25, exit - move $4,$2 +-- +1.5.4.5 + diff --git a/dietlibc-0.31-printFG.patch b/dietlibc-0.31-printFG.patch index 5da6b17..797cf7a 100644 --- a/dietlibc-0.31-printFG.patch +++ b/dietlibc-0.31-printFG.patch @@ -1,6 +1,58 @@ -diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/lib/__dtostr.c ---- dietlibc-0.31.20080409/lib/__dtostr.c.printFG 2006-07-04 05:33:02.000000000 +0200 -+++ dietlibc-0.31.20080409/lib/__dtostr.c 2008-04-14 00:36:10.000000000 +0200 +From 313a9b41133ca631890de99f979ee01074d0c0be Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 17:39:23 +0200 +Subject: [PATCH] Fixes/enhancements for INF/NAN handling in printf() + +This patch adds support for uppercase 'F' and 'G' printf format +specifiers. It fixes handling of -INF values in __dtostr() too; +previously, there was + +| unsigned int i; +| if ((i=isinf(d))) return copystring(buf,maxlen,i>0?"inf":"-inf"); + ~~~ +which evaluated to true everytime. The copystring() function +worked for 3-letter words only but not for '-inf'. + +The last argument of __dtostr() was changed from a boolean flag to +a bitmask. Bit 0 encodes 'g' or 'f', and bit 1 lower-/uppercase. +There should be probably added some macros for them; for now, +these values are used directly. + +Please note that this might affect other applications (liblowfat?) +too which are using __dtostr(). + +'isinf(3)' is a builtin with gcc 4.3 and does not give a hint +about the signess of the infinity anymore. Hence, this patch uses +a more portable way where needed. +--- + include/stdlib.h | 6 ++++- + lib/__dtostr.c | 18 +++++++++++----- + lib/__v_printf.c | 59 +++++++++++++++++++++++++++++------------------------ + test/printf.c | 44 +++++++++++++++++++++++++++++++++++---- + 4 files changed, 88 insertions(+), 39 deletions(-) + +diff --git a/include/stdlib.h b/include/stdlib.h +index d1e1569..34f3a7f 100644 +--- a/include/stdlib.h ++++ b/include/stdlib.h +@@ -28,8 +28,12 @@ long double strtold(const char *nptr, char **endptr) __THROW; + long int strtol(const char *nptr, char **endptr, int base) __THROW; + unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW; + ++/* HACK: used flags in __dtostr ++ 0x01 ... 'g' ++ 0x02 ... uppercase ++ Define some constants somewhere... */ + extern int __ltostr(char *s, unsigned int size, unsigned long i, unsigned int base, int UpCase) __THROW; +-extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int g) __THROW; ++extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int flags) __THROW; + + #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L + __extension__ long long int strtoll(const char *nptr, char **endptr, int base) __THROW; +diff --git a/lib/__dtostr.c b/lib/__dtostr.c +index 1d082e3..bc61200 100644 +--- a/lib/__dtostr.c ++++ b/lib/__dtostr.c @@ -5,13 +5,15 @@ static int copystring(char* buf,int maxlen, const char* s) { @@ -20,7 +72,7 @@ diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/li #if 1 union { unsigned long long l; -@@ -35,8 +37,12 @@ int __dtostr(double d,char *buf,unsigned +@@ -35,8 +37,12 @@ int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned i double tmp; char *oldbuf=buf; @@ -35,7 +87,7 @@ diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/li e10=1+(long)(e*0.30102999566398119802); /* log10(2) */ /* Wir iterieren von Links bis wir bei 0 sind oder maxlen erreicht * ist. Wenn maxlen erreicht ist, machen wir das nochmal in -@@ -126,7 +132,7 @@ int __dtostr(double d,char *buf,unsigned +@@ -126,7 +132,7 @@ int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned i if (prec2 || prec>(unsigned int)(buf-oldbuf)+1) { /* more digits wanted */ if (!maxlen) return 0; --maxlen; *buf='.'; ++buf; @@ -44,9 +96,10 @@ diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/li if (prec2) prec=prec2; prec-=buf-oldbuf-1; } else { -diff -up dietlibc-0.31.20080409/lib/__v_printf.c.printFG dietlibc-0.31.20080409/lib/__v_printf.c ---- dietlibc-0.31.20080409/lib/__v_printf.c.printFG 2008-02-19 01:28:13.000000000 +0100 -+++ dietlibc-0.31.20080409/lib/__v_printf.c 2008-04-14 00:36:10.000000000 +0200 +diff --git a/lib/__v_printf.c b/lib/__v_printf.c +index 36202f5..964c005 100644 +--- a/lib/__v_printf.c ++++ b/lib/__v_printf.c @@ -4,6 +4,7 @@ #include #include @@ -72,8 +125,7 @@ diff -up dietlibc-0.31.20080409/lib/__v_printf.c.printFG dietlibc-0.31.20080409/ if (flag_sign || d < +0.0) flag_in_sign=1; - sz=__dtostr(d,s,sizeof(buf)-1,width,preci,g); -+ sz=__dtostr(d,s,sizeof(buf)-1,width,preci,flags); - +- - if (flag_dot) { - char *tmp; - if ((tmp=strchr(s,'.'))) { @@ -83,6 +135,8 @@ diff -up dietlibc-0.31.20080409/lib/__v_printf.c.printFG dietlibc-0.31.20080409/ - } else if (flag_hash) { - s[sz]='.'; - s[++sz]='\0'; ++ sz=__dtostr(d,s,sizeof(buf)-1,width,preci,flags); ++ + if (!isnan(d) && !isinf(d)) { /* skip NaN + INF values */ + if (flag_dot) { + char *tmp; @@ -131,9 +185,10 @@ diff -up dietlibc-0.31.20080409/lib/__v_printf.c.printFG dietlibc-0.31.20080409/ } sz=strlen(s); -diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/test/printf.c ---- dietlibc-0.31.20080409/test/printf.c.printFG 2008-02-19 01:28:13.000000000 +0100 -+++ dietlibc-0.31.20080409/test/printf.c 2008-04-14 00:36:10.000000000 +0200 +diff --git a/test/printf.c b/test/printf.c +index 719461a..ef6050d 100644 +--- a/test/printf.c ++++ b/test/printf.c @@ -2,11 +2,26 @@ #include #include @@ -215,20 +270,6 @@ diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/tes + return EXIT_SUCCESS; } -diff -up dietlibc-0.31.20080409/include/stdlib.h.printFG dietlibc-0.31.20080409/include/stdlib.h ---- dietlibc-0.31.20080409/include/stdlib.h.printFG 2007-09-20 20:51:18.000000000 +0200 -+++ dietlibc-0.31.20080409/include/stdlib.h 2008-04-14 00:36:10.000000000 +0200 -@@ -28,8 +28,12 @@ long double strtold(const char *nptr, ch - long int strtol(const char *nptr, char **endptr, int base) __THROW; - unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW; - -+/* HACK: used flags in __dtostr -+ 0x01 ... 'g' -+ 0x02 ... uppercase -+ Define some constants somewhere... */ - extern int __ltostr(char *s, unsigned int size, unsigned long i, unsigned int base, int UpCase) __THROW; --extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int g) __THROW; -+extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int flags) __THROW; - - #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L - __extension__ long long int strtoll(const char *nptr, char **endptr, int base) __THROW; +-- +1.5.4.5 + diff --git a/dietlibc-0.31-stacksmash-dyn.patch b/dietlibc-0.31-stacksmash-dyn.patch index 1f6d81c..9090deb 100644 --- a/dietlibc-0.31-stacksmash-dyn.patch +++ b/dietlibc-0.31-stacksmash-dyn.patch @@ -1,6 +1,18 @@ -diff -up dietlibc-0.31/lib/stack_smash_handler2.c.~1~ dietlibc-0.31/lib/stack_smash_handler2.c ---- dietlibc-0.31/lib/stack_smash_handler2.c.~1~ 2007-09-01 14:13:21.000000000 +0200 -+++ dietlibc-0.31/lib/stack_smash_handler2.c 2007-09-01 14:13:40.000000000 +0200 +From 4bd1b2d53138ab594a6b73c938daf1b7c2195367 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 17:57:09 +0200 +Subject: [PATCH] __stack_chk_fail_local function + +Added __stack_chk_fail_local() function as an alias for __stack_chk_fail(). +This is required for dynamic linking. +--- + lib/stack_smash_handler2.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/lib/stack_smash_handler2.c b/lib/stack_smash_handler2.c +index ecefeb8..b03c0d5 100644 +--- a/lib/stack_smash_handler2.c ++++ b/lib/stack_smash_handler2.c @@ -2,6 +2,7 @@ #include @@ -9,3 +21,6 @@ diff -up dietlibc-0.31/lib/stack_smash_handler2.c.~1~ dietlibc-0.31/lib/stack_sm /* earlier versions of ProPolice actually gave the address and function * name as arguments to the handler, so it could print some useful +-- +1.5.4.5 + diff --git a/dietlibc-0.31-stacksmash.patch b/dietlibc-0.31-stacksmash.patch index 8044193..a47ddc8 100644 --- a/dietlibc-0.31-stacksmash.patch +++ b/dietlibc-0.31-stacksmash.patch @@ -1,14 +1,39 @@ -2007-09-01 Enrico Scholz - * lib/stack_smash_handler2: modified __stack_chk_fail() to trigger - a segfault by accessing address 0x0. Every system with an MMU - known by me, segfaults by dereferencing a NULL pointer +From 9fb58ca3604cb1426e94689fab57ab5c127c8c55 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 17:56:07 +0200 +Subject: [PATCH] Enhanced __stack_chk_fail - * Makefile: added hack to compile stack_smash_handler2 with - '--fno-omit-frame-pointer'. +* modified __stack_chk_fail() to trigger a segfault by accessing + address 0x0. Every system with an MMU known by me, segfaults + by dereferencing a NULL pointer. -diff -up dietlibc-0.31/lib/stack_smash_handler2.c.~1~ dietlibc-0.31/lib/stack_smash_handler2.c ---- dietlibc-0.31/lib/stack_smash_handler2.c.stacksmash -+++ dietlibc-0.31/lib/stack_smash_handler2.c +* added hack to compile stack_smash_handler2 with + '--fno-omit-frame-pointer'. +--- + Makefile | 3 ++- + lib/stack_smash_handler2.c | 10 +++++++++- + 2 files changed, 11 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index adc2779..0cd0105 100644 +--- a/Makefile ++++ b/Makefile +@@ -172,9 +172,10 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h + $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c + $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ + $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ ++$(OBJDIR)/stack_smash_handler2.o: XCFLAGS:=-fno-omit-frame-pointer + + $(OBJDIR)/%.o: %.c +- $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ ++ $(CROSS)$(CC) $(INC) $(CFLAGS) $(XCFLAGS) -c $< -o $@ -D__dietlibc__ + $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ + endif + +diff --git a/lib/stack_smash_handler2.c b/lib/stack_smash_handler2.c +index 9e85099..ecefeb8 100644 +--- a/lib/stack_smash_handler2.c ++++ b/lib/stack_smash_handler2.c @@ -8,5 +8,13 @@ void __stack_chk_fail(void); * diagnostics. No more. :-( */ void __stack_chk_fail(void) { @@ -24,17 +49,6 @@ diff -up dietlibc-0.31/lib/stack_smash_handler2.c.~1~ dietlibc-0.31/lib/stack_sm + while (1) + *(char *)0 = 0; } ---- dietlibc-0.31/Makefile.stacksmash -+++ dietlibc-0.31/Makefile -@@ -172,9 +172,10 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h - $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c - $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ - $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ -+$(OBJDIR)/stack_smash_handler2.o: XCFLAGS:=-fno-omit-frame-pointer - - $(OBJDIR)/%.o: %.c -- $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ -+ $(CROSS)$(CC) $(INC) $(CFLAGS) $(XCFLAGS) -c $< -o $@ -D__dietlibc__ - $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ - endif - +-- +1.5.4.5 + diff --git a/dietlibc-0.31-stat64.patch b/dietlibc-0.31-stat64.patch deleted file mode 100644 index d043d84..0000000 --- a/dietlibc-0.31-stat64.patch +++ /dev/null @@ -1,88 +0,0 @@ -diff -up dietlibc-0.31.20080409/test/stdio/tst-fseek.c.stat64 dietlibc-0.31.20080409/test/stdio/tst-fseek.c ---- dietlibc-0.31.20080409/test/stdio/tst-fseek.c.stat64 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdio/tst-fseek.c 2008-04-12 21:17:47.000000000 +0200 -@@ -19,6 +19,7 @@ - 02111-1307 USA. */ - - #define _GNU_SOURCE -+#define _FILE_OFFSET_BITS 64 - #include - #include - #include -@@ -38,8 +39,8 @@ main (void) - const char outstr[] = "hello world!\n"; - char strbuf[sizeof outstr]; - char buf[200]; -- struct stat64 st1; -- struct stat64 st2; -+ struct stat st1; -+ struct stat st2; - int result = 0; - - tmpdir = getenv ("TMPDIR"); -@@ -315,9 +316,9 @@ main (void) - } - - /* Check the access time. */ -- if (fstat64 (fd, &st1) < 0) -+ if (fstat (fd, &st1) < 0) - { -- printf ("%d: fstat64() before fseeko() failed\n\n", __LINE__); -+ printf ("%d: fstat() before fseeko() failed\n\n", __LINE__); - result = 1; - } - else -@@ -338,9 +339,9 @@ main (void) - sleep (1); - t = time (NULL); - -- if (fstat64 (fd, &st2) < 0) -+ if (fstat (fd, &st2) < 0) - { -- printf ("%d: fstat64() after fseeko() failed\n\n", __LINE__); -+ printf ("%d: fstat() after fseeko() failed\n\n", __LINE__); - result = 1; - } - if (st1.st_ctime >= t) -@@ -424,9 +425,9 @@ main (void) - printf ("%d: fopen() failed\n\n", __LINE__); - result = 1; - } -- else if (fstat64 (fileno (fp), &st1) < 0) -+ else if (fstat (fileno (fp), &st1) < 0) - { -- printf ("%d: fstat64() before fseeko() failed\n\n", __LINE__); -+ printf ("%d: fstat() before fseeko() failed\n\n", __LINE__); - result = 1; - } - else if (fseeko (fp, 0, SEEK_END) != 0) -@@ -436,7 +437,7 @@ main (void) - } - else if (ftello (fp) != st1.st_size) - { -- printf ("%d: fstat64 st_size %zd ftello %zd\n", __LINE__, -+ printf ("%d: fstat st_size %zd ftello %zd\n", __LINE__, - (size_t) st1.st_size, (size_t) ftello (fp)); - result = 1; - } -@@ -451,9 +452,9 @@ main (void) - printf ("%d: fopen() failed\n\n", __LINE__); - result = 1; - } -- else if (fstat64 (fileno (fp), &st1) < 0) -+ else if (fstat (fileno (fp), &st1) < 0) - { -- printf ("%d: fstat64() before fgetc() failed\n\n", __LINE__); -+ printf ("%d: fstat() before fgetc() failed\n\n", __LINE__); - result = 1; - } - else if (fgetc (fp) == EOF) -@@ -468,7 +469,7 @@ main (void) - } - else if (ftello (fp) != st1.st_size) - { -- printf ("%d: fstat64 st_size %zd ftello %zd\n", __LINE__, -+ printf ("%d: fstat st_size %zd ftello %zd\n", __LINE__, - (size_t) st1.st_size, (size_t) ftello (fp)); - result = 1; - } diff --git a/dietlibc-0.31-testsuite.patch b/dietlibc-0.31-testsuite.patch index bd5f24d..eb4b86d 100644 --- a/dietlibc-0.31-testsuite.patch +++ b/dietlibc-0.31-testsuite.patch @@ -1,53 +1,101 @@ -diff -up dietlibc-0.31.20080409/test/getmntent.c.testsuite dietlibc-0.31.20080409/test/getmntent.c ---- dietlibc-0.31.20080409/test/getmntent.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/getmntent.c 2008-04-14 00:41:17.000000000 +0200 -@@ -33,10 +33,6 @@ while ((e = getmntent(fstab))) { +From ca5319e550e6e64e803a46fbb80d9436d8348567 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 17:41:23 +0200 +Subject: [PATCH] Several testsuite fixes/enhancments + +* test/getmntent.c: I removed the checks which called endmntent() + multiple times resp. with a NULL pointer. Behavior in first + case is undefined and latter causes a segfault (I could not + find documentation that this is allowed). Hence, it does not + make sense to test this. + +* test/stdlib/tst-malloc.c: test 'malloc(0)' only, when + WANT_MALLOC_ZERO is set + +* test/time/tst-strftime.c: the '%Zu' printf format specifier is + bogus (from libc5 ages). I replaced it with the '%zu' one. + + Please note, that this test still fails because it uses glibc + specific features. + +* test/time/tst-strptime.c: removed tests which set a non-C + locale. Broken usage of 'strptime()' result was fixed too. + This test should succeed now. + +* test/math.c: this test was added while working on the '%F/%G' + patch and verifies the isinf() + isnan() functions. + +* fixes lot of broken printf() format specifiers + +* fixes tests using isinf(); the math.c test checks the dietlibc + implementation of isinf() (which differs between positive and + negative inf). All other tests use boolean retval only and test + for the signess of the values +--- + test/Makefile | 2 +- + test/asprintf.c | 2 +- + test/bsearch.c | 2 +- + test/byteswap.c | 8 ++++---- + test/cycles.c | 2 +- + test/getmntent.c | 6 +----- + test/math.c | 29 +++++++++++++++++++++++++++++ + test/mktime.c | 6 +++--- + test/printftest.c | 6 +++--- + test/rand48.c | 12 ++++++------ + test/runtests.sh | 2 +- + test/speed.c | 4 ++-- + test/stdio/tstscanf.c | 4 ++-- + test/stdlib/tst-malloc.c | 6 +++++- + test/stdlib/tst-strtod.c | 4 ++-- + test/sysenter.c | 6 +++--- + test/time/tst-strftime.c | 6 +++--- + test/time/tst-strptime.c | 23 ++++++++++++++++++++--- + 18 files changed, 88 insertions(+), 42 deletions(-) + create mode 100644 test/math.c + +diff --git a/test/Makefile b/test/Makefile +index ff416cf..537b32f 100644 +--- a/test/Makefile ++++ b/test/Makefile +@@ -10,7 +10,7 @@ LCOMPAT=-lcompat + TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty 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 \ ++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 \ +diff --git a/test/asprintf.c b/test/asprintf.c +index 996a5aa..0d4f2eb 100644 +--- a/test/asprintf.c ++++ b/test/asprintf.c +@@ -13,7 +13,7 @@ int main(int argc, char **argv) { + assert(strlen(path) == asprintlen); + + printf("%s\n", path); +- asprintlen=asprintf(&path, "/proc" "/%d/stat", strlen(argv[1])); ++ asprintlen=asprintf(&path, "/proc" "/%zu/stat", strlen(argv[1])); + assert(strlen(path) == asprintlen); + printf("%s\n", path); - printf("closing /etc/fstab\n"); - assert ( 1 == endmntent(fstab)); -- printf("closing /etc/fstab again\n"); -- assert ( 1 == endmntent(fstab)); /* endmntent must always return 1 */ -- printf("entmntent(0)\n"); -- assert ( 1 == endmntent(0)); /* causes a segfault with diet libc */ -+ - return 0; - } -- -diff -up dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite dietlibc-0.31.20080409/test/stdio/tst-fphex.c ---- dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdio/tst-fphex.c 2008-04-14 00:41:17.000000000 +0200 -@@ -37,7 +37,7 @@ int main (int argc, char **argv) { - int n = snprintf (buf, sizeof buf, t->fmt, t->value); - if (n != strlen (t->expect) || strcmp (buf, t->expect) != 0) - { -- printf ("%s\tExpected \"%s\" (%u)\n\tGot \"%s\" (%d, %u)\n", -+ printf ("%s\tExpected \"%s\" (%zu)\n\tGot \"%s\" (%d, %zu)\n", - t->fmt, t->expect, strlen (t->expect), buf, n, strlen (buf)); - result = 1; - } -diff -up dietlibc-0.31.20080409/test/stdio/tstscanf.c.testsuite dietlibc-0.31.20080409/test/stdio/tstscanf.c ---- dietlibc-0.31.20080409/test/stdio/tstscanf.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdio/tstscanf.c 2008-04-14 00:47:36.000000000 +0200 -@@ -338,14 +338,14 @@ main (int argc, char **argv) - int res; - - res = sscanf ("-InF", "%f", &value); -- if (res != 1 || isinf (value) != -1) -+ if (res != 1 || !isinf (value) || !(value<0)) - { - fputs ("test failed!\n", stdout); - result = 1; +diff --git a/test/bsearch.c b/test/bsearch.c +index 961ad35..ede4c88 100644 +--- a/test/bsearch.c ++++ b/test/bsearch.c +@@ -35,7 +35,7 @@ int main() { + die("bsearch returned NULL\n"); } - - res = sscanf ("+InfiNiTY", "%f", &value); -- if (res != 1 || isinf (value) != 1) -+ if (res != 1 || !isinf (value) || !(value>0)) - { - fputs ("test failed!\n", stdout); - result = 1; -diff -up dietlibc-0.31.20080409/test/byteswap.c.testsuite dietlibc-0.31.20080409/test/byteswap.c ---- dietlibc-0.31.20080409/test/byteswap.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/byteswap.c 2008-04-14 00:41:17.000000000 +0200 + if (k != array+i) die("bsearch found wrong element\n"); +- printf("%d\n",k-array); ++ printf("%ld\n",k-array); + } + } + return 0; +diff --git a/test/byteswap.c b/test/byteswap.c +index 19239dd..6f43c25 100644 +--- a/test/byteswap.c ++++ b/test/byteswap.c @@ -9,12 +9,12 @@ int main() { snprintf(buf,100,"%x %x", bswap_16(0x1234), bswap_16(0x5678)); assert(strcmp(buf, "3412 7856") == 0); @@ -65,20 +113,10 @@ diff -up dietlibc-0.31.20080409/test/byteswap.c.testsuite dietlibc-0.31.20080409 assert(strcmp(buf, "efcdab8967452301") == 0); return 0; } -diff -up dietlibc-0.31.20080409/test/runtests.sh.testsuite dietlibc-0.31.20080409/test/runtests.sh ---- dietlibc-0.31.20080409/test/runtests.sh.testsuite 2008-04-14 00:41:17.000000000 +0200 -+++ dietlibc-0.31.20080409/test/runtests.sh 2008-04-14 00:41:17.000000000 +0200 -@@ -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 sysconf sysenter ungetc waitpid" -+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 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" - - STDIN="read1" - PASS="getpass" -diff -up dietlibc-0.31.20080409/test/cycles.c.testsuite dietlibc-0.31.20080409/test/cycles.c ---- dietlibc-0.31.20080409/test/cycles.c.testsuite 2004-08-24 12:10:48.000000000 +0200 -+++ dietlibc-0.31.20080409/test/cycles.c 2008-04-14 00:41:17.000000000 +0200 +diff --git a/test/cycles.c b/test/cycles.c +index 35547f8..a4cb8c8 100644 +--- a/test/cycles.c ++++ b/test/cycles.c @@ -24,7 +24,7 @@ int main(int argc,char* argv[]) { if (!fork()) { execve(argv[1],argv+1,environ); exit(1); } wait(0); @@ -88,51 +126,84 @@ diff -up dietlibc-0.31.20080409/test/cycles.c.testsuite dietlibc-0.31.20080409/t return 0; } -diff -up dietlibc-0.31.20080409/test/sysenter.c.testsuite dietlibc-0.31.20080409/test/sysenter.c ---- dietlibc-0.31.20080409/test/sysenter.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/sysenter.c 2008-04-14 00:41:17.000000000 +0200 -@@ -11,11 +11,11 @@ int main() { - int i; - for (i=0; environ[i]; ++i) ; - for (x=(struct elf_aux*)(environ+i+1); x->type; ++x) { -- printf("%d %x\n",x->type,x->value); -+ printf("%ld %lx\n",x->type,x->value); - if (x->type==AT_PAGESZ) -- printf("pagesize %d\n",x->value); -+ printf("pagesize %ld\n",x->value); - else if (x->type==AT_SYSINFO) -- printf("vsyscall %p\n",x->value); -+ printf("vsyscall %p\n",(void *)x->value); - } +diff --git a/test/getmntent.c b/test/getmntent.c +index fc17a83..1039d06 100644 +--- a/test/getmntent.c ++++ b/test/getmntent.c +@@ -33,10 +33,6 @@ while ((e = getmntent(fstab))) { + + printf("closing /etc/fstab\n"); + assert ( 1 == endmntent(fstab)); +- printf("closing /etc/fstab again\n"); +- assert ( 1 == endmntent(fstab)); /* endmntent must always return 1 */ +- printf("entmntent(0)\n"); +- assert ( 1 == endmntent(0)); /* causes a segfault with diet libc */ ++ + return 0; + } +- +diff --git a/test/math.c b/test/math.c +new file mode 100644 +index 0000000..687103c +--- /dev/null ++++ b/test/math.c +@@ -0,0 +1,29 @@ ++#include ++#include ++#include ++ ++int main() ++{ ++ extern int __isinf(double d); ++ extern int __isnan(double d); ++ ++#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) ++ assert(__isinf(__builtin_inff()) == +1); ++ assert(__isinf(-__builtin_inff()) == -1); ++ ++ assert(__isinf(__builtin_inf()) == +1); ++ assert(__isinf(-__builtin_inf()) == -1); ++ ++ assert(__isnan(__builtin_nan(""))); ++#endif ++ ++ assert(__isinf((DBL_MAX * DBL_MAX)) == +1); ++ assert(__isinf(-(DBL_MAX * DBL_MAX)) == -1); ++ ++ assert(isinf((DBL_MAX * DBL_MAX))); ++ assert(isinf(-(DBL_MAX * DBL_MAX))); ++ ++ //assert(isnan(nan(""))); ++ ++ return 0; ++} +diff --git a/test/mktime.c b/test/mktime.c +index 5e9e65c..9b4bd5e 100644 +--- a/test/mktime.c ++++ b/test/mktime.c +@@ -9,15 +9,15 @@ int main() { + t.tm_mday=29; + t.tm_mon=2; + t.tm_year=100; +- printf("%d\n",mktime(&t)); ++ printf("%ld\n",(long)mktime(&t)); + t.tm_mday=1; + t.tm_mon=3; + t.tm_year=102; +- printf("%d\n",mktime(&t)); ++ printf("%ld\n",(long)mktime(&t)); + t.tm_mday=1; + t.tm_mon=6; + t.tm_year=102; +- printf("%d\n",mktime(&t)); ++ printf("%ld\n",(long)mktime(&t)); return 0; } -diff -up dietlibc-0.31.20080409/test/Makefile.testsuite dietlibc-0.31.20080409/test/Makefile ---- dietlibc-0.31.20080409/test/Makefile.testsuite 2008-04-14 00:41:17.000000000 +0200 -+++ dietlibc-0.31.20080409/test/Makefile 2008-04-14 00:41:17.000000000 +0200 -@@ -10,7 +10,7 @@ LCOMPAT=-lcompat - TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty 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 \ -+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 \ -diff -up dietlibc-0.31.20080409/test/bsearch.c.testsuite dietlibc-0.31.20080409/test/bsearch.c ---- dietlibc-0.31.20080409/test/bsearch.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/bsearch.c 2008-04-14 00:41:17.000000000 +0200 -@@ -35,7 +35,7 @@ int main() { - die("bsearch returned NULL\n"); - } - if (k != array+i) die("bsearch found wrong element\n"); -- printf("%d\n",k-array); -+ printf("%ld\n",k-array); - } - } - return 0; -diff -up dietlibc-0.31.20080409/test/printftest.c.testsuite dietlibc-0.31.20080409/test/printftest.c ---- dietlibc-0.31.20080409/test/printftest.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/printftest.c 2008-04-14 00:41:17.000000000 +0200 + +diff --git a/test/printftest.c b/test/printftest.c +index 4743279..47d9580 100644 +--- a/test/printftest.c ++++ b/test/printftest.c @@ -101,8 +101,8 @@ int main() printf("#%i#\n",18); printf("#%d#\n",18); @@ -153,9 +224,87 @@ diff -up dietlibc-0.31.20080409/test/printftest.c.testsuite dietlibc-0.31.200804 printf ("snprintf (\"%%.999999u\", 10) == %d\n", snprintf(buf2, sizeof(buf2), "%.999999u", 10)); -diff -up dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-malloc.c ---- dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdlib/tst-malloc.c 2008-04-14 00:41:17.000000000 +0200 +diff --git a/test/rand48.c b/test/rand48.c +index 4f5b08f..1e67632 100644 +--- a/test/rand48.c ++++ b/test/rand48.c +@@ -6,16 +6,16 @@ main (void) + { + static unsigned short data[7] = { 1, 2, 3, 4, 5, 6, 7 }; + +- printf ("one %X\n", mrand48 ()); +- printf ("two %X\n", mrand48 ()); +- printf ("three %X\n", mrand48 ()); ++ printf ("one %lX\n", mrand48 ()); ++ printf ("two %lX\n", mrand48 ()); ++ printf ("three %lX\n", mrand48 ()); + + lcong48 (data); + printf ("after lcong48:\n"); + +- printf ("one %X\n", mrand48 ()); +- printf ("two %X\n", mrand48 ()); +- printf ("three %X\n", mrand48 ()); ++ printf ("one %lX\n", mrand48 ()); ++ printf ("two %lX\n", mrand48 ()); ++ printf ("three %lX\n", mrand48 ()); + + return 0; + } +diff --git a/test/runtests.sh b/test/runtests.sh +index 908caa5..fcd3202 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 sysconf sysenter ungetc waitpid" ++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 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" + + STDIN="read1" + PASS="getpass" +diff --git a/test/speed.c b/test/speed.c +index 674b9a8..22249a7 100644 +--- a/test/speed.c ++++ b/test/speed.c +@@ -7,10 +7,10 @@ int main() { + int i; + time_t t; + +- printf("%d\n", time(0)); ++ printf("%ld\n", (long)time(0)); + for (i=0; i<10000000; ++i) + t=time(0); + +- printf("%d\n", time(0)); ++ printf("%ld\n", (long)time(0)); + return 0; + } +diff --git a/test/stdio/tstscanf.c b/test/stdio/tstscanf.c +index 44ddf49..0f55c3c 100644 +--- a/test/stdio/tstscanf.c ++++ b/test/stdio/tstscanf.c +@@ -338,14 +338,14 @@ main (int argc, char **argv) + int res; + + res = sscanf ("-InF", "%f", &value); +- if (res != 1 || isinf (value) != -1) ++ if (res != 1 || !isinf (value) || !(value<0)) + { + fputs ("test failed!\n", stdout); + result = 1; + } + + res = sscanf ("+InfiNiTY", "%f", &value); +- if (res != 1 || isinf (value) != 1) ++ if (res != 1 || !isinf (value) || !(value>0)) + { + fputs ("test failed!\n", stdout); + result = 1; +diff --git a/test/stdlib/tst-malloc.c b/test/stdlib/tst-malloc.c +index 09fbb1f..4a491d9 100644 +--- a/test/stdlib/tst-malloc.c ++++ b/test/stdlib/tst-malloc.c @@ -21,13 +21,15 @@ #include #include @@ -185,9 +334,10 @@ diff -up dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite dietlibc-0.31 p = realloc (p, 0); if (p != NULL) -diff -up dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-strtod.c ---- dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/stdlib/tst-strtod.c 2008-04-14 00:41:17.000000000 +0200 +diff --git a/test/stdlib/tst-strtod.c b/test/stdlib/tst-strtod.c +index 630a8fc..bacdca7 100644 +--- a/test/stdlib/tst-strtod.c ++++ b/test/stdlib/tst-strtod.c @@ -149,10 +149,10 @@ main (int argc, char ** argv) } @@ -201,35 +351,29 @@ diff -up dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite dietlibc-0.31 status = 1; } -diff -up dietlibc-0.31.20080409/test/rand48.c.testsuite dietlibc-0.31.20080409/test/rand48.c ---- dietlibc-0.31.20080409/test/rand48.c.testsuite 2002-05-29 15:20:40.000000000 +0200 -+++ dietlibc-0.31.20080409/test/rand48.c 2008-04-14 00:41:17.000000000 +0200 -@@ -6,16 +6,16 @@ main (void) - { - static unsigned short data[7] = { 1, 2, 3, 4, 5, 6, 7 }; - -- printf ("one %X\n", mrand48 ()); -- printf ("two %X\n", mrand48 ()); -- printf ("three %X\n", mrand48 ()); -+ printf ("one %lX\n", mrand48 ()); -+ printf ("two %lX\n", mrand48 ()); -+ printf ("three %lX\n", mrand48 ()); - - lcong48 (data); - printf ("after lcong48:\n"); - -- printf ("one %X\n", mrand48 ()); -- printf ("two %X\n", mrand48 ()); -- printf ("three %X\n", mrand48 ()); -+ printf ("one %lX\n", mrand48 ()); -+ printf ("two %lX\n", mrand48 ()); -+ printf ("three %lX\n", mrand48 ()); - +diff --git a/test/sysenter.c b/test/sysenter.c +index a8fa3a8..3d85916 100644 +--- a/test/sysenter.c ++++ b/test/sysenter.c +@@ -11,11 +11,11 @@ int main() { + int i; + for (i=0; environ[i]; ++i) ; + for (x=(struct elf_aux*)(environ+i+1); x->type; ++x) { +- printf("%d %x\n",x->type,x->value); ++ printf("%ld %lx\n",x->type,x->value); + if (x->type==AT_PAGESZ) +- printf("pagesize %d\n",x->value); ++ printf("pagesize %ld\n",x->value); + else if (x->type==AT_SYSINFO) +- printf("vsyscall %p\n",x->value); ++ printf("vsyscall %p\n",(void *)x->value); + } return 0; } -diff -up dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strftime.c ---- dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/time/tst-strftime.c 2008-04-14 00:41:17.000000000 +0200 +diff --git a/test/time/tst-strftime.c b/test/time/tst-strftime.c +index e092e93..27db9a4 100644 +--- a/test/time/tst-strftime.c ++++ b/test/time/tst-strftime.c @@ -49,18 +49,18 @@ int main (void) { if (res == 0) @@ -252,9 +396,10 @@ diff -up dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite dietlibc-0.31 free (buf); } -diff -up dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strptime.c ---- dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/time/tst-strptime.c 2008-04-14 00:41:17.000000000 +0200 +diff --git a/test/time/tst-strptime.c b/test/time/tst-strptime.c +index 6277ea6..2773180 100644 +--- a/test/time/tst-strptime.c ++++ b/test/time/tst-strptime.c @@ -41,10 +41,12 @@ static const struct { "C", "03/03/00", "%D", 5, 62, 2, 3 }, { "C", "9/9/99", "%x", 4, 251, 8, 9 }, @@ -311,86 +456,6 @@ diff -up dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite dietlibc-0.31 { printf ("not all of `%s' read\n", day_tests[i].input); result = 1; -diff -up dietlibc-0.31.20080409/test/mktime.c.testsuite dietlibc-0.31.20080409/test/mktime.c ---- dietlibc-0.31.20080409/test/mktime.c.testsuite 2004-03-27 01:47:00.000000000 +0100 -+++ dietlibc-0.31.20080409/test/mktime.c 2008-04-14 00:41:17.000000000 +0200 -@@ -9,15 +9,15 @@ int main() { - t.tm_mday=29; - t.tm_mon=2; - t.tm_year=100; -- printf("%d\n",mktime(&t)); -+ printf("%ld\n",(long)mktime(&t)); - t.tm_mday=1; - t.tm_mon=3; - t.tm_year=102; -- printf("%d\n",mktime(&t)); -+ printf("%ld\n",(long)mktime(&t)); - t.tm_mday=1; - t.tm_mon=6; - t.tm_year=102; -- printf("%d\n",mktime(&t)); -+ printf("%ld\n",(long)mktime(&t)); - return 0; - } - -diff -up dietlibc-0.31.20080409/test/asprintf.c.testsuite dietlibc-0.31.20080409/test/asprintf.c ---- dietlibc-0.31.20080409/test/asprintf.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/asprintf.c 2008-04-14 00:41:17.000000000 +0200 -@@ -13,7 +13,7 @@ int main(int argc, char **argv) { - assert(strlen(path) == asprintlen); - - printf("%s\n", path); -- asprintlen=asprintf(&path, "/proc" "/%d/stat", strlen(argv[1])); -+ asprintlen=asprintf(&path, "/proc" "/%zu/stat", strlen(argv[1])); - assert(strlen(path) == asprintlen); - printf("%s\n", path); - -diff -up /dev/null dietlibc-0.31.20080409/test/math.c ---- /dev/null 2008-03-18 07:40:22.289057188 +0100 -+++ dietlibc-0.31.20080409/test/math.c 2008-04-14 00:46:45.000000000 +0200 -@@ -0,0 +1,29 @@ -+#include -+#include -+#include -+ -+int main() -+{ -+ extern int __isinf(double d); -+ extern int __isnan(double d); -+ -+#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) -+ assert(__isinf(__builtin_inff()) == +1); -+ assert(__isinf(-__builtin_inff()) == -1); -+ -+ assert(__isinf(__builtin_inf()) == +1); -+ assert(__isinf(-__builtin_inf()) == -1); -+ -+ assert(__isnan(__builtin_nan(""))); -+#endif -+ -+ assert(__isinf((DBL_MAX * DBL_MAX)) == +1); -+ assert(__isinf(-(DBL_MAX * DBL_MAX)) == -1); -+ -+ assert(isinf((DBL_MAX * DBL_MAX))); -+ assert(isinf(-(DBL_MAX * DBL_MAX))); -+ -+ //assert(isnan(nan(""))); -+ -+ return 0; -+} -diff -up dietlibc-0.31.20080409/test/speed.c.testsuite dietlibc-0.31.20080409/test/speed.c ---- dietlibc-0.31.20080409/test/speed.c.testsuite 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080409/test/speed.c 2008-04-14 00:41:17.000000000 +0200 -@@ -7,10 +7,10 @@ int main() { - int i; - time_t t; - -- printf("%d\n", time(0)); -+ printf("%ld\n", (long)time(0)); - for (i=0; i<10000000; ++i) - t=time(0); - -- printf("%d\n", time(0)); -+ printf("%ld\n", (long)time(0)); - return 0; - } +-- +1.5.4.5 + diff --git a/dietlibc-0.31.20080212-teststdout.patch b/dietlibc-0.31.20080212-teststdout.patch index 9d11ab4..7965ff8 100644 --- a/dietlibc-0.31.20080212-teststdout.patch +++ b/dietlibc-0.31.20080212-teststdout.patch @@ -1,6 +1,21 @@ -diff -up dietlibc-0.31.20080212/test/atexit.c.~1~ dietlibc-0.31.20080212/test/atexit.c ---- dietlibc-0.31.20080212/test/atexit.c.~1~ 2003-02-20 16:57:12.000000000 +0100 -+++ dietlibc-0.31.20080212/test/atexit.c 2008-02-13 18:34:12.000000000 +0100 +From b8de58754249c7f43c5959dc72c62e13851d45cb Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 19 Apr 2008 17:45:11 +0200 +Subject: [PATCH] Use stdout instead of stderr in testsuite + +This patches uses stdout instead stderr when giving out normal status +messages in the testsuite. +--- + test/atexit.c | 2 +- + test/malloc-debugger.c | 2 +- + test/sendfile.c | 2 +- + test/waitpid.c | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/test/atexit.c b/test/atexit.c +index 709a3e4..79ee392 100644 +--- a/test/atexit.c ++++ b/test/atexit.c @@ -2,7 +2,7 @@ #include @@ -10,19 +25,10 @@ diff -up dietlibc-0.31.20080212/test/atexit.c.~1~ dietlibc-0.31.20080212/test/at } int main() { -diff -up dietlibc-0.31.20080212/test/sendfile.c.~1~ dietlibc-0.31.20080212/test/sendfile.c ---- dietlibc-0.31.20080212/test/sendfile.c.~1~ 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080212/test/sendfile.c 2008-02-13 18:35:34.000000000 +0100 -@@ -11,5 +11,5 @@ int main() { - - printf("sendfile returned %d\n",ret); - --return 0; -+ return ret<0 ? 1 : 0; - } -diff -up dietlibc-0.31.20080212/test/malloc-debugger.c.~1~ dietlibc-0.31.20080212/test/malloc-debugger.c ---- dietlibc-0.31.20080212/test/malloc-debugger.c.~1~ 2003-02-20 16:57:13.000000000 +0100 -+++ dietlibc-0.31.20080212/test/malloc-debugger.c 2008-02-13 18:34:27.000000000 +0100 +diff --git a/test/malloc-debugger.c b/test/malloc-debugger.c +index 040196e..058807e 100644 +--- a/test/malloc-debugger.c ++++ b/test/malloc-debugger.c @@ -4,7 +4,7 @@ int main() { char* c=malloc(13); @@ -32,9 +38,21 @@ diff -up dietlibc-0.31.20080212/test/malloc-debugger.c.~1~ dietlibc-0.31.2008021 c[0]=14; // c[15]=0; tmp=realloc(c,12345); -diff -up dietlibc-0.31.20080212/test/waitpid.c.~1~ dietlibc-0.31.20080212/test/waitpid.c ---- dietlibc-0.31.20080212/test/waitpid.c.~1~ 2003-12-15 14:07:42.000000000 +0100 -+++ dietlibc-0.31.20080212/test/waitpid.c 2008-02-13 18:35:57.000000000 +0100 +diff --git a/test/sendfile.c b/test/sendfile.c +index d43cdd2..28b3af5 100644 +--- a/test/sendfile.c ++++ b/test/sendfile.c +@@ -11,5 +11,5 @@ int main() { + + printf("sendfile returned %d\n",ret); + +-return 0; ++ return ret<0 ? 1 : 0; + } +diff --git a/test/waitpid.c b/test/waitpid.c +index fe2cb5b..92c0b0e 100644 +--- a/test/waitpid.c ++++ b/test/waitpid.c @@ -11,7 +11,7 @@ int main() { perror("fork"); _exit(1); @@ -44,3 +62,6 @@ diff -up dietlibc-0.31.20080212/test/waitpid.c.~1~ dietlibc-0.31.20080212/test/w sleep(1); _exit(23); } +-- +1.5.4.5 + From 921d845ad7ff918f541024ab4881dc0131ed661a Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 18 May 2008 10:14:44 +0000 Subject: [PATCH 060/161] updated to 20080517 snapshot --- .cvsignore | 2 +- sources | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.cvsignore b/.cvsignore index 842a349..85e3a5e 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -dietlibc-0.31.20080409.tar.bz2 +dietlibc-0.31.20080517.tar.bz2 diff --git a/sources b/sources index b84c684..f50cb8d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -8ab045af7ad246c930c4e1b0fca1063c dietlibc-0.31.20080409.tar.bz2 +a3cd3a38ae545a3224aee9b17b50aa12 dietlibc-0.31.20080517.tar.bz2 From 0abbcc0bacd1077d042be107338e2caa452beb22 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 18 May 2008 10:16:45 +0000 Subject: [PATCH 061/161] - updated to 20080517 snapshot - use patches from git repository --- dietlibc.spec | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 6de0312..f75e44a 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -6,7 +6,7 @@ ## --with dynamic ... enable dynamic lib support -%global snapshot 20080409 +%global snapshot 20080517 %global pkglibdir %_prefix/lib/dietlibc %ifarch %ix86 x86_64 @@ -52,7 +52,6 @@ Patch33: dietlibc-0.31-stacksmash-dyn.patch Patch41: dietlibc-0.31.20080212-teststdout.patch Patch43: dietlibc-0.31-pagesize.patch Patch44: dietlibc-0.31-printFG.patch -Patch45: dietlibc-0.31-stat64.patch Patch46: dietlibc-0.31-testsuite.patch Patch47: dietlibc-0.31-lcctime.patch Patch48: dietlibc-0.31-implicitfunc.patch @@ -108,7 +107,6 @@ This package contains the dynamic libraries for dietlibc. %patch41 -p1 -b .teststdout %patch43 -p1 -b .pagesize %patch44 -p1 -b .printFG -%patch45 -p1 -b .stat64 %patch46 -p1 -b .testsuite %patch47 -p1 -b .lcctime %patch48 -p1 -b .implicitfunc @@ -201,6 +199,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun May 18 2008 Enrico Scholz - 0.31-5.20080517 +- updated to 20080517 snapshot +- use patches from git repository + * Sun May 18 2008 Enrico Scholz - 0.31-5.20080409 - fixed __signalfd() prototype From 1cfe6b6bbf6c51378b0865191229321725b114b2 Mon Sep 17 00:00:00 2001 From: ensc Date: Sat, 21 Jun 2008 14:57:08 +0000 Subject: [PATCH 062/161] removed CVS tags --- Makefile | 1 - dietlibc.spec | 2 -- 2 files changed, 3 deletions(-) diff --git a/Makefile b/Makefile index ad740a7..538d0ab 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ # Makefile for source rpm: dietlibc -# $Id: Makefile,v 1.1 2005/03/04 00:52:22 ensc Exp $ NAME := dietlibc SPECFILE = $(firstword $(wildcard *.spec)) diff --git a/dietlibc.spec b/dietlibc.spec index f75e44a..53afe17 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -1,5 +1,3 @@ -## $Id: dietlibc.spec,v 1.3 2005/02/01 12:03:17 ensc Exp $ - ## This package understands the following switches: ## --with[out] ssp ... enable/disable SSP; default depends ## on target architecture From fd1180c7f938f7a5e1d6d91c25ee920e5b1698d3 Mon Sep 17 00:00:00 2001 From: ensc Date: Wed, 2 Jul 2008 06:57:21 +0000 Subject: [PATCH 063/161] use .comment instead of .note section for the not-implemented symbol --- dietlibc-0.29-scall.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dietlibc-0.29-scall.patch b/dietlibc-0.29-scall.patch index 526306b..3e654b1 100644 --- a/dietlibc-0.29-scall.patch +++ b/dietlibc-0.29-scall.patch @@ -13,13 +13,13 @@ diff --git a/libcompat/syscall.S b/libcompat/syscall.S index c9f72bb..6b6a8aa 100644 --- a/libcompat/syscall.S +++ b/libcompat/syscall.S -@@ -130,6 +130,12 @@ syscall: +@@ -130,7 +130,12 @@ syscall: b __unified_syscall #else - /* arch not implemented yet */ +#include -+ .section .note ++ .section .comment +#if (__WORDSIZE == 64) + .quad __syscall_2_not_implemented_for_this_arch +#else From 8298f6b77b71114e981244c17a0755f8fa6e3737 Mon Sep 17 00:00:00 2001 From: ensc Date: Wed, 2 Jul 2008 06:59:34 +0000 Subject: [PATCH 064/161] fixed ARM code and use cmp instead of orrs --- dietlibc-0.31-pagesize.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index 666eaae..f1d2a38 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -140,7 +140,7 @@ index fcd3d7c..e7e3be7 100644 +#ifdef WANT_ELFINFO +1: ldr r5, [a3], #4 @ load *envp and increment it -+ orr r5, r5, r5 @ read value==0? ++ cmp r5, #0 @ read value==0? + bne 1b + str a3, [ip, #4] @ __elfinfo = envp +#endif From e41dfb516a083798404816044d3bca24224eb9c2 Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Wed, 16 Jul 2008 20:37:53 +0000 Subject: [PATCH 065/161] fix license tag --- dietlibc.spec | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 53afe17..3f52e55 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -28,17 +28,17 @@ Summary: Small libc implementation Name: dietlibc Version: 0.31 -Release: %release_func 5%{?snapshot:.%snapshot} -License: GPL +Release: %release_func 6%{?snapshot:.%snapshot} +License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ -%if !0%{?snapshot:1} -Source0: http://www.kernel.org/pub/linux/libs/dietlibc/%name-%version.tar.bz2 -Source1: http://www.fefe.de/dietlibc/%name-%version.tar.bz2.sig -%else +# %%if !0%{?snapshot:1} +# Source0: http://www.kernel.org/pub/linux/libs/dietlibc/%name-%version.tar.bz2 +# Source1: http://www.fefe.de/dietlibc/%name-%version.tar.bz2.sig +# %%else # generated by 'make cvs-sources [CVS_DATE=....]' Source0: %name-%version.%snapshot.tar.bz2 -%endif +# %%endif Source10: runtests-X.sh Patch1: dietlibc-0.28-setpriority.patch Patch10: dietlibc-0.29-scall.patch @@ -111,14 +111,14 @@ This package contains the dynamic libraries for dietlibc. %patch49 -p1 -b .noreturn -%if %{without ssp} +# %%if %{without ssp} %patch20 -p1 -b .nostackprotector sed -i -e 's!^#define WANT_SSP$!// \0!g; s!.*\(#define WANT_STACKGAP\).*!\1!g' dietfeatures.h %global xtra_fixcflags -fno-stack-protector -%else -%global xtra_fixcflags %nil -%endif +# %%else +# %%global xtra_fixcflags %nil +# %%endif %ifarch %ix86 sed -i \ @@ -186,17 +186,20 @@ rm -rf $RPM_BUILD_ROOT %{?with_dynamic:%exclude %pkglibdir/*/*.so} -%if %{with dynamic} +# %%if %{with dynamic} %files lib %defattr(-,root,root,-) %config(noreplace) %_sysconfdir/* %dir %pkglibdir %dir %pkglibdir/lib-* %pkglibdir/lib-%target_cpu/*.so -%endif +# %%endif %changelog +* Wed Jul 16 2008 Tom "spot" Callaway - 0.31-6.20080517 +- fix license tag + * Sun May 18 2008 Enrico Scholz - 0.31-5.20080517 - updated to 20080517 snapshot - use patches from git repository From e58672bac5a79fc9cfbb2e410522812253268539 Mon Sep 17 00:00:00 2001 From: ensc Date: Wed, 16 Jul 2008 20:49:34 +0000 Subject: [PATCH 066/161] fixed patch --- dietlibc-0.29-scall.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietlibc-0.29-scall.patch b/dietlibc-0.29-scall.patch index 3e654b1..af7e6e9 100644 --- a/dietlibc-0.29-scall.patch +++ b/dietlibc-0.29-scall.patch @@ -13,7 +13,7 @@ diff --git a/libcompat/syscall.S b/libcompat/syscall.S index c9f72bb..6b6a8aa 100644 --- a/libcompat/syscall.S +++ b/libcompat/syscall.S -@@ -130,7 +130,12 @@ syscall: +@@ -130,6 +130,12 @@ syscall: b __unified_syscall #else From d5c4ed627d25d8794d5fbd70cc3640bac2198f07 Mon Sep 17 00:00:00 2001 From: ensc Date: Wed, 16 Jul 2008 21:05:56 +0000 Subject: [PATCH 067/161] fixed typo; reverted %if changes from last commit --- dietlibc.spec | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 3f52e55..987a8bf 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -14,7 +14,7 @@ %endif %ifarch %ix86 x86_64 arm -%bcond_with dynamic\ +%bcond_with dynamic %endif %ifarch %ix86 @@ -32,13 +32,13 @@ Release: %release_func 6%{?snapshot:.%snapshot} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ -# %%if !0%{?snapshot:1} -# Source0: http://www.kernel.org/pub/linux/libs/dietlibc/%name-%version.tar.bz2 -# Source1: http://www.fefe.de/dietlibc/%name-%version.tar.bz2.sig -# %%else +%if !0%{?snapshot:1} +Source0: http://www.kernel.org/pub/linux/libs/dietlibc/%name-%version.tar.bz2 +Source1: http://www.fefe.de/dietlibc/%name-%version.tar.bz2.sig +%else # generated by 'make cvs-sources [CVS_DATE=....]' Source0: %name-%version.%snapshot.tar.bz2 -# %%endif +%endif Source10: runtests-X.sh Patch1: dietlibc-0.28-setpriority.patch Patch10: dietlibc-0.29-scall.patch @@ -111,14 +111,14 @@ This package contains the dynamic libraries for dietlibc. %patch49 -p1 -b .noreturn -# %%if %{without ssp} +%if %{without ssp} %patch20 -p1 -b .nostackprotector sed -i -e 's!^#define WANT_SSP$!// \0!g; s!.*\(#define WANT_STACKGAP\).*!\1!g' dietfeatures.h %global xtra_fixcflags -fno-stack-protector -# %%else -# %%global xtra_fixcflags %nil -# %%endif +%else +%global xtra_fixcflags %nil +%endif %ifarch %ix86 sed -i \ @@ -186,14 +186,14 @@ rm -rf $RPM_BUILD_ROOT %{?with_dynamic:%exclude %pkglibdir/*/*.so} -# %%if %{with dynamic} +%if %{with dynamic} %files lib %defattr(-,root,root,-) %config(noreplace) %_sysconfdir/* %dir %pkglibdir %dir %pkglibdir/lib-* %pkglibdir/lib-%target_cpu/*.so -# %%endif +%endif %changelog From 40415ddcc8548ccd6fca3f8aec1e020ab41a850f Mon Sep 17 00:00:00 2001 From: ensc Date: Sat, 18 Oct 2008 17:02:52 +0000 Subject: [PATCH 068/161] updated ARM code s!#error!#warning! --- dietlibc-0.31-pagesize.patch | 55 +++++++++++++++++------------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index f1d2a38..1d35b91 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -1,4 +1,4 @@ -From bbeb245bbb5bc919f8f4d2049ba463ed349ef759 Mon Sep 17 00:00:00 2001 +From 6160ca8256603d1f1a929f01238bf43866552dee Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:35:14 +0200 Subject: [PATCH] Support for dynamic PAGE_SIZE @@ -66,7 +66,7 @@ auxilary elf-info table. Now, this is not available anymore and I use a type derived from __WORD_SIZE. --- alpha/start.S | 9 ++++ - arm/start.S | 12 ++++-- + arm/start.S | 13 ++++++- dietdirent.h | 6 ++- dietelfinfo.h | 20 ++++++++++ dietfeatures.h | 14 +++++++ @@ -98,14 +98,14 @@ use a type derived from __WORD_SIZE. test/runtests.sh | 2 +- test/sysconf.c | 80 ++++++++++++++++++++++++++++++++++++++++ x86_64/start.S | 16 ++++++++ - 33 files changed, 374 insertions(+), 44 deletions(-) + 33 files changed, 378 insertions(+), 41 deletions(-) create mode 100644 dietelfinfo.h create mode 100644 dietpagesize.h create mode 100644 libcruft/__get_elf_aux_value.c create mode 100644 test/sysconf.c diff --git a/alpha/start.S b/alpha/start.S -index 7e7cf9b..e5e64a1 100644 +index 7e7cf9b..b13c9c9 100644 --- a/alpha/start.S +++ b/alpha/start.S @@ -24,6 +24,15 @@ _start: @@ -113,7 +113,7 @@ index 7e7cf9b..e5e64a1 100644 stq $18, environ +#ifdef WANT_ELFINFO -+# error "MAKE ME alpha ASSEMBLER!" ++# warning "MAKE ME alpha ASSEMBLER!" +1: ldq $19, $18 ; load *envp into $19 + addq $18, 1, $18 ; increment *envp + orr $19, $19, $19 @@ -125,10 +125,10 @@ index 7e7cf9b..e5e64a1 100644 /* in v0 ($0) is the ld.so _fini pointer */ mov $0, $19 /* mov v0(dynload) to a3 */ diff --git a/arm/start.S b/arm/start.S -index fcd3d7c..e7e3be7 100644 +index ccbac48..c9cee01 100644 --- a/arm/start.S +++ b/arm/start.S -@@ -23,11 +23,18 @@ _start: +@@ -59,11 +59,22 @@ _start: #ifdef __DYN_LIB ldr sl, .L4 1: add sl, pc, sl @@ -142,19 +142,16 @@ index fcd3d7c..e7e3be7 100644 +1: ldr r5, [a3], #4 @ load *envp and increment it + cmp r5, #0 @ read value==0? + bne 1b ++#ifdef __DYN_LIB ++ str a3, [ip, sl] @ __elfinfo = envp ++#else + str a3, [ip, #4] @ __elfinfo = envp +#endif ++#endif + #ifdef PROFILING stmdb sp!, { r0 - r3 } ldr r0, .L5 -@@ -70,6 +77,3 @@ _exit: - .L5: .word .text - .L6: .word _etext - #endif -- -- -- diff --git a/dietdirent.h b/dietdirent.h index dbd7206..c9c7127 100644 --- a/dietdirent.h @@ -305,7 +302,7 @@ index 94a4f73..0c2c71d 100644 pushl $_etext pushl $.text diff --git a/ia64/start.S b/ia64/start.S -index 50fd015..bac10cb 100644 +index 50fd015..5389a4f 100644 --- a/ia64/start.S +++ b/ia64/start.S @@ -40,6 +40,16 @@ _start: @@ -313,7 +310,7 @@ index 50fd015..bac10cb 100644 st8 [r14] = out2 /* store envp in environ */ +#ifdef WANT_ELFINFO -+# error "MAKE ME IE64 CODE!" ++# warning "MAKE ME IE64 CODE!" +1: ld8 r9 = [out2], 8 /* load *envp and increment it */ + orr r9 = r9, r9 /* test for NULL */ + bne 1b @@ -582,7 +579,7 @@ index e9c15cb..b98195c 100644 case _SC_ARG_MAX: return ARG_MAX; diff --git a/mips/start.S b/mips/start.S -index 57144b3..002fcf8 100644 +index 57144b3..4c659a6 100644 --- a/mips/start.S +++ b/mips/start.S @@ -47,6 +47,15 @@ __start: @@ -590,7 +587,7 @@ index 57144b3..002fcf8 100644 add $a2, $a2, $a1 sw $a2, environ +#ifdef WANT_ELFINFO -+# error "MAKE ME MIPS CODE!" ++# warning "MAKE ME MIPS CODE!" +1: addu $a2, $a2, 4 /* increment envp */ + lw $4, -4($a2) /* load envp[-1]; TODO: is $4 a proper + temporary register? */ @@ -602,7 +599,7 @@ index 57144b3..002fcf8 100644 la $25, exit move $4,$2 diff --git a/parisc/start.S b/parisc/start.S -index 69d9cce..0f064be 100644 +index 69d9cce..b5d8793 100644 --- a/parisc/start.S +++ b/parisc/start.S @@ -34,6 +34,16 @@ _start: @@ -610,7 +607,7 @@ index 69d9cce..0f064be 100644 ldo RP%environ(%r19), %r19 +#ifdef WANT_ELFINFO -+# error "MAKE ME PARISC CODE!" ++# warning "MAKE ME PARISC CODE!" +1: add %r20, %r19, %r19 ; envp += 4 + ldw -4(0,%r19), %r21 ; load envp[-4] into %r21 + comibf =,0, 0,%21,1b ; compare %21 with 0 without nullification @@ -663,7 +660,7 @@ index a9208ff..46b4bf0 100644 /* #warning dynamic */ mr 6,7 diff --git a/s390/start.S b/s390/start.S -index c0f971f..d071564 100644 +index c0f971f..1d9106a 100644 --- a/s390/start.S +++ b/s390/start.S @@ -30,6 +30,17 @@ _start: @@ -671,7 +668,7 @@ index c0f971f..d071564 100644 st %r4,0(%r1) +#ifdef WANT_ELFINFO -+# error "VERIFY ME!" ++# warning "VERIFY ME!" +1: ahi %r4, 4 # increment envp + l %r12, -4(0,%r4) # load envp[-1] into %r12 + or %r12, %r12 # test %r12 for NULL @@ -685,7 +682,7 @@ index c0f971f..d071564 100644 l %r1,0(%r13) basr %r14,%r1 diff --git a/s390x/start.S b/s390x/start.S -index 25895a6..db71fc9 100644 +index 25895a6..51d4604 100644 --- a/s390x/start.S +++ b/s390x/start.S @@ -26,6 +26,17 @@ _start: @@ -693,7 +690,7 @@ index 25895a6..db71fc9 100644 stg %r4,0(%r13) +#ifdef WANT_ELFINFO -+# error "VERIFY ME!" ++# warning "VERIFY ME!" +1: aghi %r4, 8 # increment envp + lg %r12, -8(0,%r4) # load envp[-1] into %r12 + ogr %r12, %r12 # test %r12 for NULL @@ -732,7 +729,7 @@ index b7dce2e..ce3bfcb 100644 return result; } diff --git a/sparc/start.S b/sparc/start.S -index a7841e3..6037eae 100644 +index a7841e3..bb463c9 100644 --- a/sparc/start.S +++ b/sparc/start.S @@ -25,6 +25,17 @@ _start: @@ -740,7 +737,7 @@ index a7841e3..6037eae 100644 st %o2, [%o3] +#ifdef WANT_ELFINFO -+# error "VERIFY ME!" ++# warning "VERIFY ME!" +1: add %o2, %o2, 4 + ld [%o2-4], %o4 + orcc %o4, %o4, %o4 @@ -754,7 +751,7 @@ index a7841e3..6037eae 100644 address of the shared library termination function, which will be registered with atexit(). If we are statically linked, this will diff --git a/sparc64/start.S b/sparc64/start.S -index a79c4e7..f0e7d82 100644 +index a79c4e7..a884658 100644 --- a/sparc64/start.S +++ b/sparc64/start.S @@ -25,6 +25,17 @@ _start: @@ -762,7 +759,7 @@ index a79c4e7..f0e7d82 100644 stx %o2, [%o3] +#ifdef WANT_ELFINFO -+# error "VERIFY ME!" ++# warning "VERIFY ME!" +1: add %o2, %o2, 8 + ldx [%o2-8], %o4 + orcc %o4, %o4, %o4 @@ -955,5 +952,5 @@ index adc461a..3915e33 100644 #ifdef PROFILING pushq %rdi /* save reg args */ -- -1.5.4.5 +1.5.5.1 From 2164f44e494714a8b46c6ccb7594d36257232dbe Mon Sep 17 00:00:00 2001 From: ensc Date: Sat, 18 Oct 2008 17:04:19 +0000 Subject: [PATCH 069/161] rediffed patches --- dietlibc-0.28-setpriority.patch | 4 ++-- dietlibc-0.29-scall.patch | 6 +++--- dietlibc-0.30-longdouble.patch | 4 ++-- dietlibc-0.31-defpath.patch | 4 ++-- dietlibc-0.31-implicitfunc.patch | 4 ++-- dietlibc-0.31-lcctime.patch | 4 ++-- dietlibc-0.31-noreturn.patch | 4 ++-- dietlibc-0.31-printFG.patch | 4 ++-- dietlibc-0.31-stacksmash-dyn.patch | 4 ++-- dietlibc-0.31-stacksmash.patch | 4 ++-- dietlibc-0.31-testsuite.patch | 4 ++-- dietlibc-0.31.20080212-teststdout.patch | 4 ++-- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/dietlibc-0.28-setpriority.patch b/dietlibc-0.28-setpriority.patch index 248d18a..3b8d051 100644 --- a/dietlibc-0.28-setpriority.patch +++ b/dietlibc-0.28-setpriority.patch @@ -1,4 +1,4 @@ -From ab91f175a8c77f275c9fa917dfe7cbc9b6262e1c Mon Sep 17 00:00:00 2001 +From 395ad1b292568821a8f6ad4398be2c9746a0133b Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:49:05 +0200 Subject: [PATCH] Return new nice value for nice(2) @@ -29,5 +29,5 @@ index d751104..8e205c0 100644 } #endif -- -1.5.4.5 +1.5.5.1 diff --git a/dietlibc-0.29-scall.patch b/dietlibc-0.29-scall.patch index af7e6e9..eb48887 100644 --- a/dietlibc-0.29-scall.patch +++ b/dietlibc-0.29-scall.patch @@ -1,4 +1,4 @@ -From 406e0419735c9e9c00290d437e9f42f88c3ae6d2 Mon Sep 17 00:00:00 2001 +From 0ae5eb83091eee9cdef27eaadb5e2e8f58fa0ee9 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:50:24 +0200 Subject: [PATCH] Sanity checks for syscall availability @@ -10,7 +10,7 @@ instead of jumping to the next function and executing the wrong code 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/libcompat/syscall.S b/libcompat/syscall.S -index c9f72bb..6b6a8aa 100644 +index c9f72bb..6e964b3 100644 --- a/libcompat/syscall.S +++ b/libcompat/syscall.S @@ -130,6 +130,12 @@ syscall: @@ -28,5 +28,5 @@ index c9f72bb..6b6a8aa 100644 #endif .size syscall, . - syscall -- -1.5.4.5 +1.5.5.1 diff --git a/dietlibc-0.30-longdouble.patch b/dietlibc-0.30-longdouble.patch index 9defbe7..ec5969e 100644 --- a/dietlibc-0.30-longdouble.patch +++ b/dietlibc-0.30-longdouble.patch @@ -1,4 +1,4 @@ -From ba4e9f8557b25e4fbb6886e7c54a2ca75ca57368 Mon Sep 17 00:00:00 2001 +From 75feb30ea22b815f828c7854352007616c4393f0 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:54:03 +0200 Subject: [PATCH] Workaround PPC build issues @@ -47,5 +47,5 @@ index 9682f35..370bec6 100644 static const double coeff[] = { B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 }; int signgam; -- -1.5.4.5 +1.5.5.1 diff --git a/dietlibc-0.31-defpath.patch b/dietlibc-0.31-defpath.patch index 1543af1..2ed5a00 100644 --- a/dietlibc-0.31-defpath.patch +++ b/dietlibc-0.31-defpath.patch @@ -1,4 +1,4 @@ -From 66528a176d332bb8de4ddf324754089e59139424 Mon Sep 17 00:00:00 2001 +From 2a265ce59a6e0187ca4b96feb86196d7816d271f Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 18:00:19 +0200 Subject: [PATCH] Security fix for proper $PATH @@ -22,5 +22,5 @@ index 553b4fa..9bf216f 100644 #define _PATH_DEVNULL "/dev/null" -- -1.5.4.5 +1.5.5.1 diff --git a/dietlibc-0.31-implicitfunc.patch b/dietlibc-0.31-implicitfunc.patch index bcd7057..4a08dea 100644 --- a/dietlibc-0.31-implicitfunc.patch +++ b/dietlibc-0.31-implicitfunc.patch @@ -1,4 +1,4 @@ -From 5c0e868e1a9266d580c95411c3b2f0272dfa14ab Mon Sep 17 00:00:00 2001 +From e1f4f15e4be4283a6ac6eee1e9393a5e09369d23 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:43:08 +0200 Subject: [PATCH] Fixes for -Werror-no-implicit-functions @@ -46,5 +46,5 @@ index a9b9e2a..049117b 100644 #include #include -- -1.5.4.5 +1.5.5.1 diff --git a/dietlibc-0.31-lcctime.patch b/dietlibc-0.31-lcctime.patch index 572c7ed..1e0fa8b 100644 --- a/dietlibc-0.31-lcctime.patch +++ b/dietlibc-0.31-lcctime.patch @@ -1,4 +1,4 @@ -From aac35698d1b84f6370d37860c9e889c34cd6a21c Mon Sep 17 00:00:00 2001 +From 28fbb9c7844032fecb53ebdcc18190bf08e9b604 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:42:20 +0200 Subject: [PATCH] Fixes/enhancements in str?time() functions @@ -42,5 +42,5 @@ index 6ac5340..32dc2a7 100644 case 'y': i=getint(&s,2); -- -1.5.4.5 +1.5.5.1 diff --git a/dietlibc-0.31-noreturn.patch b/dietlibc-0.31-noreturn.patch index d3f9a51..85095bf 100644 --- a/dietlibc-0.31-noreturn.patch +++ b/dietlibc-0.31-noreturn.patch @@ -1,4 +1,4 @@ -From e96b03324e5395ff3c0041c249bfed9aa1bdb8b5 Mon Sep 17 00:00:00 2001 +From d17d4d4c6dbdb1e608208860cec304bab8044885 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:43:42 +0200 Subject: [PATCH] __noreturn__ annotation for abort(3) @@ -27,5 +27,5 @@ index 34f3a7f..0cea604 100644 extern int rand(void) __THROW; extern int rand_r(unsigned int *seed) __THROW; -- -1.5.4.5 +1.5.5.1 diff --git a/dietlibc-0.31-printFG.patch b/dietlibc-0.31-printFG.patch index 797cf7a..5d1aefc 100644 --- a/dietlibc-0.31-printFG.patch +++ b/dietlibc-0.31-printFG.patch @@ -1,4 +1,4 @@ -From 313a9b41133ca631890de99f979ee01074d0c0be Mon Sep 17 00:00:00 2001 +From cd0eb2c9f17cbc1b70c7c60aa5b046cd2cc041c9 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:39:23 +0200 Subject: [PATCH] Fixes/enhancements for INF/NAN handling in printf() @@ -271,5 +271,5 @@ index 719461a..ef6050d 100644 return EXIT_SUCCESS; } -- -1.5.4.5 +1.5.5.1 diff --git a/dietlibc-0.31-stacksmash-dyn.patch b/dietlibc-0.31-stacksmash-dyn.patch index 9090deb..58d655d 100644 --- a/dietlibc-0.31-stacksmash-dyn.patch +++ b/dietlibc-0.31-stacksmash-dyn.patch @@ -1,4 +1,4 @@ -From 4bd1b2d53138ab594a6b73c938daf1b7c2195367 Mon Sep 17 00:00:00 2001 +From 9ae9c692418d33761d6affa5bbf1784c157955cb Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:57:09 +0200 Subject: [PATCH] __stack_chk_fail_local function @@ -22,5 +22,5 @@ index ecefeb8..b03c0d5 100644 /* earlier versions of ProPolice actually gave the address and function * name as arguments to the handler, so it could print some useful -- -1.5.4.5 +1.5.5.1 diff --git a/dietlibc-0.31-stacksmash.patch b/dietlibc-0.31-stacksmash.patch index a47ddc8..ba0753e 100644 --- a/dietlibc-0.31-stacksmash.patch +++ b/dietlibc-0.31-stacksmash.patch @@ -1,4 +1,4 @@ -From 9fb58ca3604cb1426e94689fab57ab5c127c8c55 Mon Sep 17 00:00:00 2001 +From 25487e3bafa653890f2fb36f5615a420cd0c46b8 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:56:07 +0200 Subject: [PATCH] Enhanced __stack_chk_fail @@ -50,5 +50,5 @@ index 9e85099..ecefeb8 100644 + *(char *)0 = 0; } -- -1.5.4.5 +1.5.5.1 diff --git a/dietlibc-0.31-testsuite.patch b/dietlibc-0.31-testsuite.patch index eb4b86d..66c14c7 100644 --- a/dietlibc-0.31-testsuite.patch +++ b/dietlibc-0.31-testsuite.patch @@ -1,4 +1,4 @@ -From ca5319e550e6e64e803a46fbb80d9436d8348567 Mon Sep 17 00:00:00 2001 +From 103eca647519cfafcc7a125bd21b0413b3e81f5a Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:41:23 +0200 Subject: [PATCH] Several testsuite fixes/enhancments @@ -457,5 +457,5 @@ index 6277ea6..2773180 100644 printf ("not all of `%s' read\n", day_tests[i].input); result = 1; -- -1.5.4.5 +1.5.5.1 diff --git a/dietlibc-0.31.20080212-teststdout.patch b/dietlibc-0.31.20080212-teststdout.patch index 7965ff8..11471aa 100644 --- a/dietlibc-0.31.20080212-teststdout.patch +++ b/dietlibc-0.31.20080212-teststdout.patch @@ -1,4 +1,4 @@ -From b8de58754249c7f43c5959dc72c62e13851d45cb Mon Sep 17 00:00:00 2001 +From c86767c4a29b74a1e9bafb5e62048304afc475a2 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:45:11 +0200 Subject: [PATCH] Use stdout instead of stderr in testsuite @@ -63,5 +63,5 @@ index fe2cb5b..92c0b0e 100644 _exit(23); } -- -1.5.4.5 +1.5.5.1 From 2faf846d2da77d5695e1b84a2c4136c1bbb10a77 Mon Sep 17 00:00:00 2001 From: ensc Date: Sat, 18 Oct 2008 17:06:02 +0000 Subject: [PATCH 070/161] updated to 20081017 CVS snapshot --- .cvsignore | 2 +- dietlibc.spec | 8 +++++++- sources | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.cvsignore b/.cvsignore index 85e3a5e..ef37bb6 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -dietlibc-0.31.20080517.tar.bz2 +dietlibc-0.31.20081017.tar.bz2 diff --git a/dietlibc.spec b/dietlibc.spec index 987a8bf..163a882 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -4,7 +4,7 @@ ## --with dynamic ... enable dynamic lib support -%global snapshot 20080517 +%global snapshot 20081017 %global pkglibdir %_prefix/lib/dietlibc %ifarch %ix86 x86_64 @@ -197,6 +197,12 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Oct 18 2008 Enrico Scholz - 0.31-6.20081017 +- updated to 20081017 CVS snapshot +- relaxed some sanity checks on architecture not supported by Fedora + and use '#warning' instead of '#error' +- fixed ARM dynlib code + * Wed Jul 16 2008 Tom "spot" Callaway - 0.31-6.20080517 - fix license tag diff --git a/sources b/sources index f50cb8d..425b042 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a3cd3a38ae545a3224aee9b17b50aa12 dietlibc-0.31.20080517.tar.bz2 +103646fc6bfdfa0865cd18d7d4ec3d28 dietlibc-0.31.20081017.tar.bz2 From e644337fae2b060c628f43ed35f5600eb595ffbd Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Tue, 24 Feb 2009 11:46:39 +0000 Subject: [PATCH 071/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 163a882..3c1f44f 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -28,7 +28,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.31 -Release: %release_func 6%{?snapshot:.%snapshot} +Release: %release_func 7%{?snapshot:.%snapshot} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -197,6 +197,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Tue Feb 24 2009 Fedora Release Engineering - 0.31-7.20081017 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + * Sat Oct 18 2008 Enrico Scholz - 0.31-6.20081017 - updated to 20081017 CVS snapshot - relaxed some sanity checks on architecture not supported by Fedora From defd35883b5b59a90c4e500d2d6e3fb8ffdbb5f0 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 1 Mar 2009 11:53:24 +0000 Subject: [PATCH 072/161] updated --- dietlibc.spec | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 3c1f44f..d97f34d 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -4,10 +4,10 @@ ## --with dynamic ... enable dynamic lib support -%global snapshot 20081017 +%global snapshot 20090228 %global pkglibdir %_prefix/lib/dietlibc -%ifarch %ix86 x86_64 +%ifarch %ix86 x86_64 ppc ppc64 %bcond_without ssp %else %bcond_with ssp @@ -54,6 +54,7 @@ Patch46: dietlibc-0.31-testsuite.patch Patch47: dietlibc-0.31-lcctime.patch Patch48: dietlibc-0.31-implicitfunc.patch Patch49: dietlibc-0.31-noreturn.patch +Patch50: dietlibc-0.31-no-stack-protector.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -109,7 +110,7 @@ This package contains the dynamic libraries for dietlibc. %patch47 -p1 -b .lcctime %patch48 -p1 -b .implicitfunc %patch49 -p1 -b .noreturn - +%patch50 -p1 -b .no-stack-protector %if %{without ssp} %patch20 -p1 -b .nostackprotector @@ -197,6 +198,11 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun Mar 1 2009 Enrico Scholz - 0.31-7.20090228 +- updated to 20090228 +- updated patches +- enabled SSP for ppc + ppc64 + * Tue Feb 24 2009 Fedora Release Engineering - 0.31-7.20081017 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild From 851a42ec6d05b55c8b689ed30979d5ed8fa7588f Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 1 Mar 2009 12:00:59 +0000 Subject: [PATCH 073/161] updated --- dietlibc.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index d97f34d..dfb472f 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -7,7 +7,7 @@ %global snapshot 20090228 %global pkglibdir %_prefix/lib/dietlibc -%ifarch %ix86 x86_64 ppc ppc64 +%ifarch %ix86 x86_64 %bcond_without ssp %else %bcond_with ssp @@ -201,7 +201,6 @@ rm -rf $RPM_BUILD_ROOT * Sun Mar 1 2009 Enrico Scholz - 0.31-7.20090228 - updated to 20090228 - updated patches -- enabled SSP for ppc + ppc64 * Tue Feb 24 2009 Fedora Release Engineering - 0.31-7.20081017 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild From 4c54bbeedcfe9c52cafed2d761ad1a37090a1419 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 1 Mar 2009 12:26:20 +0000 Subject: [PATCH 074/161] updated --- dietlibc.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index dfb472f..02a552a 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -28,7 +28,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.31 -Release: %release_func 7%{?snapshot:.%snapshot} +Release: %release_func 8%{?snapshot:.%snapshot} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -66,7 +66,7 @@ BuildRequires: gdb Summary: dietlibc development files Group: Development/Libraries Requires: %name = %version-%release - +BuildArch: noarch %package lib Summary: Dynamic libraries for dietlibc From 6309c04f31c67ce1409f8ec208bfd6631497a330 Mon Sep 17 00:00:00 2001 From: ensc Date: Sun, 1 Mar 2009 12:42:34 +0000 Subject: [PATCH 075/161] updated --- .cvsignore | 2 +- dietlibc-0.28-setpriority.patch | 4 +- dietlibc-0.29-scall.patch | 10 +- dietlibc-0.30-longdouble.patch | 4 +- dietlibc-0.31-defpath.patch | 4 +- dietlibc-0.31-implicitfunc.patch | 4 +- dietlibc-0.31-lcctime.patch | 6 +- dietlibc-0.31-no-stack-protector.patch | 34 +++ dietlibc-0.31-noreturn.patch | 4 +- dietlibc-0.31-pagesize.patch | 281 ++++++++++++++++-------- dietlibc-0.31-printFG.patch | 4 +- dietlibc-0.31-stacksmash-dyn.patch | 4 +- dietlibc-0.31-stacksmash.patch | 4 +- dietlibc-0.31-testsuite.patch | 4 +- dietlibc-0.31.20080212-teststdout.patch | 4 +- dietlibc.spec | 26 ++- sources | 2 +- 17 files changed, 273 insertions(+), 128 deletions(-) create mode 100644 dietlibc-0.31-no-stack-protector.patch diff --git a/.cvsignore b/.cvsignore index ef37bb6..9d7e052 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -dietlibc-0.31.20081017.tar.bz2 +dietlibc-0.31.20090228.tar.bz2 diff --git a/dietlibc-0.28-setpriority.patch b/dietlibc-0.28-setpriority.patch index 3b8d051..b5192b7 100644 --- a/dietlibc-0.28-setpriority.patch +++ b/dietlibc-0.28-setpriority.patch @@ -1,4 +1,4 @@ -From 395ad1b292568821a8f6ad4398be2c9746a0133b Mon Sep 17 00:00:00 2001 +From 5ba671b7b8446645f31fcf7928908950573c53f5 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:49:05 +0200 Subject: [PATCH] Return new nice value for nice(2) @@ -29,5 +29,5 @@ index d751104..8e205c0 100644 } #endif -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc-0.29-scall.patch b/dietlibc-0.29-scall.patch index eb48887..ab6acb7 100644 --- a/dietlibc-0.29-scall.patch +++ b/dietlibc-0.29-scall.patch @@ -1,4 +1,4 @@ -From 0ae5eb83091eee9cdef27eaadb5e2e8f58fa0ee9 Mon Sep 17 00:00:00 2001 +From 5dc478088a3358ba32ae2b4c104735eb966b62d1 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:50:24 +0200 Subject: [PATCH] Sanity checks for syscall availability @@ -10,7 +10,7 @@ instead of jumping to the next function and executing the wrong code 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/libcompat/syscall.S b/libcompat/syscall.S -index c9f72bb..6e964b3 100644 +index c9f72bb..4188167 100644 --- a/libcompat/syscall.S +++ b/libcompat/syscall.S @@ -130,6 +130,12 @@ syscall: @@ -20,13 +20,13 @@ index c9f72bb..6e964b3 100644 - /* arch not implemented yet */ +#include + .section .comment -+#if (__WORDSIZE == 64) ++#if (__WORDSIZE == 64) + .quad __syscall_2_not_implemented_for_this_arch -+#else ++#else + .long __syscall_2_not_implemented_for_this_arch +#endif #endif .size syscall, . - syscall -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc-0.30-longdouble.patch b/dietlibc-0.30-longdouble.patch index ec5969e..9ba3178 100644 --- a/dietlibc-0.30-longdouble.patch +++ b/dietlibc-0.30-longdouble.patch @@ -1,4 +1,4 @@ -From 75feb30ea22b815f828c7854352007616c4393f0 Mon Sep 17 00:00:00 2001 +From e4be3aa68fdfb87c35378adc3b947e805b923fcf Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:54:03 +0200 Subject: [PATCH] Workaround PPC build issues @@ -47,5 +47,5 @@ index 9682f35..370bec6 100644 static const double coeff[] = { B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 }; int signgam; -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc-0.31-defpath.patch b/dietlibc-0.31-defpath.patch index 2ed5a00..8e4077c 100644 --- a/dietlibc-0.31-defpath.patch +++ b/dietlibc-0.31-defpath.patch @@ -1,4 +1,4 @@ -From 2a265ce59a6e0187ca4b96feb86196d7816d271f Mon Sep 17 00:00:00 2001 +From 4fee9a2dc10208f639590cabc07e7f3b91cf0d17 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 18:00:19 +0200 Subject: [PATCH] Security fix for proper $PATH @@ -22,5 +22,5 @@ index 553b4fa..9bf216f 100644 #define _PATH_DEVNULL "/dev/null" -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc-0.31-implicitfunc.patch b/dietlibc-0.31-implicitfunc.patch index 4a08dea..cc40997 100644 --- a/dietlibc-0.31-implicitfunc.patch +++ b/dietlibc-0.31-implicitfunc.patch @@ -1,4 +1,4 @@ -From e1f4f15e4be4283a6ac6eee1e9393a5e09369d23 Mon Sep 17 00:00:00 2001 +From 50c65fce74b343c43161d8194d36aa52ebed51ec Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:43:08 +0200 Subject: [PATCH] Fixes for -Werror-no-implicit-functions @@ -46,5 +46,5 @@ index a9b9e2a..049117b 100644 #include #include -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc-0.31-lcctime.patch b/dietlibc-0.31-lcctime.patch index 1e0fa8b..4e2892f 100644 --- a/dietlibc-0.31-lcctime.patch +++ b/dietlibc-0.31-lcctime.patch @@ -1,4 +1,4 @@ -From 28fbb9c7844032fecb53ebdcc18190bf08e9b604 Mon Sep 17 00:00:00 2001 +From 7e9b745e0cca4916c29b40fac68cb98d91904b09 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:42:20 +0200 Subject: [PATCH] Fixes/enhancements in str?time() functions @@ -24,7 +24,7 @@ index 56ae082..cf16f37 100644 _strf: p += strftime (p, (size_t)(dst+max-p), src, tm); break; case 'a': src = sweekdays [tm->tm_wday]; goto _str; diff --git a/libugly/strptime.c b/libugly/strptime.c -index 6ac5340..32dc2a7 100644 +index 9d7f530..d19f309 100644 --- a/libugly/strptime.c +++ b/libugly/strptime.c @@ -119,10 +119,11 @@ char* strptime(const char* s,const char* format, struct tm* tm) { @@ -42,5 +42,5 @@ index 6ac5340..32dc2a7 100644 case 'y': i=getint(&s,2); -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc-0.31-no-stack-protector.patch b/dietlibc-0.31-no-stack-protector.patch new file mode 100644 index 0000000..74350b8 --- /dev/null +++ b/dietlibc-0.31-no-stack-protector.patch @@ -0,0 +1,34 @@ +From 3bbcb9a3a908d1aceb9f69118c1ed17a8d6d1871 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 28 Feb 2009 13:32:45 +0100 +Subject: [PATCH] build some files without stack-protector + +--- + Makefile | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/Makefile b/Makefile +index 0cd0105..46ef360 100644 +--- a/Makefile ++++ b/Makefile +@@ -128,6 +128,8 @@ LIBPTHREAD_OBJS=$(patsubst libpthread/%.c,$(OBJDIR)/%.o,$(shell ./threadsafe.sh) + + LIBGMON_OBJS=$(OBJDIR)/__mcount.o $(OBJDIR)/monitor.o $(OBJDIR)/profil.o + ++NO_STACK_PROTECTOR=stackgap.o __get_elf_aux_value.o ++ + include $(ARCH)/Makefile.add + + LIBMATHOBJ=$(patsubst %,$(OBJDIR)/%,$(LIBMATH)) +@@ -177,6 +179,8 @@ $(OBJDIR)/stack_smash_handler2.o: XCFLAGS:=-fno-omit-frame-pointer + $(OBJDIR)/%.o: %.c + $(CROSS)$(CC) $(INC) $(CFLAGS) $(XCFLAGS) -c $< -o $@ -D__dietlibc__ + $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ ++ ++$(addprefix $(OBJDIR)/,$(NO_STACK_PROTECTOR)): XCFLAGS+=-fno-stack-protector + endif + + ifeq ($(shell $(CC) -v 2>&1 | grep "gcc version"),gcc version 4.0.0) +-- +1.6.0.6 + diff --git a/dietlibc-0.31-noreturn.patch b/dietlibc-0.31-noreturn.patch index 85095bf..0760f74 100644 --- a/dietlibc-0.31-noreturn.patch +++ b/dietlibc-0.31-noreturn.patch @@ -1,4 +1,4 @@ -From d17d4d4c6dbdb1e608208860cec304bab8044885 Mon Sep 17 00:00:00 2001 +From c895c51d84b36cf649764193f33f296728b27bdc Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:43:42 +0200 Subject: [PATCH] __noreturn__ annotation for abort(3) @@ -27,5 +27,5 @@ index 34f3a7f..0cea604 100644 extern int rand(void) __THROW; extern int rand_r(unsigned int *seed) __THROW; -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index 1d35b91..1b6a5b2 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -1,4 +1,4 @@ -From 6160ca8256603d1f1a929f01238bf43866552dee Mon Sep 17 00:00:00 2001 +From 2f762bc732fef1c0e91b7e920c025783d204100e Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:35:14 +0200 Subject: [PATCH] Support for dynamic PAGE_SIZE @@ -65,43 +65,44 @@ exported a elf_addr_t type in which is used in the auxilary elf-info table. Now, this is not available anymore and I use a type derived from __WORD_SIZE. --- - alpha/start.S | 9 ++++ - arm/start.S | 13 ++++++- - dietdirent.h | 6 ++- - dietelfinfo.h | 20 ++++++++++ - dietfeatures.h | 14 +++++++ - dietpagesize.h | 31 +++++++++++++++ - dynlinker/ldso_start.S | 9 ++++ - i386/start.S | 7 +++ - ia64/start.S | 10 +++++ - include/sys/shm.h | 9 ---- - lib/alloc.c | 9 ++-- - lib/closedir.c | 4 +- - lib/mmap64.c | 6 ++- - lib/opendir.c | 4 +- - lib/readdir.c | 2 +- - lib/readdir64.c | 6 +- - libcruft/__get_elf_aux_value.c | 14 +++++++ - libcruft/getpagesize.c | 20 +++++++--- - libcruft/sysconf.c | 17 ++++++-- - mips/start.S | 9 ++++ - parisc/start.S | 10 +++++ - ppc/start.S | 9 ++++ - ppc64/start.S | 9 ++++ - s390/start.S | 11 +++++ - s390x/start.S | 11 +++++ - sparc/shmat.c | 8 +-- - sparc/start.S | 11 +++++ - sparc64/start.S | 11 +++++ - syscalls.s/environ.S | 20 ++++++++++ - test/Makefile | 2 +- - test/runtests.sh | 2 +- - test/sysconf.c | 80 ++++++++++++++++++++++++++++++++++++++++ - x86_64/start.S | 16 ++++++++ - 33 files changed, 378 insertions(+), 41 deletions(-) + alpha/start.S | 9 +++++ + arm/start.S | 13 +++++++- + dietdirent.h | 6 +++- + dietelfinfo.h | 20 +++++++++++ + dietfeatures.h | 14 ++++++++ + dietpagesize.h | 31 +++++++++++++++++ + dynlinker/ldso_start.S | 9 +++++ + i386/start.S | 7 ++++ + ia64/start.S | 10 ++++++ + include/sys/shm.h | 9 ----- + lib/__get_elf_aux_value.c | 14 ++++++++ + lib/alloc.c | 9 +++-- + lib/closedir.c | 4 ++- + lib/mmap64.c | 6 ++- + lib/opendir.c | 4 ++- + lib/readdir.c | 2 +- + lib/readdir64.c | 6 ++-- + lib/stackgap.c | 20 +++++++++++- + libcruft/getpagesize.c | 28 +++++++-------- + libcruft/sysconf.c | 17 +++++++--- + mips/start.S | 9 +++++ + parisc/start.S | 10 ++++++ + ppc/start.S | 9 +++++ + ppc64/start.S | 9 +++++ + s390/start.S | 11 ++++++ + s390x/start.S | 11 ++++++ + sparc/shmat.c | 8 ++--- + sparc/start.S | 11 ++++++ + sparc64/start.S | 11 ++++++ + syscalls.s/environ.S | 16 +++++++++ + test/Makefile | 2 +- + test/runtests.sh | 2 +- + test/sysconf.c | 80 +++++++++++++++++++++++++++++++++++++++++++++ + x86_64/start.S | 16 +++++++++ + 34 files changed, 392 insertions(+), 51 deletions(-) create mode 100644 dietelfinfo.h create mode 100644 dietpagesize.h - create mode 100644 libcruft/__get_elf_aux_value.c + create mode 100644 lib/__get_elf_aux_value.c create mode 100644 test/sysconf.c diff --git a/alpha/start.S b/alpha/start.S @@ -197,12 +198,12 @@ index 0000000..f18627b + __attribute__((__visibility__("hidden"),__const__)) __pure; +#endif diff --git a/dietfeatures.h b/dietfeatures.h -index 5ad8f38..2993b9e 100644 +index 7ba02ec..ab892d6 100644 --- a/dietfeatures.h +++ b/dietfeatures.h -@@ -126,6 +126,16 @@ - /* #define WANT_SSP_XOR */ - +@@ -119,6 +119,16 @@ + #define WANT_SSP + #endif +/* Some platforms like x86_64, ppc* or mips do not have a fixed PAGE_SIZE. + * Select WANT_DYN_PAGESIZE to detect the current PAGE_SIZE at runtime. Else, @@ -217,7 +218,7 @@ index 5ad8f38..2993b9e 100644 /* stop uncommenting here ;-) */ -@@ -157,4 +167,8 @@ +@@ -150,4 +160,8 @@ #endif #endif @@ -264,14 +265,14 @@ index 0000000..8ce6ce7 + +#endif /* H_DIETLIBC_DIETPAGESIZE_H */ diff --git a/dynlinker/ldso_start.S b/dynlinker/ldso_start.S -index ca278d7..7234f69 100644 +index ca278d7..da36845 100644 --- a/dynlinker/ldso_start.S +++ b/dynlinker/ldso_start.S @@ -86,6 +86,15 @@ __environ: .long 0 #endif -+/* __elfinfo must follow __environ immediately */ ++/* __elfinfo must follow __environ immediately */ +.global __elfinfo +__elfinfo: +#if __WORDSIZE == 64 @@ -284,7 +285,7 @@ index ca278d7..7234f69 100644 fini_entry: .long 0 diff --git a/i386/start.S b/i386/start.S -index 94a4f73..0c2c71d 100644 +index 94a4f73..9ad41ff 100644 --- a/i386/start.S +++ b/i386/start.S @@ -25,6 +25,13 @@ _start: @@ -295,14 +296,14 @@ index 94a4f73..0c2c71d 100644 +1: add $4, %eax /* increment envp */ + cmpl $0, -4(%eax) /* load envp[-1] */ + jne 1b /* ... until envp[-1]==NULL */ -+ PUT_VAR %eax, __elfinfo, %ecx ++ PUT_VAR %eax, __elfinfo, %ecx +#endif + #ifdef PROFILING pushl $_etext pushl $.text diff --git a/ia64/start.S b/ia64/start.S -index 50fd015..5389a4f 100644 +index 50fd015..c917721 100644 --- a/ia64/start.S +++ b/ia64/start.S @@ -40,6 +40,16 @@ _start: @@ -312,10 +313,10 @@ index 50fd015..5389a4f 100644 +#ifdef WANT_ELFINFO +# warning "MAKE ME IE64 CODE!" +1: ld8 r9 = [out2], 8 /* load *envp and increment it */ -+ orr r9 = r9, r9 /* test for NULL */ ++ orr r9 = r9, r9 /* test for NULL */ + bne 1b + -+ adds r14 = 8, r14 /* __elfinfo = environ + 8 */ ++ adds r14 = 8, r14 /* __elfinfo = environ + 8 */ + st8 [r14] = out2 /* store envp in __elfinfo */ +#endif + @@ -342,6 +343,26 @@ 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/lib/__get_elf_aux_value.c b/lib/__get_elf_aux_value.c +new file mode 100644 +index 0000000..6ddddb4 +--- /dev/null ++++ b/lib/__get_elf_aux_value.c +@@ -0,0 +1,14 @@ ++#include ++#include "../dietelfinfo.h" ++ ++__diet_elf_addr_t *__get_elf_aux_value(unsigned int tag) ++{ ++ extern __diet_elf_addr_t const * const __elfinfo; ++ __diet_elf_addr_t *aux_ptr; ++ ++ for (aux_ptr = __elfinfo; aux_ptr[0]!=AT_NULL; aux_ptr += 2) ++ if (aux_ptr[0]==tag) ++ return aux_ptr+1; ++ ++ return NULL; ++} diff --git a/lib/alloc.c b/lib/alloc.c index 9690565..3f0cedb 100644 --- a/lib/alloc.c @@ -418,7 +439,7 @@ index 0ab29a6..5012394 100644 void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) diff --git a/lib/opendir.c b/lib/opendir.c -index 2530d1a..0b49638 100644 +index 2530d1a..847685e 100644 --- a/lib/opendir.c +++ b/lib/opendir.c @@ -5,6 +5,8 @@ @@ -435,7 +456,7 @@ index 2530d1a..0b49638 100644 if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) goto lose; - t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, -+ t = (DIR *) mmap (NULL, __DIET_PAGE_SIZE, PROT_READ | PROT_WRITE, ++ t = (DIR *) mmap (NULL, __DIET_PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (t == MAP_FAILED) lose: @@ -483,33 +504,96 @@ index 924f0a8..06d073b 100644 if (res<=0) { if (errno==ENOSYS) { trygetdents64=0; -diff --git a/libcruft/__get_elf_aux_value.c b/libcruft/__get_elf_aux_value.c -new file mode 100644 -index 0000000..6ddddb4 ---- /dev/null -+++ b/libcruft/__get_elf_aux_value.c -@@ -0,0 +1,14 @@ -+#include -+#include "../dietelfinfo.h" -+ -+__diet_elf_addr_t *__get_elf_aux_value(unsigned int tag) -+{ -+ extern __diet_elf_addr_t const * const __elfinfo; -+ __diet_elf_addr_t *aux_ptr; -+ -+ for (aux_ptr = __elfinfo; aux_ptr[0]!=AT_NULL; aux_ptr += 2) -+ if (aux_ptr[0]==tag) -+ return aux_ptr+1; -+ -+ return NULL; -+} +diff --git a/lib/stackgap.c b/lib/stackgap.c +index 0149bbe..49ad489 100644 +--- a/lib/stackgap.c ++++ b/lib/stackgap.c +@@ -6,6 +6,7 @@ + #include + #include + #include "dietfeatures.h" ++#include "dietelfinfo.h" + + extern int main(int argc,char* argv[],char* envp[]); + +@@ -30,6 +31,7 @@ static void findtlsdata(long* auxvec) { + Elf32_Phdr* x=0; + #endif + size_t i,n; ++#ifndef WANT_ELFINFO + while (*auxvec) { + if (auxvec[0]==3) { + x=(void*)auxvec[1]; +@@ -37,6 +39,10 @@ static void findtlsdata(long* auxvec) { + } + auxvec+=2; + } /* if we don't find the entry, the kernel let us down */ ++#else ++ (void)auxvec; ++ x = __get_elf_aux_value(AT_PHDR); ++#endif + if (!x) return; /* a kernel this old does not support thread local storage anyway */ + n=x->p_memsz/sizeof(*x); + for (i=1; i #include #include +-/* for environ: */ +-#include -#ifndef PAGE_SIZE -#define PAGE_SIZE 4096 @@ -519,14 +603,21 @@ index 536d3dc..80f476b 100644 -size_t __libc_getpagesize(void); size_t __libc_getpagesize(void) { -- return PAGE_SIZE; +- long* x=(long*)environ; +- int fd; +- while (*x) ++x; ++x; /* skip envp to get to auxvec */ +- while (*x) { +- if (*x==6) +- return x[1]; +- x+=2; +#ifdef WANT_DYN_PAGESIZE + static size_t pgsz; + + if (__unlikely(pgsz==0)) { + __diet_elf_addr_t *v = __get_elf_aux_value(AT_PAGESZ); + pgsz = *v; /* causes segfault when 'v==NULL' */ -+ } + } +- return PAGE_SIZE; + + return pgsz; +#else @@ -579,7 +670,7 @@ index e9c15cb..b98195c 100644 case _SC_ARG_MAX: return ARG_MAX; diff --git a/mips/start.S b/mips/start.S -index 57144b3..4c659a6 100644 +index 57144b3..3cf3433 100644 --- a/mips/start.S +++ b/mips/start.S @@ -47,6 +47,15 @@ __start: @@ -589,9 +680,9 @@ index 57144b3..4c659a6 100644 +#ifdef WANT_ELFINFO +# warning "MAKE ME MIPS CODE!" +1: addu $a2, $a2, 4 /* increment envp */ -+ lw $4, -4($a2) /* load envp[-1]; TODO: is $4 a proper ++ lw $4, -4($a2) /* load envp[-1]; TODO: is $4 a proper + temporary register? */ -+ bnz 1b /* ... until envp[-1]==NULL ++ bnz 1b /* ... until envp[-1]==NULL + TODO: use proper 'bnz' operation */ + sw $a2, __elfinfo +#endif @@ -599,7 +690,7 @@ index 57144b3..4c659a6 100644 la $25, exit move $4,$2 diff --git a/parisc/start.S b/parisc/start.S -index 69d9cce..b5d8793 100644 +index 69d9cce..894255c 100644 --- a/parisc/start.S +++ b/parisc/start.S @@ -34,6 +34,16 @@ _start: @@ -611,16 +702,16 @@ index 69d9cce..b5d8793 100644 +1: add %r20, %r19, %r19 ; envp += 4 + ldw -4(0,%r19), %r21 ; load envp[-4] into %r21 + comibf =,0, 0,%21,1b ; compare %21 with 0 without nullification -+ ++ + ldil LP%__elfinfo, %r19 + ldo RP%__elfinfo(%r19), %r19 -+#endif ++#endif + /* Expand the stack to store the 5th through 7th args */ ldo 64(%sp), %sp diff --git a/ppc/start.S b/ppc/start.S -index 771f1ad..eb62efb 100644 +index 771f1ad..3b5cab1 100644 --- a/ppc/start.S +++ b/ppc/start.S @@ -31,6 +31,15 @@ _start: @@ -632,7 +723,7 @@ index 771f1ad..eb62efb 100644 + addi 5, 5, 4 + cmpwi 15,0 + bne 1b -+ ++ + stw 5,__elfinfo@l(14) +#endif + @@ -660,7 +751,7 @@ index a9208ff..46b4bf0 100644 /* #warning dynamic */ mr 6,7 diff --git a/s390/start.S b/s390/start.S -index c0f971f..1d9106a 100644 +index c0f971f..585faf7 100644 --- a/s390/start.S +++ b/s390/start.S @@ -30,6 +30,17 @@ _start: @@ -673,7 +764,7 @@ index c0f971f..1d9106a 100644 + l %r12, -4(0,%r4) # load envp[-1] into %r12 + or %r12, %r12 # test %r12 for NULL + brc 1, 1b -+ ++ + ahi %r1, 4 + st %r4,0(%r1) +#endif @@ -682,7 +773,7 @@ index c0f971f..1d9106a 100644 l %r1,0(%r13) basr %r14,%r1 diff --git a/s390x/start.S b/s390x/start.S -index 25895a6..51d4604 100644 +index 25895a6..15ad1f9 100644 --- a/s390x/start.S +++ b/s390x/start.S @@ -26,6 +26,17 @@ _start: @@ -698,7 +789,7 @@ index 25895a6..51d4604 100644 + + aghi %r13, 8 + stg %r4,0(%r13) -+#endif ++#endif + /* call main or _dyn_start */ #ifdef WANT_DYNAMIC @@ -773,7 +864,7 @@ index a79c4e7..a884658 100644 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/environ.S b/syscalls.s/environ.S -index a4dd95e..78a17de 100644 +index a4dd95e..294f2d4 100644 --- a/syscalls.s/environ.S +++ b/syscalls.s/environ.S @@ -1,6 +1,7 @@ @@ -784,17 +875,13 @@ index a4dd95e..78a17de 100644 .type environ,object .weak environ -@@ -15,3 +16,22 @@ environ: +@@ -15,3 +16,18 @@ environ: #endif .size environ,.-environ .size __environ,.-__environ + -+/* __elfinfo will be a copy of __environ after startup. Later, it will be -+ updated by __get_elf_aux_value() to point to the terminating NULL of the -+ environment. -+ -+ Startup code assumes that __elfinfo is located immediately after -+ __environ. */ ++/* __elfinfo will be initialized in start.S to point to the ++ terminating NULL of the environment. */ + +#ifdef WANT_ELFINFO +.type __elfinfo,object @@ -919,7 +1006,7 @@ index 0000000..32263a5 + return err; +} diff --git a/x86_64/start.S b/x86_64/start.S -index adc461a..3915e33 100644 +index adc461a..8b4f3c9 100644 --- a/x86_64/start.S +++ b/x86_64/start.S @@ -12,12 +12,28 @@ _start: @@ -933,7 +1020,7 @@ index adc461a..3915e33 100644 +#else + leaq environ(%rip), %rax +#endif -+ movq %rdx, (%rax) /* environ */ ++ movq %rdx, (%rax) /* environ */ + +1: add $8, %rdx /* increment envp */ + cmpq $0, -8(%rdx) /* load envp[-1] */ @@ -952,5 +1039,5 @@ index adc461a..3915e33 100644 #ifdef PROFILING pushq %rdi /* save reg args */ -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc-0.31-printFG.patch b/dietlibc-0.31-printFG.patch index 5d1aefc..39cec6d 100644 --- a/dietlibc-0.31-printFG.patch +++ b/dietlibc-0.31-printFG.patch @@ -1,4 +1,4 @@ -From cd0eb2c9f17cbc1b70c7c60aa5b046cd2cc041c9 Mon Sep 17 00:00:00 2001 +From a38148e35b746f3325d39aca189a38e808c5585e Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:39:23 +0200 Subject: [PATCH] Fixes/enhancements for INF/NAN handling in printf() @@ -271,5 +271,5 @@ index 719461a..ef6050d 100644 return EXIT_SUCCESS; } -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc-0.31-stacksmash-dyn.patch b/dietlibc-0.31-stacksmash-dyn.patch index 58d655d..b294f5b 100644 --- a/dietlibc-0.31-stacksmash-dyn.patch +++ b/dietlibc-0.31-stacksmash-dyn.patch @@ -1,4 +1,4 @@ -From 9ae9c692418d33761d6affa5bbf1784c157955cb Mon Sep 17 00:00:00 2001 +From 62f02d841ea2fb19e365af01892e793ed923ce06 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:57:09 +0200 Subject: [PATCH] __stack_chk_fail_local function @@ -22,5 +22,5 @@ index ecefeb8..b03c0d5 100644 /* earlier versions of ProPolice actually gave the address and function * name as arguments to the handler, so it could print some useful -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc-0.31-stacksmash.patch b/dietlibc-0.31-stacksmash.patch index ba0753e..9d8bdc2 100644 --- a/dietlibc-0.31-stacksmash.patch +++ b/dietlibc-0.31-stacksmash.patch @@ -1,4 +1,4 @@ -From 25487e3bafa653890f2fb36f5615a420cd0c46b8 Mon Sep 17 00:00:00 2001 +From f8b1f860c0038613c31b800ff0466fc1c4e25823 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:56:07 +0200 Subject: [PATCH] Enhanced __stack_chk_fail @@ -50,5 +50,5 @@ index 9e85099..ecefeb8 100644 + *(char *)0 = 0; } -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc-0.31-testsuite.patch b/dietlibc-0.31-testsuite.patch index 66c14c7..193a891 100644 --- a/dietlibc-0.31-testsuite.patch +++ b/dietlibc-0.31-testsuite.patch @@ -1,4 +1,4 @@ -From 103eca647519cfafcc7a125bd21b0413b3e81f5a Mon Sep 17 00:00:00 2001 +From 02a0efbc861696460826282e5d0c1e706644991a Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:41:23 +0200 Subject: [PATCH] Several testsuite fixes/enhancments @@ -457,5 +457,5 @@ index 6277ea6..2773180 100644 printf ("not all of `%s' read\n", day_tests[i].input); result = 1; -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc-0.31.20080212-teststdout.patch b/dietlibc-0.31.20080212-teststdout.patch index 11471aa..80b9d69 100644 --- a/dietlibc-0.31.20080212-teststdout.patch +++ b/dietlibc-0.31.20080212-teststdout.patch @@ -1,4 +1,4 @@ -From c86767c4a29b74a1e9bafb5e62048304afc475a2 Mon Sep 17 00:00:00 2001 +From fd63f368885bbb3e637866a2651348cfce7f69d2 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:45:11 +0200 Subject: [PATCH] Use stdout instead of stderr in testsuite @@ -63,5 +63,5 @@ index fe2cb5b..92c0b0e 100644 _exit(23); } -- -1.5.5.1 +1.6.0.6 diff --git a/dietlibc.spec b/dietlibc.spec index 02a552a..150a2b6 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -66,6 +66,14 @@ BuildRequires: gdb Summary: dietlibc development files Group: Development/Libraries Requires: %name = %version-%release +Requires: %name-header = %version-%release + +%package header +Summary: dietlibc header files +Group: Development/Libraries +Requires: %name = %version-%release +Requires(pre): %name-devel = %version-%release +Requires: %name-devel = %version-%release BuildArch: noarch %package lib @@ -84,7 +92,14 @@ The diet libc is a libc that is optimized for small size. It can be used to create small statically linked binaries for Linux on alpha, arm, hppa, ia64, i386, mips, s390, sparc, sparc64, ppc and x86_64. -This package contains the header and object files for dietlibc. +This package contains the object files for dietlibc. + +%description header +The diet libc is a libc that is optimized for small size. It can be +used to create small statically linked binaries for Linux on alpha, +arm, hppa, ia64, i386, mips, s390, sparc, sparc64, ppc and x86_64. + +This package contains the header files for dietlibc. %description lib The diet libc is a libc that is optimized for small size. It can be @@ -181,9 +196,15 @@ rm -rf $RPM_BUILD_ROOT %_bindir/* +%files header +%defattr(-,root,root,-) +%pkglibdir/include + + %files devel %defattr(-,root,root,-) %pkglibdir +%exclude %pkglibdir/include %{?with_dynamic:%exclude %pkglibdir/*/*.so} @@ -198,6 +219,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun Mar 1 2009 Enrico Scholz - 0.31-8.20090228 +- splitted a noarch -header subpackage out of -devel + * Sun Mar 1 2009 Enrico Scholz - 0.31-7.20090228 - updated to 20090228 - updated patches diff --git a/sources b/sources index 425b042..65f9453 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -103646fc6bfdfa0865cd18d7d4ec3d28 dietlibc-0.31.20081017.tar.bz2 +e627aa62e21a812add91bd7a2b7d9e05 dietlibc-0.31.20090228.tar.bz2 From 6e4df797321659a5a0e22771d344a096cb281e09 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Fri, 24 Jul 2009 20:15:23 +0000 Subject: [PATCH 076/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 150a2b6..6af2160 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -28,7 +28,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.31 -Release: %release_func 8%{?snapshot:.%snapshot} +Release: %release_func 9%{?snapshot:.%snapshot} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -219,6 +219,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Fri Jul 24 2009 Fedora Release Engineering - 0.31-9.20090228 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + * Sun Mar 1 2009 Enrico Scholz - 0.31-8.20090228 - splitted a noarch -header subpackage out of -devel From 6153cd4d781bc240c0caa7bfa07b2c912d796697 Mon Sep 17 00:00:00 2001 From: ensc Date: Sat, 25 Jul 2009 14:52:48 +0000 Subject: [PATCH 077/161] updated --- .cvsignore | 3 +- ChangeLog.2005 | 81 +++++++++++++ dietlibc-0.28-setpriority.patch | 6 +- dietlibc-0.29-scall.patch | 6 +- dietlibc-0.30-longdouble.patch | 6 +- dietlibc-0.31-defpath.patch | 6 +- dietlibc-0.31-implicitfunc.patch | 6 +- dietlibc-0.31-lcctime.patch | 6 +- dietlibc-0.31-no-stack-protector.patch | 18 +-- dietlibc-0.31-noreturn.patch | 6 +- dietlibc-0.31-pagesize.patch | 70 ++++++----- dietlibc-0.31-printFG.patch | 6 +- dietlibc-0.31-smp-fix.patch | 148 ++++++++++++++++++++++++ dietlibc-0.31-stackgap-minor.patch | 39 +++++++ dietlibc-0.31-stacksmash-dyn.patch | 6 +- dietlibc-0.31-stacksmash.patch | 20 ++-- dietlibc-0.31-strip.patch | 95 +++++++++++++++ dietlibc-0.31-testsuite.patch | 6 +- dietlibc-0.31.20080212-teststdout.patch | 6 +- dietlibc.spec | 109 ++++------------- lastver | 2 +- sources | 3 +- 22 files changed, 479 insertions(+), 175 deletions(-) create mode 100644 ChangeLog.2005 create mode 100644 dietlibc-0.31-smp-fix.patch create mode 100644 dietlibc-0.31-stackgap-minor.patch create mode 100644 dietlibc-0.31-strip.patch diff --git a/.cvsignore b/.cvsignore index 9d7e052..b4b5e75 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1,2 @@ -dietlibc-0.31.20090228.tar.bz2 +dietlibc-0.32.tar.bz2 +dietlibc-0.32.tar.bz2.sig diff --git a/ChangeLog.2005 b/ChangeLog.2005 new file mode 100644 index 0000000..947393c --- /dev/null +++ b/ChangeLog.2005 @@ -0,0 +1,81 @@ +* Sun Oct 30 2005 Enrico Scholz - 0.29-4 +- added '-fno-stack-protector' to the CFLAGS + +* Sun Oct 30 2005 Enrico Scholz - 0.29-3 +- removed '-fstack-protector' from CLI because it uses __stack_chk_fail + which is not provided by dietlibc + +* Thu May 26 2005 Enrico Scholz - 0.29-2 +- rebuilt + +* Tue May 24 2005 Enrico Scholz - 0.29-1 +- updated to 0.29 +- unset some compiler options which cause errors with gcc4 +- rediffed -scall patch +- removed most patches as already in upstream + +* Thu May 19 2005 Enrico Scholz - 0.28-6 +- use %%dist instead of %%disttag +- package some more %%doc files (reported by Chris Ricker) +- add %%release to the BuildRoot (reported by Chris Ricker) +- fixed URLs of the sources (reported by Chris Ricker) + +* Sun May 1 2005 Enrico Scholz - 0.28-5 +- added Herbert Poetzl's syscall(2) implementation for x86_64 and + sparc* architectures (see + http://vserver.13thfloor.at/Experimental/delta-diet.diff); rediffed + the .call patch +- catch the case when syscall(2) is used on archs where it is not + implemented yet +- define MADV_* constants on HPPA and IA64 archs +- fix *truncate64() handling on 64bit archs + +* Fri Mar 4 2005 Enrico Scholz - 0.28-4 +- rebuild +- fixed compilation with gcc4 +- made nice(2) SUSv3 compliantly on x86_64 and other platforms (patch + provided by Colin Hill) +- build the dynamic libs for x86, x86_64 and arm only +- fixed PPC issues in ISO mode (do not use the 'powerpc' macro but the + '__powerpc__' one) +- added some O_* -flags for the HPPA arch +- use more modern flags for '-Os' + +* Tue Feb 1 2005 Enrico Scholz - 1:0.28-1 +- updated to 0.28 +- unset LD_RUN_PATH which would result in empty rpaths else +- removed the waitpid patch; it is solved upstream + +* Tue Aug 17 2004 Enrico Scholz - 1:0.27-1 +- updated to 0.27 + +* Fri Jun 11 2004 Enrico Scholz - 1:0.26-1 +- updated to 0.26 + +* Fri Apr 9 2004 Enrico Scholz - 1:0.25-1 +- updated to 0.25 + +* Sat Jan 17 2004 Enrico Scholz - 1:%VERSION.90.%DATE}-5 +- renewed -snprintf patch + +* Tue Jan 6 2004 Enrico Scholz - 1:%VERSION.90.%DATE}-4 +- applied -snprintf patch (from fedora dietlibc-0.24-2 package) + +* Tue Dec 30 2003 Enrico Scholz - 1:%VERSION.90.%DATE}-2 +- added C99 patch + +* Thu Dec 4 2003 Enrico Scholz - 1:0.24-1 +- updated to 0.24 + +* Tue Sep 16 2003 Enrico Scholz - 1:0.23-1 +- updated to 0.23 + +* Fri Nov 8 2002 Enrico Scholz 1:0.21-1 +- updated to 0.21 +- removed unpackaged files in %%install-stage + +* Thu Jul 11 2002 Enrico Scholz 1:0.18-1 +- updated to 0.18 + +* Thu Jul 4 2002 Enrico Scholz +- Initial build. diff --git a/dietlibc-0.28-setpriority.patch b/dietlibc-0.28-setpriority.patch index b5192b7..ebb2448 100644 --- a/dietlibc-0.28-setpriority.patch +++ b/dietlibc-0.28-setpriority.patch @@ -1,7 +1,7 @@ -From 5ba671b7b8446645f31fcf7928908950573c53f5 Mon Sep 17 00:00:00 2001 +From fdd7de4dbb4b214b45e1b53100110af4e4895458 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:49:05 +0200 -Subject: [PATCH] Return new nice value for nice(2) +Subject: [PATCH 01/18] Return new nice value for nice(2) Changed nice(2) to return the new nice value instead of 0/-1. --- @@ -29,5 +29,5 @@ index d751104..8e205c0 100644 } #endif -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.29-scall.patch b/dietlibc-0.29-scall.patch index ab6acb7..f3c9efd 100644 --- a/dietlibc-0.29-scall.patch +++ b/dietlibc-0.29-scall.patch @@ -1,7 +1,7 @@ -From 5dc478088a3358ba32ae2b4c104735eb966b62d1 Mon Sep 17 00:00:00 2001 +From b855ea26129711c87489ce185def60ea46a77698 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:50:24 +0200 -Subject: [PATCH] Sanity checks for syscall availability +Subject: [PATCH 05/18] Sanity checks for syscall availability Catch the case when syscall(2) is not implemented for the actual arch instead of jumping to the next function and executing the wrong code @@ -28,5 +28,5 @@ index c9f72bb..4188167 100644 #endif .size syscall, . - syscall -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.30-longdouble.patch b/dietlibc-0.30-longdouble.patch index 9ba3178..79cf9db 100644 --- a/dietlibc-0.30-longdouble.patch +++ b/dietlibc-0.30-longdouble.patch @@ -1,7 +1,7 @@ -From e4be3aa68fdfb87c35378adc3b947e805b923fcf Mon Sep 17 00:00:00 2001 +From 81eaf0eab3a66c6e055dc243fc70b204d33c59a2 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:54:03 +0200 -Subject: [PATCH] Workaround PPC build issues +Subject: [PATCH 06/18] Workaround PPC build issues Fixes https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=182118 and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27054 @@ -47,5 +47,5 @@ index 9682f35..370bec6 100644 static const double coeff[] = { B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 }; int signgam; -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.31-defpath.patch b/dietlibc-0.31-defpath.patch index 8e4077c..6e4c77c 100644 --- a/dietlibc-0.31-defpath.patch +++ b/dietlibc-0.31-defpath.patch @@ -1,7 +1,7 @@ -From 4fee9a2dc10208f639590cabc07e7f3b91cf0d17 Mon Sep 17 00:00:00 2001 +From 6aecc55de013adb4cf83be57a85092a96034731c Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 18:00:19 +0200 -Subject: [PATCH] Security fix for proper $PATH +Subject: [PATCH 07/18] Security fix for proper $PATH Removed '.' from the default $PATH. --- @@ -22,5 +22,5 @@ index 553b4fa..9bf216f 100644 #define _PATH_DEVNULL "/dev/null" -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.31-implicitfunc.patch b/dietlibc-0.31-implicitfunc.patch index cc40997..200ef70 100644 --- a/dietlibc-0.31-implicitfunc.patch +++ b/dietlibc-0.31-implicitfunc.patch @@ -1,7 +1,7 @@ -From 50c65fce74b343c43161d8194d36aa52ebed51ec Mon Sep 17 00:00:00 2001 +From 1a0c2661fa8f3ad43c7d38915c967ad6aac987f9 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:43:08 +0200 -Subject: [PATCH] Fixes for -Werror-no-implicit-functions +Subject: [PATCH 14/18] Fixes for -Werror-no-implicit-functions Some fixes for issues preventing builds with '-Werror-implicit-function-declaration'. @@ -46,5 +46,5 @@ index a9b9e2a..049117b 100644 #include #include -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.31-lcctime.patch b/dietlibc-0.31-lcctime.patch index 4e2892f..d3e574d 100644 --- a/dietlibc-0.31-lcctime.patch +++ b/dietlibc-0.31-lcctime.patch @@ -1,7 +1,7 @@ -From 7e9b745e0cca4916c29b40fac68cb98d91904b09 Mon Sep 17 00:00:00 2001 +From 93df169bb52d83027d77f17c30212a1b109cfc9d Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:42:20 +0200 -Subject: [PATCH] Fixes/enhancements in str?time() functions +Subject: [PATCH 13/18] Fixes/enhancements in str?time() functions This patch changes the used format for %x and %X specifiers in strptime(3) to match these specified by SUSv2. It adds support @@ -42,5 +42,5 @@ index 9d7f530..d19f309 100644 case 'y': i=getint(&s,2); -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.31-no-stack-protector.patch b/dietlibc-0.31-no-stack-protector.patch index 74350b8..18eaf12 100644 --- a/dietlibc-0.31-no-stack-protector.patch +++ b/dietlibc-0.31-no-stack-protector.patch @@ -1,17 +1,17 @@ -From 3bbcb9a3a908d1aceb9f69118c1ed17a8d6d1871 Mon Sep 17 00:00:00 2001 +From f49499c7c3a6791249588ab4863d6e9eb1ba1010 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 28 Feb 2009 13:32:45 +0100 -Subject: [PATCH] build some files without stack-protector +Subject: [PATCH 04/18] Build some files without stack-protector --- Makefile | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Makefile b/Makefile -index 0cd0105..46ef360 100644 +index dc23d1a..ec97fe9 100644 --- a/Makefile +++ b/Makefile -@@ -128,6 +128,8 @@ LIBPTHREAD_OBJS=$(patsubst libpthread/%.c,$(OBJDIR)/%.o,$(shell ./threadsafe.sh) +@@ -129,6 +129,8 @@ LIBPTHREAD_OBJS=$(patsubst libpthread/%.c,$(OBJDIR)/%.o,$(shell ./threadsafe.sh) LIBGMON_OBJS=$(OBJDIR)/__mcount.o $(OBJDIR)/monitor.o $(OBJDIR)/profil.o @@ -20,15 +20,15 @@ index 0cd0105..46ef360 100644 include $(ARCH)/Makefile.add LIBMATHOBJ=$(patsubst %,$(OBJDIR)/%,$(LIBMATH)) -@@ -177,6 +179,8 @@ $(OBJDIR)/stack_smash_handler2.o: XCFLAGS:=-fno-omit-frame-pointer - $(OBJDIR)/%.o: %.c - $(CROSS)$(CC) $(INC) $(CFLAGS) $(XCFLAGS) -c $< -o $@ -D__dietlibc__ - $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ +@@ -177,6 +179,8 @@ $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp + $(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ + $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ + +$(addprefix $(OBJDIR)/,$(NO_STACK_PROTECTOR)): XCFLAGS+=-fno-stack-protector endif ifeq ($(shell $(CC) -v 2>&1 | grep "gcc version"),gcc version 4.0.0) -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.31-noreturn.patch b/dietlibc-0.31-noreturn.patch index 0760f74..a5f6307 100644 --- a/dietlibc-0.31-noreturn.patch +++ b/dietlibc-0.31-noreturn.patch @@ -1,7 +1,7 @@ -From c895c51d84b36cf649764193f33f296728b27bdc Mon Sep 17 00:00:00 2001 +From a4e9c68f8d10d81bca7b285c100405492b7687da Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:43:42 +0200 -Subject: [PATCH] __noreturn__ annotation for abort(3) +Subject: [PATCH 15/18] __noreturn__ annotation for abort(3) SUSv2 says about abort(3): @@ -27,5 +27,5 @@ index 34f3a7f..0cea604 100644 extern int rand(void) __THROW; extern int rand_r(unsigned int *seed) __THROW; -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index 1b6a5b2..92b89d5 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -1,7 +1,7 @@ -From 2f762bc732fef1c0e91b7e920c025783d204100e Mon Sep 17 00:00:00 2001 +From e6aa8f40136da35a259bcc92026aa2c8f0c935ff Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:35:14 +0200 -Subject: [PATCH] Support for dynamic PAGE_SIZE +Subject: [PATCH 11/18] Support for dynamic PAGE_SIZE This patch adds support for dynamic PAGE_SIZE values. It is a little bit invasive in several aspects: @@ -82,7 +82,7 @@ use a type derived from __WORD_SIZE. lib/opendir.c | 4 ++- lib/readdir.c | 2 +- lib/readdir64.c | 6 ++-- - lib/stackgap.c | 20 +++++++++++- + lib/stackgap.c | 28 +++++++++++++++- libcruft/getpagesize.c | 28 +++++++-------- libcruft/sysconf.c | 17 +++++++--- mips/start.S | 9 +++++ @@ -99,7 +99,7 @@ use a type derived from __WORD_SIZE. test/runtests.sh | 2 +- test/sysconf.c | 80 +++++++++++++++++++++++++++++++++++++++++++++ x86_64/start.S | 16 +++++++++ - 34 files changed, 392 insertions(+), 51 deletions(-) + 34 files changed, 400 insertions(+), 51 deletions(-) create mode 100644 dietelfinfo.h create mode 100644 dietpagesize.h create mode 100644 lib/__get_elf_aux_value.c @@ -173,7 +173,7 @@ index dbd7206..c9c7127 100644 +#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) diff --git a/dietelfinfo.h b/dietelfinfo.h new file mode 100644 -index 0000000..f18627b +index 0000000..de8c717 --- /dev/null +++ b/dietelfinfo.h @@ -0,0 +1,20 @@ @@ -194,7 +194,7 @@ index 0000000..f18627b +typedef uint32_t __diet_elf_addr_t; +#endif + -+__diet_elf_addr_t * __get_elf_aux_value(unsigned int tag) ++__diet_elf_addr_t const * __get_elf_aux_value(unsigned int tag) + __attribute__((__visibility__("hidden"),__const__)) __pure; +#endif diff --git a/dietfeatures.h b/dietfeatures.h @@ -345,17 +345,17 @@ index 9b2d04d..70bb17e 100644 extern int shmdt (const void *shmaddr) __THROW; diff --git a/lib/__get_elf_aux_value.c b/lib/__get_elf_aux_value.c new file mode 100644 -index 0000000..6ddddb4 +index 0000000..8a2e3bc --- /dev/null +++ b/lib/__get_elf_aux_value.c @@ -0,0 +1,14 @@ +#include +#include "../dietelfinfo.h" + -+__diet_elf_addr_t *__get_elf_aux_value(unsigned int tag) ++__diet_elf_addr_t const *__get_elf_aux_value(unsigned int tag) +{ + extern __diet_elf_addr_t const * const __elfinfo; -+ __diet_elf_addr_t *aux_ptr; ++ __diet_elf_addr_t const *aux_ptr; + + for (aux_ptr = __elfinfo; aux_ptr[0]!=AT_NULL; aux_ptr += 2) + if (aux_ptr[0]==tag) @@ -505,7 +505,7 @@ index 924f0a8..06d073b 100644 if (errno==ENOSYS) { trygetdents64=0; diff --git a/lib/stackgap.c b/lib/stackgap.c -index 0149bbe..49ad489 100644 +index e974e2c..5d51c5d 100644 --- a/lib/stackgap.c +++ b/lib/stackgap.c @@ -6,6 +6,7 @@ @@ -524,18 +524,23 @@ index 0149bbe..49ad489 100644 while (*auxvec) { if (auxvec[0]==3) { x=(void*)auxvec[1]; -@@ -37,6 +39,10 @@ static void findtlsdata(long* auxvec) { +@@ -37,6 +39,15 @@ static void findtlsdata(long* auxvec) { } auxvec+=2; } /* if we don't find the entry, the kernel let us down */ +#else -+ (void)auxvec; -+ x = __get_elf_aux_value(AT_PHDR); ++ { ++ __diet_elf_addr_t const *x_addr = __get_elf_aux_value(AT_PHDR); ++ ++ (void)auxvec; ++ if (x_addr) ++ x = (__typeof__(x)) *x_addr; ++ } +#endif if (!x) return; /* a kernel this old does not support thread local storage anyway */ - n=x->p_memsz/sizeof(*x); - for (i=1; ip_type!=PT_PHDR) return; /* should start with PT_PHDR */ + /* if it doesn't, assume there is no thread local storage */ +@@ -92,6 +103,7 @@ static void setup_tls(tcbhead_t* mainthread) { } #endif @@ -543,7 +548,7 @@ index 0149bbe..49ad489 100644 static void* find_rand(long* x) { while (*x) { if (*x==25) -@@ -98,20 +105,27 @@ static void* find_rand(long* x) { +@@ -100,20 +112,30 @@ static void* find_rand(long* x) { } return NULL; } @@ -567,12 +572,15 @@ index 0149bbe..49ad489 100644 +#ifndef WANT_ELFINFO rand=find_rand(auxvec); +#else -+ rand = __get_elf_aux_value(25); ++ { ++ __diet_elf_addr_t const *rand_addr = __get_elf_aux_value(25); ++ rand = rand_addr ? (void *)*rand_addr : NULL; ++ } +#endif if (!rand) { char myrand[10]; int fd=open("/dev/urandom",O_RDONLY); -@@ -132,7 +146,11 @@ int stackgap(int argc,char* argv[],char* envp[]) { +@@ -134,7 +156,11 @@ int stackgap(int argc,char* argv[],char* envp[]) { #endif #if defined(WANT_SSP) || defined(WANT_TLS) @@ -585,7 +593,7 @@ index 0149bbe..49ad489 100644 memcpy(tlsdata,__tdataptr,__tdatasize); memset(tlsdata+__tdatasize,0,__tmemsize-__tdatasize); diff --git a/libcruft/getpagesize.c b/libcruft/getpagesize.c -index 5ff8973..80f476b 100644 +index 5ff8973..ac701cf 100644 --- a/libcruft/getpagesize.c +++ b/libcruft/getpagesize.c @@ -1,25 +1,23 @@ @@ -614,7 +622,7 @@ index 5ff8973..80f476b 100644 + static size_t pgsz; + + if (__unlikely(pgsz==0)) { -+ __diet_elf_addr_t *v = __get_elf_aux_value(AT_PAGESZ); ++ __diet_elf_addr_t const *v = __get_elf_aux_value(AT_PAGESZ); + pgsz = *v; /* causes segfault when 'v==NULL' */ } - return PAGE_SIZE; @@ -628,26 +636,26 @@ index 5ff8973..80f476b 100644 size_t getpagesize(void) __attribute__((weak,alias("__libc_getpagesize"))); - diff --git a/libcruft/sysconf.c b/libcruft/sysconf.c -index e9c15cb..b98195c 100644 +index 5a6259c..507de94 100644 --- a/libcruft/sysconf.c +++ b/libcruft/sysconf.c -@@ -3,6 +3,9 @@ - #include +@@ -4,6 +4,9 @@ #include + #include +#include "dietelfinfo.h" +#include "dietpagesize.h" + extern int __sc_nr_cpus(); - long sysconf(int name) -@@ -16,6 +19,14 @@ long sysconf(int name) + static long physpages() { +@@ -40,6 +43,14 @@ long sysconf(int name) return limit.rlim_cur; } case _SC_CLK_TCK: +#ifdef WANT_ELFINFO + { -+ __diet_elf_addr_t *v = __get_elf_aux_value(AT_CLKTCK); ++ __diet_elf_addr_t const *v = __get_elf_aux_value(AT_CLKTCK); + if (v) + return *v; + } @@ -656,7 +664,7 @@ index e9c15cb..b98195c 100644 #ifdef __alpha__ return 1024; #else -@@ -23,11 +34,7 @@ long sysconf(int name) +@@ -47,11 +58,7 @@ long sysconf(int name) #endif case _SC_PAGESIZE: @@ -667,8 +675,8 @@ index e9c15cb..b98195c 100644 -#endif + return __libc_getpagesize(); - case _SC_ARG_MAX: - return ARG_MAX; + case _SC_PHYS_PAGES: + return physpages(); diff --git a/mips/start.S b/mips/start.S index 57144b3..3cf3433 100644 --- a/mips/start.S @@ -1039,5 +1047,5 @@ index adc461a..8b4f3c9 100644 #ifdef PROFILING pushq %rdi /* save reg args */ -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.31-printFG.patch b/dietlibc-0.31-printFG.patch index 39cec6d..08bd452 100644 --- a/dietlibc-0.31-printFG.patch +++ b/dietlibc-0.31-printFG.patch @@ -1,7 +1,7 @@ -From a38148e35b746f3325d39aca189a38e808c5585e Mon Sep 17 00:00:00 2001 +From d10d2f6fca4e391fa863d771dd8c5f7c01d7dfa4 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:39:23 +0200 -Subject: [PATCH] Fixes/enhancements for INF/NAN handling in printf() +Subject: [PATCH 12/18] Fixes/enhancements for INF/NAN handling in printf() This patch adds support for uppercase 'F' and 'G' printf format specifiers. It fixes handling of -INF values in __dtostr() too; @@ -271,5 +271,5 @@ index 719461a..ef6050d 100644 return EXIT_SUCCESS; } -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.31-smp-fix.patch b/dietlibc-0.31-smp-fix.patch new file mode 100644 index 0000000..d98a405 --- /dev/null +++ b/dietlibc-0.31-smp-fix.patch @@ -0,0 +1,148 @@ +From c1354c051ff98683508272385834d35198253542 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 25 Jul 2009 13:54:39 +0200 +Subject: [PATCH 02/18] Fixed SMP build + +'make -j' fails usually because $(OBJDIR) was not created yet when +compiling files. + +This patch adds a $(OBJDIR)/.dirstamp target which is added as a +dependency for object files and executes an 'mkdir'. + +Ditto for $(PICODIR) +--- + Makefile | 42 +++++++++++++++++++++--------------------- + 1 files changed, 21 insertions(+), 21 deletions(-) + +diff --git a/Makefile b/Makefile +index adc2779..8009cb4 100644 +--- a/Makefile ++++ b/Makefile +@@ -88,7 +88,7 @@ ILIBDIR=$(LIBDIR)-$(ARCH) + + HOME=$(shell pwd) + +-WHAT= $(OBJDIR) $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \ ++WHAT= $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \ + $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a \ + $(OBJDIR)/libcompat.a $(OBJDIR)/libm.a \ + $(OBJDIR)/librpc.a $(OBJDIR)/libpthread.a \ +@@ -150,30 +150,30 @@ PWD=$(shell pwd) + # added real dynamic dietlibc.so + PICODIR = pic-$(ARCH) + +-$(OBJDIR) $(PICODIR): +- mkdir $@ +- + % :: %,v + ++%/.dirstamp: ++ mkdir $* ++ @touch $@ + ifeq ($(CC),tcc) +-$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h ++$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp + $(CROSS)cpp $(INC) $< | $(CROSS)as -o $@ + +-$(OBJDIR)/%.o: %.c ++$(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp + tcc -I. -Iinclude -c $< -o $@ + $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ + else +-$(OBJDIR)/pstart.o: start.S ++$(OBJDIR)/pstart.o: start.S $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -DPROFILING -c $< -o $@ + +-$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h ++$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ + +-$(OBJDIR)/pthread_%.o: libpthread/pthread_%.c ++$(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ + $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ + +-$(OBJDIR)/%.o: %.c ++$(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ + $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ + endif +@@ -188,7 +188,7 @@ endif + + CC+=-D__dietlibc__ + +-$(OBJDIR)/crypt.o: libcrypt/crypt.c ++$(OBJDIR)/crypt.o: libcrypt/crypt.c $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(SAFER_CFLAGS) -c $< -o $@ + + DIETLIBC_OBJ = $(OBJDIR)/unified.o \ +@@ -203,7 +203,7 @@ $(OBJDIR)/dietlibc.a: $(DIETLIBC_OBJ) $(OBJDIR)/start.o + $(OBJDIR)/librpc.a: $(LIBRPCOBJ) + $(CROSS)ar cru $@ $(LIBRPCOBJ) + +-$(OBJDIR)/libcrypt.a: ++$(OBJDIR)/libcrypt.a: $(OBJDIR)/.dirstamp + touch dummy.c + $(CROSS)$(CC) -c dummy.c + $(CROSS)ar cru $@ dummy.o +@@ -235,26 +235,26 @@ dyn: dyn_lib + $(OBJDIR)/libdl.a: $(LIBDLOBJ) + $(CROSS)ar cru $@ $(LIBDLOBJ) + +-dyn_lib: $(PICODIR) $(PICODIR)/libc.so $(PICODIR)/dstart.o \ ++dyn_lib: $(PICODIR)/libc.so $(PICODIR)/dstart.o \ + $(PICODIR)/dyn_so_start.o $(PICODIR)/dyn_start.o $(PICODIR)/dyn_stop.o \ + $(PICODIR)/libpthread.so $(PICODIR)/libdl.so $(PICODIR)/libcompat.so \ + $(PICODIR)/libm.so $(PICODIR)/diet-dyn $(PICODIR)/diet-dyn-i + +-$(PICODIR)/%.o: %.S $(ARCH)/syscalls.h ++$(PICODIR)/%.o: %.S $(ARCH)/syscalls.h $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ + +-$(PICODIR)/pthread_%.o: libpthread/pthread_%.c ++$(PICODIR)/pthread_%.o: libpthread/pthread_%.c $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ + $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ + +-$(PICODIR)/%.o: %.c ++$(PICODIR)/%.o: %.c $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ + $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ + +-$(PICODIR)/dstart.o: start.S ++$(PICODIR)/dstart.o: start.S $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ + +-$(PICODIR)/dyn_so_start.o: dyn_start.c ++$(PICODIR)/dyn_so_start.o: dyn_start.c $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -D__DYN_LIB_SHARED -c $< -o $@ + $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ + +@@ -272,13 +272,13 @@ DYN_LIBCOMPAT_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBCOMPATOBJ)) + + DYN_LIBMATH_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBMATHOBJ)) + +-$(PICODIR)/libc.so: $(PICODIR) $(DYN_LIBC_OBJ) ++$(PICODIR)/libc.so: $(DYN_LIBC_OBJ) + $(LD_UNSET) $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBC_OBJ) -lgcc -Wl,-soname=libc.so + + $(PICODIR)/libpthread.so: $(DYN_PTHREAD_OBJS) dietfeatures.h + $(LD_UNSET) $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_PTHREAD_OBJS) -L$(PICODIR) -lc -Wl,-soname=libpthread.so + +-$(PICODIR)/libdl.so: libdl/_dl_main.c dietfeatures.h ++$(PICODIR)/libdl.so: libdl/_dl_main.c dietfeatures.h $(PICODIR)/.dirstamp + $(LD_UNSET) $(CROSS)$(CC) -D__OD_CLEAN_ROOM -DNODIETREF -fPIC -nostdlib -shared -Bsymbolic -Wl,-Bsymbolic \ + -o $@ $(SAFE_CFLAGS) $(INC) libdl/_dl_main.c -Wl,-soname=libdl.so + +@@ -330,7 +330,7 @@ $(OBJDIR)/load: + chmod 755 $@ + + clean: +- rm -f *.o *.a t t1 compile load elftrunc exports mapfile libdietc.so ++ rm -f *.o *.a t t1 compile load elftrunc exports mapfile libdietc.so .dirstamp + rm -rf bin-* pic-* + $(MAKE) -C examples clean + $(MAKE) -C dynlinker clean +-- +1.6.2.5 + diff --git a/dietlibc-0.31-stackgap-minor.patch b/dietlibc-0.31-stackgap-minor.patch new file mode 100644 index 0000000..201b721 --- /dev/null +++ b/dietlibc-0.31-stackgap-minor.patch @@ -0,0 +1,39 @@ +From b993cb8bebea6870771bb66eae8b6d41f9e6e9e6 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 25 Jul 2009 15:34:44 +0200 +Subject: [PATCH 17/18] minor cleanups in stackgap.c + +--- + lib/stackgap.c | 6 +++--- + 1 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/stackgap.c b/lib/stackgap.c +index 5d51c5d..f30b58a 100644 +--- a/lib/stackgap.c ++++ b/lib/stackgap.c +@@ -26,9 +26,9 @@ void* __tdataptr; + + static void findtlsdata(long* auxvec) { + #if (__WORDSIZE == 64) +- Elf64_Phdr* x=0; ++ Elf64_Phdr const * x=0; + #else +- Elf32_Phdr* x=0; ++ Elf32_Phdr const * x=0; + #endif + size_t i,n; + #ifndef WANT_ELFINFO +@@ -125,9 +125,9 @@ int stackgap(int argc,char* argv[],char* envp[]) { + #endif + #ifdef WANT_STACKGAP + unsigned short s; ++ volatile char* gap; + #endif + #if defined(WANT_STACKGAP) || defined(WANT_SSP) +- volatile char* gap; + #ifndef WANT_ELFINFO + rand=find_rand(auxvec); + #else +-- +1.6.2.5 + diff --git a/dietlibc-0.31-stacksmash-dyn.patch b/dietlibc-0.31-stacksmash-dyn.patch index b294f5b..ed4ce9c 100644 --- a/dietlibc-0.31-stacksmash-dyn.patch +++ b/dietlibc-0.31-stacksmash-dyn.patch @@ -1,7 +1,7 @@ -From 62f02d841ea2fb19e365af01892e793ed923ce06 Mon Sep 17 00:00:00 2001 +From 729c8524b8a5f3a4bf4ebda7ae23c0a10ef62560 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:57:09 +0200 -Subject: [PATCH] __stack_chk_fail_local function +Subject: [PATCH 09/18] __stack_chk_fail_local function Added __stack_chk_fail_local() function as an alias for __stack_chk_fail(). This is required for dynamic linking. @@ -22,5 +22,5 @@ index ecefeb8..b03c0d5 100644 /* earlier versions of ProPolice actually gave the address and function * name as arguments to the handler, so it could print some useful -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.31-stacksmash.patch b/dietlibc-0.31-stacksmash.patch index 9d8bdc2..894a0d4 100644 --- a/dietlibc-0.31-stacksmash.patch +++ b/dietlibc-0.31-stacksmash.patch @@ -1,7 +1,7 @@ -From f8b1f860c0038613c31b800ff0466fc1c4e25823 Mon Sep 17 00:00:00 2001 +From 6838387d66f76e8acb227102d46549a26e7b217c Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:56:07 +0200 -Subject: [PATCH] Enhanced __stack_chk_fail +Subject: [PATCH 08/18] Enhanced __stack_chk_fail * modified __stack_chk_fail() to trigger a segfault by accessing address 0x0. Every system with an MMU known by me, segfaults @@ -15,21 +15,21 @@ Subject: [PATCH] Enhanced __stack_chk_fail 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile -index adc2779..0cd0105 100644 +index ec97fe9..9ea5078 100644 --- a/Makefile +++ b/Makefile -@@ -172,9 +172,10 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h - $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c +@@ -175,9 +175,10 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp + $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ - $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ + $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ +$(OBJDIR)/stack_smash_handler2.o: XCFLAGS:=-fno-omit-frame-pointer - $(OBJDIR)/%.o: %.c + $(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ + $(CROSS)$(CC) $(INC) $(CFLAGS) $(XCFLAGS) -c $< -o $@ -D__dietlibc__ - $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ - endif + $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ + $(addprefix $(OBJDIR)/,$(NO_STACK_PROTECTOR)): XCFLAGS+=-fno-stack-protector diff --git a/lib/stack_smash_handler2.c b/lib/stack_smash_handler2.c index 9e85099..ecefeb8 100644 --- a/lib/stack_smash_handler2.c @@ -50,5 +50,5 @@ index 9e85099..ecefeb8 100644 + *(char *)0 = 0; } -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.31-strip.patch b/dietlibc-0.31-strip.patch new file mode 100644 index 0000000..3ceaaae --- /dev/null +++ b/dietlibc-0.31-strip.patch @@ -0,0 +1,95 @@ +From 87682b6ad631272dfdc45e1c760331d803851c06 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 25 Jul 2009 15:12:43 +0200 +Subject: [PATCH 03/18] Define and use $(STRIP) makefile variable + +This increases readability and makes it easier to turn off stripping +of debug symbols. +--- + Makefile | 21 +++++++++++---------- + 1 files changed, 11 insertions(+), 10 deletions(-) + +diff --git a/Makefile b/Makefile +index 8009cb4..dc23d1a 100644 +--- a/Makefile ++++ b/Makefile +@@ -105,6 +105,7 @@ CROSS= + + CC=gcc + INC=-I. -isystem include ++STRIP=$(CROSS)strip + + VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:libcompat:libdl:librpc:libregex:libm:profiling + +@@ -161,7 +162,7 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp + + $(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp + tcc -I. -Iinclude -c $< -o $@ +- $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ ++ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ + else + $(OBJDIR)/pstart.o: start.S $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -DPROFILING -c $< -o $@ +@@ -171,11 +172,11 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp + + $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ +- $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ ++ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ + + $(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ +- $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ ++ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ + endif + + ifeq ($(shell $(CC) -v 2>&1 | grep "gcc version"),gcc version 4.0.0) +@@ -245,18 +246,18 @@ $(PICODIR)/%.o: %.S $(ARCH)/syscalls.h $(PICODIR)/.dirstamp + + $(PICODIR)/pthread_%.o: libpthread/pthread_%.c $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ +- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ ++ $(COMMENT) $(STRIP) -x -R .comment -R .note $@ + + $(PICODIR)/%.o: %.c $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ +- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ ++ $(COMMENT) $(STRIP) -x -R .comment -R .note $@ + + $(PICODIR)/dstart.o: start.S $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ + + $(PICODIR)/dyn_so_start.o: dyn_start.c $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -D__DYN_LIB_SHARED -c $< -o $@ +- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ ++ $(COMMENT) $(STRIP) -x -R .comment -R .note $@ + + DYN_LIBC_PIC = $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \ + $(LIBCRUFTOBJ) $(LIBCRYPTOBJ) $(LIBSHELLOBJ) $(LIBREGEXOBJ) +@@ -305,19 +306,19 @@ CURNAME=$(notdir $(shell pwd)) + + $(OBJDIR)/diet: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o + $(CROSS)$(CC) -isystem include $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -DVERSION=\"$(VERSION)\" -lgcc +- $(CROSS)strip -R .comment -R .note $@ ++ $(STRIP) -R .comment -R .note $@ + + $(OBJDIR)/diet-i: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o + $(CROSS)$(CC) -isystem include $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -DVERSION=\"$(VERSION)\" -DINSTALLVERSION -lgcc +- $(CROSS)strip -R .comment -R .note $@ ++ $(STRIP) -R .comment -R .note $@ + + $(PICODIR)/diet-dyn: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c + $(LD_UNSET) $(CROSS)$(CC) -isystem include $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(HOME)/$(PICODIR)/libdl.so +- $(CROSS)strip -R .command -R .note $@ ++ $(STRIP) -R .command -R .note $@ + + $(PICODIR)/diet-dyn-i: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c + $(LD_UNSET) $(CROSS)$(CC) -isystem include $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(ILIBDIR)/libdl.so -DINSTALLVERSION +- $(CROSS)strip -R .command -R .note $@ ++ $(STRIP) -R .command -R .note $@ + + $(OBJDIR)/djb: $(OBJDIR)/compile $(OBJDIR)/load + +-- +1.6.2.5 + diff --git a/dietlibc-0.31-testsuite.patch b/dietlibc-0.31-testsuite.patch index 193a891..307b8a4 100644 --- a/dietlibc-0.31-testsuite.patch +++ b/dietlibc-0.31-testsuite.patch @@ -1,7 +1,7 @@ -From 02a0efbc861696460826282e5d0c1e706644991a Mon Sep 17 00:00:00 2001 +From 7227ec436a737f13d8bc1fd9bf8f8995d073eb0b Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:41:23 +0200 -Subject: [PATCH] Several testsuite fixes/enhancments +Subject: [PATCH 16/18] Several testsuite fixes/enhancments * test/getmntent.c: I removed the checks which called endmntent() multiple times resp. with a NULL pointer. Behavior in first @@ -457,5 +457,5 @@ index 6277ea6..2773180 100644 printf ("not all of `%s' read\n", day_tests[i].input); result = 1; -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc-0.31.20080212-teststdout.patch b/dietlibc-0.31.20080212-teststdout.patch index 80b9d69..2fc1e71 100644 --- a/dietlibc-0.31.20080212-teststdout.patch +++ b/dietlibc-0.31.20080212-teststdout.patch @@ -1,7 +1,7 @@ -From fd63f368885bbb3e637866a2651348cfce7f69d2 Mon Sep 17 00:00:00 2001 +From 7bf571cbff4c43098d9b1cd2b4bbd9457bff5b60 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:45:11 +0200 -Subject: [PATCH] Use stdout instead of stderr in testsuite +Subject: [PATCH 10/18] Use stdout instead of stderr in testsuite This patches uses stdout instead stderr when giving out normal status messages in the testsuite. @@ -63,5 +63,5 @@ index fe2cb5b..92c0b0e 100644 _exit(23); } -- -1.6.0.6 +1.6.2.5 diff --git a/dietlibc.spec b/dietlibc.spec index 6af2160..80906fe 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -4,7 +4,7 @@ ## --with dynamic ... enable dynamic lib support -%global snapshot 20090228 +#global snapshot 20090228 %global pkglibdir %_prefix/lib/dietlibc %ifarch %ix86 x86_64 @@ -27,8 +27,8 @@ Summary: Small libc implementation Name: dietlibc -Version: 0.31 -Release: %release_func 9%{?snapshot:.%snapshot} +Version: 0.32 +Release: %release_func 0%{?snapshot:.%snapshot} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -55,6 +55,9 @@ Patch47: dietlibc-0.31-lcctime.patch Patch48: dietlibc-0.31-implicitfunc.patch Patch49: dietlibc-0.31-noreturn.patch Patch50: dietlibc-0.31-no-stack-protector.patch +Patch51: dietlibc-0.31-smp-fix.patch +Patch52: dietlibc-0.31-stackgap-minor.patch +Patch53: dietlibc-0.31-strip.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -112,6 +115,10 @@ This package contains the dynamic libraries for dietlibc. %prep %setup -q %{?snapshot:-n %name-%version.%snapshot} %patch1 -p1 -b .nice +%patch51 -p1 -b .smp +%patch53 -p1 -b .strip +%patch50 -p1 -b .no-stack-protector + %patch10 -p1 -b .scall %patch30 -p1 -b .longdouble %patch31 -p1 -b .defpath @@ -125,7 +132,7 @@ This package contains the dynamic libraries for dietlibc. %patch47 -p1 -b .lcctime %patch48 -p1 -b .implicitfunc %patch49 -p1 -b .noreturn -%patch50 -p1 -b .no-stack-protector +%patch52 -p1 -b .stackgap %if %{without ssp} %patch20 -p1 -b .nostackprotector @@ -144,10 +151,8 @@ sed -i \ dietfeatures.h %endif -sed -i -e 's!strip !: !g' Makefile - %global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -g3 -Werror-implicit-function-declaration -%global basemakeflags prefix=%pkglibdir BINDIR=%_bindir MAN1DIR=%_mandir/man1 COMMENT=: CFLAGS="$RPM_OPT_FLAGS %fixcflags $XTRA_CFLAGS" PDIET=%pkglibdir +%global basemakeflags prefix=%pkglibdir BINDIR=%_bindir MAN1DIR=%_mandir/man1 CFLAGS="$RPM_OPT_FLAGS %fixcflags $XTRA_CFLAGS" PDIET=%pkglibdir STRIP=: %global makeflags %basemakeflags for i in `find test -name 'runtests.sh'`; do @@ -188,6 +193,8 @@ bash ./runtests-X.sh %clean rm -rf $RPM_BUILD_ROOT +%changelog + %files %defattr(-,root,root,-) %doc AUTHOR BUGS CAVEAT CHANGES COPYING FAQ PORTING README* @@ -219,6 +226,12 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Jul 25 2009 Enrico Scholz - 0.32-0 +- updated to 0.32 +- fixed stackgap/auxvec patch +- added patches to fix SMP builds and to prevent object file stripping +- moved %%changelog entries from 2005 and before into ChangeLog.2005 file + * Fri Jul 24 2009 Fedora Release Engineering - 0.31-9.20090228 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild @@ -304,85 +317,3 @@ rm -rf $RPM_BUILD_ROOT * Sat Feb 18 2006 Enrico Scholz - 0.29-6 - added '-Os' to the CFLAGS - exclude PPC arch due to strange compilation errors - -* Sun Oct 30 2005 Enrico Scholz - 0.29-4 -- added '-fno-stack-protector' to the CFLAGS - -* Sun Oct 30 2005 Enrico Scholz - 0.29-3 -- removed '-fstack-protector' from CLI because it uses __stack_chk_fail - which is not provided by dietlibc - -* Thu May 26 2005 Enrico Scholz - 0.29-2 -- rebuilt - -* Tue May 24 2005 Enrico Scholz - 0.29-1 -- updated to 0.29 -- unset some compiler options which cause errors with gcc4 -- rediffed -scall patch -- removed most patches as already in upstream - -* Thu May 19 2005 Enrico Scholz - 0.28-6 -- use %%dist instead of %%disttag -- package some more %%doc files (reported by Chris Ricker) -- add %%release to the BuildRoot (reported by Chris Ricker) -- fixed URLs of the sources (reported by Chris Ricker) - -* Sun May 1 2005 Enrico Scholz - 0.28-5 -- added Herbert Poetzl's syscall(2) implementation for x86_64 and - sparc* architectures (see - http://vserver.13thfloor.at/Experimental/delta-diet.diff); rediffed - the .call patch -- catch the case when syscall(2) is used on archs where it is not - implemented yet -- define MADV_* constants on HPPA and IA64 archs -- fix *truncate64() handling on 64bit archs - -* Fri Mar 4 2005 Enrico Scholz - 0.28-4 -- rebuild -- fixed compilation with gcc4 -- made nice(2) SUSv3 compliantly on x86_64 and other platforms (patch - provided by Colin Hill) -- build the dynamic libs for x86, x86_64 and arm only -- fixed PPC issues in ISO mode (do not use the 'powerpc' macro but the - '__powerpc__' one) -- added some O_* -flags for the HPPA arch -- use more modern flags for '-Os' - -* Tue Feb 1 2005 Enrico Scholz - 1:0.28-1 -- updated to 0.28 -- unset LD_RUN_PATH which would result in empty rpaths else -- removed the waitpid patch; it is solved upstream - -* Tue Aug 17 2004 Enrico Scholz - 1:0.27-1 -- updated to 0.27 - -* Fri Jun 11 2004 Enrico Scholz - 1:0.26-1 -- updated to 0.26 - -* Fri Apr 9 2004 Enrico Scholz - 1:0.25-1 -- updated to 0.25 - -* Sat Jan 17 2004 Enrico Scholz - 1:%VERSION.90.%DATE}-5 -- renewed -snprintf patch - -* Tue Jan 6 2004 Enrico Scholz - 1:%VERSION.90.%DATE}-4 -- applied -snprintf patch (from fedora dietlibc-0.24-2 package) - -* Tue Dec 30 2003 Enrico Scholz - 1:%VERSION.90.%DATE}-2 -- added C99 patch - -* Thu Dec 4 2003 Enrico Scholz - 1:0.24-1 -- updated to 0.24 - -* Tue Sep 16 2003 Enrico Scholz - 1:0.23-1 -- updated to 0.23 - -* Fri Nov 8 2002 Enrico Scholz 1:0.21-1 -- updated to 0.21 -- removed unpackaged files in %%install-stage - -* Thu Jul 11 2002 Enrico Scholz 1:0.18-1 -- updated to 0.18 - -* Thu Jul 4 2002 Enrico Scholz -- Initial build. diff --git a/lastver b/lastver index 48b9990..00d0c14 100644 --- a/lastver +++ b/lastver @@ -1 +1 @@ -0.31 +0.32 diff --git a/sources b/sources index 65f9453..4022f48 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -e627aa62e21a812add91bd7a2b7d9e05 dietlibc-0.31.20090228.tar.bz2 +0098761c17924c15e21d25acdda4a8b5 dietlibc-0.32.tar.bz2 +f2c6737dc9597558da34deed1246c802 dietlibc-0.32.tar.bz2.sig From b698ec0421af0708dd9cef7576b150c1447a1ae2 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 25 Nov 2009 23:12:00 +0000 Subject: [PATCH 078/161] Fix typo that causes a failure to update the common directory. (releng #2781) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 538d0ab..f485823 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ NAME := dietlibc SPECFILE = $(firstword $(wildcard *.spec)) define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done endef MAKEFILE_COMMON := $(shell $(find-makefile-common)) From 0d68259124239d9268ae2603d535ff9ab4d3db0f Mon Sep 17 00:00:00 2001 From: ensc Date: Fri, 9 Jul 2010 08:17:59 +0000 Subject: [PATCH 079/161] - added -static provides (#609606) - use %%apply, not %%patch - updated %%release_func macro --- dietlibc.spec | 66 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 80906fe..283889e 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -3,8 +3,11 @@ ## on target architecture ## --with dynamic ... enable dynamic lib support +## Fedora Extras specific customization below... +%bcond_without noarch +## -#global snapshot 20090228 +#global prerelease 20090228 %global pkglibdir %_prefix/lib/dietlibc %ifarch %ix86 x86_64 @@ -23,21 +26,24 @@ %global target_cpu %_target_cpu %endif -%{!?release_func:%global release_func() %1%{?dist}} +%{?with_noarch:%global noarch BuildArch: noarch} +%{!?release_func:%global release_func() %%{?prerelease:0.}%1%%{?prerelease:.%%prerelease}%%{?dist}} +%{!?apply:%global apply(p:n:b:) %patch%%{-n:%%{-n*}} %%{-p:-p %%{-p*}} %%{-b:-b %%{-b*}} \ +%nil} Summary: Small libc implementation Name: dietlibc Version: 0.32 -Release: %release_func 0%{?snapshot:.%snapshot} +Release: %release_func 1400 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ -%if !0%{?snapshot:1} +%if !0%{?prerelease:1} Source0: http://www.kernel.org/pub/linux/libs/dietlibc/%name-%version.tar.bz2 Source1: http://www.fefe.de/dietlibc/%name-%version.tar.bz2.sig %else # generated by 'make cvs-sources [CVS_DATE=....]' -Source0: %name-%version.%snapshot.tar.bz2 +Source0: %name-%version.%prerelease.tar.bz2 %endif Source10: runtests-X.sh Patch1: dietlibc-0.28-setpriority.patch @@ -70,6 +76,8 @@ Summary: dietlibc development files Group: Development/Libraries Requires: %name = %version-%release Requires: %name-header = %version-%release +Provides: %name-static = %version-%release +Provides: %name-static%{?_isa} = %version-%release %package header Summary: dietlibc header files @@ -77,7 +85,7 @@ Group: Development/Libraries Requires: %name = %version-%release Requires(pre): %name-devel = %version-%release Requires: %name-devel = %version-%release -BuildArch: noarch +%{?noarch} %package lib Summary: Dynamic libraries for dietlibc @@ -113,29 +121,29 @@ This package contains the dynamic libraries for dietlibc. %prep -%setup -q %{?snapshot:-n %name-%version.%snapshot} -%patch1 -p1 -b .nice -%patch51 -p1 -b .smp -%patch53 -p1 -b .strip -%patch50 -p1 -b .no-stack-protector +%setup -q %{?prerelease:-n %name-%version.%prerelease} +%apply -n1 -p1 -b .nice +%apply -n51 -p1 -b .smp +%apply -n53 -p1 -b .strip +%apply -n50 -p1 -b .no-stack-protector -%patch10 -p1 -b .scall -%patch30 -p1 -b .longdouble -%patch31 -p1 -b .defpath -%patch32 -p1 -b .stacksmash -%patch33 -p1 -b .stacksmash-dyn +%apply -n10 -p1 -b .scall +%apply -n30 -p1 -b .longdouble +%apply -n31 -p1 -b .defpath +%apply -n32 -p1 -b .stacksmash +%apply -n33 -p1 -b .stacksmash-dyn -%patch41 -p1 -b .teststdout -%patch43 -p1 -b .pagesize -%patch44 -p1 -b .printFG -%patch46 -p1 -b .testsuite -%patch47 -p1 -b .lcctime -%patch48 -p1 -b .implicitfunc -%patch49 -p1 -b .noreturn -%patch52 -p1 -b .stackgap +%apply -n41 -p1 -b .teststdout +%apply -n43 -p1 -b .pagesize +%apply -n44 -p1 -b .printFG +%apply -n46 -p1 -b .testsuite +%apply -n47 -p1 -b .lcctime +%apply -n48 -p1 -b .implicitfunc +%apply -n49 -p1 -b .noreturn +%apply -n52 -p1 -b .stackgap %if %{without ssp} -%patch20 -p1 -b .nostackprotector +%apply -n20 -p1 -b .nostackprotector sed -i -e 's!^#define WANT_SSP$!// \0!g; s!.*\(#define WANT_STACKGAP\).*!\1!g' dietfeatures.h %global xtra_fixcflags -fno-stack-protector @@ -193,8 +201,6 @@ bash ./runtests-X.sh %clean rm -rf $RPM_BUILD_ROOT -%changelog - %files %defattr(-,root,root,-) %doc AUTHOR BUGS CAVEAT CHANGES COPYING FAQ PORTING README* @@ -226,6 +232,12 @@ rm -rf $RPM_BUILD_ROOT %changelog +%changelog +* Fri Jul 9 2010 Enrico Scholz - 0.32-1400 +- added -static provides (#609606) +- use %%apply, not %%patch +- updated %%release_func macro + * Sat Jul 25 2009 Enrico Scholz - 0.32-0 - updated to 0.32 - fixed stackgap/auxvec patch From c7bbe4034ad2c46962188b5b5812bab29d24a31d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 28 Jul 2010 12:58:00 +0000 Subject: [PATCH 080/161] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 29 ----------------------------- 2 files changed, 29 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index f485823..0000000 --- a/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# Makefile for source rpm: dietlibc -NAME := dietlibc -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) - - -CVS_BASEVER = 0.31 -CVS_DATE := $(shell date +'%Y%m%d' -d '-1 day') -_cvs_suffix = ${CVS_BASEVER}.${CVS_DATE} - -cvs-sources: - cd ${DESTDIR} . && cvs -d :pserver:cvs@cvs.fefe.de:/cvs -z9 export -D${CVS_DATE} -d dietlibc-${_cvs_suffix} dietlibc - cd ${DESTDIR} . && tar cjf dietlibc-${_cvs_suffix}.tar.bz2 dietlibc-${_cvs_suffix} --owner root --group root From 2425041cc1eb0f0ec2dc836e950242c5abc1452f Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 15 Aug 2010 23:53:19 +0200 Subject: [PATCH 081/161] readded makefile --- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b12939d --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +MAKEFILE_COMMON = $(HOME)/.fedora/common.mk +-include $(MAKEFILE_COMMON) + +CVS ?= cvs +TAR ?= tar +CVS_BASEVER = 0.31 +CVS_DATE := $(shell date +'%Y%m%d' -d '-1 day') +_cvs_suffix = ${CVS_BASEVER}.${CVS_DATE} + +cvs-sources: + cd ${DESTDIR} . && $(CVS) -d :pserver:cvs@cvs.fefe.de:/cvs -z9 export -D${CVS_DATE} -d dietlibc-${_cvs_suffix} dietlibc + cd ${DESTDIR} . && $(TAR) cjf dietlibc-${_cvs_suffix}.tar.bz2 dietlibc-${_cvs_suffix} --owner root --group root From 1db3978d8feafa662065d06f9ed4add27e9bab0d Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Fri, 24 Dec 2010 13:22:00 +0100 Subject: [PATCH 082/161] rediffed --- dietlibc-0.31-no-stack-protector.patch | 8 ++-- dietlibc-0.31-pagesize.patch | 55 ++++++++++++++------------ dietlibc-0.31-smp-fix.patch | 24 +++++------ dietlibc-0.31-stackgap-minor.patch | 12 +++--- dietlibc-0.31-stacksmash.patch | 8 ++-- dietlibc-0.31-strip.patch | 14 +++---- 6 files changed, 63 insertions(+), 58 deletions(-) diff --git a/dietlibc-0.31-no-stack-protector.patch b/dietlibc-0.31-no-stack-protector.patch index 18eaf12..4f82c4c 100644 --- a/dietlibc-0.31-no-stack-protector.patch +++ b/dietlibc-0.31-no-stack-protector.patch @@ -1,4 +1,4 @@ -From f49499c7c3a6791249588ab4863d6e9eb1ba1010 Mon Sep 17 00:00:00 2001 +From 114b8b213688bfe34755d5d419dce287347a87b5 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 28 Feb 2009 13:32:45 +0100 Subject: [PATCH 04/18] Build some files without stack-protector @@ -8,7 +8,7 @@ Subject: [PATCH 04/18] Build some files without stack-protector 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Makefile b/Makefile -index dc23d1a..ec97fe9 100644 +index 7186116..c274e3a 100644 --- a/Makefile +++ b/Makefile @@ -129,6 +129,8 @@ LIBPTHREAD_OBJS=$(patsubst libpthread/%.c,$(OBJDIR)/%.o,$(shell ./threadsafe.sh) @@ -20,7 +20,7 @@ index dc23d1a..ec97fe9 100644 include $(ARCH)/Makefile.add LIBMATHOBJ=$(patsubst %,$(OBJDIR)/%,$(LIBMATH)) -@@ -177,6 +179,8 @@ $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp +@@ -178,6 +180,8 @@ $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp $(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ @@ -30,5 +30,5 @@ index dc23d1a..ec97fe9 100644 ifeq ($(shell $(CC) -v 2>&1 | grep "gcc version"),gcc version 4.0.0) -- -1.6.2.5 +1.7.3.3 diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index 92b89d5..7bba7fb 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -1,4 +1,4 @@ -From e6aa8f40136da35a259bcc92026aa2c8f0c935ff Mon Sep 17 00:00:00 2001 +From abcbc90e768b431ce4e063de8a47ab236feeacf5 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:35:14 +0200 Subject: [PATCH 11/18] Support for dynamic PAGE_SIZE @@ -82,7 +82,7 @@ use a type derived from __WORD_SIZE. lib/opendir.c | 4 ++- lib/readdir.c | 2 +- lib/readdir64.c | 6 ++-- - lib/stackgap.c | 28 +++++++++++++++- + lib/stackgap.c | 31 +++++++++++++++++- libcruft/getpagesize.c | 28 +++++++-------- libcruft/sysconf.c | 17 +++++++--- mips/start.S | 9 +++++ @@ -99,7 +99,7 @@ use a type derived from __WORD_SIZE. test/runtests.sh | 2 +- test/sysconf.c | 80 +++++++++++++++++++++++++++++++++++++++++++++ x86_64/start.S | 16 +++++++++ - 34 files changed, 400 insertions(+), 51 deletions(-) + 34 files changed, 403 insertions(+), 51 deletions(-) create mode 100644 dietelfinfo.h create mode 100644 dietpagesize.h create mode 100644 lib/__get_elf_aux_value.c @@ -198,10 +198,10 @@ index 0000000..de8c717 + __attribute__((__visibility__("hidden"),__const__)) __pure; +#endif diff --git a/dietfeatures.h b/dietfeatures.h -index 7ba02ec..ab892d6 100644 +index dcdda39..0d44425 100644 --- a/dietfeatures.h +++ b/dietfeatures.h -@@ -119,6 +119,16 @@ +@@ -138,6 +138,16 @@ #define WANT_SSP #endif @@ -218,7 +218,7 @@ index 7ba02ec..ab892d6 100644 /* stop uncommenting here ;-) */ -@@ -150,4 +160,8 @@ +@@ -169,4 +179,8 @@ #endif #endif @@ -505,42 +505,45 @@ index 924f0a8..06d073b 100644 if (errno==ENOSYS) { trygetdents64=0; diff --git a/lib/stackgap.c b/lib/stackgap.c -index e974e2c..5d51c5d 100644 +index 3ba6954..98f6874 100644 --- a/lib/stackgap.c +++ b/lib/stackgap.c -@@ -6,6 +6,7 @@ - #include +@@ -16,6 +16,7 @@ #include + #include #include "dietfeatures.h" +#include "dietelfinfo.h" - extern int main(int argc,char* argv[],char* envp[]); - -@@ -30,6 +31,7 @@ static void findtlsdata(long* auxvec) { + #ifdef WANT_GNU_STARTUP_BLOAT + char* program_invocation_name; +@@ -53,6 +54,7 @@ static void findtlsdata(long* auxvec) { Elf32_Phdr* x=0; #endif - size_t i,n; + size_t i,n=0; +#ifndef WANT_ELFINFO while (*auxvec) { - if (auxvec[0]==3) { + if (auxvec[0]==3) { /* AT_PHDR */ x=(void*)auxvec[1]; -@@ -37,6 +39,15 @@ static void findtlsdata(long* auxvec) { +@@ -63,6 +65,18 @@ static void findtlsdata(long* auxvec) { } auxvec+=2; } /* if we don't find the entry, the kernel let us down */ +#else + { + __diet_elf_addr_t const *x_addr = __get_elf_aux_value(AT_PHDR); ++ __diet_elf_addr_t const *n_addr = __get_elf_aux_value(AT_PHNUM); + + (void)auxvec; + if (x_addr) + x = (__typeof__(x)) *x_addr; ++ if (n_addr) ++ n = *n_addr; + } +#endif - if (!x) return; /* a kernel this old does not support thread local storage anyway */ - if (x->p_type!=PT_PHDR) return; /* should start with PT_PHDR */ - /* if it doesn't, assume there is no thread local storage */ -@@ -92,6 +103,7 @@ static void setup_tls(tcbhead_t* mainthread) { + if (!x || !n) return; /* a kernel this old does not support thread local storage anyway */ + for (i=0; i512*1024*1024) || + __unlikely(__tmemsize<__tdatasize)) diff --git a/libcruft/getpagesize.c b/libcruft/getpagesize.c index 5ff8973..ac701cf 100644 --- a/libcruft/getpagesize.c @@ -1047,5 +1050,5 @@ index adc461a..8b4f3c9 100644 #ifdef PROFILING pushq %rdi /* save reg args */ -- -1.6.2.5 +1.7.3.3 diff --git a/dietlibc-0.31-smp-fix.patch b/dietlibc-0.31-smp-fix.patch index d98a405..90cce1b 100644 --- a/dietlibc-0.31-smp-fix.patch +++ b/dietlibc-0.31-smp-fix.patch @@ -1,4 +1,4 @@ -From c1354c051ff98683508272385834d35198253542 Mon Sep 17 00:00:00 2001 +From 6d56724a14f6b490c4312368d0124310b8825b5c Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 25 Jul 2009 13:54:39 +0200 Subject: [PATCH 02/18] Fixed SMP build @@ -11,11 +11,11 @@ dependency for object files and executes an 'mkdir'. Ditto for $(PICODIR) --- - Makefile | 42 +++++++++++++++++++++--------------------- - 1 files changed, 21 insertions(+), 21 deletions(-) + Makefile | 43 +++++++++++++++++++++---------------------- + 1 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile -index adc2779..8009cb4 100644 +index 143113b..166c8a5 100644 --- a/Makefile +++ b/Makefile @@ -88,7 +88,7 @@ ILIBDIR=$(LIBDIR)-$(ARCH) @@ -27,7 +27,7 @@ index adc2779..8009cb4 100644 $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a \ $(OBJDIR)/libcompat.a $(OBJDIR)/libm.a \ $(OBJDIR)/librpc.a $(OBJDIR)/libpthread.a \ -@@ -150,30 +150,30 @@ PWD=$(shell pwd) +@@ -150,32 +150,31 @@ PWD=$(shell pwd) # added real dynamic dietlibc.so PICODIR = pic-$(ARCH) @@ -36,9 +36,11 @@ index adc2779..8009cb4 100644 - % :: %,v +-$(OBJDIR)/%.o: $(OBJDIR) +%/.dirstamp: + mkdir $* + @touch $@ + ifeq ($(CC),tcc) -$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h +$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp @@ -67,7 +69,7 @@ index adc2779..8009cb4 100644 $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ endif -@@ -188,7 +188,7 @@ endif +@@ -190,7 +189,7 @@ endif CC+=-D__dietlibc__ @@ -76,7 +78,7 @@ index adc2779..8009cb4 100644 $(CROSS)$(CC) $(INC) $(SAFER_CFLAGS) -c $< -o $@ DIETLIBC_OBJ = $(OBJDIR)/unified.o \ -@@ -203,7 +203,7 @@ $(OBJDIR)/dietlibc.a: $(DIETLIBC_OBJ) $(OBJDIR)/start.o +@@ -205,7 +204,7 @@ $(OBJDIR)/dietlibc.a: $(DIETLIBC_OBJ) $(OBJDIR)/start.o $(OBJDIR)/librpc.a: $(LIBRPCOBJ) $(CROSS)ar cru $@ $(LIBRPCOBJ) @@ -85,7 +87,7 @@ index adc2779..8009cb4 100644 touch dummy.c $(CROSS)$(CC) -c dummy.c $(CROSS)ar cru $@ dummy.o -@@ -235,26 +235,26 @@ dyn: dyn_lib +@@ -237,26 +236,26 @@ dyn: dyn_lib $(OBJDIR)/libdl.a: $(LIBDLOBJ) $(CROSS)ar cru $@ $(LIBDLOBJ) @@ -118,7 +120,7 @@ index adc2779..8009cb4 100644 $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -D__DYN_LIB_SHARED -c $< -o $@ $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ -@@ -272,13 +272,13 @@ DYN_LIBCOMPAT_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBCOMPATOBJ)) +@@ -274,13 +273,13 @@ DYN_LIBCOMPAT_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBCOMPATOBJ)) DYN_LIBMATH_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBMATHOBJ)) @@ -134,7 +136,7 @@ index adc2779..8009cb4 100644 $(LD_UNSET) $(CROSS)$(CC) -D__OD_CLEAN_ROOM -DNODIETREF -fPIC -nostdlib -shared -Bsymbolic -Wl,-Bsymbolic \ -o $@ $(SAFE_CFLAGS) $(INC) libdl/_dl_main.c -Wl,-soname=libdl.so -@@ -330,7 +330,7 @@ $(OBJDIR)/load: +@@ -335,7 +334,7 @@ $(OBJDIR)/load: chmod 755 $@ clean: @@ -144,5 +146,5 @@ index adc2779..8009cb4 100644 $(MAKE) -C examples clean $(MAKE) -C dynlinker clean -- -1.6.2.5 +1.7.3.3 diff --git a/dietlibc-0.31-stackgap-minor.patch b/dietlibc-0.31-stackgap-minor.patch index 201b721..ac9b4d0 100644 --- a/dietlibc-0.31-stackgap-minor.patch +++ b/dietlibc-0.31-stackgap-minor.patch @@ -1,4 +1,4 @@ -From b993cb8bebea6870771bb66eae8b6d41f9e6e9e6 Mon Sep 17 00:00:00 2001 +From ff124a1717fd6308da2f2f6eb0bd3837c4ba8d5a Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 25 Jul 2009 15:34:44 +0200 Subject: [PATCH 17/18] minor cleanups in stackgap.c @@ -8,10 +8,10 @@ Subject: [PATCH 17/18] minor cleanups in stackgap.c 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/stackgap.c b/lib/stackgap.c -index 5d51c5d..f30b58a 100644 +index 98f6874..d4a505b 100644 --- a/lib/stackgap.c +++ b/lib/stackgap.c -@@ -26,9 +26,9 @@ void* __tdataptr; +@@ -49,9 +49,9 @@ void* __tdataptr; static void findtlsdata(long* auxvec) { #if (__WORDSIZE == 64) @@ -21,9 +21,9 @@ index 5d51c5d..f30b58a 100644 - Elf32_Phdr* x=0; + Elf32_Phdr const * x=0; #endif - size_t i,n; + size_t i,n=0; #ifndef WANT_ELFINFO -@@ -125,9 +125,9 @@ int stackgap(int argc,char* argv[],char* envp[]) { +@@ -158,9 +158,9 @@ int stackgap(int argc,char* argv[],char* envp[]) { #endif #ifdef WANT_STACKGAP unsigned short s; @@ -35,5 +35,5 @@ index 5d51c5d..f30b58a 100644 rand=find_rand(auxvec); #else -- -1.6.2.5 +1.7.3.3 diff --git a/dietlibc-0.31-stacksmash.patch b/dietlibc-0.31-stacksmash.patch index 894a0d4..9a56262 100644 --- a/dietlibc-0.31-stacksmash.patch +++ b/dietlibc-0.31-stacksmash.patch @@ -1,4 +1,4 @@ -From 6838387d66f76e8acb227102d46549a26e7b217c Mon Sep 17 00:00:00 2001 +From 06ee7369e5e24d23222c3f0f7ef949eaecd86cc4 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:56:07 +0200 Subject: [PATCH 08/18] Enhanced __stack_chk_fail @@ -15,10 +15,10 @@ Subject: [PATCH 08/18] Enhanced __stack_chk_fail 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile -index ec97fe9..9ea5078 100644 +index c274e3a..575b138 100644 --- a/Makefile +++ b/Makefile -@@ -175,9 +175,10 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp +@@ -176,9 +176,10 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ @@ -50,5 +50,5 @@ index 9e85099..ecefeb8 100644 + *(char *)0 = 0; } -- -1.6.2.5 +1.7.3.3 diff --git a/dietlibc-0.31-strip.patch b/dietlibc-0.31-strip.patch index 3ceaaae..421d75d 100644 --- a/dietlibc-0.31-strip.patch +++ b/dietlibc-0.31-strip.patch @@ -1,4 +1,4 @@ -From 87682b6ad631272dfdc45e1c760331d803851c06 Mon Sep 17 00:00:00 2001 +From a3616a3e74164644dae72379224ce5bf70210734 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 25 Jul 2009 15:12:43 +0200 Subject: [PATCH 03/18] Define and use $(STRIP) makefile variable @@ -10,7 +10,7 @@ of debug symbols. 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile -index 8009cb4..dc23d1a 100644 +index 166c8a5..7186116 100644 --- a/Makefile +++ b/Makefile @@ -105,6 +105,7 @@ CROSS= @@ -21,7 +21,7 @@ index 8009cb4..dc23d1a 100644 VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:libcompat:libdl:librpc:libregex:libm:profiling -@@ -161,7 +162,7 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp +@@ -162,7 +163,7 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp $(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp tcc -I. -Iinclude -c $< -o $@ @@ -30,7 +30,7 @@ index 8009cb4..dc23d1a 100644 else $(OBJDIR)/pstart.o: start.S $(OBJDIR)/.dirstamp $(CROSS)$(CC) $(INC) $(CFLAGS) -DPROFILING -c $< -o $@ -@@ -171,11 +172,11 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp +@@ -172,11 +173,11 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ @@ -44,7 +44,7 @@ index 8009cb4..dc23d1a 100644 endif ifeq ($(shell $(CC) -v 2>&1 | grep "gcc version"),gcc version 4.0.0) -@@ -245,18 +246,18 @@ $(PICODIR)/%.o: %.S $(ARCH)/syscalls.h $(PICODIR)/.dirstamp +@@ -246,18 +247,18 @@ $(PICODIR)/%.o: %.S $(ARCH)/syscalls.h $(PICODIR)/.dirstamp $(PICODIR)/pthread_%.o: libpthread/pthread_%.c $(PICODIR)/.dirstamp $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ @@ -66,7 +66,7 @@ index 8009cb4..dc23d1a 100644 DYN_LIBC_PIC = $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \ $(LIBCRUFTOBJ) $(LIBCRYPTOBJ) $(LIBSHELLOBJ) $(LIBREGEXOBJ) -@@ -305,19 +306,19 @@ CURNAME=$(notdir $(shell pwd)) +@@ -309,19 +310,19 @@ CURNAME=$(notdir $(shell pwd)) $(OBJDIR)/diet: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o $(CROSS)$(CC) -isystem include $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -DVERSION=\"$(VERSION)\" -lgcc @@ -91,5 +91,5 @@ index 8009cb4..dc23d1a 100644 $(OBJDIR)/djb: $(OBJDIR)/compile $(OBJDIR)/load -- -1.6.2.5 +1.7.3.3 From c24d5e7f4bfc155ced56f3150e770a5e64fd9c38 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Fri, 24 Dec 2010 13:22:10 +0100 Subject: [PATCH 083/161] updated CVS_BASEVER --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b12939d..1af08ee 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ MAKEFILE_COMMON = $(HOME)/.fedora/common.mk CVS ?= cvs TAR ?= tar -CVS_BASEVER = 0.31 +CVS_BASEVER = 0.33 CVS_DATE := $(shell date +'%Y%m%d' -d '-1 day') _cvs_suffix = ${CVS_BASEVER}.${CVS_DATE} From 1c6c4ec53cbdecfa9d39b401544fe6a363a9247c Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Fri, 24 Dec 2010 13:23:16 +0100 Subject: [PATCH 084/161] whitespace cleanup --- dietlibc.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 283889e..bd31525 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -154,7 +154,7 @@ sed -i -e 's!^#define WANT_SSP$!// \0!g; %ifarch %ix86 sed -i \ -e '/#define WANT_DYN_PAGESIZE/{c\' \ - -e '#define WANT_ELFINFO' \ + -e '#define WANT_ELFINFO' \ -e '}' \ dietfeatures.h %endif From 9c6a50d7ce95d1cfad7f091993e24fb4ba408ca6 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Fri, 24 Dec 2010 13:23:45 +0100 Subject: [PATCH 085/161] updated to 20101223 CVS snapshot --- .gitignore | 1 + dietlibc.spec | 9 ++++++--- sources | 3 +-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index b4b5e75..acde95c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ dietlibc-0.32.tar.bz2 dietlibc-0.32.tar.bz2.sig +/dietlibc-0.33.20101223.tar.bz2 diff --git a/dietlibc.spec b/dietlibc.spec index bd31525..59ed944 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -7,7 +7,7 @@ %bcond_without noarch ## -#global prerelease 20090228 +%global prerelease 20101223 %global pkglibdir %_prefix/lib/dietlibc %ifarch %ix86 x86_64 @@ -33,8 +33,8 @@ Summary: Small libc implementation Name: dietlibc -Version: 0.32 -Release: %release_func 1400 +Version: 0.33 +Release: %release_func 1500 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -232,6 +232,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Fri Dec 24 2010 Enrico Scholz - 0.33-0.1500.20101223 +- updated to 20101223 CVS snapshot + %changelog * Fri Jul 9 2010 Enrico Scholz - 0.32-1400 - added -static provides (#609606) diff --git a/sources b/sources index 4022f48..87c5fef 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -0098761c17924c15e21d25acdda4a8b5 dietlibc-0.32.tar.bz2 -f2c6737dc9597558da34deed1246c802 dietlibc-0.32.tar.bz2.sig +44df912e2af432a413930387537d6bb2 dietlibc-0.33.20101223.tar.bz2 From 6c2f51368e9d2f7461c996d491b17954c75086d2 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 9 Jan 2011 14:39:22 +0100 Subject: [PATCH 086/161] initial checkin --- dietlibc-0.33-arm-cflags.patch | 42 +++++++++++++++++++++++++++++ dietlibc-0.33-arm-stack-align.patch | 31 +++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 dietlibc-0.33-arm-cflags.patch create mode 100644 dietlibc-0.33-arm-stack-align.patch diff --git a/dietlibc-0.33-arm-cflags.patch b/dietlibc-0.33-arm-cflags.patch new file mode 100644 index 0000000..10a2a84 --- /dev/null +++ b/dietlibc-0.33-arm-cflags.patch @@ -0,0 +1,42 @@ +From 2e6c12aa4627ddf911c545462c9cdc93971a1044 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Fri, 7 Jan 2011 15:41:22 +0100 +Subject: [PATCH 01/20] ARM: fixed compiler flags for EABI + +Do not set '-mfloat-abi=soft' or '-meabi=4' options when '-Os' was +specified. + +The '-mfloat-abi' switch can make dietlibc and programs binary +incompatible when they are compiled with different '-O' options. 'soft' +seems to be a bad choice too because EABI uses usually the 'softfp' +floating point abi. + +The '-meabi=4' switch is unknown to recent gccs and breaks compilation. + +Both options are unrelated to space optimizations and are removed by the +patch hence. + +Signed-off-by: Enrico Scholz +--- + diet.c | 4 ---- + 1 files changed, 0 insertions(+), 4 deletions(-) + +diff --git a/diet.c b/diet.c +index e7fd3e8..22e3696 100644 +--- a/diet.c ++++ b/diet.c +@@ -32,11 +32,7 @@ static const char* Os[] = { + "sparc","-Os","-mcpu=supersparc",0, + "sparc64","-Os","-m64","-mhard-quad-float",0, + "alpha","-Os","-fomit-frame-pointer",0, +-#ifdef __ARM_EABI__ +- "arm","-Os","-fomit-frame-pointer","-mfloat-abi=soft","-meabi=4",0, +-#else + "arm","-Os","-fomit-frame-pointer",0, +-#endif + "mips","-Os","-fomit-frame-pointer","-mno-abicalls","-fno-pic","-G","0",0, + "mipsel","-Os","-fomit-frame-pointer","-mno-abicalls","-fno-pic","-G","0",0, + "ppc","-Os","-fomit-frame-pointer","-mpowerpc-gpopt","-mpowerpc-gfxopt",0, +-- +1.7.3.4 + diff --git a/dietlibc-0.33-arm-stack-align.patch b/dietlibc-0.33-arm-stack-align.patch new file mode 100644 index 0000000..6e33187 --- /dev/null +++ b/dietlibc-0.33-arm-stack-align.patch @@ -0,0 +1,31 @@ +From f0da937d99ef1c32b53fb8c61c3a0225c2dc71c4 Mon Sep 17 00:00:00 2001 +From: Enrico Scholz +Date: Sat, 8 Jan 2011 01:14:13 +0100 +Subject: [PATCH 02/20] ARM: fix stack alignment + +ARM EABI requires an 8-byte stack alignment. Previous startup sequence +destroyed it by popping the 4-byte 'argc' from the aligned stack. + +Signed-off-by: Enrico Scholz +--- + arm/start.S | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arm/start.S b/arm/start.S +index ccbac48..d68d49d 100644 +--- a/arm/start.S ++++ b/arm/start.S +@@ -19,8 +19,8 @@ + _start: + + mov fp, #0 @ clear the frame pointer +- ldr a1, [sp], #4 @ argc +- mov a2, sp @ argv ++ ldr a1, [sp] @ argc ++ add a2, sp, #4 @ argv + ldr ip, .L3 + add a3, a2, a1, lsl #2 @ &argv[argc] + add a3, a3, #4 @ envp +-- +1.7.3.4 + From c42d5c855044e64b3f5cf2ca402dd63cfffdf2e2 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 9 Jan 2011 14:39:48 +0100 Subject: [PATCH 087/161] updated pagesize patch --- dietlibc-0.31-pagesize.patch | 41 +++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch index 7bba7fb..5091c59 100644 --- a/dietlibc-0.31-pagesize.patch +++ b/dietlibc-0.31-pagesize.patch @@ -1,7 +1,7 @@ -From abcbc90e768b431ce4e063de8a47ab236feeacf5 Mon Sep 17 00:00:00 2001 +From 537a231d89113170b9f761f8a490389f8b1c5cee Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 19 Apr 2008 17:35:14 +0200 -Subject: [PATCH 11/18] Support for dynamic PAGE_SIZE +Subject: [PATCH 13/20] Support for dynamic PAGE_SIZE This patch adds support for dynamic PAGE_SIZE values. It is a little bit invasive in several aspects: @@ -66,7 +66,7 @@ auxilary elf-info table. Now, this is not available anymore and I use a type derived from __WORD_SIZE. --- alpha/start.S | 9 +++++ - arm/start.S | 13 +++++++- + arm/start.S | 27 ++++++++++++++- dietdirent.h | 6 +++- dietelfinfo.h | 20 +++++++++++ dietfeatures.h | 14 ++++++++ @@ -99,7 +99,7 @@ use a type derived from __WORD_SIZE. test/runtests.sh | 2 +- test/sysconf.c | 80 +++++++++++++++++++++++++++++++++++++++++++++ x86_64/start.S | 16 +++++++++ - 34 files changed, 403 insertions(+), 51 deletions(-) + 34 files changed, 417 insertions(+), 51 deletions(-) create mode 100644 dietelfinfo.h create mode 100644 dietpagesize.h create mode 100644 lib/__get_elf_aux_value.c @@ -126,10 +126,28 @@ index 7e7cf9b..b13c9c9 100644 /* in v0 ($0) is the ld.so _fini pointer */ mov $0, $19 /* mov v0(dynload) to a3 */ diff --git a/arm/start.S b/arm/start.S -index ccbac48..c9cee01 100644 +index d68d49d..765021b 100644 --- a/arm/start.S +++ b/arm/start.S -@@ -59,11 +59,22 @@ _start: +@@ -25,6 +25,17 @@ _start: + add a3, a2, a1, lsl #2 @ &argv[argc] + add a3, a3, #4 @ envp + str a3, [ip, #0] @ environ = envp ++ ++#ifdef WANT_ELFINFO ++ mov r6, a3 @ work on a copy of a3 so that common ++ @ 'main(argc, argv, envp)' function ++ @ stays valid ++1: ldr r5, [r6], #4 @ load *envp and increment it ++ cmp r5, #0 @ read value==0? ++ bne 1b ++ str r6, [ip, #4] @ __elfinfo = envp ++#endif ++ + bl main + + @ +@@ -59,11 +70,25 @@ _start: #ifdef __DYN_LIB ldr sl, .L4 1: add sl, pc, sl @@ -140,13 +158,16 @@ index ccbac48..c9cee01 100644 #endif +#ifdef WANT_ELFINFO -+1: ldr r5, [a3], #4 @ load *envp and increment it ++ mov r6, a3 @ work on a copy of a3 so that common ++ @ 'main(argc, argv, envp)' function ++ @ stays valid ++1: ldr r5, [r6], #4 @ load *envp and increment it + cmp r5, #0 @ read value==0? + bne 1b +#ifdef __DYN_LIB -+ str a3, [ip, sl] @ __elfinfo = envp ++ str r6, [ip, sl] @ __elfinfo = envp +#else -+ str a3, [ip, #4] @ __elfinfo = envp ++ str r6, [ip, #4] @ __elfinfo = envp +#endif +#endif + @@ -1050,5 +1071,5 @@ index adc461a..8b4f3c9 100644 #ifdef PROFILING pushq %rdi /* save reg args */ -- -1.7.3.3 +1.7.3.4 From b92a8e93a6de2889c96109e20ad304387a56055d Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 9 Jan 2011 14:44:03 +0100 Subject: [PATCH 088/161] - replaced all the single patches with a big one from https://github.com/ensc/dietlibc/commits/rebase - various ARM-EABI fixes (667852) --- dietlibc-0.28-setpriority.patch | 33 - dietlibc-0.29-nostackprotector.patch | 11 - dietlibc-0.29-scall.patch | 32 - dietlibc-0.30-longdouble.patch | 51 - dietlibc-0.31-defpath.patch | 26 - dietlibc-0.31-implicitfunc.patch | 50 - dietlibc-0.31-lcctime.patch | 46 - dietlibc-0.31-no-stack-protector.patch | 34 - dietlibc-0.31-noreturn.patch | 31 - dietlibc-0.31-pagesize.patch | 1075 ---------- dietlibc-0.31-printFG.patch | 275 --- dietlibc-0.31-smp-fix.patch | 150 -- dietlibc-0.31-stackgap-minor.patch | 39 - dietlibc-0.31-stacksmash-dyn.patch | 26 - dietlibc-0.31-stacksmash.patch | 54 - dietlibc-0.31-strip.patch | 95 - dietlibc-0.31-testsuite.patch | 461 ----- dietlibc-0.31.20080212-teststdout.patch | 67 - dietlibc-0.33-arm-cflags.patch | 42 - dietlibc-0.33-arm-stack-align.patch | 31 - dietlibc-github.patch | 2421 +++++++++++++++++++++++ dietlibc.spec | 47 +- 22 files changed, 2430 insertions(+), 2667 deletions(-) delete mode 100644 dietlibc-0.28-setpriority.patch delete mode 100644 dietlibc-0.29-nostackprotector.patch delete mode 100644 dietlibc-0.29-scall.patch delete mode 100644 dietlibc-0.30-longdouble.patch delete mode 100644 dietlibc-0.31-defpath.patch delete mode 100644 dietlibc-0.31-implicitfunc.patch delete mode 100644 dietlibc-0.31-lcctime.patch delete mode 100644 dietlibc-0.31-no-stack-protector.patch delete mode 100644 dietlibc-0.31-noreturn.patch delete mode 100644 dietlibc-0.31-pagesize.patch delete mode 100644 dietlibc-0.31-printFG.patch delete mode 100644 dietlibc-0.31-smp-fix.patch delete mode 100644 dietlibc-0.31-stackgap-minor.patch delete mode 100644 dietlibc-0.31-stacksmash-dyn.patch delete mode 100644 dietlibc-0.31-stacksmash.patch delete mode 100644 dietlibc-0.31-strip.patch delete mode 100644 dietlibc-0.31-testsuite.patch delete mode 100644 dietlibc-0.31.20080212-teststdout.patch delete mode 100644 dietlibc-0.33-arm-cflags.patch delete mode 100644 dietlibc-0.33-arm-stack-align.patch create mode 100644 dietlibc-github.patch diff --git a/dietlibc-0.28-setpriority.patch b/dietlibc-0.28-setpriority.patch deleted file mode 100644 index ebb2448..0000000 --- a/dietlibc-0.28-setpriority.patch +++ /dev/null @@ -1,33 +0,0 @@ -From fdd7de4dbb4b214b45e1b53100110af4e4895458 Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 17:49:05 +0200 -Subject: [PATCH 01/18] Return new nice value for nice(2) - -Changed nice(2) to return the new nice value instead of 0/-1. ---- - lib/__nice.c | 8 ++++++-- - 1 files changed, 6 insertions(+), 2 deletions(-) - -diff --git a/lib/__nice.c b/lib/__nice.c -index d751104..8e205c0 100644 ---- a/lib/__nice.c -+++ b/lib/__nice.c -@@ -1,9 +1,13 @@ - #include "syscalls.h" --#include -+#include - #include - - #ifndef __NR_nice - int nice(int i) { -- return setpriority(PRIO_PROCESS,0,getpriority(PRIO_PROCESS,0)+i); -+ if (setpriority(PRIO_PROCESS,0,getpriority(PRIO_PROCESS,0)+i) == -1) { -+ errno=EPERM; -+ return -1; -+ } -+ return getpriority(PRIO_PROCESS,0); - } - #endif --- -1.6.2.5 - diff --git a/dietlibc-0.29-nostackprotector.patch b/dietlibc-0.29-nostackprotector.patch deleted file mode 100644 index 27e3d9c..0000000 --- a/dietlibc-0.29-nostackprotector.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- dietlibc-0.29/diet.c.nostackprotector 2005-05-18 16:38:55.000000000 +0200 -+++ dietlibc-0.29/diet.c 2005-10-30 12:27:06.000000000 +0100 -@@ -319,6 +319,8 @@ - if (strcmp(argv[i],"-fpic") && strcmp(argv[i],"-fno-pic")) - continue; - } -+ if (strcmp(argv[i],"-fstack-protector")==0) -+ continue; - *dest++=argv[i]; - } - #ifndef __DYN_LIB diff --git a/dietlibc-0.29-scall.patch b/dietlibc-0.29-scall.patch deleted file mode 100644 index f3c9efd..0000000 --- a/dietlibc-0.29-scall.patch +++ /dev/null @@ -1,32 +0,0 @@ -From b855ea26129711c87489ce185def60ea46a77698 Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 17:50:24 +0200 -Subject: [PATCH 05/18] Sanity checks for syscall availability - -Catch the case when syscall(2) is not implemented for the actual arch -instead of jumping to the next function and executing the wrong code ---- - libcompat/syscall.S | 8 +++++++- - 1 files changed, 7 insertions(+), 1 deletions(-) - -diff --git a/libcompat/syscall.S b/libcompat/syscall.S -index c9f72bb..4188167 100644 ---- a/libcompat/syscall.S -+++ b/libcompat/syscall.S -@@ -130,6 +130,12 @@ syscall: - b __unified_syscall - - #else -- /* arch not implemented yet */ -+#include -+ .section .comment -+#if (__WORDSIZE == 64) -+ .quad __syscall_2_not_implemented_for_this_arch -+#else -+ .long __syscall_2_not_implemented_for_this_arch -+#endif - #endif - .size syscall, . - syscall --- -1.6.2.5 - diff --git a/dietlibc-0.30-longdouble.patch b/dietlibc-0.30-longdouble.patch deleted file mode 100644 index 79cf9db..0000000 --- a/dietlibc-0.30-longdouble.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 81eaf0eab3a66c6e055dc243fc70b204d33c59a2 Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 17:54:03 +0200 -Subject: [PATCH 06/18] Workaround PPC build issues - -Fixes https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=182118 and -http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27054 ---- - libm/gamma.c | 26 +++++++++++++------------- - 1 files changed, 13 insertions(+), 13 deletions(-) - -diff --git a/libm/gamma.c b/libm/gamma.c -index 9682f35..370bec6 100644 ---- a/libm/gamma.c -+++ b/libm/gamma.c -@@ -33,19 +33,19 @@ Return value gamma returns a value in range (-0.1208, +oo). For a input - #include - #include - --#define B0 + 1.0l/ 6/ 1/ 2 --#define B1 - 1.0l/ 30/ 3/ 4 --#define B2 + 1.0l/ 42/ 5/ 6 --#define B3 - 1.0l/ 30/ 7/ 8 --#define B4 + 5.0l/ 66/ 9/10 --#define B5 - 691.0l/2730/11/12 --#define B6 + 7.0l/ 6/13/14 --#define B7 - 3617.0l/ 510/15/16 --#define B8 + 43867.0l/ 798/17/18 --#define B9 - 174611.0l/ 330/19/20 --#define B10 + 854513.0l/ 138/21/22 --#define B11 - 236364091.0l/2730/23/24 --#define B12 + 8553103.0l/ 6/25/26 -+#define B0 + 1.0/ 6/ 1/ 2 -+#define B1 - 1.0/ 30/ 3/ 4 -+#define B2 + 1.0/ 42/ 5/ 6 -+#define B3 - 1.0/ 30/ 7/ 8 -+#define B4 + 5.0/ 66/ 9/10 -+#define B5 - 691.0/2730/11/12 -+#define B6 + 7.0/ 6/13/14 -+#define B7 - 3617.0/ 510/15/16 -+#define B8 + 43867.0/ 798/17/18 -+#define B9 - 174611.0/ 330/19/20 -+#define B10 + 854513.0/ 138/21/22 -+#define B11 - 236364091.0/2730/23/24 -+#define B12 + 8553103.0/ 6/25/26 - - static const double coeff[] = { B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 }; - int signgam; --- -1.6.2.5 - diff --git a/dietlibc-0.31-defpath.patch b/dietlibc-0.31-defpath.patch deleted file mode 100644 index 6e4c77c..0000000 --- a/dietlibc-0.31-defpath.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 6aecc55de013adb4cf83be57a85092a96034731c Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 18:00:19 +0200 -Subject: [PATCH 07/18] Security fix for proper $PATH - -Removed '.' from the default $PATH. ---- - include/paths.h | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/include/paths.h b/include/paths.h -index 553b4fa..9bf216f 100644 ---- a/include/paths.h -+++ b/include/paths.h -@@ -2,7 +2,7 @@ - #define _PATHS_H - - #define _PATH_BSHELL "/bin/sh" --#define _PATH_DEFPATH "/bin:/usr/bin:" -+#define _PATH_DEFPATH "/bin:/usr/bin" - - #define _PATH_DEVNULL "/dev/null" - --- -1.6.2.5 - diff --git a/dietlibc-0.31-implicitfunc.patch b/dietlibc-0.31-implicitfunc.patch deleted file mode 100644 index 200ef70..0000000 --- a/dietlibc-0.31-implicitfunc.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 1a0c2661fa8f3ad43c7d38915c967ad6aac987f9 Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 17:43:08 +0200 -Subject: [PATCH 14/18] Fixes for -Werror-no-implicit-functions - -Some fixes for issues preventing builds with -'-Werror-implicit-function-declaration'. ---- - test/getservbyname.c | 1 + - test/stdlib/testsort.c | 2 ++ - test/stdlib/tst-calloc.c | 2 ++ - 3 files changed, 5 insertions(+), 0 deletions(-) - -diff --git a/test/getservbyname.c b/test/getservbyname.c -index b70ca19..caf1c9f 100644 ---- a/test/getservbyname.c -+++ b/test/getservbyname.c -@@ -1,5 +1,6 @@ - #include - #include -+#include - - int main(int argc,char *argv[]) { - struct servent* se; -diff --git a/test/stdlib/testsort.c b/test/stdlib/testsort.c -index aa4332a..5a92bc0 100644 ---- a/test/stdlib/testsort.c -+++ b/test/stdlib/testsort.c -@@ -1,3 +1,5 @@ -+#define _BSD_SOURCE -+ - #include - #include - #include -diff --git a/test/stdlib/tst-calloc.c b/test/stdlib/tst-calloc.c -index a9b9e2a..049117b 100644 ---- a/test/stdlib/tst-calloc.c -+++ b/test/stdlib/tst-calloc.c -@@ -17,6 +17,8 @@ - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -+#define _BSD_SOURCE -+ - #include - #include - #include --- -1.6.2.5 - diff --git a/dietlibc-0.31-lcctime.patch b/dietlibc-0.31-lcctime.patch deleted file mode 100644 index d3e574d..0000000 --- a/dietlibc-0.31-lcctime.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 93df169bb52d83027d77f17c30212a1b109cfc9d Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 17:42:20 +0200 -Subject: [PATCH 13/18] Fixes/enhancements in str?time() functions - -This patch changes the used format for %x and %X specifiers in -strptime(3) to match these specified by SUSv2. It adds support -for '%F' in strftime(3) too. ---- - libugly/strftime.c | 1 + - libugly/strptime.c | 5 +++-- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/libugly/strftime.c b/libugly/strftime.c -index 56ae082..cf16f37 100644 ---- a/libugly/strftime.c -+++ b/libugly/strftime.c -@@ -55,6 +55,7 @@ again: - case 'x': src = "%b %a %d"; goto _strf; - case 'X': src = "%k:%M:%S"; goto _strf; - case 'D': src = "%m/%d/%y"; goto _strf; -+ case 'F': src = "%Y-%m-%d"; goto _strf; - case 'T': src = "%H:%M:%S"; - _strf: p += strftime (p, (size_t)(dst+max-p), src, tm); break; - case 'a': src = sweekdays [tm->tm_wday]; goto _str; -diff --git a/libugly/strptime.c b/libugly/strptime.c -index 9d7f530..d19f309 100644 ---- a/libugly/strptime.c -+++ b/libugly/strptime.c -@@ -119,10 +119,11 @@ char* strptime(const char* s,const char* format, struct tm* tm) { - ++s; - break; - case 'x': -- s=strptime(s,"%b %a %d",tm); -+ /* see SUSv2, Ch.7 "LC_TIME Category in the POSIX Locale" */ -+ s=strptime(s,"%m/%d/%y",tm); - break; - case 'X': -- s=strptime(s,"%k:%M:%S",tm); -+ s=strptime(s,"%H:%M:%S",tm); - break; - case 'y': - i=getint(&s,2); --- -1.6.2.5 - diff --git a/dietlibc-0.31-no-stack-protector.patch b/dietlibc-0.31-no-stack-protector.patch deleted file mode 100644 index 4f82c4c..0000000 --- a/dietlibc-0.31-no-stack-protector.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 114b8b213688bfe34755d5d419dce287347a87b5 Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 28 Feb 2009 13:32:45 +0100 -Subject: [PATCH 04/18] Build some files without stack-protector - ---- - Makefile | 4 ++++ - 1 files changed, 4 insertions(+), 0 deletions(-) - -diff --git a/Makefile b/Makefile -index 7186116..c274e3a 100644 ---- a/Makefile -+++ b/Makefile -@@ -129,6 +129,8 @@ LIBPTHREAD_OBJS=$(patsubst libpthread/%.c,$(OBJDIR)/%.o,$(shell ./threadsafe.sh) - - LIBGMON_OBJS=$(OBJDIR)/__mcount.o $(OBJDIR)/monitor.o $(OBJDIR)/profil.o - -+NO_STACK_PROTECTOR=stackgap.o __get_elf_aux_value.o -+ - include $(ARCH)/Makefile.add - - LIBMATHOBJ=$(patsubst %,$(OBJDIR)/%,$(LIBMATH)) -@@ -178,6 +180,8 @@ $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp - $(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ - $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ -+ -+$(addprefix $(OBJDIR)/,$(NO_STACK_PROTECTOR)): XCFLAGS+=-fno-stack-protector - endif - - ifeq ($(shell $(CC) -v 2>&1 | grep "gcc version"),gcc version 4.0.0) --- -1.7.3.3 - diff --git a/dietlibc-0.31-noreturn.patch b/dietlibc-0.31-noreturn.patch deleted file mode 100644 index a5f6307..0000000 --- a/dietlibc-0.31-noreturn.patch +++ /dev/null @@ -1,31 +0,0 @@ -From a4e9c68f8d10d81bca7b285c100405492b7687da Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 17:43:42 +0200 -Subject: [PATCH 15/18] __noreturn__ annotation for abort(3) - -SUSv2 says about abort(3): - - The abort() function shall not return. - -Hence, an '__attribute__((__noreturn__))' should be added to the -abort(3) declaration. ---- - include/stdlib.h | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/include/stdlib.h b/include/stdlib.h -index 34f3a7f..0cea604 100644 ---- a/include/stdlib.h -+++ b/include/stdlib.h -@@ -47,7 +47,7 @@ double atof(const char *nptr) __THROW; - __extension__ long long int atoll(const char *nptr); - - void exit(int status) __THROW __attribute__((__noreturn__)); --void abort(void) __THROW; -+void abort(void) __THROW __attribute__((__noreturn__)); - - extern int rand(void) __THROW; - extern int rand_r(unsigned int *seed) __THROW; --- -1.6.2.5 - diff --git a/dietlibc-0.31-pagesize.patch b/dietlibc-0.31-pagesize.patch deleted file mode 100644 index 5091c59..0000000 --- a/dietlibc-0.31-pagesize.patch +++ /dev/null @@ -1,1075 +0,0 @@ -From 537a231d89113170b9f761f8a490389f8b1c5cee Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 17:35:14 +0200 -Subject: [PATCH 13/20] Support for dynamic PAGE_SIZE - -This patch adds support for dynamic PAGE_SIZE values. It -is a little bit invasive in several aspects: - -* it modifies the startup code. We need to know the position of - the elf-info auxilary table which is located after 'environ'. - We can not use 'environ' directly because it might be modified - by the application. - - Hence, an additional __elfinfo variable is placed into .bss and - filled in the startup code. Depending on platform, this adds - 4-8 instructions and an additional pointer to .bss. - - I tested only the i386 and x86_64 modifications; it would be - nice when people with corresponding hardware would test the - other ones. I am especially uncertain regarding the parisc - changes. - - The elf-info stuff (which might be interesting e.g. for dynamic - linking or sysconf(_SC_CLK_TCK)) can be enabled without the - dynamic pagesize too. - -* it removes the 'PAGE_SIZE' macro from ; this will - break compilation of existing userspace application which are - using this deprecated macro - -* I added a new internal 'dietpagesize.h' header which defines - - | __DIET_PAGE_SIZE - | __DIET_PAGE_SHIFT - - macros. These return either builtin constants (when - WANT_DYN_PAGESIZE is not selected), or values derived from - __libc_getpagesize(). - - Every usage of PAGE_SIZE in dietlibc code was replaced by these - macros. - -* due to the previous point, the internal 'struct __dirstream' - was modified. I replaced - - | getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1); - - with - - | getdents64(d->fd,(struct dirent64*)d->buf, __DIRSTREAM_BUF_SIZE-1); - - literally but I am not sure where the '-1' is coming from. - There is one hunk, where this '-1' is missing so I think the - '-1' should be removed from all calls to getdents64(). - -* changes affect the *alloc() functions too; on x86_64 around 64 - bytes were added to .text of alloc.o - -* the new testprogramm requires a 'getconf' binary which returns - the correct values for PAGE_SIZE and CLK_TCK - -Patch seems to work fine on i386, x86_64, ppc and ppc64. Things -went a little bit complicated with linux 2.6.25; previous kernels -exported a elf_addr_t type in which is used in the -auxilary elf-info table. Now, this is not available anymore and I -use a type derived from __WORD_SIZE. ---- - alpha/start.S | 9 +++++ - arm/start.S | 27 ++++++++++++++- - dietdirent.h | 6 +++- - dietelfinfo.h | 20 +++++++++++ - dietfeatures.h | 14 ++++++++ - dietpagesize.h | 31 +++++++++++++++++ - dynlinker/ldso_start.S | 9 +++++ - i386/start.S | 7 ++++ - ia64/start.S | 10 ++++++ - include/sys/shm.h | 9 ----- - lib/__get_elf_aux_value.c | 14 ++++++++ - lib/alloc.c | 9 +++-- - lib/closedir.c | 4 ++- - lib/mmap64.c | 6 ++- - lib/opendir.c | 4 ++- - lib/readdir.c | 2 +- - lib/readdir64.c | 6 ++-- - lib/stackgap.c | 31 +++++++++++++++++- - libcruft/getpagesize.c | 28 +++++++-------- - libcruft/sysconf.c | 17 +++++++--- - mips/start.S | 9 +++++ - parisc/start.S | 10 ++++++ - ppc/start.S | 9 +++++ - ppc64/start.S | 9 +++++ - s390/start.S | 11 ++++++ - s390x/start.S | 11 ++++++ - sparc/shmat.c | 8 ++--- - sparc/start.S | 11 ++++++ - sparc64/start.S | 11 ++++++ - syscalls.s/environ.S | 16 +++++++++ - test/Makefile | 2 +- - test/runtests.sh | 2 +- - test/sysconf.c | 80 +++++++++++++++++++++++++++++++++++++++++++++ - x86_64/start.S | 16 +++++++++ - 34 files changed, 417 insertions(+), 51 deletions(-) - create mode 100644 dietelfinfo.h - create mode 100644 dietpagesize.h - create mode 100644 lib/__get_elf_aux_value.c - create mode 100644 test/sysconf.c - -diff --git a/alpha/start.S b/alpha/start.S -index 7e7cf9b..b13c9c9 100644 ---- a/alpha/start.S -+++ b/alpha/start.S -@@ -24,6 +24,15 @@ _start: - - stq $18, environ - -+#ifdef WANT_ELFINFO -+# warning "MAKE ME alpha ASSEMBLER!" -+1: ldq $19, $18 ; load *envp into $19 -+ addq $18, 1, $18 ; increment *envp -+ orr $19, $19, $19 -+ jne 1b -+ stq $18, __elfinfo -+#endif -+ - #ifdef WANT_DYNAMIC - /* in v0 ($0) is the ld.so _fini pointer */ - mov $0, $19 /* mov v0(dynload) to a3 */ -diff --git a/arm/start.S b/arm/start.S -index d68d49d..765021b 100644 ---- a/arm/start.S -+++ b/arm/start.S -@@ -25,6 +25,17 @@ _start: - add a3, a2, a1, lsl #2 @ &argv[argc] - add a3, a3, #4 @ envp - str a3, [ip, #0] @ environ = envp -+ -+#ifdef WANT_ELFINFO -+ mov r6, a3 @ work on a copy of a3 so that common -+ @ 'main(argc, argv, envp)' function -+ @ stays valid -+1: ldr r5, [r6], #4 @ load *envp and increment it -+ cmp r5, #0 @ read value==0? -+ bne 1b -+ str r6, [ip, #4] @ __elfinfo = envp -+#endif -+ - bl main - - @ -@@ -59,11 +70,25 @@ _start: - #ifdef __DYN_LIB - ldr sl, .L4 - 1: add sl, pc, sl -- str a3, [sl, ip] @ environ = envp -+ str a3, [ip, sl]! @ environ = envp; ip = GOT(environ) - #else - str a3, [ip, #0] @ environ = envp - #endif - -+#ifdef WANT_ELFINFO -+ mov r6, a3 @ work on a copy of a3 so that common -+ @ 'main(argc, argv, envp)' function -+ @ stays valid -+1: ldr r5, [r6], #4 @ load *envp and increment it -+ cmp r5, #0 @ read value==0? -+ bne 1b -+#ifdef __DYN_LIB -+ str r6, [ip, sl] @ __elfinfo = envp -+#else -+ str r6, [ip, #4] @ __elfinfo = envp -+#endif -+#endif -+ - #ifdef PROFILING - stmdb sp!, { r0 - r3 } - ldr r0, .L5 -diff --git a/dietdirent.h b/dietdirent.h -index dbd7206..c9c7127 100644 ---- a/dietdirent.h -+++ b/dietdirent.h -@@ -1,8 +1,12 @@ - #include - -+#include "dietpagesize.h" -+ - struct __dirstream { - int fd; -- char buf[PAGE_SIZE-(sizeof (int)*3)]; - unsigned int num; - unsigned int cur; -+ char buf[]; - }; /* stream data from opendir() */ -+ -+#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) -diff --git a/dietelfinfo.h b/dietelfinfo.h -new file mode 100644 -index 0000000..de8c717 ---- /dev/null -+++ b/dietelfinfo.h -@@ -0,0 +1,20 @@ -+#include "dietfeatures.h" -+ -+#ifdef WANT_ELFINFO -+#include -+#include -+#include -+ -+/* TODO: exported interface from has been changed in 2.6.25 so -+ * the 'elf_addr_t' type is not available anymore. Hence, derive it from -+ * __WORDSIZE__. */ -+ -+#if __WORDSIZE == 64 -+typedef uint64_t __diet_elf_addr_t; -+#elif __WORDSIZE == 32 -+typedef uint32_t __diet_elf_addr_t; -+#endif -+ -+__diet_elf_addr_t const * __get_elf_aux_value(unsigned int tag) -+ __attribute__((__visibility__("hidden"),__const__)) __pure; -+#endif -diff --git a/dietfeatures.h b/dietfeatures.h -index dcdda39..0d44425 100644 ---- a/dietfeatures.h -+++ b/dietfeatures.h -@@ -138,6 +138,16 @@ - #define WANT_SSP - #endif - -+/* Some platforms like x86_64, ppc* or mips do not have a fixed PAGE_SIZE. -+ * Select WANT_DYN_PAGESIZE to detect the current PAGE_SIZE at runtime. Else, -+ * define WANT_STATIC_PAGESIZE to a proper value (must be a power of 2) -+ * matching the configured pagesize of the kernel where your binaries are -+ * running on. -+ * -+ * Selecting WANT_DYN_PAGESIZE enlarges the startup code by around 1-3 -+ * instructions and might add an additional __elfinfo symbol */ -+#define WANT_DYN_PAGESIZE -+/* #define WANT_STATIC_PAGESIZE 0x10000UL */ - - - /* stop uncommenting here ;-) */ -@@ -169,4 +179,8 @@ - #endif - #endif - -+#ifdef WANT_DYN_PAGESIZE -+#define WANT_ELFINFO -+#endif -+ - #endif -diff --git a/dietpagesize.h b/dietpagesize.h -new file mode 100644 -index 0000000..8ce6ce7 ---- /dev/null -+++ b/dietpagesize.h -@@ -0,0 +1,31 @@ -+#ifndef H_DIETLIBC_DIETPAGESIZE_H -+#define H_DIETLIBC_DIETPAGESIZE_H -+ -+#include -+#include "dietfeatures.h" -+ -+extern size_t __libc_getpagesize(void) __attribute__((__const__)) __pure; -+ -+#if defined(WANT_STATIC_PAGESIZE) -+# define __DIET_PAGE_SIZE_PREDEF (WANT_STATIC_PAGESIZE) -+# define __DIET_PAGE_SHIFT_PREDEF (ffs(__DIET_PAGE_SIZE_PREDEF)-1) -+#elif defined(__alpha__) || defined(__sparc__) -+# define __DIET_PAGE_SIZE_PREDEF (8192UL) -+# define __DIET_PAGE_SHIFT_PREDEF (13) -+#elif defined(__powerpc64__) -+# define __DIET_PAGE_SIZE_PREDEF (65536UL) -+# define __DIET_PAGE_SHIFT_PREDEF (16) -+#else -+# define __DIET_PAGE_SIZE_PREDEF (4096UL) -+# define __DIET_PAGE_SHIFT_PREDEF (12) -+#endif -+ -+#ifdef WANT_DYN_PAGESIZE -+# define __DIET_PAGE_SIZE (__libc_getpagesize()) -+# define __DIET_PAGE_SHIFT (ffs(__DIET_PAGE_SIZE)-1) -+#else -+# define __DIET_PAGE_SIZE __DIET_PAGE_SIZE_PREDEF -+# define __DIET_PAGE_SHIFT __DIET_PAGE_SHIFT_PREDEF -+#endif -+ -+#endif /* H_DIETLIBC_DIETPAGESIZE_H */ -diff --git a/dynlinker/ldso_start.S b/dynlinker/ldso_start.S -index ca278d7..da36845 100644 ---- a/dynlinker/ldso_start.S -+++ b/dynlinker/ldso_start.S -@@ -86,6 +86,15 @@ __environ: - .long 0 - #endif - -+/* __elfinfo must follow __environ immediately */ -+.global __elfinfo -+__elfinfo: -+#if __WORDSIZE == 64 -+ .quad 0 -+#else -+ .long 0 -+#endif -+ - .global fini_entry - fini_entry: - .long 0 -diff --git a/i386/start.S b/i386/start.S -index 94a4f73..9ad41ff 100644 ---- a/i386/start.S -+++ b/i386/start.S -@@ -25,6 +25,13 @@ _start: - PIC_INIT /* non-PIC: this is an empty line */ - PUT_VAR %eax, environ, %ecx /* non-PIC: movl %eax,environ */ - -+#ifdef WANT_ELFINFO -+1: add $4, %eax /* increment envp */ -+ cmpl $0, -4(%eax) /* load envp[-1] */ -+ jne 1b /* ... until envp[-1]==NULL */ -+ PUT_VAR %eax, __elfinfo, %ecx -+#endif -+ - #ifdef PROFILING - pushl $_etext - pushl $.text -diff --git a/ia64/start.S b/ia64/start.S -index 50fd015..c917721 100644 ---- a/ia64/start.S -+++ b/ia64/start.S -@@ -40,6 +40,16 @@ _start: - ;; - st8 [r14] = out2 /* store envp in environ */ - -+#ifdef WANT_ELFINFO -+# warning "MAKE ME IE64 CODE!" -+1: ld8 r9 = [out2], 8 /* load *envp and increment it */ -+ orr r9 = r9, r9 /* test for NULL */ -+ bne 1b -+ -+ adds r14 = 8, r14 /* __elfinfo = environ + 8 */ -+ st8 [r14] = out2 /* store envp in __elfinfo */ -+#endif -+ - #ifdef WANT_DYNAMIC - /* FIXME: dl_init parameter ??? */ - br.call.sptk.few rp = _dyn_start -diff --git a/include/sys/shm.h b/include/sys/shm.h -index 9b2d04d..70bb17e 100644 ---- a/include/sys/shm.h -+++ b/include/sys/shm.h -@@ -60,15 +60,6 @@ struct shm_info { - unsigned long swap_successes; - }; - --#if defined(__i386__) || defined(__mips__) || defined(__arm__) || defined(__powerpc__) || defined (__powerpc64__) || defined(__s390__) || defined(__hppa__) || defined(__x86_64__) || defined(__ia64__) --#define PAGE_SIZE 4096UL --#define PAGE_SHIFT 12 --#elif defined(__alpha__) || defined(__sparc__) --/* sun4* has 4k except sun4 architecture, sparc64 has 8k */ --#define PAGE_SIZE 8192UL --#define PAGE_SHIFT 13 --#endif -- - 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/lib/__get_elf_aux_value.c b/lib/__get_elf_aux_value.c -new file mode 100644 -index 0000000..8a2e3bc ---- /dev/null -+++ b/lib/__get_elf_aux_value.c -@@ -0,0 +1,14 @@ -+#include -+#include "../dietelfinfo.h" -+ -+__diet_elf_addr_t const *__get_elf_aux_value(unsigned int tag) -+{ -+ extern __diet_elf_addr_t const * const __elfinfo; -+ __diet_elf_addr_t const *aux_ptr; -+ -+ for (aux_ptr = __elfinfo; aux_ptr[0]!=AT_NULL; aux_ptr += 2) -+ if (aux_ptr[0]==tag) -+ return aux_ptr+1; -+ -+ return NULL; -+} -diff --git a/lib/alloc.c b/lib/alloc.c -index 9690565..3f0cedb 100644 ---- a/lib/alloc.c -+++ b/lib/alloc.c -@@ -18,8 +18,7 @@ - #include - #include - --#include /* for PAGE_SIZE */ -- -+#include "../dietpagesize.h" - - /* -- HELPER CODE --------------------------------------------------------- */ - -@@ -39,7 +38,7 @@ typedef struct { - #define BLOCK_START(b) (((void*)(b))-sizeof(__alloc_t)) - #define BLOCK_RET(b) (((void*)(b))+sizeof(__alloc_t)) - --#define MEM_BLOCK_SIZE PAGE_SIZE -+#define MEM_BLOCK_SIZE __DIET_PAGE_SIZE - #define PAGE_ALIGN(s) (((s)+MEM_BLOCK_SIZE-1)&(unsigned long)(~(MEM_BLOCK_SIZE-1))) - - /* a simple mmap :) */ -@@ -66,7 +65,9 @@ static __alloc_t* __small_mem[8]; - - #define FIRST_SMALL(p) (((unsigned long)(p))&(~(MEM_BLOCK_SIZE-1))) - --static inline int __ind_shift() { return (MEM_BLOCK_SIZE==4096)?4:5; } -+static inline int __ind_shift() { -+ return __DIET_PAGE_SHIFT - sizeof(__small_mem)/sizeof(__small_mem[0]); -+} - - static size_t REGPARM(1) get_index(size_t _size) { - register size_t idx=0; -diff --git a/lib/closedir.c b/lib/closedir.c -index 3aade81..21de234 100644 ---- a/lib/closedir.c -+++ b/lib/closedir.c -@@ -4,8 +4,10 @@ - #include - #include - -+#include "../dietpagesize.h" -+ - int closedir (DIR* d) { - int res=close(d->fd); -- munmap (d, PAGE_SIZE); -+ munmap (d, __DIET_PAGE_SIZE); - return res; - } -diff --git a/lib/mmap64.c b/lib/mmap64.c -index 0ab29a6..5012394 100644 ---- a/lib/mmap64.c -+++ b/lib/mmap64.c -@@ -4,16 +4,18 @@ - #include - #include - -+#include "../dietpagesize.h" -+ - #ifdef __NR_mmap2 - void*__mmap2(void*start,size_t length,int prot,int flags,int fd,off_t pgoffset); - - void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset); - void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) { -- if (offset&(PAGE_SIZE-1)) { -+ if (offset&(__DIET_PAGE_SIZE)) { - errno=-EINVAL; - return MAP_FAILED; - } -- return __mmap2(addr,len,prot,flags,fd,offset>>PAGE_SHIFT); -+ return __mmap2(addr,len,prot,flags,fd,offset>>__DIET_PAGE_SHIFT); - } - - void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) -diff --git a/lib/opendir.c b/lib/opendir.c -index 2530d1a..847685e 100644 ---- a/lib/opendir.c -+++ b/lib/opendir.c -@@ -5,6 +5,8 @@ - #include - #include - -+#include "../dietpagesize.h" -+ - DIR* opendir ( const char* name ) { - int fd = open (name, O_RDONLY | O_DIRECTORY); - DIR* t = NULL; -@@ -12,7 +14,7 @@ DIR* opendir ( const char* name ) { - if ( fd >= 0 ) { - if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) - goto lose; -- t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, -+ t = (DIR *) mmap (NULL, __DIET_PAGE_SIZE, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (t == MAP_FAILED) - lose: -diff --git a/lib/readdir.c b/lib/readdir.c -index ed885a5..d80a406 100644 ---- a/lib/readdir.c -+++ b/lib/readdir.c -@@ -5,7 +5,7 @@ - - struct dirent* readdir(DIR *d) { - if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { -- int res=getdents(d->fd,(struct dirent*)d->buf,sizeof (d->buf)-1); -+ int res=getdents(d->fd,(struct dirent*)d->buf,__DIRSTREAM_BUF_SIZE-1); - if (res<=0) return 0; - d->num=res; d->cur=0; - } -diff --git a/lib/readdir64.c b/lib/readdir64.c -index 924f0a8..06d073b 100644 ---- a/lib/readdir64.c -+++ b/lib/readdir64.c -@@ -14,7 +14,7 @@ - #ifndef WANT_LARGEFILE_BACKCOMPAT - struct dirent64* readdir64(DIR *d) { - if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) { -- int res=getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1); -+ int res=getdents64(d->fd,(struct dirent64*)d->buf, __DIRSTREAM_BUF_SIZE-1); - if (res<=0) return 0; - d->num=res; d->cur=0; - } -@@ -32,7 +32,7 @@ again: - if (!trygetdents64) { - #endif - if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { -- int res=getdents(d->fd,(struct dirent*)d->buf, sizeof (d->buf)-1); -+ int res=getdents(d->fd,(struct dirent*)d->buf, __DIRSTREAM_BUF_SIZE-1); - if (res<=0) return 0; - d->num=res; d->cur=0; - } -@@ -46,7 +46,7 @@ again: - #ifdef __NR_getdents64 - } - if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) { -- int res=getdents64(d->fd,(struct dirent64*)d->buf,sizeof (d->buf)); -+ int res=getdents64(d->fd,(struct dirent64*)d->buf,__DIRSTREAM_BUF_SIZE); - if (res<=0) { - if (errno==ENOSYS) { - trygetdents64=0; -diff --git a/lib/stackgap.c b/lib/stackgap.c -index 3ba6954..98f6874 100644 ---- a/lib/stackgap.c -+++ b/lib/stackgap.c -@@ -16,6 +16,7 @@ - #include - #include - #include "dietfeatures.h" -+#include "dietelfinfo.h" - - #ifdef WANT_GNU_STARTUP_BLOAT - char* program_invocation_name; -@@ -53,6 +54,7 @@ static void findtlsdata(long* auxvec) { - Elf32_Phdr* x=0; - #endif - size_t i,n=0; -+#ifndef WANT_ELFINFO - while (*auxvec) { - if (auxvec[0]==3) { /* AT_PHDR */ - x=(void*)auxvec[1]; -@@ -63,6 +65,18 @@ static void findtlsdata(long* auxvec) { - } - auxvec+=2; - } /* if we don't find the entry, the kernel let us down */ -+#else -+ { -+ __diet_elf_addr_t const *x_addr = __get_elf_aux_value(AT_PHDR); -+ __diet_elf_addr_t const *n_addr = __get_elf_aux_value(AT_PHNUM); -+ -+ (void)auxvec; -+ if (x_addr) -+ x = (__typeof__(x)) *x_addr; -+ if (n_addr) -+ n = *n_addr; -+ } -+#endif - if (!x || !n) return; /* a kernel this old does not support thread local storage anyway */ - for (i=0; i512*1024*1024) || - __unlikely(__tmemsize<__tdatasize)) -diff --git a/libcruft/getpagesize.c b/libcruft/getpagesize.c -index 5ff8973..ac701cf 100644 ---- a/libcruft/getpagesize.c -+++ b/libcruft/getpagesize.c -@@ -1,25 +1,23 @@ - #include - #include - #include --/* for environ: */ --#include - --#ifndef PAGE_SIZE --#define PAGE_SIZE 4096 --#endif -+#include "../dietelfinfo.h" -+#include "../dietpagesize.h" - --size_t __libc_getpagesize(void); - size_t __libc_getpagesize(void) { -- long* x=(long*)environ; -- int fd; -- while (*x) ++x; ++x; /* skip envp to get to auxvec */ -- while (*x) { -- if (*x==6) -- return x[1]; -- x+=2; -+#ifdef WANT_DYN_PAGESIZE -+ static size_t pgsz; -+ -+ if (__unlikely(pgsz==0)) { -+ __diet_elf_addr_t const *v = __get_elf_aux_value(AT_PAGESZ); -+ pgsz = *v; /* causes segfault when 'v==NULL' */ - } -- return PAGE_SIZE; -+ -+ return pgsz; -+#else -+ return __DIET_PAGE_SIZE_PREDEF; -+#endif - } - - size_t getpagesize(void) __attribute__((weak,alias("__libc_getpagesize"))); -- -diff --git a/libcruft/sysconf.c b/libcruft/sysconf.c -index 5a6259c..507de94 100644 ---- a/libcruft/sysconf.c -+++ b/libcruft/sysconf.c -@@ -4,6 +4,9 @@ - #include - #include - -+#include "dietelfinfo.h" -+#include "dietpagesize.h" -+ - extern int __sc_nr_cpus(); - - static long physpages() { -@@ -40,6 +43,14 @@ long sysconf(int name) - return limit.rlim_cur; - } - case _SC_CLK_TCK: -+#ifdef WANT_ELFINFO -+ { -+ __diet_elf_addr_t const *v = __get_elf_aux_value(AT_CLKTCK); -+ if (v) -+ return *v; -+ } -+#endif -+ - #ifdef __alpha__ - return 1024; - #else -@@ -47,11 +58,7 @@ long sysconf(int name) - #endif - - case _SC_PAGESIZE: --#if ( defined(__alpha__) || defined(__sparc__) ) -- return 8192; --#else -- return 4096; --#endif -+ return __libc_getpagesize(); - - case _SC_PHYS_PAGES: - return physpages(); -diff --git a/mips/start.S b/mips/start.S -index 57144b3..3cf3433 100644 ---- a/mips/start.S -+++ b/mips/start.S -@@ -47,6 +47,15 @@ __start: - #endif - add $a2, $a2, $a1 - sw $a2, environ -+#ifdef WANT_ELFINFO -+# warning "MAKE ME MIPS CODE!" -+1: addu $a2, $a2, 4 /* increment envp */ -+ lw $4, -4($a2) /* load envp[-1]; TODO: is $4 a proper -+ temporary register? */ -+ bnz 1b /* ... until envp[-1]==NULL -+ TODO: use proper 'bnz' operation */ -+ sw $a2, __elfinfo -+#endif - jalr $25 - la $25, exit - move $4,$2 -diff --git a/parisc/start.S b/parisc/start.S -index 69d9cce..894255c 100644 ---- a/parisc/start.S -+++ b/parisc/start.S -@@ -34,6 +34,16 @@ _start: - ldil LP%environ, %r19 - ldo RP%environ(%r19), %r19 - -+#ifdef WANT_ELFINFO -+# warning "MAKE ME PARISC CODE!" -+1: add %r20, %r19, %r19 ; envp += 4 -+ ldw -4(0,%r19), %r21 ; load envp[-4] into %r21 -+ comibf =,0, 0,%21,1b ; compare %21 with 0 without nullification -+ -+ ldil LP%__elfinfo, %r19 -+ ldo RP%__elfinfo(%r19), %r19 -+#endif -+ - /* Expand the stack to store the 5th through 7th args */ - ldo 64(%sp), %sp - -diff --git a/ppc/start.S b/ppc/start.S -index 771f1ad..3b5cab1 100644 ---- a/ppc/start.S -+++ b/ppc/start.S -@@ -31,6 +31,15 @@ _start: - lis 14,environ@ha - stw 5,environ@l(14) - -+#ifdef WANT_ELFINFO -+1: lwzu 15,0(5) -+ addi 5, 5, 4 -+ cmpwi 15,0 -+ bne 1b -+ -+ stw 5,__elfinfo@l(14) -+#endif -+ - #ifdef WANT_DYNAMIC - mr 6,7 - bl _dyn_start -diff --git a/ppc64/start.S b/ppc64/start.S -index a9208ff..46b4bf0 100644 ---- a/ppc64/start.S -+++ b/ppc64/start.S -@@ -58,6 +58,15 @@ _start: - oris 14,14,environ@ha - std 5,environ@l(14) - -+#ifdef WANT_ELFINFO -+1: ldu 15,0(5) -+ addi 5, 5, 8 -+ cmpdi 15,0 -+ bne 1b -+ -+ std 5,__elfinfo@l(14) -+#endif -+ - #ifdef WANT_DYNAMIC - /* #warning dynamic */ - mr 6,7 -diff --git a/s390/start.S b/s390/start.S -index c0f971f..585faf7 100644 ---- a/s390/start.S -+++ b/s390/start.S -@@ -30,6 +30,17 @@ _start: - l %r1,8(%r13) - st %r4,0(%r1) - -+#ifdef WANT_ELFINFO -+# warning "VERIFY ME!" -+1: ahi %r4, 4 # increment envp -+ l %r12, -4(0,%r4) # load envp[-1] into %r12 -+ or %r12, %r12 # test %r12 for NULL -+ brc 1, 1b -+ -+ ahi %r1, 4 -+ st %r4,0(%r1) -+#endif -+ - /* call main or _dyn_start */ - l %r1,0(%r13) - basr %r14,%r1 -diff --git a/s390x/start.S b/s390x/start.S -index 25895a6..15ad1f9 100644 ---- a/s390x/start.S -+++ b/s390x/start.S -@@ -26,6 +26,17 @@ _start: - larl %r13,environ - stg %r4,0(%r13) - -+#ifdef WANT_ELFINFO -+# warning "VERIFY ME!" -+1: aghi %r4, 8 # increment envp -+ lg %r12, -8(0,%r4) # load envp[-1] into %r12 -+ ogr %r12, %r12 # test %r12 for NULL -+ brc 1, 1b -+ -+ aghi %r13, 8 -+ stg %r4,0(%r13) -+#endif -+ - /* call main or _dyn_start */ - #ifdef WANT_DYNAMIC - brasl %r14,_dyn_start -diff --git a/sparc/shmat.c b/sparc/shmat.c -index b7dce2e..ce3bfcb 100644 ---- a/sparc/shmat.c -+++ b/sparc/shmat.c -@@ -3,17 +3,15 @@ - #include - #include - --extern void* __ipc(); -+#include "../dietpagesize.h" - --#ifndef PAGE_SIZE --#define PAGE_SIZE 4096 --#endif -+extern void* __ipc(); - - void* shmat(int shmid,const void* shmaddr,int shmflg) { - void* raddr; - register void* result; - result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr); -- if ((unsigned long)result <= -(unsigned long)PAGE_SIZE) -+ if ((unsigned long)result <= -(unsigned long)__DIET_PAGE_SIZE) - result=raddr; - return result; - } -diff --git a/sparc/start.S b/sparc/start.S -index a7841e3..bb463c9 100644 ---- a/sparc/start.S -+++ b/sparc/start.S -@@ -25,6 +25,17 @@ _start: - or %o3, %lo(environ), %o3 - st %o2, [%o3] - -+#ifdef WANT_ELFINFO -+# warning "VERIFY ME!" -+1: add %o2, %o2, 4 -+ ld [%o2-4], %o4 -+ orcc %o4, %o4, %o4 -+ bne 1b -+ -+ add %o3, %o3, 4 -+ st %o2, [%o3] -+#endif -+ - /* 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/sparc64/start.S b/sparc64/start.S -index a79c4e7..a884658 100644 ---- a/sparc64/start.S -+++ b/sparc64/start.S -@@ -25,6 +25,17 @@ _start: - or %o3, %lo(environ), %o3 - stx %o2, [%o3] - -+#ifdef WANT_ELFINFO -+# warning "VERIFY ME!" -+1: add %o2, %o2, 8 -+ ldx [%o2-8], %o4 -+ orcc %o4, %o4, %o4 -+ bne 1b -+ -+ add %o3, %o3, 8 -+ stx %o2, [%o3] -+#endif -+ - /* 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/environ.S b/syscalls.s/environ.S -index a4dd95e..294f2d4 100644 ---- a/syscalls.s/environ.S -+++ b/syscalls.s/environ.S -@@ -1,6 +1,7 @@ - .section ".bss" - .align 8 - #include -+#include - - .type environ,object - .weak environ -@@ -15,3 +16,18 @@ environ: - #endif - .size environ,.-environ - .size __environ,.-__environ -+ -+/* __elfinfo will be initialized in start.S to point to the -+ terminating NULL of the environment. */ -+ -+#ifdef WANT_ELFINFO -+.type __elfinfo,object -+.weak __elfinfo -+__elfinfo: -+#if __WORDSIZE == 64 -+ .quad 0 -+#else -+ .long 0 -+#endif -+.size __elfinfo,.-__elfinfo -+#endif -diff --git a/test/Makefile b/test/Makefile -index eea0075..ff416cf 100644 ---- a/test/Makefile -+++ b/test/Makefile -@@ -14,7 +14,7 @@ glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testhar - 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 sysenter ungetc waitpid -+strstr strtol sysconf sysenter ungetc waitpid - - test: $(TESTPROGRAMS) - -diff --git a/test/runtests.sh b/test/runtests.sh -index 6d89efb..908caa5 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 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 sysconf sysenter ungetc waitpid" - - STDIN="read1" - PASS="getpass" -diff --git a/test/sysconf.c b/test/sysconf.c -new file mode 100644 -index 0000000..32263a5 ---- /dev/null -+++ b/test/sysconf.c -@@ -0,0 +1,80 @@ -+#include -+#include -+#include -+#include -+#include -+ -+#include "../dietpagesize.h" -+ -+static long exec_getconf(char const *var) -+{ -+ char buf[128]; -+ pid_t pid; -+ int fd[2]; -+ int status; -+ ssize_t l; -+ -+ if (pipe(fd)<0 || (pid = fork())<0) -+ abort(); -+ -+ if (pid==0) { -+ close(fd[0]); -+ -+ if (fd[1]!=1) { -+ dup2(fd[1], 1); -+ close(fd[1]); -+ } -+ -+ execlp("getconf", "getconf", var, NULL); -+ _exit(1); -+ } -+ -+ close(fd[1]); -+ l = read(fd[0], buf, sizeof(buf)-1); -+ if (l<0) { -+ perror("read()"); -+ goto err; -+ } else if (l==sizeof(buf)-1) -+ goto err; -+ close(fd[0]); -+ -+ buf[l] = '\0'; -+ -+ if (waitpid(pid, &status, 0)<0) -+ goto err; -+ -+ if (!WIFEXITED(status) || WEXITSTATUS(status)!=0) -+ goto err; -+ -+ return strtol(buf, NULL, 10); -+ -+ err: -+ kill(pid, SIGKILL); -+ abort(); -+} -+ -+static unsigned int do_check(char const *var, long exp) -+{ -+ long cur = exec_getconf(var); -+ -+ if (cur!=exp) { -+ fprintf(stderr, "%s mismatch: got %ld, expected %ld\n", -+ var, cur, exp); -+ return 1; -+ } -+ -+ return 0; -+} -+ -+int main(int argc, char *argv[]) -+{ -+ unsigned int err = 0; -+ -+ assert(sysconf(_SC_PAGESIZE) == __DIET_PAGE_SIZE); -+ assert(__DIET_PAGE_SIZE == (1<<__DIET_PAGE_SHIFT)); -+ -+ err += do_check("PAGE_SIZE", sysconf(_SC_PAGESIZE)); -+ err += do_check("CLK_TCK", sysconf(_SC_CLK_TCK)); -+ -+ return err; -+} -diff --git a/x86_64/start.S b/x86_64/start.S -index adc461a..8b4f3c9 100644 ---- a/x86_64/start.S -+++ b/x86_64/start.S -@@ -12,12 +12,28 @@ _start: - - leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */ - -+ -+#ifdef WANT_ELFINFO -+#ifdef __DYN_LIB -+ movq environ@GOTPCREL(%rip), %rax -+#else -+ leaq environ(%rip), %rax -+#endif -+ movq %rdx, (%rax) /* environ */ -+ -+1: add $8, %rdx /* increment envp */ -+ cmpq $0, -8(%rdx) /* load envp[-1] */ -+ jne 1b /* ... until envp[-1]==NULL */ -+ -+ movq %rdx, 8(%rax) /* __elfinfo */ -+#else - #ifdef __DYN_LIB - movq environ@GOTPCREL(%rip), %rax - movq %rdx, (%rax) - #else - movq %rdx, environ(%rip) - #endif -+#endif - - #ifdef PROFILING - pushq %rdi /* save reg args */ --- -1.7.3.4 - diff --git a/dietlibc-0.31-printFG.patch b/dietlibc-0.31-printFG.patch deleted file mode 100644 index 08bd452..0000000 --- a/dietlibc-0.31-printFG.patch +++ /dev/null @@ -1,275 +0,0 @@ -From d10d2f6fca4e391fa863d771dd8c5f7c01d7dfa4 Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 17:39:23 +0200 -Subject: [PATCH 12/18] Fixes/enhancements for INF/NAN handling in printf() - -This patch adds support for uppercase 'F' and 'G' printf format -specifiers. It fixes handling of -INF values in __dtostr() too; -previously, there was - -| unsigned int i; -| if ((i=isinf(d))) return copystring(buf,maxlen,i>0?"inf":"-inf"); - ~~~ -which evaluated to true everytime. The copystring() function -worked for 3-letter words only but not for '-inf'. - -The last argument of __dtostr() was changed from a boolean flag to -a bitmask. Bit 0 encodes 'g' or 'f', and bit 1 lower-/uppercase. -There should be probably added some macros for them; for now, -these values are used directly. - -Please note that this might affect other applications (liblowfat?) -too which are using __dtostr(). - -'isinf(3)' is a builtin with gcc 4.3 and does not give a hint -about the signess of the infinity anymore. Hence, this patch uses -a more portable way where needed. ---- - include/stdlib.h | 6 ++++- - lib/__dtostr.c | 18 +++++++++++----- - lib/__v_printf.c | 59 +++++++++++++++++++++++++++++------------------------ - test/printf.c | 44 +++++++++++++++++++++++++++++++++++---- - 4 files changed, 88 insertions(+), 39 deletions(-) - -diff --git a/include/stdlib.h b/include/stdlib.h -index d1e1569..34f3a7f 100644 ---- a/include/stdlib.h -+++ b/include/stdlib.h -@@ -28,8 +28,12 @@ long double strtold(const char *nptr, char **endptr) __THROW; - long int strtol(const char *nptr, char **endptr, int base) __THROW; - unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW; - -+/* HACK: used flags in __dtostr -+ 0x01 ... 'g' -+ 0x02 ... uppercase -+ Define some constants somewhere... */ - extern int __ltostr(char *s, unsigned int size, unsigned long i, unsigned int base, int UpCase) __THROW; --extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int g) __THROW; -+extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int flags) __THROW; - - #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L - __extension__ long long int strtoll(const char *nptr, char **endptr, int base) __THROW; -diff --git a/lib/__dtostr.c b/lib/__dtostr.c -index 1d082e3..bc61200 100644 ---- a/lib/__dtostr.c -+++ b/lib/__dtostr.c -@@ -5,13 +5,15 @@ - - static int copystring(char* buf,int maxlen, const char* s) { - int i; -- for (i=0; i<3&&i0?"inf":"-inf"); -- if (isnan(d)) return copystring(buf,maxlen,"nan"); -+ if (isinf(d)) -+ return copystring(buf,maxlen, -+ (d<0)? -+ (flags&0x02?"-INF":"-inf"): -+ (flags&0x02?"INF":"inf")); -+ if (isnan(d)) return copystring(buf,maxlen,flags&0x02?"NAN":"nan"); - e10=1+(long)(e*0.30102999566398119802); /* log10(2) */ - /* Wir iterieren von Links bis wir bei 0 sind oder maxlen erreicht - * ist. Wenn maxlen erreicht ist, machen wir das nochmal in -@@ -126,7 +132,7 @@ int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned i - if (prec2 || prec>(unsigned int)(buf-oldbuf)+1) { /* more digits wanted */ - if (!maxlen) return 0; --maxlen; - *buf='.'; ++buf; -- if (g) { -+ if ((flags & 0x01)) { - if (prec2) prec=prec2; - prec-=buf-oldbuf-1; - } else { -diff --git a/lib/__v_printf.c b/lib/__v_printf.c -index 36202f5..964c005 100644 ---- a/lib/__v_printf.c -+++ b/lib/__v_printf.c -@@ -4,6 +4,7 @@ - #include - #include - #include -+#include - #include "dietstdio.h" - #include "dietwarning.h" - -@@ -346,45 +347,49 @@ num_printf: - #ifdef WANT_FLOATING_POINT_IN_PRINTF - /* print a floating point value */ - case 'f': -+ case 'F': - case 'g': -+ case 'G': - { -- int g=(ch=='g'); -+ int flags=(((ch&0x5f)=='G') ? 0x01 : 0x00) | ((ch&0x20) ? 0x00 : 0x02); - double d=va_arg(arg_ptr,double); - s=buf+1; - if (width==0) width=1; - if (!flag_dot) preci=6; - if (flag_sign || d < +0.0) flag_in_sign=1; - -- sz=__dtostr(d,s,sizeof(buf)-1,width,preci,g); -- -- if (flag_dot) { -- char *tmp; -- if ((tmp=strchr(s,'.'))) { -- if (preci || flag_hash) ++tmp; -- while (preci>0 && *++tmp) --preci; -- *tmp=0; -- } else if (flag_hash) { -- s[sz]='.'; -- s[++sz]='\0'; -+ sz=__dtostr(d,s,sizeof(buf)-1,width,preci,flags); -+ -+ if (!isnan(d) && !isinf(d)) { /* skip NaN + INF values */ -+ if (flag_dot) { -+ char *tmp; -+ if ((tmp=strchr(s,'.'))) { -+ if (preci || flag_hash) ++tmp; -+ while (preci>0 && *++tmp) --preci; -+ *tmp=0; -+ } else if (flag_hash) { -+ s[sz]='.'; -+ s[++sz]='\0'; -+ } - } -- } - -- if (g) { -- char *tmp,*tmp1; /* boy, is _this_ ugly! */ -- if ((tmp=strchr(s,'.'))) { -- tmp1=strchr(tmp,'e'); -- while (*tmp) ++tmp; -- if (tmp1) tmp=tmp1; -- while (*--tmp=='0') ; -- if (*tmp!='.') ++tmp; -- *tmp=0; -- if (tmp1) strcpy(tmp,tmp1); -+ if ((flags&0x01)) { -+ char *tmp,*tmp1; /* boy, is _this_ ugly! */ -+ if ((tmp=strchr(s,'.'))) { -+ tmp1=strchr(tmp,'e'); -+ while (*tmp) ++tmp; -+ if (tmp1) tmp=tmp1; -+ while (*--tmp=='0') ; -+ if (*tmp!='.') ++tmp; -+ *tmp=0; -+ if (tmp1) strcpy(tmp,tmp1); -+ } - } -- } - -- if ((flag_sign || flag_space) && d>=0) { -- *(--s)=(flag_sign)?'+':' '; -- ++sz; -+ if ((flag_sign || flag_space) && d>=0) { -+ *(--s)=(flag_sign)?'+':' '; -+ ++sz; -+ } - } - - sz=strlen(s); -diff --git a/test/printf.c b/test/printf.c -index 719461a..ef6050d 100644 ---- a/test/printf.c -+++ b/test/printf.c -@@ -2,11 +2,26 @@ - #include - #include - #include -+#include -+#include - #include - #include - - #define ALGN 5 - -+#ifndef INFINITY -+# if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) -+# define INFINITY (__builtin_inf()) -+# endif -+#endif -+ -+#ifndef NAN -+# if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) -+# define NAN (__builtin_nan("")) -+# endif -+#endif -+ -+ - // https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=112986 - #if 0 - #undef assert -@@ -60,7 +75,7 @@ - TEST_SNPRINTF(EXP, 0, __VA_ARGS__); \ - TEST_SNPRINTF(EXP, sizeof(EXP)+ALGN, __VA_ARGS__); \ - TEST_SNPRINTF_NULL(EXP, __VA_ARGS__) -- -+ - - int main() - { -@@ -101,7 +116,7 @@ int main() - TEST("42.23", "%5.2f", 42.23); - TEST("42.23", "%5.4g", 42.23); - TEST(" 42.2", "%5.3g", 42.23); -- -+ - TEST(" 1", "%*i", 4, 1); - TEST(" 1", "%4i", 1); - TEST("1 ", "%-4i", 1); -@@ -131,13 +146,32 @@ int main() - TEST("-01234", "%6.5i", -1234); - TEST(" 1234", "%6.5s", "1234"); - -+#ifdef INFINITY -+ TEST("inf", "%f", INFINITY); -+ TEST("-inf", "%f", -INFINITY); -+ TEST("INF", "%F", INFINITY); -+ TEST("-INF", "%F", -INFINITY); -+ -+ TEST("inf", "%g", INFINITY); -+ TEST("-inf", "%g", -INFINITY); -+ TEST("INF", "%G", INFINITY); -+ TEST("-INF", "%G", -INFINITY); -+#endif -+ -+#ifdef NAN -+ TEST("nan", "%f", NAN); -+ TEST("NAN", "%F", NAN); -+ TEST("nan", "%g", NAN); -+ TEST("NAN", "%G", NAN); -+#endif -+ - #ifdef XSI_TESTS - setlocale(LC_ALL, "de_DE"); -- -+ - TEST("1.234", "%'u", 1234); - TEST("2 1", "%2$u %1$u", 1, 2); - #endif -- -- -+ -+ - return EXIT_SUCCESS; - } --- -1.6.2.5 - diff --git a/dietlibc-0.31-smp-fix.patch b/dietlibc-0.31-smp-fix.patch deleted file mode 100644 index 90cce1b..0000000 --- a/dietlibc-0.31-smp-fix.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 6d56724a14f6b490c4312368d0124310b8825b5c Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 25 Jul 2009 13:54:39 +0200 -Subject: [PATCH 02/18] Fixed SMP build - -'make -j' fails usually because $(OBJDIR) was not created yet when -compiling files. - -This patch adds a $(OBJDIR)/.dirstamp target which is added as a -dependency for object files and executes an 'mkdir'. - -Ditto for $(PICODIR) ---- - Makefile | 43 +++++++++++++++++++++---------------------- - 1 files changed, 21 insertions(+), 22 deletions(-) - -diff --git a/Makefile b/Makefile -index 143113b..166c8a5 100644 ---- a/Makefile -+++ b/Makefile -@@ -88,7 +88,7 @@ ILIBDIR=$(LIBDIR)-$(ARCH) - - HOME=$(shell pwd) - --WHAT= $(OBJDIR) $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \ -+WHAT= $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \ - $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a \ - $(OBJDIR)/libcompat.a $(OBJDIR)/libm.a \ - $(OBJDIR)/librpc.a $(OBJDIR)/libpthread.a \ -@@ -150,32 +150,31 @@ PWD=$(shell pwd) - # added real dynamic dietlibc.so - PICODIR = pic-$(ARCH) - --$(OBJDIR) $(PICODIR): -- mkdir $@ -- - % :: %,v - --$(OBJDIR)/%.o: $(OBJDIR) -+%/.dirstamp: -+ mkdir $* -+ @touch $@ - - ifeq ($(CC),tcc) --$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h -+$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp - $(CROSS)cpp $(INC) $< | $(CROSS)as -o $@ - --$(OBJDIR)/%.o: %.c -+$(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp - tcc -I. -Iinclude -c $< -o $@ - $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ - else --$(OBJDIR)/pstart.o: start.S -+$(OBJDIR)/pstart.o: start.S $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -DPROFILING -c $< -o $@ - --$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h -+$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ - --$(OBJDIR)/pthread_%.o: libpthread/pthread_%.c -+$(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ - $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ - --$(OBJDIR)/%.o: %.c -+$(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ - $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ - endif -@@ -190,7 +189,7 @@ endif - - CC+=-D__dietlibc__ - --$(OBJDIR)/crypt.o: libcrypt/crypt.c -+$(OBJDIR)/crypt.o: libcrypt/crypt.c $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(SAFER_CFLAGS) -c $< -o $@ - - DIETLIBC_OBJ = $(OBJDIR)/unified.o \ -@@ -205,7 +204,7 @@ $(OBJDIR)/dietlibc.a: $(DIETLIBC_OBJ) $(OBJDIR)/start.o - $(OBJDIR)/librpc.a: $(LIBRPCOBJ) - $(CROSS)ar cru $@ $(LIBRPCOBJ) - --$(OBJDIR)/libcrypt.a: -+$(OBJDIR)/libcrypt.a: $(OBJDIR)/.dirstamp - touch dummy.c - $(CROSS)$(CC) -c dummy.c - $(CROSS)ar cru $@ dummy.o -@@ -237,26 +236,26 @@ dyn: dyn_lib - $(OBJDIR)/libdl.a: $(LIBDLOBJ) - $(CROSS)ar cru $@ $(LIBDLOBJ) - --dyn_lib: $(PICODIR) $(PICODIR)/libc.so $(PICODIR)/dstart.o \ -+dyn_lib: $(PICODIR)/libc.so $(PICODIR)/dstart.o \ - $(PICODIR)/dyn_so_start.o $(PICODIR)/dyn_start.o $(PICODIR)/dyn_stop.o \ - $(PICODIR)/libpthread.so $(PICODIR)/libdl.so $(PICODIR)/libcompat.so \ - $(PICODIR)/libm.so $(PICODIR)/diet-dyn $(PICODIR)/diet-dyn-i - --$(PICODIR)/%.o: %.S $(ARCH)/syscalls.h -+$(PICODIR)/%.o: %.S $(ARCH)/syscalls.h $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ - --$(PICODIR)/pthread_%.o: libpthread/pthread_%.c -+$(PICODIR)/pthread_%.o: libpthread/pthread_%.c $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ - $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ - --$(PICODIR)/%.o: %.c -+$(PICODIR)/%.o: %.c $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ - $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ - --$(PICODIR)/dstart.o: start.S -+$(PICODIR)/dstart.o: start.S $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ - --$(PICODIR)/dyn_so_start.o: dyn_start.c -+$(PICODIR)/dyn_so_start.o: dyn_start.c $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -D__DYN_LIB_SHARED -c $< -o $@ - $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ - -@@ -274,13 +273,13 @@ DYN_LIBCOMPAT_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBCOMPATOBJ)) - - DYN_LIBMATH_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBMATHOBJ)) - --$(PICODIR)/libc.so: $(PICODIR) $(DYN_LIBC_OBJ) -+$(PICODIR)/libc.so: $(DYN_LIBC_OBJ) - $(LD_UNSET) $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBC_OBJ) -lgcc -Wl,-soname=libc.so - - $(PICODIR)/libpthread.so: $(DYN_PTHREAD_OBJS) dietfeatures.h - $(LD_UNSET) $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_PTHREAD_OBJS) -L$(PICODIR) -lc -Wl,-soname=libpthread.so - --$(PICODIR)/libdl.so: libdl/_dl_main.c dietfeatures.h -+$(PICODIR)/libdl.so: libdl/_dl_main.c dietfeatures.h $(PICODIR)/.dirstamp - $(LD_UNSET) $(CROSS)$(CC) -D__OD_CLEAN_ROOM -DNODIETREF -fPIC -nostdlib -shared -Bsymbolic -Wl,-Bsymbolic \ - -o $@ $(SAFE_CFLAGS) $(INC) libdl/_dl_main.c -Wl,-soname=libdl.so - -@@ -335,7 +334,7 @@ $(OBJDIR)/load: - chmod 755 $@ - - clean: -- rm -f *.o *.a t t1 compile load elftrunc exports mapfile libdietc.so -+ rm -f *.o *.a t t1 compile load elftrunc exports mapfile libdietc.so .dirstamp - rm -rf bin-* pic-* - $(MAKE) -C examples clean - $(MAKE) -C dynlinker clean --- -1.7.3.3 - diff --git a/dietlibc-0.31-stackgap-minor.patch b/dietlibc-0.31-stackgap-minor.patch deleted file mode 100644 index ac9b4d0..0000000 --- a/dietlibc-0.31-stackgap-minor.patch +++ /dev/null @@ -1,39 +0,0 @@ -From ff124a1717fd6308da2f2f6eb0bd3837c4ba8d5a Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 25 Jul 2009 15:34:44 +0200 -Subject: [PATCH 17/18] minor cleanups in stackgap.c - ---- - lib/stackgap.c | 6 +++--- - 1 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/lib/stackgap.c b/lib/stackgap.c -index 98f6874..d4a505b 100644 ---- a/lib/stackgap.c -+++ b/lib/stackgap.c -@@ -49,9 +49,9 @@ void* __tdataptr; - - static void findtlsdata(long* auxvec) { - #if (__WORDSIZE == 64) -- Elf64_Phdr* x=0; -+ Elf64_Phdr const * x=0; - #else -- Elf32_Phdr* x=0; -+ Elf32_Phdr const * x=0; - #endif - size_t i,n=0; - #ifndef WANT_ELFINFO -@@ -158,9 +158,9 @@ int stackgap(int argc,char* argv[],char* envp[]) { - #endif - #ifdef WANT_STACKGAP - unsigned short s; -+ volatile char* gap; - #endif - #if defined(WANT_STACKGAP) || defined(WANT_SSP) -- volatile char* gap; - #ifndef WANT_ELFINFO - rand=find_rand(auxvec); - #else --- -1.7.3.3 - diff --git a/dietlibc-0.31-stacksmash-dyn.patch b/dietlibc-0.31-stacksmash-dyn.patch deleted file mode 100644 index ed4ce9c..0000000 --- a/dietlibc-0.31-stacksmash-dyn.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 729c8524b8a5f3a4bf4ebda7ae23c0a10ef62560 Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 17:57:09 +0200 -Subject: [PATCH 09/18] __stack_chk_fail_local function - -Added __stack_chk_fail_local() function as an alias for __stack_chk_fail(). -This is required for dynamic linking. ---- - lib/stack_smash_handler2.c | 1 + - 1 files changed, 1 insertions(+), 0 deletions(-) - -diff --git a/lib/stack_smash_handler2.c b/lib/stack_smash_handler2.c -index ecefeb8..b03c0d5 100644 ---- a/lib/stack_smash_handler2.c -+++ b/lib/stack_smash_handler2.c -@@ -2,6 +2,7 @@ - #include - - void __stack_chk_fail(void); -+void __stack_chk_fail_local(void) __attribute__((__alias__("__stack_chk_fail"))); - - /* earlier versions of ProPolice actually gave the address and function - * name as arguments to the handler, so it could print some useful --- -1.6.2.5 - diff --git a/dietlibc-0.31-stacksmash.patch b/dietlibc-0.31-stacksmash.patch deleted file mode 100644 index 9a56262..0000000 --- a/dietlibc-0.31-stacksmash.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 06ee7369e5e24d23222c3f0f7ef949eaecd86cc4 Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 17:56:07 +0200 -Subject: [PATCH 08/18] Enhanced __stack_chk_fail - -* modified __stack_chk_fail() to trigger a segfault by accessing - address 0x0. Every system with an MMU known by me, segfaults - by dereferencing a NULL pointer. - -* added hack to compile stack_smash_handler2 with - '--fno-omit-frame-pointer'. ---- - Makefile | 3 ++- - lib/stack_smash_handler2.c | 10 +++++++++- - 2 files changed, 11 insertions(+), 2 deletions(-) - -diff --git a/Makefile b/Makefile -index c274e3a..575b138 100644 ---- a/Makefile -+++ b/Makefile -@@ -176,9 +176,10 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp - $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ - $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ -+$(OBJDIR)/stack_smash_handler2.o: XCFLAGS:=-fno-omit-frame-pointer - - $(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp -- $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ -+ $(CROSS)$(CC) $(INC) $(CFLAGS) $(XCFLAGS) -c $< -o $@ -D__dietlibc__ - $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ - - $(addprefix $(OBJDIR)/,$(NO_STACK_PROTECTOR)): XCFLAGS+=-fno-stack-protector -diff --git a/lib/stack_smash_handler2.c b/lib/stack_smash_handler2.c -index 9e85099..ecefeb8 100644 ---- a/lib/stack_smash_handler2.c -+++ b/lib/stack_smash_handler2.c -@@ -8,5 +8,13 @@ void __stack_chk_fail(void); - * diagnostics. No more. :-( */ - void __stack_chk_fail(void) { - __write2("smashed stack detected, program terminated.\n"); -- _exit(127); -+ -+ /* trigger a segfault which can be inspected within a debugger (inclusive -+ * stack-trace). 'abort(3)' at this place would be too heavy weighted. -+ * -+ * TODO: limit this to systems which are known to have an MMU (resp. is -+ * dietlibc with stack-protector used on systems without an MMU?) -+ */ -+ while (1) -+ *(char *)0 = 0; - } --- -1.7.3.3 - diff --git a/dietlibc-0.31-strip.patch b/dietlibc-0.31-strip.patch deleted file mode 100644 index 421d75d..0000000 --- a/dietlibc-0.31-strip.patch +++ /dev/null @@ -1,95 +0,0 @@ -From a3616a3e74164644dae72379224ce5bf70210734 Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 25 Jul 2009 15:12:43 +0200 -Subject: [PATCH 03/18] Define and use $(STRIP) makefile variable - -This increases readability and makes it easier to turn off stripping -of debug symbols. ---- - Makefile | 21 +++++++++++---------- - 1 files changed, 11 insertions(+), 10 deletions(-) - -diff --git a/Makefile b/Makefile -index 166c8a5..7186116 100644 ---- a/Makefile -+++ b/Makefile -@@ -105,6 +105,7 @@ CROSS= - - CC=gcc - INC=-I. -isystem include -+STRIP=$(CROSS)strip - - VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:libcompat:libdl:librpc:libregex:libm:profiling - -@@ -162,7 +163,7 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp - - $(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp - tcc -I. -Iinclude -c $< -o $@ -- $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ -+ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ - else - $(OBJDIR)/pstart.o: start.S $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -DPROFILING -c $< -o $@ -@@ -172,11 +173,11 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp - - $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -- $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ -+ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ - - $(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ -- $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ -+ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ - endif - - ifeq ($(shell $(CC) -v 2>&1 | grep "gcc version"),gcc version 4.0.0) -@@ -246,18 +247,18 @@ $(PICODIR)/%.o: %.S $(ARCH)/syscalls.h $(PICODIR)/.dirstamp - - $(PICODIR)/pthread_%.o: libpthread/pthread_%.c $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ -- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ -+ $(COMMENT) $(STRIP) -x -R .comment -R .note $@ - - $(PICODIR)/%.o: %.c $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ -- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ -+ $(COMMENT) $(STRIP) -x -R .comment -R .note $@ - - $(PICODIR)/dstart.o: start.S $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ - - $(PICODIR)/dyn_so_start.o: dyn_start.c $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -D__DYN_LIB_SHARED -c $< -o $@ -- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ -+ $(COMMENT) $(STRIP) -x -R .comment -R .note $@ - - DYN_LIBC_PIC = $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \ - $(LIBCRUFTOBJ) $(LIBCRYPTOBJ) $(LIBSHELLOBJ) $(LIBREGEXOBJ) -@@ -309,19 +310,19 @@ CURNAME=$(notdir $(shell pwd)) - - $(OBJDIR)/diet: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o - $(CROSS)$(CC) -isystem include $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -DVERSION=\"$(VERSION)\" -lgcc -- $(CROSS)strip -R .comment -R .note $@ -+ $(STRIP) -R .comment -R .note $@ - - $(OBJDIR)/diet-i: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o - $(CROSS)$(CC) -isystem include $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -DVERSION=\"$(VERSION)\" -DINSTALLVERSION -lgcc -- $(CROSS)strip -R .comment -R .note $@ -+ $(STRIP) -R .comment -R .note $@ - - $(PICODIR)/diet-dyn: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c - $(LD_UNSET) $(CROSS)$(CC) -isystem include $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(HOME)/$(PICODIR)/libdl.so -- $(CROSS)strip -R .command -R .note $@ -+ $(STRIP) -R .command -R .note $@ - - $(PICODIR)/diet-dyn-i: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c - $(LD_UNSET) $(CROSS)$(CC) -isystem include $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(ILIBDIR)/libdl.so -DINSTALLVERSION -- $(CROSS)strip -R .command -R .note $@ -+ $(STRIP) -R .command -R .note $@ - - $(OBJDIR)/djb: $(OBJDIR)/compile $(OBJDIR)/load - --- -1.7.3.3 - diff --git a/dietlibc-0.31-testsuite.patch b/dietlibc-0.31-testsuite.patch deleted file mode 100644 index 307b8a4..0000000 --- a/dietlibc-0.31-testsuite.patch +++ /dev/null @@ -1,461 +0,0 @@ -From 7227ec436a737f13d8bc1fd9bf8f8995d073eb0b Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 17:41:23 +0200 -Subject: [PATCH 16/18] Several testsuite fixes/enhancments - -* test/getmntent.c: I removed the checks which called endmntent() - multiple times resp. with a NULL pointer. Behavior in first - case is undefined and latter causes a segfault (I could not - find documentation that this is allowed). Hence, it does not - make sense to test this. - -* test/stdlib/tst-malloc.c: test 'malloc(0)' only, when - WANT_MALLOC_ZERO is set - -* test/time/tst-strftime.c: the '%Zu' printf format specifier is - bogus (from libc5 ages). I replaced it with the '%zu' one. - - Please note, that this test still fails because it uses glibc - specific features. - -* test/time/tst-strptime.c: removed tests which set a non-C - locale. Broken usage of 'strptime()' result was fixed too. - This test should succeed now. - -* test/math.c: this test was added while working on the '%F/%G' - patch and verifies the isinf() + isnan() functions. - -* fixes lot of broken printf() format specifiers - -* fixes tests using isinf(); the math.c test checks the dietlibc - implementation of isinf() (which differs between positive and - negative inf). All other tests use boolean retval only and test - for the signess of the values ---- - test/Makefile | 2 +- - test/asprintf.c | 2 +- - test/bsearch.c | 2 +- - test/byteswap.c | 8 ++++---- - test/cycles.c | 2 +- - test/getmntent.c | 6 +----- - test/math.c | 29 +++++++++++++++++++++++++++++ - test/mktime.c | 6 +++--- - test/printftest.c | 6 +++--- - test/rand48.c | 12 ++++++------ - test/runtests.sh | 2 +- - test/speed.c | 4 ++-- - test/stdio/tstscanf.c | 4 ++-- - test/stdlib/tst-malloc.c | 6 +++++- - test/stdlib/tst-strtod.c | 4 ++-- - test/sysenter.c | 6 +++--- - test/time/tst-strftime.c | 6 +++--- - test/time/tst-strptime.c | 23 ++++++++++++++++++++--- - 18 files changed, 88 insertions(+), 42 deletions(-) - create mode 100644 test/math.c - -diff --git a/test/Makefile b/test/Makefile -index ff416cf..537b32f 100644 ---- a/test/Makefile -+++ b/test/Makefile -@@ -10,7 +10,7 @@ LCOMPAT=-lcompat - TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty 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 \ -+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 \ -diff --git a/test/asprintf.c b/test/asprintf.c -index 996a5aa..0d4f2eb 100644 ---- a/test/asprintf.c -+++ b/test/asprintf.c -@@ -13,7 +13,7 @@ int main(int argc, char **argv) { - assert(strlen(path) == asprintlen); - - printf("%s\n", path); -- asprintlen=asprintf(&path, "/proc" "/%d/stat", strlen(argv[1])); -+ asprintlen=asprintf(&path, "/proc" "/%zu/stat", strlen(argv[1])); - assert(strlen(path) == asprintlen); - printf("%s\n", path); - -diff --git a/test/bsearch.c b/test/bsearch.c -index 961ad35..ede4c88 100644 ---- a/test/bsearch.c -+++ b/test/bsearch.c -@@ -35,7 +35,7 @@ int main() { - die("bsearch returned NULL\n"); - } - if (k != array+i) die("bsearch found wrong element\n"); -- printf("%d\n",k-array); -+ printf("%ld\n",k-array); - } - } - return 0; -diff --git a/test/byteswap.c b/test/byteswap.c -index 19239dd..6f43c25 100644 ---- a/test/byteswap.c -+++ b/test/byteswap.c -@@ -9,12 +9,12 @@ int main() { - snprintf(buf,100,"%x %x", bswap_16(0x1234), bswap_16(0x5678)); - assert(strcmp(buf, "3412 7856") == 0); - -- printf("%lx\n",bswap_32(0x12345678)); -- snprintf(buf,100,"%lx", bswap_32(0x12345678)); -+ printf("%x\n",(unsigned int)bswap_32(0x12345678)); -+ snprintf(buf,100,"%x", (unsigned int)bswap_32(0x12345678)); - assert(strcmp(buf, "78563412") == 0); - -- printf("%qx\n",bswap_64(0x123456789ABCDEFull)); -- snprintf(buf,100,"%qx", bswap_64(0x123456789ABCDEFull)); -+ printf("%llx\n",(unsigned long long)bswap_64(0x123456789ABCDEFull)); -+ snprintf(buf,100,"%llx", (unsigned long long)bswap_64(0x123456789ABCDEFull)); - assert(strcmp(buf, "efcdab8967452301") == 0); - return 0; - } -diff --git a/test/cycles.c b/test/cycles.c -index 35547f8..a4cb8c8 100644 ---- a/test/cycles.c -+++ b/test/cycles.c -@@ -24,7 +24,7 @@ int main(int argc,char* argv[]) { - if (!fork()) { execve(argv[1],argv+1,environ); exit(1); } - wait(0); - RDTSC(b); -- printf("%llu cycles\n",b-a); -+ printf("%llu cycles\n",(unsigned long long)(b-a)); - - return 0; - } -diff --git a/test/getmntent.c b/test/getmntent.c -index fc17a83..1039d06 100644 ---- a/test/getmntent.c -+++ b/test/getmntent.c -@@ -33,10 +33,6 @@ while ((e = getmntent(fstab))) { - - printf("closing /etc/fstab\n"); - assert ( 1 == endmntent(fstab)); -- printf("closing /etc/fstab again\n"); -- assert ( 1 == endmntent(fstab)); /* endmntent must always return 1 */ -- printf("entmntent(0)\n"); -- assert ( 1 == endmntent(0)); /* causes a segfault with diet libc */ -+ - return 0; - } -- -diff --git a/test/math.c b/test/math.c -new file mode 100644 -index 0000000..687103c ---- /dev/null -+++ b/test/math.c -@@ -0,0 +1,29 @@ -+#include -+#include -+#include -+ -+int main() -+{ -+ extern int __isinf(double d); -+ extern int __isnan(double d); -+ -+#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) -+ assert(__isinf(__builtin_inff()) == +1); -+ assert(__isinf(-__builtin_inff()) == -1); -+ -+ assert(__isinf(__builtin_inf()) == +1); -+ assert(__isinf(-__builtin_inf()) == -1); -+ -+ assert(__isnan(__builtin_nan(""))); -+#endif -+ -+ assert(__isinf((DBL_MAX * DBL_MAX)) == +1); -+ assert(__isinf(-(DBL_MAX * DBL_MAX)) == -1); -+ -+ assert(isinf((DBL_MAX * DBL_MAX))); -+ assert(isinf(-(DBL_MAX * DBL_MAX))); -+ -+ //assert(isnan(nan(""))); -+ -+ return 0; -+} -diff --git a/test/mktime.c b/test/mktime.c -index 5e9e65c..9b4bd5e 100644 ---- a/test/mktime.c -+++ b/test/mktime.c -@@ -9,15 +9,15 @@ int main() { - t.tm_mday=29; - t.tm_mon=2; - t.tm_year=100; -- printf("%d\n",mktime(&t)); -+ printf("%ld\n",(long)mktime(&t)); - t.tm_mday=1; - t.tm_mon=3; - t.tm_year=102; -- printf("%d\n",mktime(&t)); -+ printf("%ld\n",(long)mktime(&t)); - t.tm_mday=1; - t.tm_mon=6; - t.tm_year=102; -- printf("%d\n",mktime(&t)); -+ printf("%ld\n",(long)mktime(&t)); - return 0; - } - -diff --git a/test/printftest.c b/test/printftest.c -index 4743279..47d9580 100644 ---- a/test/printftest.c -+++ b/test/printftest.c -@@ -101,8 +101,8 @@ int main() - printf("#%i#\n",18); - printf("#%d#\n",18); - printf("#%u#\n",18); -- printf("#%lu#\n",18); -- printf("#%li#\n",18); -+ printf("#%lu#\n",18l); -+ printf("#%li#\n",18l); - printf("#%-+#06d#\n", -123); - printf("#%-+#6d#\n", -123); - printf("#%+#06d#\n", -123); -@@ -142,7 +142,7 @@ int main() - buf); - memset(buf2,0,sizeof(buf)); - i=snprintf(buf2, 256, "%.9999u", 10); -- printf("%i %i\n",i,strlen(buf2)); -+ printf("%i %li\n",i,strlen(buf2)); - - printf ("snprintf (\"%%.999999u\", 10) == %d\n", - snprintf(buf2, sizeof(buf2), "%.999999u", 10)); -diff --git a/test/rand48.c b/test/rand48.c -index 4f5b08f..1e67632 100644 ---- a/test/rand48.c -+++ b/test/rand48.c -@@ -6,16 +6,16 @@ main (void) - { - static unsigned short data[7] = { 1, 2, 3, 4, 5, 6, 7 }; - -- printf ("one %X\n", mrand48 ()); -- printf ("two %X\n", mrand48 ()); -- printf ("three %X\n", mrand48 ()); -+ printf ("one %lX\n", mrand48 ()); -+ printf ("two %lX\n", mrand48 ()); -+ printf ("three %lX\n", mrand48 ()); - - lcong48 (data); - printf ("after lcong48:\n"); - -- printf ("one %X\n", mrand48 ()); -- printf ("two %X\n", mrand48 ()); -- printf ("three %X\n", mrand48 ()); -+ printf ("one %lX\n", mrand48 ()); -+ printf ("two %lX\n", mrand48 ()); -+ printf ("three %lX\n", mrand48 ()); - - return 0; - } -diff --git a/test/runtests.sh b/test/runtests.sh -index 908caa5..fcd3202 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 sysconf sysenter ungetc waitpid" -+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 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" - - STDIN="read1" - PASS="getpass" -diff --git a/test/speed.c b/test/speed.c -index 674b9a8..22249a7 100644 ---- a/test/speed.c -+++ b/test/speed.c -@@ -7,10 +7,10 @@ int main() { - int i; - time_t t; - -- printf("%d\n", time(0)); -+ printf("%ld\n", (long)time(0)); - for (i=0; i<10000000; ++i) - t=time(0); - -- printf("%d\n", time(0)); -+ printf("%ld\n", (long)time(0)); - return 0; - } -diff --git a/test/stdio/tstscanf.c b/test/stdio/tstscanf.c -index 44ddf49..0f55c3c 100644 ---- a/test/stdio/tstscanf.c -+++ b/test/stdio/tstscanf.c -@@ -338,14 +338,14 @@ main (int argc, char **argv) - int res; - - res = sscanf ("-InF", "%f", &value); -- if (res != 1 || isinf (value) != -1) -+ if (res != 1 || !isinf (value) || !(value<0)) - { - fputs ("test failed!\n", stdout); - result = 1; - } - - res = sscanf ("+InfiNiTY", "%f", &value); -- if (res != 1 || isinf (value) != 1) -+ if (res != 1 || !isinf (value) || !(value>0)) - { - fputs ("test failed!\n", stdout); - result = 1; -diff --git a/test/stdlib/tst-malloc.c b/test/stdlib/tst-malloc.c -index 09fbb1f..4a491d9 100644 ---- a/test/stdlib/tst-malloc.c -+++ b/test/stdlib/tst-malloc.c -@@ -21,13 +21,15 @@ - #include - #include - -+#include "../../dietfeatures.h" -+ - static int errors = 0; - - static void - merror (const char *msg) - { - ++errors; -- printf ("Error: %s\n", msg); -+ fprintf (stderr, "Error: %s\n", msg); - } - - int -@@ -56,9 +58,11 @@ main (void) - if (p != NULL) - merror ("realloc (p, 0) failed."); - -+#ifdef WANT_MALLOC_ZERO - p = malloc (0); - if (p == NULL) - merror ("malloc (0) failed."); -+#endif - - p = realloc (p, 0); - if (p != NULL) -diff --git a/test/stdlib/tst-strtod.c b/test/stdlib/tst-strtod.c -index 630a8fc..bacdca7 100644 ---- a/test/stdlib/tst-strtod.c -+++ b/test/stdlib/tst-strtod.c -@@ -149,10 +149,10 @@ main (int argc, char ** argv) - } - - const char input2[] = "+1.000000000116415321826934814453125"; -- if (strtold (input2, NULL) != +1.000000000116415321826934814453125) -+ if (strtold (input2, NULL) != +1.000000000116415321826934814453125L) - { - printf ("input2: %La != %La\n", strtold (input2, NULL), -- +1.000000000116415321826934814453125); -+ +1.000000000116415321826934814453125L); - status = 1; - } - -diff --git a/test/sysenter.c b/test/sysenter.c -index a8fa3a8..3d85916 100644 ---- a/test/sysenter.c -+++ b/test/sysenter.c -@@ -11,11 +11,11 @@ int main() { - int i; - for (i=0; environ[i]; ++i) ; - for (x=(struct elf_aux*)(environ+i+1); x->type; ++x) { -- printf("%d %x\n",x->type,x->value); -+ printf("%ld %lx\n",x->type,x->value); - if (x->type==AT_PAGESZ) -- printf("pagesize %d\n",x->value); -+ printf("pagesize %ld\n",x->value); - else if (x->type==AT_SYSINFO) -- printf("vsyscall %p\n",x->value); -+ printf("vsyscall %p\n",(void *)x->value); - } - return 0; - } -diff --git a/test/time/tst-strftime.c b/test/time/tst-strftime.c -index e092e93..27db9a4 100644 ---- a/test/time/tst-strftime.c -+++ b/test/time/tst-strftime.c -@@ -49,18 +49,18 @@ int main (void) { - - if (res == 0) - { -- printf ("%Zu: %s: res == 0 despite size == %Zu\n", -+ printf ("%zu: %s: res == 0 despite size == %zu\n", - cnt, tests[cnt].fmt, size); - result = 1; - } - else if (size < tests[cnt].min) - { -- printf ("%Zu: %s: size == %Zu was enough\n", -+ printf ("%zu: %s: size == %zu was enough\n", - cnt, tests[cnt].fmt, size); - result = 1; - } - else -- printf ("%Zu: %s: size == %Zu: OK\n", cnt, tests[cnt].fmt, size); -+ printf ("%zu: %s: size == %zu: OK\n", cnt, tests[cnt].fmt, size); - - free (buf); - } -diff --git a/test/time/tst-strptime.c b/test/time/tst-strptime.c -index 6277ea6..2773180 100644 ---- a/test/time/tst-strptime.c -+++ b/test/time/tst-strptime.c -@@ -41,10 +41,12 @@ static const struct - { "C", "03/03/00", "%D", 5, 62, 2, 3 }, - { "C", "9/9/99", "%x", 4, 251, 8, 9 }, - { "C", "19990502123412", "%Y%m%d%H%M%S", 0, 121, 4, 2 }, -+#if 0 /* dietlibc does not support %U/%W/%j and non-POSIX locales */ - { "C", "2001 20 Mon", "%Y %U %a", 1, 140, 4, 21 }, - { "C", "2001 21 Mon", "%Y %W %a", 1, 140, 4, 21 }, - { "ja_JP.EUC-JP", "2001 20 \xb7\xee", "%Y %U %a", 1, 140, 4, 21 }, - { "ja_JP.EUC-JP", "2001 21 \xb7\xee", "%Y %W %a", 1, 140, 4, 21 }, -+#endif - }; - - -@@ -72,9 +74,16 @@ test_tm (void) - - for (i = 0; i < sizeof (tm_tests) / sizeof (tm_tests[0]); ++i) - { -+ char *pres; - memset (&tm, '\0', sizeof (tm)); -- -- if (strptime (tm_tests[i].input, tm_tests[i].format, &tm) != '\0') -+ -+ pres = strptime (tm_tests[i].input, tm_tests[i].format, &tm); -+ if (!pres) -+ { -+ fprintf(stderr, "failed to parse '%s'\n", day_tests[i].input); -+ result = 1; -+ } -+ else if (*pres != '\0') - { - printf ("not all of `%s' read\n", tm_tests[i].input); - result = 1; -@@ -118,6 +127,7 @@ int main (void) { - - for (i = 0; i < sizeof (day_tests) / sizeof (day_tests[0]); ++i) - { -+ char *pres; - memset (&tm, '\0', sizeof (tm)); - - if (setlocale (LC_ALL, day_tests[i].locale) == NULL) -@@ -125,7 +135,14 @@ int main (void) { - printf ("cannot set locale %s: %m\n", day_tests[i].locale); - } - -- if (*strptime (day_tests[i].input, day_tests[i].format, &tm) != '\0') -+ pres = strptime (day_tests[i].input, day_tests[i].format, &tm); -+ if (!pres) -+ { -+ fprintf(stderr, "failed to parse '%s' for locale '%s'\n", -+ day_tests[i].input, day_tests[i].locale); -+ result = 1; -+ } -+ else if (*pres != '\0') - { - printf ("not all of `%s' read\n", day_tests[i].input); - result = 1; --- -1.6.2.5 - diff --git a/dietlibc-0.31.20080212-teststdout.patch b/dietlibc-0.31.20080212-teststdout.patch deleted file mode 100644 index 2fc1e71..0000000 --- a/dietlibc-0.31.20080212-teststdout.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 7bf571cbff4c43098d9b1cd2b4bbd9457bff5b60 Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 19 Apr 2008 17:45:11 +0200 -Subject: [PATCH 10/18] Use stdout instead of stderr in testsuite - -This patches uses stdout instead stderr when giving out normal status -messages in the testsuite. ---- - test/atexit.c | 2 +- - test/malloc-debugger.c | 2 +- - test/sendfile.c | 2 +- - test/waitpid.c | 2 +- - 4 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/test/atexit.c b/test/atexit.c -index 709a3e4..79ee392 100644 ---- a/test/atexit.c -+++ b/test/atexit.c -@@ -2,7 +2,7 @@ - #include - - void blah(void) { -- write(2,"atexit\n",7); -+ write(1,"atexit\n",7); - } - - int main() { -diff --git a/test/malloc-debugger.c b/test/malloc-debugger.c -index 040196e..058807e 100644 ---- a/test/malloc-debugger.c -+++ b/test/malloc-debugger.c -@@ -4,7 +4,7 @@ - int main() { - char* c=malloc(13); - char* tmp; -- fprintf(stderr,"got %p\n",c); -+ fprintf(stdout,"got %p\n",c); - c[0]=14; - // c[15]=0; - tmp=realloc(c,12345); -diff --git a/test/sendfile.c b/test/sendfile.c -index d43cdd2..28b3af5 100644 ---- a/test/sendfile.c -+++ b/test/sendfile.c -@@ -11,5 +11,5 @@ int main() { - - printf("sendfile returned %d\n",ret); - --return 0; -+ return ret<0 ? 1 : 0; - } -diff --git a/test/waitpid.c b/test/waitpid.c -index fe2cb5b..92c0b0e 100644 ---- a/test/waitpid.c -+++ b/test/waitpid.c -@@ -11,7 +11,7 @@ int main() { - perror("fork"); - _exit(1); - case 0: -- fprintf(stderr,"child, my pid is %u\n",getpid()); -+ fprintf(stdout,"child, my pid is %u\n",getpid()); - sleep(1); - _exit(23); - } --- -1.6.2.5 - diff --git a/dietlibc-0.33-arm-cflags.patch b/dietlibc-0.33-arm-cflags.patch deleted file mode 100644 index 10a2a84..0000000 --- a/dietlibc-0.33-arm-cflags.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 2e6c12aa4627ddf911c545462c9cdc93971a1044 Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Fri, 7 Jan 2011 15:41:22 +0100 -Subject: [PATCH 01/20] ARM: fixed compiler flags for EABI - -Do not set '-mfloat-abi=soft' or '-meabi=4' options when '-Os' was -specified. - -The '-mfloat-abi' switch can make dietlibc and programs binary -incompatible when they are compiled with different '-O' options. 'soft' -seems to be a bad choice too because EABI uses usually the 'softfp' -floating point abi. - -The '-meabi=4' switch is unknown to recent gccs and breaks compilation. - -Both options are unrelated to space optimizations and are removed by the -patch hence. - -Signed-off-by: Enrico Scholz ---- - diet.c | 4 ---- - 1 files changed, 0 insertions(+), 4 deletions(-) - -diff --git a/diet.c b/diet.c -index e7fd3e8..22e3696 100644 ---- a/diet.c -+++ b/diet.c -@@ -32,11 +32,7 @@ static const char* Os[] = { - "sparc","-Os","-mcpu=supersparc",0, - "sparc64","-Os","-m64","-mhard-quad-float",0, - "alpha","-Os","-fomit-frame-pointer",0, --#ifdef __ARM_EABI__ -- "arm","-Os","-fomit-frame-pointer","-mfloat-abi=soft","-meabi=4",0, --#else - "arm","-Os","-fomit-frame-pointer",0, --#endif - "mips","-Os","-fomit-frame-pointer","-mno-abicalls","-fno-pic","-G","0",0, - "mipsel","-Os","-fomit-frame-pointer","-mno-abicalls","-fno-pic","-G","0",0, - "ppc","-Os","-fomit-frame-pointer","-mpowerpc-gpopt","-mpowerpc-gfxopt",0, --- -1.7.3.4 - diff --git a/dietlibc-0.33-arm-stack-align.patch b/dietlibc-0.33-arm-stack-align.patch deleted file mode 100644 index 6e33187..0000000 --- a/dietlibc-0.33-arm-stack-align.patch +++ /dev/null @@ -1,31 +0,0 @@ -From f0da937d99ef1c32b53fb8c61c3a0225c2dc71c4 Mon Sep 17 00:00:00 2001 -From: Enrico Scholz -Date: Sat, 8 Jan 2011 01:14:13 +0100 -Subject: [PATCH 02/20] ARM: fix stack alignment - -ARM EABI requires an 8-byte stack alignment. Previous startup sequence -destroyed it by popping the 4-byte 'argc' from the aligned stack. - -Signed-off-by: Enrico Scholz ---- - arm/start.S | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/arm/start.S b/arm/start.S -index ccbac48..d68d49d 100644 ---- a/arm/start.S -+++ b/arm/start.S -@@ -19,8 +19,8 @@ - _start: - - mov fp, #0 @ clear the frame pointer -- ldr a1, [sp], #4 @ argc -- mov a2, sp @ argv -+ ldr a1, [sp] @ argc -+ add a2, sp, #4 @ argv - ldr ip, .L3 - add a3, a2, a1, lsl #2 @ &argv[argc] - add a3, a3, #4 @ envp --- -1.7.3.4 - diff --git a/dietlibc-github.patch b/dietlibc-github.patch new file mode 100644 index 0000000..66cc1bb --- /dev/null +++ b/dietlibc-github.patch @@ -0,0 +1,2421 @@ +diff --git a/Makefile b/Makefile +index 143113b..a4f0c0c 100644 +--- a/Makefile ++++ b/Makefile +@@ -88,7 +88,7 @@ ILIBDIR=$(LIBDIR)-$(ARCH) + + HOME=$(shell pwd) + +-WHAT= $(OBJDIR) $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \ ++WHAT= $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \ + $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a \ + $(OBJDIR)/libcompat.a $(OBJDIR)/libm.a \ + $(OBJDIR)/librpc.a $(OBJDIR)/libpthread.a \ +@@ -105,6 +105,7 @@ CROSS= + + CC=gcc + INC=-I. -isystem include ++STRIP=$(CROSS)strip + + VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:libcompat:libdl:librpc:libregex:libm:profiling + +@@ -128,6 +129,8 @@ LIBPTHREAD_OBJS=$(patsubst libpthread/%.c,$(OBJDIR)/%.o,$(shell ./threadsafe.sh) + + LIBGMON_OBJS=$(OBJDIR)/__mcount.o $(OBJDIR)/monitor.o $(OBJDIR)/profil.o + ++NO_STACK_PROTECTOR=stackgap.o __get_elf_aux_value.o ++ + include $(ARCH)/Makefile.add + + LIBMATHOBJ=$(patsubst %,$(OBJDIR)/%,$(LIBMATH)) +@@ -150,34 +153,36 @@ PWD=$(shell pwd) + # added real dynamic dietlibc.so + PICODIR = pic-$(ARCH) + +-$(OBJDIR) $(PICODIR): +- mkdir $@ +- + % :: %,v + +-$(OBJDIR)/%.o: $(OBJDIR) ++%/.dirstamp: ++ mkdir $* ++ @touch $@ + + ifeq ($(CC),tcc) +-$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h ++$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp + $(CROSS)cpp $(INC) $< | $(CROSS)as -o $@ + +-$(OBJDIR)/%.o: %.c ++$(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp + tcc -I. -Iinclude -c $< -o $@ +- $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ ++ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ + else +-$(OBJDIR)/pstart.o: start.S ++$(OBJDIR)/pstart.o: start.S $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -DPROFILING -c $< -o $@ + +-$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h ++$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ + +-$(OBJDIR)/pthread_%.o: libpthread/pthread_%.c ++$(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ +- $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ ++ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ ++$(OBJDIR)/stack_smash_handler2.o: XCFLAGS:=-fno-omit-frame-pointer + +-$(OBJDIR)/%.o: %.c +- $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ +- $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ ++$(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp ++ $(CROSS)$(CC) $(INC) $(CFLAGS) $(XCFLAGS) -c $< -o $@ -D__dietlibc__ ++ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ ++ ++$(addprefix $(OBJDIR)/,$(NO_STACK_PROTECTOR)): XCFLAGS+=-fno-stack-protector + endif + + ifeq ($(shell $(CC) -v 2>&1 | grep "gcc version"),gcc version 4.0.0) +@@ -190,7 +195,7 @@ endif + + CC+=-D__dietlibc__ + +-$(OBJDIR)/crypt.o: libcrypt/crypt.c ++$(OBJDIR)/crypt.o: libcrypt/crypt.c $(OBJDIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(SAFER_CFLAGS) -c $< -o $@ + + DIETLIBC_OBJ = $(OBJDIR)/unified.o \ +@@ -205,7 +210,7 @@ $(OBJDIR)/dietlibc.a: $(DIETLIBC_OBJ) $(OBJDIR)/start.o + $(OBJDIR)/librpc.a: $(LIBRPCOBJ) + $(CROSS)ar cru $@ $(LIBRPCOBJ) + +-$(OBJDIR)/libcrypt.a: ++$(OBJDIR)/libcrypt.a: $(OBJDIR)/.dirstamp + touch dummy.c + $(CROSS)$(CC) -c dummy.c + $(CROSS)ar cru $@ dummy.o +@@ -237,28 +242,28 @@ dyn: dyn_lib + $(OBJDIR)/libdl.a: $(LIBDLOBJ) + $(CROSS)ar cru $@ $(LIBDLOBJ) + +-dyn_lib: $(PICODIR) $(PICODIR)/libc.so $(PICODIR)/dstart.o \ ++dyn_lib: $(PICODIR)/libc.so $(PICODIR)/dstart.o \ + $(PICODIR)/dyn_so_start.o $(PICODIR)/dyn_start.o $(PICODIR)/dyn_stop.o \ + $(PICODIR)/libpthread.so $(PICODIR)/libdl.so $(PICODIR)/libcompat.so \ + $(PICODIR)/libm.so $(PICODIR)/diet-dyn $(PICODIR)/diet-dyn-i + +-$(PICODIR)/%.o: %.S $(ARCH)/syscalls.h ++$(PICODIR)/%.o: %.S $(ARCH)/syscalls.h $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ + +-$(PICODIR)/pthread_%.o: libpthread/pthread_%.c ++$(PICODIR)/pthread_%.o: libpthread/pthread_%.c $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ +- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ ++ $(COMMENT) $(STRIP) -x -R .comment -R .note $@ + +-$(PICODIR)/%.o: %.c ++$(PICODIR)/%.o: %.c $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ +- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ ++ $(COMMENT) $(STRIP) -x -R .comment -R .note $@ + +-$(PICODIR)/dstart.o: start.S ++$(PICODIR)/dstart.o: start.S $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ + +-$(PICODIR)/dyn_so_start.o: dyn_start.c ++$(PICODIR)/dyn_so_start.o: dyn_start.c $(PICODIR)/.dirstamp + $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -D__DYN_LIB_SHARED -c $< -o $@ +- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ ++ $(COMMENT) $(STRIP) -x -R .comment -R .note $@ + + DYN_LIBC_PIC = $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \ + $(LIBCRUFTOBJ) $(LIBCRYPTOBJ) $(LIBSHELLOBJ) $(LIBREGEXOBJ) +@@ -274,13 +279,13 @@ DYN_LIBCOMPAT_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBCOMPATOBJ)) + + DYN_LIBMATH_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBMATHOBJ)) + +-$(PICODIR)/libc.so: $(PICODIR) $(DYN_LIBC_OBJ) ++$(PICODIR)/libc.so: $(DYN_LIBC_OBJ) + $(LD_UNSET) $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBC_OBJ) -lgcc -Wl,-soname=libc.so + + $(PICODIR)/libpthread.so: $(DYN_PTHREAD_OBJS) dietfeatures.h + $(LD_UNSET) $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_PTHREAD_OBJS) -L$(PICODIR) -lc -Wl,-soname=libpthread.so + +-$(PICODIR)/libdl.so: libdl/_dl_main.c dietfeatures.h ++$(PICODIR)/libdl.so: libdl/_dl_main.c dietfeatures.h $(PICODIR)/.dirstamp + $(LD_UNSET) $(CROSS)$(CC) -D__OD_CLEAN_ROOM -DNODIETREF -fPIC -nostdlib -shared -Bsymbolic -Wl,-Bsymbolic \ + -o $@ $(SAFE_CFLAGS) $(INC) libdl/_dl_main.c -Wl,-soname=libdl.so + +@@ -310,19 +315,19 @@ CURNAME=$(notdir $(shell pwd)) + + $(OBJDIR)/diet: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o + $(CROSS)$(CC) -isystem include $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -DVERSION=\"$(VERSION)\" -lgcc +- $(CROSS)strip -R .comment -R .note $@ ++ $(STRIP) -R .comment -R .note $@ + + $(OBJDIR)/diet-i: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o + $(CROSS)$(CC) -isystem include $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -DVERSION=\"$(VERSION)\" -DINSTALLVERSION -lgcc +- $(CROSS)strip -R .comment -R .note $@ ++ $(STRIP) -R .comment -R .note $@ + + $(PICODIR)/diet-dyn: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c + $(LD_UNSET) $(CROSS)$(CC) -isystem include $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(HOME)/$(PICODIR)/libdl.so +- $(CROSS)strip -R .command -R .note $@ ++ $(STRIP) -R .command -R .note $@ + + $(PICODIR)/diet-dyn-i: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c + $(LD_UNSET) $(CROSS)$(CC) -isystem include $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(ILIBDIR)/libdl.so -DINSTALLVERSION +- $(CROSS)strip -R .command -R .note $@ ++ $(STRIP) -R .command -R .note $@ + + $(OBJDIR)/djb: $(OBJDIR)/compile $(OBJDIR)/load + +@@ -335,7 +340,7 @@ $(OBJDIR)/load: + chmod 755 $@ + + clean: +- rm -f *.o *.a t t1 compile load elftrunc exports mapfile libdietc.so ++ rm -f *.o *.a t t1 compile load elftrunc exports mapfile libdietc.so .dirstamp + rm -rf bin-* pic-* + $(MAKE) -C examples clean + $(MAKE) -C dynlinker clean +@@ -531,3 +536,8 @@ $(OBJDIR)/stackgap.o: dietfeatures.h + + # WANT_MALLOC_ZERO + $(OBJDIR)/strndup.o: dietfeatures.h ++ ++ ++GIT_CVSIMPORT=git cvsimport ++cvsimport: ++ $(GIT_CVSIMPORT) -k -p '--cvs-direct' -d :pserver:cvs@cvs.fefe.de:/cvs dietlibc +diff --git a/alpha/__time.c b/alpha/__time.c +deleted file mode 100644 +index 07275e0..0000000 +--- a/alpha/__time.c ++++ /dev/null +@@ -1,11 +0,0 @@ +-#include +-#include +- +-time_t time(time_t *foo) { +- struct timeval tv; +- time_t tmp=(time_t)-1; +- if (gettimeofday(&tv,0)==0) +- tmp=(time_t)tv.tv_sec; +- if (foo) *foo=tmp; +- return tmp; +-} +diff --git a/alpha/start.S b/alpha/start.S +index 7e7cf9b..b13c9c9 100644 +--- a/alpha/start.S ++++ b/alpha/start.S +@@ -24,6 +24,15 @@ _start: + + stq $18, environ + ++#ifdef WANT_ELFINFO ++# warning "MAKE ME alpha ASSEMBLER!" ++1: ldq $19, $18 ; load *envp into $19 ++ addq $18, 1, $18 ; increment *envp ++ orr $19, $19, $19 ++ jne 1b ++ stq $18, __elfinfo ++#endif ++ + #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 +new file mode 100644 +index 0000000..fdda683 +--- /dev/null ++++ b/arm/__mmap.S +@@ -0,0 +1,42 @@ ++#ifndef __NR_mmap ++ ++#include ++#include "syscalls.h" ++ ++.text ++ ++@ ++@ 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. ++@ ++ ++@ TODO: check whether pgoffset is really in 4096 bytes or in PAGESIZE ++@ units. ++ ++.global mmap ++.type mmap,function ++ ++mmap: ++ stmfd sp!,{r4,r5,r7,lr} ++# if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || defined(__ARM_ARCH_5T__) ++ ldr r4, [sp,#16] ++ ldr r5, [sp,#20] ++# 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 +diff --git a/arm/mmap.S b/arm/mmap.S +deleted file mode 100644 +index d3ea131..0000000 +--- a/arm/mmap.S ++++ /dev/null +@@ -1,42 +0,0 @@ +-#include +-#include "syscalls.h" +- +-.text +- +-@ +-@ 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. +-@ +- +-.global mmap +- +-#ifdef __ARM_EABI__ +- +-mmap: +- str r5, [sp, #-4]! +- ldr r5, [sp, #8] +- str r4, [sp, #-4]! +- ldr r4, [sp, #8] +- mov ip, r7 +- mov r7, #__NR_mmap2 +- svc 0x00000000 +- mov r7, ip +- ldr r4, [sp], #4 +- ldr r5, [sp], #4 +- cmn r0, #4096 +- mov pc, lr @ return +- +-#else +- +-mmap: +- stmdb sp!, {r0, r1, r2, r3} +- mov r0, sp +- swi __NR_mmap +- add sp, sp, #16 +- b __unified_syscall +- +-#endif +diff --git a/arm/setjmp.S b/arm/setjmp.S +index 6b850d4..4c46e05 100644 +--- a/arm/setjmp.S ++++ b/arm/setjmp.S +@@ -15,3 +15,4 @@ sigsetjmp: + sub r0, r0, #48 + b __sigjmp_save + ++.size __sigsetjmp, . - __sigsetjmp +diff --git a/arm/start.S b/arm/start.S +index ccbac48..765021b 100644 +--- a/arm/start.S ++++ b/arm/start.S +@@ -19,12 +19,23 @@ + _start: + + mov fp, #0 @ clear the frame pointer +- ldr a1, [sp], #4 @ argc +- mov a2, sp @ argv ++ ldr a1, [sp] @ argc ++ add a2, sp, #4 @ argv + ldr ip, .L3 + add a3, a2, a1, lsl #2 @ &argv[argc] + add a3, a3, #4 @ envp + str a3, [ip, #0] @ environ = envp ++ ++#ifdef WANT_ELFINFO ++ mov r6, a3 @ work on a copy of a3 so that common ++ @ 'main(argc, argv, envp)' function ++ @ stays valid ++1: ldr r5, [r6], #4 @ load *envp and increment it ++ cmp r5, #0 @ read value==0? ++ bne 1b ++ str r6, [ip, #4] @ __elfinfo = envp ++#endif ++ + bl main + + @ +@@ -59,11 +70,25 @@ _start: + #ifdef __DYN_LIB + ldr sl, .L4 + 1: add sl, pc, sl +- str a3, [sl, ip] @ environ = envp ++ str a3, [ip, sl]! @ environ = envp; ip = GOT(environ) + #else + str a3, [ip, #0] @ environ = envp + #endif + ++#ifdef WANT_ELFINFO ++ mov r6, a3 @ work on a copy of a3 so that common ++ @ 'main(argc, argv, envp)' function ++ @ stays valid ++1: ldr r5, [r6], #4 @ load *envp and increment it ++ cmp r5, #0 @ read value==0? ++ bne 1b ++#ifdef __DYN_LIB ++ str r6, [ip, sl] @ __elfinfo = envp ++#else ++ str r6, [ip, #4] @ __elfinfo = envp ++#endif ++#endif ++ + #ifdef PROFILING + stmdb sp!, { r0 - r3 } + ldr r0, .L5 +diff --git a/arm/syscalls.h b/arm/syscalls.h +index 774350a..21bb579 100644 +--- a/arm/syscalls.h ++++ b/arm/syscalls.h +@@ -785,6 +785,8 @@ + ldr r7, =\name + swi 0 + b __unified_syscall ++ ++.size \sym, . - \sym + .endm + + +@@ -800,6 +802,8 @@ + ldr r7, =\name + swi 0 + b __unified_syscall ++ ++.size \sym, . - \sym + .endm + + #else +@@ -824,6 +828,8 @@ + .else + b __unified_syscall + .endif ++ ++.size \sym, . - \sym + .endm + + #define syscall(name,sym) __syscall $__NR_##name, sym, __ARGS_##name +@@ -843,6 +849,8 @@ + .else + b __unified_syscall + .endif ++ ++.size \sym, . - \sym + .endm + + #endif +diff --git a/arm/unified.S b/arm/unified.S +index 3023032..efdd8d3 100644 +--- a/arm/unified.S ++++ b/arm/unified.S +@@ -25,9 +25,12 @@ __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 */ + #include "dietuglyweaks.h" ++ mov pc, lr @ return + + #else + +@@ -52,6 +55,8 @@ __unified_syscall: + #include "dietuglyweaks.h" + + mov pc, lr @ return ++ .size __unified_syscall, . - __unified_syscall ++ .size __unified_syscall4, . - __unified_syscall4 + + #ifndef WANT_THREAD_SAFE + .L0: .long errno +diff --git a/diet.c b/diet.c +index e7fd3e8..22e3696 100644 +--- a/diet.c ++++ b/diet.c +@@ -32,11 +32,7 @@ static const char* Os[] = { + "sparc","-Os","-mcpu=supersparc",0, + "sparc64","-Os","-m64","-mhard-quad-float",0, + "alpha","-Os","-fomit-frame-pointer",0, +-#ifdef __ARM_EABI__ +- "arm","-Os","-fomit-frame-pointer","-mfloat-abi=soft","-meabi=4",0, +-#else + "arm","-Os","-fomit-frame-pointer",0, +-#endif + "mips","-Os","-fomit-frame-pointer","-mno-abicalls","-fno-pic","-G","0",0, + "mipsel","-Os","-fomit-frame-pointer","-mno-abicalls","-fno-pic","-G","0",0, + "ppc","-Os","-fomit-frame-pointer","-mpowerpc-gpopt","-mpowerpc-gfxopt",0, +diff --git a/dietdirent.h b/dietdirent.h +index dbd7206..c9c7127 100644 +--- a/dietdirent.h ++++ b/dietdirent.h +@@ -1,8 +1,12 @@ + #include + ++#include "dietpagesize.h" ++ + struct __dirstream { + int fd; +- char buf[PAGE_SIZE-(sizeof (int)*3)]; + unsigned int num; + unsigned int cur; ++ char buf[]; + }; /* stream data from opendir() */ ++ ++#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) +diff --git a/dietelfinfo.h b/dietelfinfo.h +new file mode 100644 +index 0000000..de8c717 +--- /dev/null ++++ b/dietelfinfo.h +@@ -0,0 +1,20 @@ ++#include "dietfeatures.h" ++ ++#ifdef WANT_ELFINFO ++#include ++#include ++#include ++ ++/* TODO: exported interface from has been changed in 2.6.25 so ++ * the 'elf_addr_t' type is not available anymore. Hence, derive it from ++ * __WORDSIZE__. */ ++ ++#if __WORDSIZE == 64 ++typedef uint64_t __diet_elf_addr_t; ++#elif __WORDSIZE == 32 ++typedef uint32_t __diet_elf_addr_t; ++#endif ++ ++__diet_elf_addr_t const * __get_elf_aux_value(unsigned int tag) ++ __attribute__((__visibility__("hidden"),__const__)) __pure; ++#endif +diff --git a/dietfeatures.h b/dietfeatures.h +index dcdda39..0d44425 100644 +--- a/dietfeatures.h ++++ b/dietfeatures.h +@@ -138,6 +138,16 @@ + #define WANT_SSP + #endif + ++/* Some platforms like x86_64, ppc* or mips do not have a fixed PAGE_SIZE. ++ * Select WANT_DYN_PAGESIZE to detect the current PAGE_SIZE at runtime. Else, ++ * define WANT_STATIC_PAGESIZE to a proper value (must be a power of 2) ++ * matching the configured pagesize of the kernel where your binaries are ++ * running on. ++ * ++ * Selecting WANT_DYN_PAGESIZE enlarges the startup code by around 1-3 ++ * instructions and might add an additional __elfinfo symbol */ ++#define WANT_DYN_PAGESIZE ++/* #define WANT_STATIC_PAGESIZE 0x10000UL */ + + + /* stop uncommenting here ;-) */ +@@ -169,4 +179,8 @@ + #endif + #endif + ++#ifdef WANT_DYN_PAGESIZE ++#define WANT_ELFINFO ++#endif ++ + #endif +diff --git a/dietpagesize.h b/dietpagesize.h +new file mode 100644 +index 0000000..8ce6ce7 +--- /dev/null ++++ b/dietpagesize.h +@@ -0,0 +1,31 @@ ++#ifndef H_DIETLIBC_DIETPAGESIZE_H ++#define H_DIETLIBC_DIETPAGESIZE_H ++ ++#include ++#include "dietfeatures.h" ++ ++extern size_t __libc_getpagesize(void) __attribute__((__const__)) __pure; ++ ++#if defined(WANT_STATIC_PAGESIZE) ++# define __DIET_PAGE_SIZE_PREDEF (WANT_STATIC_PAGESIZE) ++# define __DIET_PAGE_SHIFT_PREDEF (ffs(__DIET_PAGE_SIZE_PREDEF)-1) ++#elif defined(__alpha__) || defined(__sparc__) ++# define __DIET_PAGE_SIZE_PREDEF (8192UL) ++# define __DIET_PAGE_SHIFT_PREDEF (13) ++#elif defined(__powerpc64__) ++# define __DIET_PAGE_SIZE_PREDEF (65536UL) ++# define __DIET_PAGE_SHIFT_PREDEF (16) ++#else ++# define __DIET_PAGE_SIZE_PREDEF (4096UL) ++# define __DIET_PAGE_SHIFT_PREDEF (12) ++#endif ++ ++#ifdef WANT_DYN_PAGESIZE ++# define __DIET_PAGE_SIZE (__libc_getpagesize()) ++# define __DIET_PAGE_SHIFT (ffs(__DIET_PAGE_SIZE)-1) ++#else ++# define __DIET_PAGE_SIZE __DIET_PAGE_SIZE_PREDEF ++# define __DIET_PAGE_SHIFT __DIET_PAGE_SHIFT_PREDEF ++#endif ++ ++#endif /* H_DIETLIBC_DIETPAGESIZE_H */ +diff --git a/dynlinker/ldso_start.S b/dynlinker/ldso_start.S +index ca278d7..da36845 100644 +--- a/dynlinker/ldso_start.S ++++ b/dynlinker/ldso_start.S +@@ -86,6 +86,15 @@ __environ: + .long 0 + #endif + ++/* __elfinfo must follow __environ immediately */ ++.global __elfinfo ++__elfinfo: ++#if __WORDSIZE == 64 ++ .quad 0 ++#else ++ .long 0 ++#endif ++ + .global fini_entry + fini_entry: + .long 0 +diff --git a/i386/start.S b/i386/start.S +index 94a4f73..9ad41ff 100644 +--- a/i386/start.S ++++ b/i386/start.S +@@ -25,6 +25,13 @@ _start: + PIC_INIT /* non-PIC: this is an empty line */ + PUT_VAR %eax, environ, %ecx /* non-PIC: movl %eax,environ */ + ++#ifdef WANT_ELFINFO ++1: add $4, %eax /* increment envp */ ++ cmpl $0, -4(%eax) /* load envp[-1] */ ++ jne 1b /* ... until envp[-1]==NULL */ ++ PUT_VAR %eax, __elfinfo, %ecx ++#endif ++ + #ifdef PROFILING + pushl $_etext + pushl $.text +diff --git a/ia64/__time.c b/ia64/__time.c +deleted file mode 100644 +index 7547acb..0000000 +--- a/ia64/__time.c ++++ /dev/null +@@ -1,14 +0,0 @@ +-#include +-#include +- +-time_t time(time_t*t) { +- struct timeval tv; +- time_t ret; +- if (gettimeofday(&tv,0)) { +- ret=(time_t)-1; +- } else { +- ret=(time_t)tv.tv_sec; +- } +- if (t) *t=ret; +- return ret; +-} +diff --git a/ia64/start.S b/ia64/start.S +index 50fd015..c917721 100644 +--- a/ia64/start.S ++++ b/ia64/start.S +@@ -40,6 +40,16 @@ _start: + ;; + st8 [r14] = out2 /* store envp in environ */ + ++#ifdef WANT_ELFINFO ++# warning "MAKE ME IE64 CODE!" ++1: ld8 r9 = [out2], 8 /* load *envp and increment it */ ++ orr r9 = r9, r9 /* test for NULL */ ++ bne 1b ++ ++ adds r14 = 8, r14 /* __elfinfo = environ + 8 */ ++ st8 [r14] = out2 /* store envp in __elfinfo */ ++#endif ++ + #ifdef WANT_DYNAMIC + /* FIXME: dl_init parameter ??? */ + br.call.sptk.few rp = _dyn_start +diff --git a/include/paths.h b/include/paths.h +index 553b4fa..9bf216f 100644 +--- a/include/paths.h ++++ b/include/paths.h +@@ -2,7 +2,7 @@ + #define _PATHS_H + + #define _PATH_BSHELL "/bin/sh" +-#define _PATH_DEFPATH "/bin:/usr/bin:" ++#define _PATH_DEFPATH "/bin:/usr/bin" + + #define _PATH_DEVNULL "/dev/null" + +diff --git a/include/stdlib.h b/include/stdlib.h +index b3b0e15..bd3fabf 100644 +--- a/include/stdlib.h ++++ b/include/stdlib.h +@@ -28,8 +28,12 @@ long double strtold(const char *nptr, char **endptr) __THROW; + long int strtol(const char *nptr, char **endptr, int base) __THROW; + unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW; + ++/* HACK: used flags in __dtostr ++ 0x01 ... 'g' ++ 0x02 ... uppercase ++ Define some constants somewhere... */ + extern int __ltostr(char *s, unsigned int size, unsigned long i, unsigned int base, int UpCase) __THROW; +-extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int g) __THROW; ++extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int flags) __THROW; + + #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L + __extension__ long long int strtoll(const char *nptr, char **endptr, int base) __THROW; +@@ -43,7 +47,7 @@ double atof(const char *nptr) __THROW; + __extension__ long long int atoll(const char *nptr); + + void exit(int status) __THROW __attribute__((__noreturn__)); +-void abort(void) __THROW; ++void abort(void) __THROW __attribute__((__noreturn__)); + + extern int rand(void) __THROW; + extern int rand_r(unsigned int *seed) __THROW; +diff --git a/include/sys/shm.h b/include/sys/shm.h +index 9b2d04d..70bb17e 100644 +--- a/include/sys/shm.h ++++ b/include/sys/shm.h +@@ -60,15 +60,6 @@ struct shm_info { + unsigned long swap_successes; + }; + +-#if defined(__i386__) || defined(__mips__) || defined(__arm__) || defined(__powerpc__) || defined (__powerpc64__) || defined(__s390__) || defined(__hppa__) || defined(__x86_64__) || defined(__ia64__) +-#define PAGE_SIZE 4096UL +-#define PAGE_SHIFT 12 +-#elif defined(__alpha__) || defined(__sparc__) +-/* sun4* has 4k except sun4 architecture, sparc64 has 8k */ +-#define PAGE_SIZE 8192UL +-#define PAGE_SHIFT 13 +-#endif +- + 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/lib/__dtostr.c b/lib/__dtostr.c +index 1d082e3..bc61200 100644 +--- a/lib/__dtostr.c ++++ b/lib/__dtostr.c +@@ -5,13 +5,15 @@ + + static int copystring(char* buf,int maxlen, const char* s) { + int i; +- for (i=0; i<3&&i0?"inf":"-inf"); +- if (isnan(d)) return copystring(buf,maxlen,"nan"); ++ if (isinf(d)) ++ return copystring(buf,maxlen, ++ (d<0)? ++ (flags&0x02?"-INF":"-inf"): ++ (flags&0x02?"INF":"inf")); ++ if (isnan(d)) return copystring(buf,maxlen,flags&0x02?"NAN":"nan"); + e10=1+(long)(e*0.30102999566398119802); /* log10(2) */ + /* Wir iterieren von Links bis wir bei 0 sind oder maxlen erreicht + * ist. Wenn maxlen erreicht ist, machen wir das nochmal in +@@ -126,7 +132,7 @@ int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned i + if (prec2 || prec>(unsigned int)(buf-oldbuf)+1) { /* more digits wanted */ + if (!maxlen) return 0; --maxlen; + *buf='.'; ++buf; +- if (g) { ++ if ((flags & 0x01)) { + if (prec2) prec=prec2; + prec-=buf-oldbuf-1; + } else { +diff --git a/lib/__get_elf_aux_value.c b/lib/__get_elf_aux_value.c +new file mode 100644 +index 0000000..8a2e3bc +--- /dev/null ++++ b/lib/__get_elf_aux_value.c +@@ -0,0 +1,14 @@ ++#include ++#include "../dietelfinfo.h" ++ ++__diet_elf_addr_t const *__get_elf_aux_value(unsigned int tag) ++{ ++ extern __diet_elf_addr_t const * const __elfinfo; ++ __diet_elf_addr_t const *aux_ptr; ++ ++ for (aux_ptr = __elfinfo; aux_ptr[0]!=AT_NULL; aux_ptr += 2) ++ if (aux_ptr[0]==tag) ++ return aux_ptr+1; ++ ++ return NULL; ++} +diff --git a/lib/__mmap.c b/lib/__mmap.c +new file mode 100644 +index 0000000..1b035c3 +--- /dev/null ++++ b/lib/__mmap.c +@@ -0,0 +1,20 @@ ++#include ++#include ++#include ++ ++#ifndef __NR_mmap ++void*__mmap2(void*start,size_t length,int prot,int flags,int fd,off_t pgoffset); ++void *mmap(void *addr, size_t length, int prot, int flags, int fd, ++ off_t offset) ++{ ++ size_t pgsz = 4096; /* TODO: fix for dynamic PAGESIZEs needed? */ ++ void *res; ++ ++ if (__unlikely(offset & (pgsz - 1))) { ++ errno = -EINVAL; ++ res = MAP_FAILED; ++ } else ++ res = __mmap2(addr, length, prot, flags, fd, offset / pgsz); ++ return res; ++} ++#endif +diff --git a/lib/__nice.c b/lib/__nice.c +index d751104..8e205c0 100644 +--- a/lib/__nice.c ++++ b/lib/__nice.c +@@ -1,9 +1,13 @@ + #include "syscalls.h" +-#include ++#include + #include + + #ifndef __NR_nice + int nice(int i) { +- return setpriority(PRIO_PROCESS,0,getpriority(PRIO_PROCESS,0)+i); ++ if (setpriority(PRIO_PROCESS,0,getpriority(PRIO_PROCESS,0)+i) == -1) { ++ errno=EPERM; ++ return -1; ++ } ++ return getpriority(PRIO_PROCESS,0); + } + #endif +diff --git a/lib/__time.c b/lib/__time.c +new file mode 100644 +index 0000000..87a6d5d +--- /dev/null ++++ b/lib/__time.c +@@ -0,0 +1,15 @@ ++#include ++#include ++#include ++ ++#ifndef __NR_time ++time_t time(time_t *t) ++{ ++ struct timeval tv; ++ if (__unlikely(gettimeofday(&tv, NULL) < 0)) ++ tv.tv_sec = -1; ++ if (t) ++ *t = tv.tv_sec; ++ return tv.tv_sec; ++} ++#endif +diff --git a/lib/__v_printf.c b/lib/__v_printf.c +index 36202f5..964c005 100644 +--- a/lib/__v_printf.c ++++ b/lib/__v_printf.c +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + #include "dietstdio.h" + #include "dietwarning.h" + +@@ -346,45 +347,49 @@ num_printf: + #ifdef WANT_FLOATING_POINT_IN_PRINTF + /* print a floating point value */ + case 'f': ++ case 'F': + case 'g': ++ case 'G': + { +- int g=(ch=='g'); ++ int flags=(((ch&0x5f)=='G') ? 0x01 : 0x00) | ((ch&0x20) ? 0x00 : 0x02); + double d=va_arg(arg_ptr,double); + s=buf+1; + if (width==0) width=1; + if (!flag_dot) preci=6; + if (flag_sign || d < +0.0) flag_in_sign=1; + +- sz=__dtostr(d,s,sizeof(buf)-1,width,preci,g); +- +- if (flag_dot) { +- char *tmp; +- if ((tmp=strchr(s,'.'))) { +- if (preci || flag_hash) ++tmp; +- while (preci>0 && *++tmp) --preci; +- *tmp=0; +- } else if (flag_hash) { +- s[sz]='.'; +- s[++sz]='\0'; ++ sz=__dtostr(d,s,sizeof(buf)-1,width,preci,flags); ++ ++ if (!isnan(d) && !isinf(d)) { /* skip NaN + INF values */ ++ if (flag_dot) { ++ char *tmp; ++ if ((tmp=strchr(s,'.'))) { ++ if (preci || flag_hash) ++tmp; ++ while (preci>0 && *++tmp) --preci; ++ *tmp=0; ++ } else if (flag_hash) { ++ s[sz]='.'; ++ s[++sz]='\0'; ++ } + } +- } + +- if (g) { +- char *tmp,*tmp1; /* boy, is _this_ ugly! */ +- if ((tmp=strchr(s,'.'))) { +- tmp1=strchr(tmp,'e'); +- while (*tmp) ++tmp; +- if (tmp1) tmp=tmp1; +- while (*--tmp=='0') ; +- if (*tmp!='.') ++tmp; +- *tmp=0; +- if (tmp1) strcpy(tmp,tmp1); ++ if ((flags&0x01)) { ++ char *tmp,*tmp1; /* boy, is _this_ ugly! */ ++ if ((tmp=strchr(s,'.'))) { ++ tmp1=strchr(tmp,'e'); ++ while (*tmp) ++tmp; ++ if (tmp1) tmp=tmp1; ++ while (*--tmp=='0') ; ++ if (*tmp!='.') ++tmp; ++ *tmp=0; ++ if (tmp1) strcpy(tmp,tmp1); ++ } + } +- } + +- if ((flag_sign || flag_space) && d>=0) { +- *(--s)=(flag_sign)?'+':' '; +- ++sz; ++ if ((flag_sign || flag_space) && d>=0) { ++ *(--s)=(flag_sign)?'+':' '; ++ ++sz; ++ } + } + + sz=strlen(s); +diff --git a/lib/alloc.c b/lib/alloc.c +index 9690565..3f0cedb 100644 +--- a/lib/alloc.c ++++ b/lib/alloc.c +@@ -18,8 +18,7 @@ + #include + #include + +-#include /* for PAGE_SIZE */ +- ++#include "../dietpagesize.h" + + /* -- HELPER CODE --------------------------------------------------------- */ + +@@ -39,7 +38,7 @@ typedef struct { + #define BLOCK_START(b) (((void*)(b))-sizeof(__alloc_t)) + #define BLOCK_RET(b) (((void*)(b))+sizeof(__alloc_t)) + +-#define MEM_BLOCK_SIZE PAGE_SIZE ++#define MEM_BLOCK_SIZE __DIET_PAGE_SIZE + #define PAGE_ALIGN(s) (((s)+MEM_BLOCK_SIZE-1)&(unsigned long)(~(MEM_BLOCK_SIZE-1))) + + /* a simple mmap :) */ +@@ -66,7 +65,9 @@ static __alloc_t* __small_mem[8]; + + #define FIRST_SMALL(p) (((unsigned long)(p))&(~(MEM_BLOCK_SIZE-1))) + +-static inline int __ind_shift() { return (MEM_BLOCK_SIZE==4096)?4:5; } ++static inline int __ind_shift() { ++ return __DIET_PAGE_SHIFT - sizeof(__small_mem)/sizeof(__small_mem[0]); ++} + + static size_t REGPARM(1) get_index(size_t _size) { + register size_t idx=0; +diff --git a/lib/closedir.c b/lib/closedir.c +index 3aade81..21de234 100644 +--- a/lib/closedir.c ++++ b/lib/closedir.c +@@ -4,8 +4,10 @@ + #include + #include + ++#include "../dietpagesize.h" ++ + int closedir (DIR* d) { + int res=close(d->fd); +- munmap (d, PAGE_SIZE); ++ munmap (d, __DIET_PAGE_SIZE); + return res; + } +diff --git a/lib/mmap64.c b/lib/mmap64.c +index 0ab29a6..5012394 100644 +--- a/lib/mmap64.c ++++ b/lib/mmap64.c +@@ -4,16 +4,18 @@ + #include + #include + ++#include "../dietpagesize.h" ++ + #ifdef __NR_mmap2 + void*__mmap2(void*start,size_t length,int prot,int flags,int fd,off_t pgoffset); + + void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset); + void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) { +- if (offset&(PAGE_SIZE-1)) { ++ if (offset&(__DIET_PAGE_SIZE)) { + errno=-EINVAL; + return MAP_FAILED; + } +- return __mmap2(addr,len,prot,flags,fd,offset>>PAGE_SHIFT); ++ return __mmap2(addr,len,prot,flags,fd,offset>>__DIET_PAGE_SHIFT); + } + + void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) +diff --git a/lib/opendir.c b/lib/opendir.c +index 2530d1a..847685e 100644 +--- a/lib/opendir.c ++++ b/lib/opendir.c +@@ -5,6 +5,8 @@ + #include + #include + ++#include "../dietpagesize.h" ++ + DIR* opendir ( const char* name ) { + int fd = open (name, O_RDONLY | O_DIRECTORY); + DIR* t = NULL; +@@ -12,7 +14,7 @@ DIR* opendir ( const char* name ) { + if ( fd >= 0 ) { + if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) + goto lose; +- t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, ++ t = (DIR *) mmap (NULL, __DIET_PAGE_SIZE, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (t == MAP_FAILED) + lose: +diff --git a/lib/readdir.c b/lib/readdir.c +index ed885a5..d80a406 100644 +--- a/lib/readdir.c ++++ b/lib/readdir.c +@@ -5,7 +5,7 @@ + + struct dirent* readdir(DIR *d) { + if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { +- int res=getdents(d->fd,(struct dirent*)d->buf,sizeof (d->buf)-1); ++ int res=getdents(d->fd,(struct dirent*)d->buf,__DIRSTREAM_BUF_SIZE-1); + if (res<=0) return 0; + d->num=res; d->cur=0; + } +diff --git a/lib/readdir64.c b/lib/readdir64.c +index 924f0a8..06d073b 100644 +--- a/lib/readdir64.c ++++ b/lib/readdir64.c +@@ -14,7 +14,7 @@ + #ifndef WANT_LARGEFILE_BACKCOMPAT + struct dirent64* readdir64(DIR *d) { + if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) { +- int res=getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1); ++ int res=getdents64(d->fd,(struct dirent64*)d->buf, __DIRSTREAM_BUF_SIZE-1); + if (res<=0) return 0; + d->num=res; d->cur=0; + } +@@ -32,7 +32,7 @@ again: + if (!trygetdents64) { + #endif + if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { +- int res=getdents(d->fd,(struct dirent*)d->buf, sizeof (d->buf)-1); ++ int res=getdents(d->fd,(struct dirent*)d->buf, __DIRSTREAM_BUF_SIZE-1); + if (res<=0) return 0; + d->num=res; d->cur=0; + } +@@ -46,7 +46,7 @@ again: + #ifdef __NR_getdents64 + } + if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) { +- int res=getdents64(d->fd,(struct dirent64*)d->buf,sizeof (d->buf)); ++ int res=getdents64(d->fd,(struct dirent64*)d->buf,__DIRSTREAM_BUF_SIZE); + if (res<=0) { + if (errno==ENOSYS) { + trygetdents64=0; +diff --git a/lib/stack_smash_handler2.c b/lib/stack_smash_handler2.c +index 9e85099..b03c0d5 100644 +--- a/lib/stack_smash_handler2.c ++++ b/lib/stack_smash_handler2.c +@@ -2,11 +2,20 @@ + #include + + void __stack_chk_fail(void); ++void __stack_chk_fail_local(void) __attribute__((__alias__("__stack_chk_fail"))); + + /* earlier versions of ProPolice actually gave the address and function + * name as arguments to the handler, so it could print some useful + * diagnostics. No more. :-( */ + void __stack_chk_fail(void) { + __write2("smashed stack detected, program terminated.\n"); +- _exit(127); ++ ++ /* trigger a segfault which can be inspected within a debugger (inclusive ++ * stack-trace). 'abort(3)' at this place would be too heavy weighted. ++ * ++ * TODO: limit this to systems which are known to have an MMU (resp. is ++ * dietlibc with stack-protector used on systems without an MMU?) ++ */ ++ while (1) ++ *(char *)0 = 0; + } +diff --git a/lib/stackgap.c b/lib/stackgap.c +index 3ba6954..d4a505b 100644 +--- a/lib/stackgap.c ++++ b/lib/stackgap.c +@@ -16,6 +16,7 @@ + #include + #include + #include "dietfeatures.h" ++#include "dietelfinfo.h" + + #ifdef WANT_GNU_STARTUP_BLOAT + char* program_invocation_name; +@@ -48,11 +49,12 @@ void* __tdataptr; + + static void findtlsdata(long* auxvec) { + #if (__WORDSIZE == 64) +- Elf64_Phdr* x=0; ++ Elf64_Phdr const * x=0; + #else +- Elf32_Phdr* x=0; ++ Elf32_Phdr const * x=0; + #endif + size_t i,n=0; ++#ifndef WANT_ELFINFO + while (*auxvec) { + if (auxvec[0]==3) { /* AT_PHDR */ + x=(void*)auxvec[1]; +@@ -63,6 +65,18 @@ static void findtlsdata(long* auxvec) { + } + auxvec+=2; + } /* if we don't find the entry, the kernel let us down */ ++#else ++ { ++ __diet_elf_addr_t const *x_addr = __get_elf_aux_value(AT_PHDR); ++ __diet_elf_addr_t const *n_addr = __get_elf_aux_value(AT_PHNUM); ++ ++ (void)auxvec; ++ if (x_addr) ++ x = (__typeof__(x)) *x_addr; ++ if (n_addr) ++ n = *n_addr; ++ } ++#endif + if (!x || !n) return; /* a kernel this old does not support thread local storage anyway */ + for (i=0; i512*1024*1024) || + __unlikely(__tmemsize<__tdatasize)) +diff --git a/libcompat/syscall.S b/libcompat/syscall.S +index c9f72bb..4188167 100644 +--- a/libcompat/syscall.S ++++ b/libcompat/syscall.S +@@ -130,6 +130,12 @@ syscall: + b __unified_syscall + + #else +- /* arch not implemented yet */ ++#include ++ .section .comment ++#if (__WORDSIZE == 64) ++ .quad __syscall_2_not_implemented_for_this_arch ++#else ++ .long __syscall_2_not_implemented_for_this_arch ++#endif + #endif + .size syscall, . - syscall +diff --git a/libcruft/getpagesize.c b/libcruft/getpagesize.c +index 5ff8973..ac701cf 100644 +--- a/libcruft/getpagesize.c ++++ b/libcruft/getpagesize.c +@@ -1,25 +1,23 @@ + #include + #include + #include +-/* for environ: */ +-#include + +-#ifndef PAGE_SIZE +-#define PAGE_SIZE 4096 +-#endif ++#include "../dietelfinfo.h" ++#include "../dietpagesize.h" + +-size_t __libc_getpagesize(void); + size_t __libc_getpagesize(void) { +- long* x=(long*)environ; +- int fd; +- while (*x) ++x; ++x; /* skip envp to get to auxvec */ +- while (*x) { +- if (*x==6) +- return x[1]; +- x+=2; ++#ifdef WANT_DYN_PAGESIZE ++ static size_t pgsz; ++ ++ if (__unlikely(pgsz==0)) { ++ __diet_elf_addr_t const *v = __get_elf_aux_value(AT_PAGESZ); ++ pgsz = *v; /* causes segfault when 'v==NULL' */ + } +- return PAGE_SIZE; ++ ++ return pgsz; ++#else ++ return __DIET_PAGE_SIZE_PREDEF; ++#endif + } + + size_t getpagesize(void) __attribute__((weak,alias("__libc_getpagesize"))); +- +diff --git a/libcruft/sysconf.c b/libcruft/sysconf.c +index 5a6259c..507de94 100644 +--- a/libcruft/sysconf.c ++++ b/libcruft/sysconf.c +@@ -4,6 +4,9 @@ + #include + #include + ++#include "dietelfinfo.h" ++#include "dietpagesize.h" ++ + extern int __sc_nr_cpus(); + + static long physpages() { +@@ -40,6 +43,14 @@ long sysconf(int name) + return limit.rlim_cur; + } + case _SC_CLK_TCK: ++#ifdef WANT_ELFINFO ++ { ++ __diet_elf_addr_t const *v = __get_elf_aux_value(AT_CLKTCK); ++ if (v) ++ return *v; ++ } ++#endif ++ + #ifdef __alpha__ + return 1024; + #else +@@ -47,11 +58,7 @@ long sysconf(int name) + #endif + + case _SC_PAGESIZE: +-#if ( defined(__alpha__) || defined(__sparc__) ) +- return 8192; +-#else +- return 4096; +-#endif ++ return __libc_getpagesize(); + + case _SC_PHYS_PAGES: + return physpages(); +diff --git a/libm/gamma.c b/libm/gamma.c +index 9682f35..370bec6 100644 +--- a/libm/gamma.c ++++ b/libm/gamma.c +@@ -33,19 +33,19 @@ Return value gamma returns a value in range (-0.1208, +oo). For a input + #include + #include + +-#define B0 + 1.0l/ 6/ 1/ 2 +-#define B1 - 1.0l/ 30/ 3/ 4 +-#define B2 + 1.0l/ 42/ 5/ 6 +-#define B3 - 1.0l/ 30/ 7/ 8 +-#define B4 + 5.0l/ 66/ 9/10 +-#define B5 - 691.0l/2730/11/12 +-#define B6 + 7.0l/ 6/13/14 +-#define B7 - 3617.0l/ 510/15/16 +-#define B8 + 43867.0l/ 798/17/18 +-#define B9 - 174611.0l/ 330/19/20 +-#define B10 + 854513.0l/ 138/21/22 +-#define B11 - 236364091.0l/2730/23/24 +-#define B12 + 8553103.0l/ 6/25/26 ++#define B0 + 1.0/ 6/ 1/ 2 ++#define B1 - 1.0/ 30/ 3/ 4 ++#define B2 + 1.0/ 42/ 5/ 6 ++#define B3 - 1.0/ 30/ 7/ 8 ++#define B4 + 5.0/ 66/ 9/10 ++#define B5 - 691.0/2730/11/12 ++#define B6 + 7.0/ 6/13/14 ++#define B7 - 3617.0/ 510/15/16 ++#define B8 + 43867.0/ 798/17/18 ++#define B9 - 174611.0/ 330/19/20 ++#define B10 + 854513.0/ 138/21/22 ++#define B11 - 236364091.0/2730/23/24 ++#define B12 + 8553103.0/ 6/25/26 + + static const double coeff[] = { B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 }; + int signgam; +diff --git a/libugly/strftime.c b/libugly/strftime.c +index 56ae082..cf16f37 100644 +--- a/libugly/strftime.c ++++ b/libugly/strftime.c +@@ -55,6 +55,7 @@ again: + case 'x': src = "%b %a %d"; goto _strf; + case 'X': src = "%k:%M:%S"; goto _strf; + case 'D': src = "%m/%d/%y"; goto _strf; ++ case 'F': src = "%Y-%m-%d"; goto _strf; + case 'T': src = "%H:%M:%S"; + _strf: p += strftime (p, (size_t)(dst+max-p), src, tm); break; + case 'a': src = sweekdays [tm->tm_wday]; goto _str; +diff --git a/libugly/strptime.c b/libugly/strptime.c +index 9d7f530..d19f309 100644 +--- a/libugly/strptime.c ++++ b/libugly/strptime.c +@@ -119,10 +119,11 @@ char* strptime(const char* s,const char* format, struct tm* tm) { + ++s; + break; + case 'x': +- s=strptime(s,"%b %a %d",tm); ++ /* see SUSv2, Ch.7 "LC_TIME Category in the POSIX Locale" */ ++ s=strptime(s,"%m/%d/%y",tm); + break; + case 'X': +- s=strptime(s,"%k:%M:%S",tm); ++ s=strptime(s,"%H:%M:%S",tm); + break; + case 'y': + i=getint(&s,2); +diff --git a/mips/start.S b/mips/start.S +index 57144b3..3cf3433 100644 +--- a/mips/start.S ++++ b/mips/start.S +@@ -47,6 +47,15 @@ __start: + #endif + add $a2, $a2, $a1 + sw $a2, environ ++#ifdef WANT_ELFINFO ++# warning "MAKE ME MIPS CODE!" ++1: addu $a2, $a2, 4 /* increment envp */ ++ lw $4, -4($a2) /* load envp[-1]; TODO: is $4 a proper ++ temporary register? */ ++ bnz 1b /* ... until envp[-1]==NULL ++ TODO: use proper 'bnz' operation */ ++ sw $a2, __elfinfo ++#endif + jalr $25 + la $25, exit + move $4,$2 +diff --git a/parisc/start.S b/parisc/start.S +index 69d9cce..894255c 100644 +--- a/parisc/start.S ++++ b/parisc/start.S +@@ -34,6 +34,16 @@ _start: + ldil LP%environ, %r19 + ldo RP%environ(%r19), %r19 + ++#ifdef WANT_ELFINFO ++# warning "MAKE ME PARISC CODE!" ++1: add %r20, %r19, %r19 ; envp += 4 ++ ldw -4(0,%r19), %r21 ; load envp[-4] into %r21 ++ comibf =,0, 0,%21,1b ; compare %21 with 0 without nullification ++ ++ ldil LP%__elfinfo, %r19 ++ ldo RP%__elfinfo(%r19), %r19 ++#endif ++ + /* Expand the stack to store the 5th through 7th args */ + ldo 64(%sp), %sp + +diff --git a/ppc/start.S b/ppc/start.S +index 771f1ad..3b5cab1 100644 +--- a/ppc/start.S ++++ b/ppc/start.S +@@ -31,6 +31,15 @@ _start: + lis 14,environ@ha + stw 5,environ@l(14) + ++#ifdef WANT_ELFINFO ++1: lwzu 15,0(5) ++ addi 5, 5, 4 ++ cmpwi 15,0 ++ bne 1b ++ ++ stw 5,__elfinfo@l(14) ++#endif ++ + #ifdef WANT_DYNAMIC + mr 6,7 + bl _dyn_start +diff --git a/ppc64/start.S b/ppc64/start.S +index a9208ff..46b4bf0 100644 +--- a/ppc64/start.S ++++ b/ppc64/start.S +@@ -58,6 +58,15 @@ _start: + oris 14,14,environ@ha + std 5,environ@l(14) + ++#ifdef WANT_ELFINFO ++1: ldu 15,0(5) ++ addi 5, 5, 8 ++ cmpdi 15,0 ++ bne 1b ++ ++ std 5,__elfinfo@l(14) ++#endif ++ + #ifdef WANT_DYNAMIC + /* #warning dynamic */ + mr 6,7 +diff --git a/s390/start.S b/s390/start.S +index c0f971f..585faf7 100644 +--- a/s390/start.S ++++ b/s390/start.S +@@ -30,6 +30,17 @@ _start: + l %r1,8(%r13) + st %r4,0(%r1) + ++#ifdef WANT_ELFINFO ++# warning "VERIFY ME!" ++1: ahi %r4, 4 # increment envp ++ l %r12, -4(0,%r4) # load envp[-1] into %r12 ++ or %r12, %r12 # test %r12 for NULL ++ brc 1, 1b ++ ++ ahi %r1, 4 ++ st %r4,0(%r1) ++#endif ++ + /* call main or _dyn_start */ + l %r1,0(%r13) + basr %r14,%r1 +diff --git a/s390x/__time.c b/s390x/__time.c +deleted file mode 100644 +index af935ae..0000000 +--- a/s390x/__time.c ++++ /dev/null +@@ -1,10 +0,0 @@ +-#include +-#include +- +-time_t time(time_t *t) { +- struct timeval tv; +- if (gettimeofday(&tv, 0) == -1) +- tv.tv_sec=-1; +- if (t) *t=tv.tv_sec; +- return tv.tv_sec; +-} +diff --git a/s390x/start.S b/s390x/start.S +index 25895a6..15ad1f9 100644 +--- a/s390x/start.S ++++ b/s390x/start.S +@@ -26,6 +26,17 @@ _start: + larl %r13,environ + stg %r4,0(%r13) + ++#ifdef WANT_ELFINFO ++# warning "VERIFY ME!" ++1: aghi %r4, 8 # increment envp ++ lg %r12, -8(0,%r4) # load envp[-1] into %r12 ++ ogr %r12, %r12 # test %r12 for NULL ++ brc 1, 1b ++ ++ aghi %r13, 8 ++ stg %r4,0(%r13) ++#endif ++ + /* call main or _dyn_start */ + #ifdef WANT_DYNAMIC + brasl %r14,_dyn_start +diff --git a/sparc/shmat.c b/sparc/shmat.c +index b7dce2e..ce3bfcb 100644 +--- a/sparc/shmat.c ++++ b/sparc/shmat.c +@@ -3,17 +3,15 @@ + #include + #include + +-extern void* __ipc(); ++#include "../dietpagesize.h" + +-#ifndef PAGE_SIZE +-#define PAGE_SIZE 4096 +-#endif ++extern void* __ipc(); + + void* shmat(int shmid,const void* shmaddr,int shmflg) { + void* raddr; + register void* result; + result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr); +- if ((unsigned long)result <= -(unsigned long)PAGE_SIZE) ++ if ((unsigned long)result <= -(unsigned long)__DIET_PAGE_SIZE) + result=raddr; + return result; + } +diff --git a/sparc/start.S b/sparc/start.S +index a7841e3..bb463c9 100644 +--- a/sparc/start.S ++++ b/sparc/start.S +@@ -25,6 +25,17 @@ _start: + or %o3, %lo(environ), %o3 + st %o2, [%o3] + ++#ifdef WANT_ELFINFO ++# warning "VERIFY ME!" ++1: add %o2, %o2, 4 ++ ld [%o2-4], %o4 ++ orcc %o4, %o4, %o4 ++ bne 1b ++ ++ add %o3, %o3, 4 ++ st %o2, [%o3] ++#endif ++ + /* 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/sparc64/__time.c b/sparc64/__time.c +deleted file mode 100644 +index efa1e8b..0000000 +--- a/sparc64/__time.c ++++ /dev/null +@@ -1 +0,0 @@ +-#include "alpha/__time.c" +diff --git a/sparc64/start.S b/sparc64/start.S +index a79c4e7..a884658 100644 +--- a/sparc64/start.S ++++ b/sparc64/start.S +@@ -25,6 +25,17 @@ _start: + or %o3, %lo(environ), %o3 + stx %o2, [%o3] + ++#ifdef WANT_ELFINFO ++# warning "VERIFY ME!" ++1: add %o2, %o2, 8 ++ ldx [%o2-8], %o4 ++ orcc %o4, %o4, %o4 ++ bne 1b ++ ++ add %o3, %o3, 8 ++ stx %o2, [%o3] ++#endif ++ + /* 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/environ.S b/syscalls.s/environ.S +index a4dd95e..294f2d4 100644 +--- a/syscalls.s/environ.S ++++ b/syscalls.s/environ.S +@@ -1,6 +1,7 @@ + .section ".bss" + .align 8 + #include ++#include + + .type environ,object + .weak environ +@@ -15,3 +16,18 @@ environ: + #endif + .size environ,.-environ + .size __environ,.-__environ ++ ++/* __elfinfo will be initialized in start.S to point to the ++ terminating NULL of the environment. */ ++ ++#ifdef WANT_ELFINFO ++.type __elfinfo,object ++.weak __elfinfo ++__elfinfo: ++#if __WORDSIZE == 64 ++ .quad 0 ++#else ++ .long 0 ++#endif ++.size __elfinfo,.-__elfinfo ++#endif +diff --git a/syscalls.s/getrlimit.S b/syscalls.s/getrlimit.S +index 1c63c01..3341add 100644 +--- a/syscalls.s/getrlimit.S ++++ b/syscalls.s/getrlimit.S +@@ -1,3 +1,11 @@ + #include "syscalls.h" + ++#ifdef __NR_ugetrlimit ++ ++syscall(ugetrlimit,getrlimit) ++ ++#elif defined(__NR_getrlimit) ++ + syscall(getrlimit,getrlimit) ++ ++#endif +diff --git a/syscalls.s/mmap.S b/syscalls.s/mmap.S +index 2e57fbb..486b531 100644 +--- a/syscalls.s/mmap.S ++++ b/syscalls.s/mmap.S +@@ -1,3 +1,7 @@ + #include "syscalls.h" + ++#ifdef __NR_mmap ++ + syscall(mmap,mmap) ++ ++#endif +diff --git a/test/Makefile b/test/Makefile +index eea0075..537b32f 100644 +--- a/test/Makefile ++++ b/test/Makefile +@@ -10,11 +10,11 @@ LCOMPAT=-lcompat + TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty 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 \ ++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 sysenter ungetc waitpid ++strstr strtol sysconf sysenter ungetc waitpid + + test: $(TESTPROGRAMS) + +diff --git a/test/asprintf.c b/test/asprintf.c +index 996a5aa..0d4f2eb 100644 +--- a/test/asprintf.c ++++ b/test/asprintf.c +@@ -13,7 +13,7 @@ int main(int argc, char **argv) { + assert(strlen(path) == asprintlen); + + printf("%s\n", path); +- asprintlen=asprintf(&path, "/proc" "/%d/stat", strlen(argv[1])); ++ asprintlen=asprintf(&path, "/proc" "/%zu/stat", strlen(argv[1])); + assert(strlen(path) == asprintlen); + printf("%s\n", path); + +diff --git a/test/atexit.c b/test/atexit.c +index 709a3e4..79ee392 100644 +--- a/test/atexit.c ++++ b/test/atexit.c +@@ -2,7 +2,7 @@ + #include + + void blah(void) { +- write(2,"atexit\n",7); ++ write(1,"atexit\n",7); + } + + int main() { +diff --git a/test/bsearch.c b/test/bsearch.c +index 961ad35..ede4c88 100644 +--- a/test/bsearch.c ++++ b/test/bsearch.c +@@ -35,7 +35,7 @@ int main() { + die("bsearch returned NULL\n"); + } + if (k != array+i) die("bsearch found wrong element\n"); +- printf("%d\n",k-array); ++ printf("%ld\n",k-array); + } + } + return 0; +diff --git a/test/byteswap.c b/test/byteswap.c +index 19239dd..6f43c25 100644 +--- a/test/byteswap.c ++++ b/test/byteswap.c +@@ -9,12 +9,12 @@ int main() { + snprintf(buf,100,"%x %x", bswap_16(0x1234), bswap_16(0x5678)); + assert(strcmp(buf, "3412 7856") == 0); + +- printf("%lx\n",bswap_32(0x12345678)); +- snprintf(buf,100,"%lx", bswap_32(0x12345678)); ++ printf("%x\n",(unsigned int)bswap_32(0x12345678)); ++ snprintf(buf,100,"%x", (unsigned int)bswap_32(0x12345678)); + assert(strcmp(buf, "78563412") == 0); + +- printf("%qx\n",bswap_64(0x123456789ABCDEFull)); +- snprintf(buf,100,"%qx", bswap_64(0x123456789ABCDEFull)); ++ printf("%llx\n",(unsigned long long)bswap_64(0x123456789ABCDEFull)); ++ snprintf(buf,100,"%llx", (unsigned long long)bswap_64(0x123456789ABCDEFull)); + assert(strcmp(buf, "efcdab8967452301") == 0); + return 0; + } +diff --git a/test/cycles.c b/test/cycles.c +index 35547f8..46b2f32 100644 +--- a/test/cycles.c ++++ b/test/cycles.c +@@ -13,7 +13,8 @@ + dst = (((uint64_t)h) << 32) | l; \ + } while (0) + #else +-#error "Unimplemented rdtsc" ++#warning "Unimplemented rdtsc" ++#define RDTSC(dst) dst = 0 + #endif + + extern char **environ; +@@ -24,7 +25,7 @@ int main(int argc,char* argv[]) { + if (!fork()) { execve(argv[1],argv+1,environ); exit(1); } + wait(0); + RDTSC(b); +- printf("%llu cycles\n",b-a); ++ printf("%llu cycles\n",(unsigned long long)(b-a)); + + return 0; + } +diff --git a/test/getmntent.c b/test/getmntent.c +index fc17a83..1039d06 100644 +--- a/test/getmntent.c ++++ b/test/getmntent.c +@@ -33,10 +33,6 @@ while ((e = getmntent(fstab))) { + + printf("closing /etc/fstab\n"); + assert ( 1 == endmntent(fstab)); +- printf("closing /etc/fstab again\n"); +- assert ( 1 == endmntent(fstab)); /* endmntent must always return 1 */ +- printf("entmntent(0)\n"); +- assert ( 1 == endmntent(0)); /* causes a segfault with diet libc */ ++ + return 0; + } +- +diff --git a/test/getservbyname.c b/test/getservbyname.c +index b70ca19..caf1c9f 100644 +--- a/test/getservbyname.c ++++ b/test/getservbyname.c +@@ -1,5 +1,6 @@ + #include + #include ++#include + + int main(int argc,char *argv[]) { + struct servent* se; +diff --git a/test/malloc-debugger.c b/test/malloc-debugger.c +index 040196e..058807e 100644 +--- a/test/malloc-debugger.c ++++ b/test/malloc-debugger.c +@@ -4,7 +4,7 @@ + int main() { + char* c=malloc(13); + char* tmp; +- fprintf(stderr,"got %p\n",c); ++ fprintf(stdout,"got %p\n",c); + c[0]=14; + // c[15]=0; + tmp=realloc(c,12345); +diff --git a/test/math.c b/test/math.c +new file mode 100644 +index 0000000..687103c +--- /dev/null ++++ b/test/math.c +@@ -0,0 +1,29 @@ ++#include ++#include ++#include ++ ++int main() ++{ ++ extern int __isinf(double d); ++ extern int __isnan(double d); ++ ++#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) ++ assert(__isinf(__builtin_inff()) == +1); ++ assert(__isinf(-__builtin_inff()) == -1); ++ ++ assert(__isinf(__builtin_inf()) == +1); ++ assert(__isinf(-__builtin_inf()) == -1); ++ ++ assert(__isnan(__builtin_nan(""))); ++#endif ++ ++ assert(__isinf((DBL_MAX * DBL_MAX)) == +1); ++ assert(__isinf(-(DBL_MAX * DBL_MAX)) == -1); ++ ++ assert(isinf((DBL_MAX * DBL_MAX))); ++ assert(isinf(-(DBL_MAX * DBL_MAX))); ++ ++ //assert(isnan(nan(""))); ++ ++ return 0; ++} +diff --git a/test/mktime.c b/test/mktime.c +index 5e9e65c..9b4bd5e 100644 +--- a/test/mktime.c ++++ b/test/mktime.c +@@ -9,15 +9,15 @@ int main() { + t.tm_mday=29; + t.tm_mon=2; + t.tm_year=100; +- printf("%d\n",mktime(&t)); ++ printf("%ld\n",(long)mktime(&t)); + t.tm_mday=1; + t.tm_mon=3; + t.tm_year=102; +- printf("%d\n",mktime(&t)); ++ printf("%ld\n",(long)mktime(&t)); + t.tm_mday=1; + t.tm_mon=6; + t.tm_year=102; +- printf("%d\n",mktime(&t)); ++ printf("%ld\n",(long)mktime(&t)); + return 0; + } + +diff --git a/test/printf.c b/test/printf.c +index 719461a..ef6050d 100644 +--- a/test/printf.c ++++ b/test/printf.c +@@ -2,11 +2,26 @@ + #include + #include + #include ++#include ++#include + #include + #include + + #define ALGN 5 + ++#ifndef INFINITY ++# if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) ++# define INFINITY (__builtin_inf()) ++# endif ++#endif ++ ++#ifndef NAN ++# if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) ++# define NAN (__builtin_nan("")) ++# endif ++#endif ++ ++ + // https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=112986 + #if 0 + #undef assert +@@ -60,7 +75,7 @@ + TEST_SNPRINTF(EXP, 0, __VA_ARGS__); \ + TEST_SNPRINTF(EXP, sizeof(EXP)+ALGN, __VA_ARGS__); \ + TEST_SNPRINTF_NULL(EXP, __VA_ARGS__) +- ++ + + int main() + { +@@ -101,7 +116,7 @@ int main() + TEST("42.23", "%5.2f", 42.23); + TEST("42.23", "%5.4g", 42.23); + TEST(" 42.2", "%5.3g", 42.23); +- ++ + TEST(" 1", "%*i", 4, 1); + TEST(" 1", "%4i", 1); + TEST("1 ", "%-4i", 1); +@@ -131,13 +146,32 @@ int main() + TEST("-01234", "%6.5i", -1234); + TEST(" 1234", "%6.5s", "1234"); + ++#ifdef INFINITY ++ TEST("inf", "%f", INFINITY); ++ TEST("-inf", "%f", -INFINITY); ++ TEST("INF", "%F", INFINITY); ++ TEST("-INF", "%F", -INFINITY); ++ ++ TEST("inf", "%g", INFINITY); ++ TEST("-inf", "%g", -INFINITY); ++ TEST("INF", "%G", INFINITY); ++ TEST("-INF", "%G", -INFINITY); ++#endif ++ ++#ifdef NAN ++ TEST("nan", "%f", NAN); ++ TEST("NAN", "%F", NAN); ++ TEST("nan", "%g", NAN); ++ TEST("NAN", "%G", NAN); ++#endif ++ + #ifdef XSI_TESTS + setlocale(LC_ALL, "de_DE"); +- ++ + TEST("1.234", "%'u", 1234); + TEST("2 1", "%2$u %1$u", 1, 2); + #endif +- +- ++ ++ + return EXIT_SUCCESS; + } +diff --git a/test/printftest.c b/test/printftest.c +index 4743279..47d9580 100644 +--- a/test/printftest.c ++++ b/test/printftest.c +@@ -101,8 +101,8 @@ int main() + printf("#%i#\n",18); + printf("#%d#\n",18); + printf("#%u#\n",18); +- printf("#%lu#\n",18); +- printf("#%li#\n",18); ++ printf("#%lu#\n",18l); ++ printf("#%li#\n",18l); + printf("#%-+#06d#\n", -123); + printf("#%-+#6d#\n", -123); + printf("#%+#06d#\n", -123); +@@ -142,7 +142,7 @@ int main() + buf); + memset(buf2,0,sizeof(buf)); + i=snprintf(buf2, 256, "%.9999u", 10); +- printf("%i %i\n",i,strlen(buf2)); ++ printf("%i %li\n",i,strlen(buf2)); + + printf ("snprintf (\"%%.999999u\", 10) == %d\n", + snprintf(buf2, sizeof(buf2), "%.999999u", 10)); +diff --git a/test/rand48.c b/test/rand48.c +index 4f5b08f..1e67632 100644 +--- a/test/rand48.c ++++ b/test/rand48.c +@@ -6,16 +6,16 @@ main (void) + { + static unsigned short data[7] = { 1, 2, 3, 4, 5, 6, 7 }; + +- printf ("one %X\n", mrand48 ()); +- printf ("two %X\n", mrand48 ()); +- printf ("three %X\n", mrand48 ()); ++ printf ("one %lX\n", mrand48 ()); ++ printf ("two %lX\n", mrand48 ()); ++ printf ("three %lX\n", mrand48 ()); + + lcong48 (data); + printf ("after lcong48:\n"); + +- printf ("one %X\n", mrand48 ()); +- printf ("two %X\n", mrand48 ()); +- printf ("three %X\n", mrand48 ()); ++ printf ("one %lX\n", mrand48 ()); ++ printf ("two %lX\n", mrand48 ()); ++ printf ("three %lX\n", mrand48 ()); + + return 0; + } +diff --git a/test/runtests.sh b/test/runtests.sh +index 6d89efb..fcd3202 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 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" + + STDIN="read1" + PASS="getpass" +diff --git a/test/sendfile.c b/test/sendfile.c +index d43cdd2..28b3af5 100644 +--- a/test/sendfile.c ++++ b/test/sendfile.c +@@ -11,5 +11,5 @@ int main() { + + printf("sendfile returned %d\n",ret); + +-return 0; ++ return ret<0 ? 1 : 0; + } +diff --git a/test/speed.c b/test/speed.c +index 674b9a8..22249a7 100644 +--- a/test/speed.c ++++ b/test/speed.c +@@ -7,10 +7,10 @@ int main() { + int i; + time_t t; + +- printf("%d\n", time(0)); ++ printf("%ld\n", (long)time(0)); + for (i=0; i<10000000; ++i) + t=time(0); + +- printf("%d\n", time(0)); ++ printf("%ld\n", (long)time(0)); + return 0; + } +diff --git a/test/stdio/tstscanf.c b/test/stdio/tstscanf.c +index 44ddf49..0f55c3c 100644 +--- a/test/stdio/tstscanf.c ++++ b/test/stdio/tstscanf.c +@@ -338,14 +338,14 @@ main (int argc, char **argv) + int res; + + res = sscanf ("-InF", "%f", &value); +- if (res != 1 || isinf (value) != -1) ++ if (res != 1 || !isinf (value) || !(value<0)) + { + fputs ("test failed!\n", stdout); + result = 1; + } + + res = sscanf ("+InfiNiTY", "%f", &value); +- if (res != 1 || isinf (value) != 1) ++ if (res != 1 || !isinf (value) || !(value>0)) + { + fputs ("test failed!\n", stdout); + result = 1; +diff --git a/test/stdlib/testsort.c b/test/stdlib/testsort.c +index aa4332a..5a92bc0 100644 +--- a/test/stdlib/testsort.c ++++ b/test/stdlib/testsort.c +@@ -1,3 +1,5 @@ ++#define _BSD_SOURCE ++ + #include + #include + #include +diff --git a/test/stdlib/tst-calloc.c b/test/stdlib/tst-calloc.c +index a9b9e2a..049117b 100644 +--- a/test/stdlib/tst-calloc.c ++++ b/test/stdlib/tst-calloc.c +@@ -17,6 +17,8 @@ + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + ++#define _BSD_SOURCE ++ + #include + #include + #include +diff --git a/test/stdlib/tst-malloc.c b/test/stdlib/tst-malloc.c +index 09fbb1f..4a491d9 100644 +--- a/test/stdlib/tst-malloc.c ++++ b/test/stdlib/tst-malloc.c +@@ -21,13 +21,15 @@ + #include + #include + ++#include "../../dietfeatures.h" ++ + static int errors = 0; + + static void + merror (const char *msg) + { + ++errors; +- printf ("Error: %s\n", msg); ++ fprintf (stderr, "Error: %s\n", msg); + } + + int +@@ -56,9 +58,11 @@ main (void) + if (p != NULL) + merror ("realloc (p, 0) failed."); + ++#ifdef WANT_MALLOC_ZERO + p = malloc (0); + if (p == NULL) + merror ("malloc (0) failed."); ++#endif + + p = realloc (p, 0); + if (p != NULL) +diff --git a/test/stdlib/tst-strtod.c b/test/stdlib/tst-strtod.c +index 630a8fc..bacdca7 100644 +--- a/test/stdlib/tst-strtod.c ++++ b/test/stdlib/tst-strtod.c +@@ -149,10 +149,10 @@ main (int argc, char ** argv) + } + + const char input2[] = "+1.000000000116415321826934814453125"; +- if (strtold (input2, NULL) != +1.000000000116415321826934814453125) ++ if (strtold (input2, NULL) != +1.000000000116415321826934814453125L) + { + printf ("input2: %La != %La\n", strtold (input2, NULL), +- +1.000000000116415321826934814453125); ++ +1.000000000116415321826934814453125L); + status = 1; + } + +diff --git a/test/sysconf.c b/test/sysconf.c +new file mode 100644 +index 0000000..32263a5 +--- /dev/null ++++ b/test/sysconf.c +@@ -0,0 +1,80 @@ ++#include ++#include ++#include ++#include ++#include ++ ++#include "../dietpagesize.h" ++ ++static long exec_getconf(char const *var) ++{ ++ char buf[128]; ++ pid_t pid; ++ int fd[2]; ++ int status; ++ ssize_t l; ++ ++ if (pipe(fd)<0 || (pid = fork())<0) ++ abort(); ++ ++ if (pid==0) { ++ close(fd[0]); ++ ++ if (fd[1]!=1) { ++ dup2(fd[1], 1); ++ close(fd[1]); ++ } ++ ++ execlp("getconf", "getconf", var, NULL); ++ _exit(1); ++ } ++ ++ close(fd[1]); ++ l = read(fd[0], buf, sizeof(buf)-1); ++ if (l<0) { ++ perror("read()"); ++ goto err; ++ } else if (l==sizeof(buf)-1) ++ goto err; ++ close(fd[0]); ++ ++ buf[l] = '\0'; ++ ++ if (waitpid(pid, &status, 0)<0) ++ goto err; ++ ++ if (!WIFEXITED(status) || WEXITSTATUS(status)!=0) ++ goto err; ++ ++ return strtol(buf, NULL, 10); ++ ++ err: ++ kill(pid, SIGKILL); ++ abort(); ++} ++ ++static unsigned int do_check(char const *var, long exp) ++{ ++ long cur = exec_getconf(var); ++ ++ if (cur!=exp) { ++ fprintf(stderr, "%s mismatch: got %ld, expected %ld\n", ++ var, cur, exp); ++ return 1; ++ } ++ ++ return 0; ++} ++ ++int main(int argc, char *argv[]) ++{ ++ unsigned int err = 0; ++ ++ assert(sysconf(_SC_PAGESIZE) == __DIET_PAGE_SIZE); ++ assert(__DIET_PAGE_SIZE == (1<<__DIET_PAGE_SHIFT)); ++ ++ err += do_check("PAGE_SIZE", sysconf(_SC_PAGESIZE)); ++ err += do_check("CLK_TCK", sysconf(_SC_CLK_TCK)); ++ ++ return err; ++} +diff --git a/test/sysenter.c b/test/sysenter.c +index a8fa3a8..3d85916 100644 +--- a/test/sysenter.c ++++ b/test/sysenter.c +@@ -11,11 +11,11 @@ int main() { + int i; + for (i=0; environ[i]; ++i) ; + for (x=(struct elf_aux*)(environ+i+1); x->type; ++x) { +- printf("%d %x\n",x->type,x->value); ++ printf("%ld %lx\n",x->type,x->value); + if (x->type==AT_PAGESZ) +- printf("pagesize %d\n",x->value); ++ printf("pagesize %ld\n",x->value); + else if (x->type==AT_SYSINFO) +- printf("vsyscall %p\n",x->value); ++ printf("vsyscall %p\n",(void *)x->value); + } + return 0; + } +diff --git a/test/time/tst-strftime.c b/test/time/tst-strftime.c +index e092e93..27db9a4 100644 +--- a/test/time/tst-strftime.c ++++ b/test/time/tst-strftime.c +@@ -49,18 +49,18 @@ int main (void) { + + if (res == 0) + { +- printf ("%Zu: %s: res == 0 despite size == %Zu\n", ++ printf ("%zu: %s: res == 0 despite size == %zu\n", + cnt, tests[cnt].fmt, size); + result = 1; + } + else if (size < tests[cnt].min) + { +- printf ("%Zu: %s: size == %Zu was enough\n", ++ printf ("%zu: %s: size == %zu was enough\n", + cnt, tests[cnt].fmt, size); + result = 1; + } + else +- printf ("%Zu: %s: size == %Zu: OK\n", cnt, tests[cnt].fmt, size); ++ printf ("%zu: %s: size == %zu: OK\n", cnt, tests[cnt].fmt, size); + + free (buf); + } +diff --git a/test/time/tst-strptime.c b/test/time/tst-strptime.c +index 6277ea6..2773180 100644 +--- a/test/time/tst-strptime.c ++++ b/test/time/tst-strptime.c +@@ -41,10 +41,12 @@ static const struct + { "C", "03/03/00", "%D", 5, 62, 2, 3 }, + { "C", "9/9/99", "%x", 4, 251, 8, 9 }, + { "C", "19990502123412", "%Y%m%d%H%M%S", 0, 121, 4, 2 }, ++#if 0 /* dietlibc does not support %U/%W/%j and non-POSIX locales */ + { "C", "2001 20 Mon", "%Y %U %a", 1, 140, 4, 21 }, + { "C", "2001 21 Mon", "%Y %W %a", 1, 140, 4, 21 }, + { "ja_JP.EUC-JP", "2001 20 \xb7\xee", "%Y %U %a", 1, 140, 4, 21 }, + { "ja_JP.EUC-JP", "2001 21 \xb7\xee", "%Y %W %a", 1, 140, 4, 21 }, ++#endif + }; + + +@@ -72,9 +74,16 @@ test_tm (void) + + for (i = 0; i < sizeof (tm_tests) / sizeof (tm_tests[0]); ++i) + { ++ char *pres; + memset (&tm, '\0', sizeof (tm)); +- +- if (strptime (tm_tests[i].input, tm_tests[i].format, &tm) != '\0') ++ ++ pres = strptime (tm_tests[i].input, tm_tests[i].format, &tm); ++ if (!pres) ++ { ++ fprintf(stderr, "failed to parse '%s'\n", day_tests[i].input); ++ result = 1; ++ } ++ else if (*pres != '\0') + { + printf ("not all of `%s' read\n", tm_tests[i].input); + result = 1; +@@ -118,6 +127,7 @@ int main (void) { + + for (i = 0; i < sizeof (day_tests) / sizeof (day_tests[0]); ++i) + { ++ char *pres; + memset (&tm, '\0', sizeof (tm)); + + if (setlocale (LC_ALL, day_tests[i].locale) == NULL) +@@ -125,7 +135,14 @@ int main (void) { + printf ("cannot set locale %s: %m\n", day_tests[i].locale); + } + +- if (*strptime (day_tests[i].input, day_tests[i].format, &tm) != '\0') ++ pres = strptime (day_tests[i].input, day_tests[i].format, &tm); ++ if (!pres) ++ { ++ fprintf(stderr, "failed to parse '%s' for locale '%s'\n", ++ day_tests[i].input, day_tests[i].locale); ++ result = 1; ++ } ++ else if (*pres != '\0') + { + printf ("not all of `%s' read\n", day_tests[i].input); + result = 1; +diff --git a/test/waitpid.c b/test/waitpid.c +index fe2cb5b..92c0b0e 100644 +--- a/test/waitpid.c ++++ b/test/waitpid.c +@@ -11,7 +11,7 @@ int main() { + perror("fork"); + _exit(1); + case 0: +- fprintf(stderr,"child, my pid is %u\n",getpid()); ++ fprintf(stdout,"child, my pid is %u\n",getpid()); + sleep(1); + _exit(23); + } +diff --git a/x86_64/__time.S b/x86_64/__time.S +new file mode 100644 +index 0000000..9d2d4b4 +--- /dev/null ++++ b/x86_64/__time.S +@@ -0,0 +1,21 @@ ++/* implement time(2) via gettimeofday(2) on x86-64 because gettimeofday ++ is a vsyscall (i.e. no actual switch to kernel mode) */ ++.text ++.global time ++.type time,@function ++time: ++ push %rdi ++ xor %rsi,%rsi ++ sub $16,%rsp ++ mov %rsp,%rdi ++ call gettimeofday ++ pop %rax ++ pop %rdi ++ pop %rdi ++ test %rdi,%rdi ++ jz 1f ++ mov %rax,(%rdi) ++1: ++ ret ++.Lhere: ++ .size time,.Lhere-time +diff --git a/x86_64/start.S b/x86_64/start.S +index adc461a..8b4f3c9 100644 +--- a/x86_64/start.S ++++ b/x86_64/start.S +@@ -12,12 +12,28 @@ _start: + + leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */ + ++ ++#ifdef WANT_ELFINFO ++#ifdef __DYN_LIB ++ movq environ@GOTPCREL(%rip), %rax ++#else ++ leaq environ(%rip), %rax ++#endif ++ movq %rdx, (%rax) /* environ */ ++ ++1: add $8, %rdx /* increment envp */ ++ cmpq $0, -8(%rdx) /* load envp[-1] */ ++ jne 1b /* ... until envp[-1]==NULL */ ++ ++ movq %rdx, 8(%rax) /* __elfinfo */ ++#else + #ifdef __DYN_LIB + movq environ@GOTPCREL(%rip), %rax + movq %rdx, (%rax) + #else + movq %rdx, environ(%rip) + #endif ++#endif + + #ifdef PROFILING + pushq %rdi /* save reg args */ +diff --git a/x86_64/time.S b/x86_64/time.S +index 9d2d4b4..dbe7894 100644 +--- a/x86_64/time.S ++++ b/x86_64/time.S +@@ -1,21 +1 @@ +-/* implement time(2) via gettimeofday(2) on x86-64 because gettimeofday +- is a vsyscall (i.e. no actual switch to kernel mode) */ +-.text +-.global time +-.type time,@function +-time: +- push %rdi +- xor %rsi,%rsi +- sub $16,%rsp +- mov %rsp,%rdi +- call gettimeofday +- pop %rax +- pop %rdi +- pop %rdi +- test %rdi,%rdi +- jz 1f +- mov %rax,(%rdi) +-1: +- ret +-.Lhere: +- .size time,.Lhere-time ++ .text /* avoid empty source file */ diff --git a/dietlibc.spec b/dietlibc.spec index 59ed944..340094a 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -34,7 +34,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1500 +Release: %release_func 1502 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -46,24 +46,8 @@ Source1: http://www.fefe.de/dietlibc/%name-%version.tar.bz2.sig Source0: %name-%version.%prerelease.tar.bz2 %endif Source10: runtests-X.sh -Patch1: dietlibc-0.28-setpriority.patch -Patch10: dietlibc-0.29-scall.patch -Patch20: dietlibc-0.29-nostackprotector.patch -Patch30: dietlibc-0.30-longdouble.patch -Patch31: dietlibc-0.31-defpath.patch -Patch32: dietlibc-0.31-stacksmash.patch -Patch33: dietlibc-0.31-stacksmash-dyn.patch -Patch41: dietlibc-0.31.20080212-teststdout.patch -Patch43: dietlibc-0.31-pagesize.patch -Patch44: dietlibc-0.31-printFG.patch -Patch46: dietlibc-0.31-testsuite.patch -Patch47: dietlibc-0.31-lcctime.patch -Patch48: dietlibc-0.31-implicitfunc.patch -Patch49: dietlibc-0.31-noreturn.patch -Patch50: dietlibc-0.31-no-stack-protector.patch -Patch51: dietlibc-0.31-smp-fix.patch -Patch52: dietlibc-0.31-stackgap-minor.patch -Patch53: dietlibc-0.31-strip.patch +## CVS..master diff from https://github.com/ensc/dietlibc +Patch0: dietlibc-github.patch BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -122,28 +106,10 @@ This package contains the dynamic libraries for dietlibc. %prep %setup -q %{?prerelease:-n %name-%version.%prerelease} -%apply -n1 -p1 -b .nice -%apply -n51 -p1 -b .smp -%apply -n53 -p1 -b .strip -%apply -n50 -p1 -b .no-stack-protector -%apply -n10 -p1 -b .scall -%apply -n30 -p1 -b .longdouble -%apply -n31 -p1 -b .defpath -%apply -n32 -p1 -b .stacksmash -%apply -n33 -p1 -b .stacksmash-dyn - -%apply -n41 -p1 -b .teststdout -%apply -n43 -p1 -b .pagesize -%apply -n44 -p1 -b .printFG -%apply -n46 -p1 -b .testsuite -%apply -n47 -p1 -b .lcctime -%apply -n48 -p1 -b .implicitfunc -%apply -n49 -p1 -b .noreturn -%apply -n52 -p1 -b .stackgap +%apply -n0 -p1 %if %{without ssp} -%apply -n20 -p1 -b .nostackprotector sed -i -e 's!^#define WANT_SSP$!// \0!g; s!.*\(#define WANT_STACKGAP\).*!\1!g' dietfeatures.h %global xtra_fixcflags -fno-stack-protector @@ -232,6 +198,11 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun Jan 9 2011 Enrico Scholz - 0.33-0.1502.20101223 +- replaced all the single patches with a big one from + https://github.com/ensc/dietlibc/commits/rebase +- various ARM-EABI fixes (667852) + * Fri Dec 24 2010 Enrico Scholz - 0.33-0.1500.20101223 - updated to 20101223 CVS snapshot From dc82a0df5a0259d9af3b9aea37338b00f34e1baa Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 9 Jan 2011 15:16:36 +0100 Subject: [PATCH 089/161] updated comment about failing tst-strtod test whitespace cleanups --- runtests-X.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtests-X.sh b/runtests-X.sh index eaa2d93..a0dbfc4 100644 --- a/runtests-X.sh +++ b/runtests-X.sh @@ -7,7 +7,7 @@ FAILURES_BOGUS=( ":stdlib:tst-environ" # test uses environ function in unsupported ways (dup keys) ":stdlib:tst-rand48" # platform dependent; does not give reliable results - ":stdlib:tst-strtod" # must be investigated further... + ":stdlib:tst-strtod" # infinite recursion in __dtostr() ":time:tst-mktime" # dietlibc does not support $TZ env ":time:tst-posixtz" # dietlibc does not support $TZ env ":time:tst-strftime" # dietlibc does not support glibc specific format specifications @@ -51,7 +51,7 @@ for p in $TESTPROGRAMS; do (false:true:true) res='OK (bogus)';; (false:true:false) res="OK (unexpected)"; let ++rc;; (true:*:true) res='FAIL (bogus)';; - (true:true:*) res="FAIL (known)";; + (true:true:*) res="FAIL (known)";; (true:false:*) res='FAIL'; let ++rc;; esac @@ -68,7 +68,7 @@ for d in $SUBDIRS; do let RUNTEST_INDENT+=2 old_ns=$RUNTEST_NS RUNTEST_NS=$RUNTEST_NS:$d - + cd $d && bash ./runtests-X.sh || let ++rc RUNTEST_NS=$old_ns From 6e9794c707457d5ddaf285d23e4fcc07bb74e58f Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Fri, 14 Jan 2011 21:29:01 +0100 Subject: [PATCH 090/161] added common alarm(2) implementation --- dietlibc-github.patch | 132 ++++++++++++++++++++++++++++++++++++++++-- dietlibc.spec | 5 +- 2 files changed, 131 insertions(+), 6 deletions(-) diff --git a/dietlibc-github.patch b/dietlibc-github.patch index 66cc1bb..edc8620 100644 --- a/dietlibc-github.patch +++ b/dietlibc-github.patch @@ -193,6 +193,25 @@ index 143113b..a4f0c0c 100644 +GIT_CVSIMPORT=git cvsimport +cvsimport: + $(GIT_CVSIMPORT) -k -p '--cvs-direct' -d :pserver:cvs@cvs.fefe.de:/cvs dietlibc +diff --git a/alpha/__alarm.c b/alpha/__alarm.c +deleted file mode 100644 +index 7ca35cb..0000000 +--- a/alpha/__alarm.c ++++ /dev/null +@@ -1,13 +0,0 @@ +-#include +-#include +- +-unsigned int alarm(unsigned int seconds) { +- struct itimerval old, new; +- unsigned int ret; +- new.it_interval.tv_usec=0; +- new.it_interval.tv_sec=0; +- new.it_value.tv_usec =0; +- new.it_value.tv_sec =(long)seconds; +- if (setitimer(ITIMER_REAL,&new,&old)==-1) return 0; +- return old.it_value.tv_sec+(old.it_value.tv_usec?1:0); +-} diff --git a/alpha/__time.c b/alpha/__time.c deleted file mode 100644 index 07275e0..0000000 @@ -623,6 +642,13 @@ index 94a4f73..9ad41ff 100644 #ifdef PROFILING pushl $_etext pushl $.text +diff --git a/ia64/__alarm.c b/ia64/__alarm.c +deleted file mode 100644 +index e2c499f..0000000 +--- a/ia64/__alarm.c ++++ /dev/null +@@ -1 +0,0 @@ +-#include "alpha/__alarm.c" diff --git a/ia64/__time.c b/ia64/__time.c deleted file mode 100644 index 7547acb..0000000 @@ -724,6 +750,28 @@ 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/lib/__alarm.c b/lib/__alarm.c +new file mode 100644 +index 0000000..9b4bc30 +--- /dev/null ++++ b/lib/__alarm.c +@@ -0,0 +1,16 @@ ++#include ++#include ++#include ++ ++#ifndef __NR_alarm ++unsigned int alarm(unsigned int seconds) { ++ struct itimerval old, new; ++ unsigned int ret; ++ new.it_interval.tv_usec=0; ++ new.it_interval.tv_sec=0; ++ new.it_value.tv_usec =0; ++ new.it_value.tv_sec =(long)seconds; ++ if (setitimer(ITIMER_REAL,&new,&old)==-1) return 0; ++ return old.it_value.tv_sec+(old.it_value.tv_usec?1:0); ++} ++#endif diff --git a/lib/__dtostr.c b/lib/__dtostr.c index 1d082e3..bc61200 100644 --- a/lib/__dtostr.c @@ -1660,11 +1708,15 @@ index 2e57fbb..486b531 100644 + +#endif diff --git a/test/Makefile b/test/Makefile -index eea0075..537b32f 100644 +index eea0075..69454e5 100644 --- a/test/Makefile +++ b/test/Makefile -@@ -10,11 +10,11 @@ LCOMPAT=-lcompat - TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty flush fnmatch \ +@@ -7,14 +7,14 @@ CFLAGS=-nostdinc -Wall + + 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 \ 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 \ @@ -1677,6 +1729,76 @@ index eea0075..537b32f 100644 test: $(TESTPROGRAMS) +diff --git a/test/alarm.c b/test/alarm.c +new file mode 100644 +index 0000000..d1e13ce +--- /dev/null ++++ b/test/alarm.c +@@ -0,0 +1,64 @@ ++#include ++#include ++ ++#include ++#include ++#include ++ ++static volatile int alrm_triggered; ++ ++static void sig_alrm(int s) ++{ ++ alrm_triggered = 1; ++} ++ ++int main() ++{ ++ int rc; ++ time_t end; ++ sighandler_t old_sig; ++ ++ alarm(50); ++ ++ old_sig = signal(SIGALRM, &sig_alrm); ++ assert(old_sig != SIG_ERR); ++ ++ /* check whether alarm() returns correct number of remaining ++ * seconds */ ++ rc = alarm(2); ++ assert(rc > 40 && rc <= 50); ++ ++ /* check whether SIGALRM is triggered within the set time */ ++ end = time(NULL) + 5; ++ while (!alrm_triggered && time(NULL) < end) { ++ /* noop */ ++ } ++ assert(alrm_triggered); ++ ++ /* there should be no pending alarm */ ++ rc = alarm(0); ++ assert(rc == 0); ++ ++ alrm_triggered = 0; ++ ++ /* test whether alarm can be canceled */ ++ rc = alarm(2); ++ assert(rc == 0); ++ ++ rc = alarm(0); ++ assert(rc > 0 && rc < 4); ++ assert(!alrm_triggered); ++ ++ /* there should not happen an alarm */ ++ end = time(NULL) + 5; ++ while (!alrm_triggered && time(NULL) < end) { ++ /* noop */ ++ } ++ assert(!alrm_triggered); ++ ++ /* there should be no pending alarm */ ++ rc = alarm(0); ++ assert(rc == 0); ++ ++ return EXIT_SUCCESS; ++} diff --git a/test/asprintf.c b/test/asprintf.c index 996a5aa..0d4f2eb 100644 --- a/test/asprintf.c @@ -1995,14 +2117,14 @@ index 4f5b08f..1e67632 100644 return 0; } diff --git a/test/runtests.sh b/test/runtests.sh -index 6d89efb..fcd3202 100644 +index 6d89efb..3896fbf 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 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 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" STDIN="read1" PASS="getpass" diff --git a/dietlibc.spec b/dietlibc.spec index 340094a..973d909 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -34,7 +34,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1502 +Release: %release_func 1503 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -198,6 +198,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Fri Jan 14 2011 Enrico Scholz +- added common alarm(2) implementation + * Sun Jan 9 2011 Enrico Scholz - 0.33-0.1502.20101223 - replaced all the single patches with a big one from https://github.com/ensc/dietlibc/commits/rebase From 7c1ee801ca6d7d062cfae31927400c16b47a9ce6 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Tue, 8 Feb 2011 07:49:21 -0600 Subject: [PATCH 091/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 973d909..b98d2a2 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -34,7 +34,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1503 +Release: %release_func 1504 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -198,6 +198,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Tue Feb 08 2011 Fedora Release Engineering - 0.33-0.1504.20101223 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + * Fri Jan 14 2011 Enrico Scholz - added common alarm(2) implementation From f2e3c0ca3efaf5ade26ad45a6df875b49cb2c3f0 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 20 Feb 2011 16:21:54 +0100 Subject: [PATCH 092/161] - 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 From d7dfb66cefd7947c4fb3654cf25de5c4296132ad Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 20 Feb 2011 20:57:53 +0100 Subject: [PATCH 093/161] - other ARM enhancements - fixed missing headers in last utime(2) + fadvise(2) patches --- dietlibc-github.patch | 71 ++++++++++++++++++++++++++++++++++++++----- dietlibc.spec | 6 +++- 2 files changed, 68 insertions(+), 9 deletions(-) diff --git a/dietlibc-github.patch b/dietlibc-github.patch index b8b64f0..e31f22f 100644 --- a/dietlibc-github.patch +++ b/dietlibc-github.patch @@ -313,14 +313,17 @@ index ca631bc..9334eee 100644 +FUNC_END __aeabi_unwind_cpp_pr0 diff --git a/arm/__fadvise.c b/arm/__fadvise.c new file mode 100644 -index 0000000..0aa1246 +index 0000000..c6748c4 --- /dev/null +++ b/arm/__fadvise.c -@@ -0,0 +1,14 @@ -+#include +@@ -0,0 +1,17 @@ +#include "syscalls.h" + +#ifndef __NR_fadvise64 ++#define _LINUX_SOURCE ++#include ++#include ++ +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); @@ -1234,7 +1237,7 @@ index e7fd3e8..22e3696 100644 "mipsel","-Os","-fomit-frame-pointer","-mno-abicalls","-fno-pic","-G","0",0, "ppc","-Os","-fomit-frame-pointer","-mpowerpc-gpopt","-mpowerpc-gfxopt",0, diff --git a/dietdirent.h b/dietdirent.h -index dbd7206..c9c7127 100644 +index dbd7206..3e823f8 100644 --- a/dietdirent.h +++ b/dietdirent.h @@ -1,8 +1,12 @@ @@ -1247,7 +1250,7 @@ index dbd7206..c9c7127 100644 - char buf[PAGE_SIZE-(sizeof (int)*3)]; unsigned int num; unsigned int cur; -+ char buf[]; ++ char buf[] __attribute__((__aligned__(8))); }; /* stream data from opendir() */ + +#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) @@ -1699,14 +1702,17 @@ index 0000000..24bb220 +#endif diff --git a/lib/__utime.c b/lib/__utime.c new file mode 100644 -index 0000000..e013265 +index 0000000..0e4d0df --- /dev/null +++ b/lib/__utime.c -@@ -0,0 +1,18 @@ -+#include +@@ -0,0 +1,21 @@ +#include + +#ifndef __NR_utime ++#define _BSD_SOURCE ++#include ++#include ++ +int utime(const char *filename, const struct utimbuf *times) +{ + if (times == NULL) @@ -2229,6 +2235,55 @@ index 9682f35..370bec6 100644 static const double coeff[] = { B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 }; int signgam; +diff --git a/librpc/clnt_raw.c b/librpc/clnt_raw.c +index 042d130..1e89ac0 100644 +--- a/librpc/clnt_raw.c ++++ b/librpc/clnt_raw.c +@@ -53,7 +53,10 @@ static struct clntraw_private { + CLIENT client_object; + XDR xdr_stream; + char _raw_buf[UDPMSGSIZE]; +- char mashl_callmsg[MCALL_MSG_SIZE]; ++ union { ++ struct rpc_msg msg; ++ char buf[MCALL_MSG_SIZE]; ++ } mashl_call; + unsigned int mcnt; + } *clntraw_private; + +@@ -101,7 +104,7 @@ unsigned long vers; + call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; + call_msg.rm_call.cb_prog = prog; + call_msg.rm_call.cb_vers = vers; +- xdrmem_create(xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE); ++ xdrmem_create(xdrs, clp->mashl_call.buf, MCALL_MSG_SIZE, XDR_ENCODE); + if (!xdr_callhdr(xdrs, &call_msg)) { + perror("clnt_raw.c - Fatal header serialization error."); + } +@@ -145,8 +148,8 @@ struct timeval timeout; + */ + xdrs->x_op = XDR_ENCODE; + XDR_SETPOS(xdrs, 0); +- ((struct rpc_msg *) clp->mashl_callmsg)->rm_xid++; +- if ((!XDR_PUTBYTES(xdrs, clp->mashl_callmsg, clp->mcnt)) || ++ clp->mashl_call.msg.rm_xid++; ++ if ((!XDR_PUTBYTES(xdrs, clp->mashl_call.buf, clp->mcnt)) || + (!XDR_PUTLONG(xdrs, (long *) &proc)) || + (!AUTH_MARSHALL(h->cl_auth, xdrs)) || (!(*xargs) (xdrs, argsp))) { + return (RPC_CANTENCODEARGS); +diff --git a/librpc/clnt_udp.c b/librpc/clnt_udp.c +index ae7f3d8..003edf5 100644 +--- a/librpc/clnt_udp.c ++++ b/librpc/clnt_udp.c +@@ -335,7 +335,7 @@ struct timeval utimeout; /* seconds to wait before giving up */ + if (inlen < 4) + continue; + /* see if reply transaction id matches sent id */ +- if (*((uint32_t *) (cu->cu_inbuf)) != *((uint32_t *) (cu->cu_outbuf))) ++ if (memcmp(cu->cu_inbuf, cu->cu_outbuf, 4) != 0) + continue; + /* we now assume we have the proper reply */ + break; diff --git a/libugly/strftime.c b/libugly/strftime.c index 56ae082..cf16f37 100644 --- a/libugly/strftime.c diff --git a/dietlibc.spec b/dietlibc.spec index 3981eb5..30ee522 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -34,7 +34,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1505 +Release: %release_func 1600 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.1600.20101223 +- other ARM enhancements +- fixed missing headers in last utime(2) + fadvise(2) patches + * Sun Feb 20 2011 Enrico Scholz - 0.33-0.1505.20101223 - further ARM fixes - global fixes for utime(2), fadvise*(2) From eb12cf48a8b8a91ed458b6351d3213bbac528167 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 12 Mar 2011 21:31:14 +0100 Subject: [PATCH 094/161] updated to 20110311 CVS + rediffed patches --- .gitignore | 1 + dietlibc-github.patch | 1272 +++++++++++++++++++++-------------------- dietlibc.spec | 6 +- sources | 2 +- 4 files changed, 650 insertions(+), 631 deletions(-) diff --git a/.gitignore b/.gitignore index acde95c..7f1ea53 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ dietlibc-0.32.tar.bz2 dietlibc-0.32.tar.bz2.sig /dietlibc-0.33.20101223.tar.bz2 +/dietlibc-0.33.20110311.tar.bz2 diff --git a/dietlibc-github.patch b/dietlibc-github.patch index e31f22f..84a5b44 100644 --- a/dietlibc-github.patch +++ b/dietlibc-github.patch @@ -1,3 +1,112 @@ + .gitignore | 1 + + Makefile | 76 +++++++++++++---------- + alpha/start.S | 9 +++ + arm/__aeabi_unwind_cpp.S | 25 +++----- + arm/__fadvise.c | 5 +- + arm/__guard.S | 3 + + arm/__longjmp.S | 13 +++-- + arm/__testandset.S | 16 ++++- + arm/arm-features.h | 103 ++++++++++++++++++++++++++++++++ + arm/clone.S | 22 ++++---- + arm/dyn_syscalls.S | 18 ++++-- + arm/mcount.S | 10 +-- + arm/md5asm.S | 26 +++----- + arm/mmap.S | 42 ------------- + arm/setjmp.S | 29 +++++---- + arm/start.S | 65 +++++++++++++-------- + arm/strcpy.S | 12 +--- + arm/strlen.S | 15 +---- + arm/syscalls.h | 65 ++++---------------- + arm/unified.S | 45 +++++++++----- + arm/waitpid.S | 19 ++---- + dietdirent.h | 6 ++- + dietelfinfo.h | 20 ++++++ + dietfeatures.h | 14 +++++ + dietpagesize.h | 31 ++++++++++ + dynlinker/ldso_start.S | 9 +++ + i386/start.S | 8 ++- + ia64/start.S | 10 +++ + include/paths.h | 2 +- + include/stdlib.h | 8 ++- + include/sys/shm.h | 9 --- + lib/__dtostr.c | 18 ++++-- + lib/__get_elf_aux_value.c | 14 +++++ + lib/__nice.c | 8 ++- + lib/__utime.c | 5 +- + lib/__v_printf.c | 59 ++++++++++--------- + lib/alloc.c | 9 ++- + lib/closedir.c | 4 +- + lib/mmap64.c | 6 +- + lib/opendir.c | 4 +- + lib/readdir.c | 2 +- + lib/readdir64.c | 6 +- + lib/stack_smash_handler2.c | 13 ++++- + lib/stackgap.c | 37 ++++++++++- + libcompat/syscall.S | 8 ++- + libcruft/getpagesize.c | 28 ++++----- + libcruft/sysconf.c | 17 ++++-- + libm/ceil.c | 92 +++++++++++++++++++++++++++++ + libm/gamma.c | 26 ++++---- + librpc/clnt_raw.c | 11 ++- + librpc/clnt_udp.c | 2 +- + libugly/strftime.c | 1 + + libugly/strptime.c | 5 +- + mips/start.S | 9 +++ + parisc/start.S | 10 +++ + ppc/start.S | 9 +++ + ppc64/start.S | 9 +++ + s390/start.S | 11 ++++ + s390x/start.S | 11 ++++ + sparc/shmat.c | 8 +-- + sparc/start.S | 11 ++++ + sparc64/start.S | 11 ++++ + syscalls.s/environ.S | 16 +++++ + syscalls.s/fadvise64.S | 9 +-- + test/.gitignore | 85 ++++++++++++++++++++++++++ + test/Makefile | 10 ++-- + test/adjtime.c | 18 +++++- + test/asprintf.c | 2 +- + test/atexit.c | 2 +- + test/bsearch.c | 2 +- + test/byteswap.c | 8 +- + test/cycles.c | 5 +- + test/dirent/.gitignore | 2 + + test/ftruncate.c | 53 +++++++++++++++++ + test/getmntent.c | 6 +-- + test/getservbyname.c | 1 + + test/if_nameindex.c | 4 + + test/malloc-debugger.c | 2 +- + test/math.c | 29 +++++++++ + test/mktime.c | 6 +- + test/mmap_test.c | 2 +- + test/pipe.c | 3 + + test/printf.c | 44 ++++++++++++-- + test/printftest.c | 6 +- + test/rand48.c | 12 ++-- + test/runtests.sh | 2 +- + test/sendfile.c | 2 +- + test/setjmp.c | 106 +++++++++++++++++++++++++++++++++ + test/sigsetjmp.c | 140 ++++++++++++++++++++++++++++++++++++++++++++ + test/speed.c | 4 +- + test/stdio/.gitignore | 14 +++++ + test/stdio/tstscanf.c | 4 +- + test/stdlib/.gitignore | 13 ++++ + test/stdlib/testsort.c | 2 + + test/stdlib/tst-calloc.c | 2 + + test/stdlib/tst-malloc.c | 6 ++- + test/stdlib/tst-strtod.c | 4 +- + test/string/.gitignore | 16 +++++ + test/sysconf.c | 80 +++++++++++++++++++++++++ + test/sysenter.c | 6 +- + test/time/.gitignore | 4 + + test/time/tst-strftime.c | 6 +- + test/time/tst-strptime.c | 23 ++++++- + test/waitpid.c | 2 +- + x86_64/__time.S | 11 ++++ + x86_64/start.S | 16 +++++ + x86_64/time.S | 12 +---- + 107 files changed, 1536 insertions(+), 466 deletions(-) + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0a72698 @@ -200,42 +309,6 @@ index 143113b..a4f0c0c 100644 +GIT_CVSIMPORT=git cvsimport +cvsimport: + $(GIT_CVSIMPORT) -k -p '--cvs-direct' -d :pserver:cvs@cvs.fefe.de:/cvs dietlibc -diff --git a/alpha/__alarm.c b/alpha/__alarm.c -deleted file mode 100644 -index 7ca35cb..0000000 ---- a/alpha/__alarm.c -+++ /dev/null -@@ -1,13 +0,0 @@ --#include --#include -- --unsigned int alarm(unsigned int seconds) { -- struct itimerval old, new; -- unsigned int ret; -- new.it_interval.tv_usec=0; -- new.it_interval.tv_sec=0; -- new.it_value.tv_usec =0; -- new.it_value.tv_sec =(long)seconds; -- if (setitimer(ITIMER_REAL,&new,&old)==-1) return 0; -- return old.it_value.tv_sec+(old.it_value.tv_usec?1:0); --} -diff --git a/alpha/__time.c b/alpha/__time.c -deleted file mode 100644 -index 07275e0..0000000 ---- a/alpha/__time.c -+++ /dev/null -@@ -1,11 +0,0 @@ --#include --#include -- --time_t time(time_t *foo) { -- struct timeval tv; -- time_t tmp=(time_t)-1; -- if (gettimeofday(&tv,0)==0) -- tmp=(time_t)tv.tv_sec; -- if (foo) *foo=tmp; -- return tmp; --} diff --git a/alpha/start.S b/alpha/start.S index 7e7cf9b..b13c9c9 100644 --- a/alpha/start.S @@ -256,26 +329,6 @@ 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/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 @@ -312,28 +365,21 @@ index ca631bc..9334eee 100644 +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..c6748c4 ---- /dev/null +index 0aa1246..c6748c4 100644 +--- a/arm/__fadvise.c +++ b/arm/__fadvise.c -@@ -0,0 +1,17 @@ -+#include "syscalls.h" -+ -+#ifndef __NR_fadvise64 +@@ -1,7 +1,10 @@ +-#include + #include "syscalls.h" + + #ifndef __NR_fadvise64 +#define _LINUX_SOURCE +#include +#include + -+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); -+ -+ return __arm_fadvise64_64(fd, advice, offset, len); -+} -+ -+int posix_fadvise(int fd, off64_t offset, off64_t len, int advise) -+ __attribute__((__alias__("fadvise64_64"))); -+#endif + 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); diff --git a/arm/__guard.S b/arm/__guard.S index 7218d13..a4e53aa 100644 --- a/arm/__guard.S @@ -351,10 +397,10 @@ index 7218d13..a4e53aa 100644 +.size __guard, . - __guard +.size __stack_chk_guard, . - __stack_chk_guard diff --git a/arm/__longjmp.S b/arm/__longjmp.S -index 31307bd..5850398 100644 +index 31307bd..ba03146 100644 --- a/arm/__longjmp.S +++ b/arm/__longjmp.S -@@ -1,7 +1,6 @@ +@@ -1,11 +1,14 @@ -.text -.global __longjmp -.type __longjmp,function @@ -365,8 +411,12 @@ index 31307bd..5850398 100644 mov ip, r0 movs r0, r1 moveq r0, #1 -@@ -9,3 +8,4 @@ __longjmp: - lfm f4, 4, [ip], #48 + #ifndef __SOFTFP__ +- lfm f4, 4, [ip], #48 ++ lfm f4, 4, [ip, #10*4] ++#endif ++#ifdef __IWMMXT__ ++# warning "sigjmp will not restore iwmmxt coprocessor registers" #endif ldmia ip, {r4-r11, sp, pc} +FUNC_END __longjmp @@ -503,17 +553,6 @@ index 0000000..cf330eb +#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 @@ -579,7 +618,7 @@ index 4a4b2f4..b2ef450 100644 #endif diff --git a/arm/dyn_syscalls.S b/arm/dyn_syscalls.S -index 895657f..c128891 100644 +index a4baf28..a8fe803 100644 --- a/arm/dyn_syscalls.S +++ b/arm/dyn_syscalls.S @@ -8,11 +8,15 @@ @@ -612,7 +651,7 @@ index 895657f..c128891 100644 /* ok now include all syscalls.s (*.S) and sysdep *.S */ #include "mmap.S" -@@ -278,9 +284,11 @@ __unified_syscall: +@@ -280,9 +286,11 @@ __unified_syscall: #include "../syscalls.s/fgetxattr.S" /* other asm-files w.o. changes ... */ @@ -782,10 +821,10 @@ index d3ea131..0000000 - -#endif diff --git a/arm/setjmp.S b/arm/setjmp.S -index 6b850d4..797d21b 100644 +index 6b850d4..e7503b2 100644 --- a/arm/setjmp.S +++ b/arm/setjmp.S -@@ -1,17 +1,18 @@ +@@ -1,17 +1,20 @@ -.text -.weak setjmp -setjmp: @@ -805,26 +844,32 @@ index 6b850d4..797d21b 100644 + +FUNC_START_WEAK sigsetjmp +FUNC_START __sigsetjmp ++ stmia r0, {r4-r11, sp, lr} #ifndef __SOFTFP__ - sfm f4, 4, [r0], #48 +- sfm f4, 4, [r0], #48 ++ sfm f4, 4, [r0, #10*4] ++#endif ++#ifdef __IWMMXT__ ++# warning "setjmp will not save iwmmxt coprocessor registers" #endif - stmia r0, {r4-r11, sp, lr} - sub r0, r0, #48 +- stmia r0, {r4-r11, sp, lr} +- sub r0, r0, #48 b __sigjmp_save - +FUNC_END __sigsetjmp +FUNC_END sigsetjmp diff --git a/arm/start.S b/arm/start.S -index ccbac48..cfb298c 100644 +index d68d49d..cfb298c 100644 --- a/arm/start.S +++ b/arm/start.S -@@ -1,30 +1,29 @@ +@@ -1,23 +1,11 @@ #include "dietfeatures.h" #include "syscalls.h" -- ++#include "arm-features.h" + - .text --#ifdef __ARM_EABI__ + #ifdef __ARM_EABI__ - .align 4 -#else - .align 2 @@ -834,19 +879,16 @@ index ccbac48..cfb298c 100644 - .weak exit - .global _exit - -+#include "arm-features.h" - - #ifdef __ARM_EABI__ - --_start: - +-#ifdef __ARM_EABI__ +- +-_start: + +FUNC_START _start mov fp, #0 @ clear the frame pointer -- ldr a1, [sp], #4 @ argc -- mov a2, sp @ argv -+ ldr a1, [sp] @ argc -+ add a2, sp, #4 @ argv - ldr ip, .L3 + ldr a1, [sp] @ argc + add a2, sp, #4 @ argv +@@ -25,6 +13,17 @@ _start: add a3, a2, a1, lsl #2 @ &argv[argc] add a3, a3, #4 @ envp str a3, [ip, #0] @ environ = envp @@ -946,7 +988,7 @@ index ccbac48..cfb298c 100644 .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 +index 20e1029..7a86562 100644 --- a/arm/strcpy.S +++ b/arm/strcpy.S @@ -1,10 +1,7 @@ @@ -962,7 +1004,7 @@ index 20e1029..cc376d3 100644 #ifndef WANT_SMALL_STRING_ROUTINES mov ip, r0 ands r2, r1, #3 -@@ -61,6 +58,6 @@ strcpy: +@@ -61,6 +58,5 @@ strcpy: ldrneb r2, [r1], #1 #endif bne .Lloop @@ -971,7 +1013,6 @@ index 20e1029..cc376d3 100644 - .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 @@ -1007,10 +1048,10 @@ index 6b2b459..a6af8f0 100644 - .size strlen,.Lstrlen-strlen +FUNC_END strlen diff --git a/arm/syscalls.h b/arm/syscalls.h -index 774350a..6720496 100644 +index d092f55..21a6dcc 100644 --- a/arm/syscalls.h +++ b/arm/syscalls.h -@@ -697,9 +697,9 @@ +@@ -700,9 +700,9 @@ #define __ARGS_getpeername 0 #define __ARGS_socketpair 0 #define __ARGS_send 0 @@ -1022,7 +1063,7 @@ index 774350a..6720496 100644 #define __ARGS_shutdown 0 #define __ARGS_setsockopt 0 #define __ARGS_getsockopt 0 -@@ -768,70 +768,30 @@ +@@ -771,70 +771,30 @@ #ifdef __ASSEMBLER__ @@ -1103,7 +1144,7 @@ index 774350a..6720496 100644 .ifgt \typ mov ip, sp stmfd sp!,{r4, r5, r6} -@@ -843,6 +803,7 @@ +@@ -846,6 +806,7 @@ .else b __unified_syscall .endif @@ -1112,7 +1153,7 @@ index 774350a..6720496 100644 #endif diff --git a/arm/unified.S b/arm/unified.S -index 3023032..999d4f3 100644 +index e6ea3f6..bd5b987 100644 --- a/arm/unified.S +++ b/arm/unified.S @@ -1,21 +1,28 @@ @@ -1156,15 +1197,16 @@ index 3023032..999d4f3 100644 cmn r0, #4096 rsbcs r2, r0, #0 ldrcs r3, 1f -@@ -25,15 +32,17 @@ __unified_syscall: +@@ -25,17 +32,18 @@ __unified_syscall: .balign 4 1: .word errno -- --/* here we go and "reuse" the return for weak-void functions */ +FUNC_END __unified_syscall -+ + +-/* here we go and "reuse" the return for weak-void functions */ #include "dietuglyweaks.h" + +- mov pc, lr @ return + RET #else @@ -1178,13 +1220,12 @@ index 3023032..999d4f3 100644 cmn r0, #4096 movcc pc, lr @ return value comes direct from kernel. -@@ -50,11 +59,14 @@ __unified_syscall: - +@@ -53,10 +61,13 @@ __unified_syscall: /* here we go and "reuse" the return for weak-void functions */ #include "dietuglyweaks.h" -+ RET - mov pc, lr @ return ++ RET #ifndef WANT_THREAD_SAFE + .align 2 @@ -1220,22 +1261,6 @@ index 2c3a75b..0d099a8 100644 - .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 -+++ b/diet.c -@@ -32,11 +32,7 @@ static const char* Os[] = { - "sparc","-Os","-mcpu=supersparc",0, - "sparc64","-Os","-m64","-mhard-quad-float",0, - "alpha","-Os","-fomit-frame-pointer",0, --#ifdef __ARM_EABI__ -- "arm","-Os","-fomit-frame-pointer","-mfloat-abi=soft","-meabi=4",0, --#else - "arm","-Os","-fomit-frame-pointer",0, --#endif - "mips","-Os","-fomit-frame-pointer","-mno-abicalls","-fno-pic","-G","0",0, - "mipsel","-Os","-fomit-frame-pointer","-mno-abicalls","-fno-pic","-G","0",0, - "ppc","-Os","-fomit-frame-pointer","-mpowerpc-gpopt","-mpowerpc-gfxopt",0, diff --git a/dietdirent.h b/dietdirent.h index dbd7206..3e823f8 100644 --- a/dietdirent.h @@ -1368,50 +1393,29 @@ index ca278d7..da36845 100644 fini_entry: .long 0 diff --git a/i386/start.S b/i386/start.S -index 94a4f73..9ad41ff 100644 +index 361af3d..b681d05 100644 --- a/i386/start.S +++ b/i386/start.S -@@ -25,6 +25,13 @@ _start: +@@ -20,12 +20,18 @@ _start: PIC_INIT /* non-PIC: this is an empty line */ - PUT_VAR %eax, environ, %ecx /* non-PIC: movl %eax,environ */ + PUT_VAR %esi, environ, %ecx /* non-PIC: movl %esi,environ */ -+#ifdef WANT_ELFINFO -+1: add $4, %eax /* increment envp */ -+ cmpl $0, -4(%eax) /* load envp[-1] */ -+ jne 1b /* ... until envp[-1]==NULL */ -+ PUT_VAR %eax, __elfinfo, %ecx +-#ifdef WANT_SYSENTER ++#if defined(WANT_ELFINFO) || defined(WANT_SYSENTER) + /* skip environment, scan for NULL */ + 1: + lodsl + testl %eax,%eax + jnz 1b ++# ifdef WANT_ELFINFO ++ PUT_VAR %esi, __elfinfo, %ecx ++# endif +#endif + - #ifdef PROFILING - pushl $_etext - pushl $.text -diff --git a/ia64/__alarm.c b/ia64/__alarm.c -deleted file mode 100644 -index e2c499f..0000000 ---- a/ia64/__alarm.c -+++ /dev/null -@@ -1 +0,0 @@ --#include "alpha/__alarm.c" -diff --git a/ia64/__time.c b/ia64/__time.c -deleted file mode 100644 -index 7547acb..0000000 ---- a/ia64/__time.c -+++ /dev/null -@@ -1,14 +0,0 @@ --#include --#include -- --time_t time(time_t*t) { -- struct timeval tv; -- time_t ret; -- if (gettimeofday(&tv,0)) { -- ret=(time_t)-1; -- } else { -- ret=(time_t)tv.tv_sec; -- } -- if (t) *t=ret; -- return ret; --} ++#ifdef WANT_SYSENTER + /* The ELF auxvec follows the environment, consists of key/value pairs. + We are looking for key 32, which stands for the vsyscall page */ + 1: diff --git a/ia64/start.S b/ia64/start.S index 50fd015..c917721 100644 --- a/ia64/start.S @@ -1433,29 +1437,6 @@ 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 @@ -1470,7 +1451,7 @@ index 553b4fa..9bf216f 100644 #define _PATH_DEVNULL "/dev/null" diff --git a/include/stdlib.h b/include/stdlib.h -index b3b0e15..bd3fabf 100644 +index 4976f86..1dd10ff 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -28,8 +28,12 @@ long double strtold(const char *nptr, char **endptr) __THROW; @@ -1516,41 +1497,6 @@ 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 ---- /dev/null -+++ b/lib/__alarm.c -@@ -0,0 +1,16 @@ -+#include -+#include -+#include -+ -+#ifndef __NR_alarm -+unsigned int alarm(unsigned int seconds) { -+ struct itimerval old, new; -+ unsigned int ret; -+ new.it_interval.tv_usec=0; -+ new.it_interval.tv_sec=0; -+ new.it_value.tv_usec =0; -+ new.it_value.tv_sec =(long)seconds; -+ if (setitimer(ITIMER_REAL,&new,&old)==-1) return 0; -+ return old.it_value.tv_sec+(old.it_value.tv_usec?1:0); -+} -+#endif diff --git a/lib/__dtostr.c b/lib/__dtostr.c index 1d082e3..bc61200 100644 --- a/lib/__dtostr.c @@ -1618,32 +1564,6 @@ index 0000000..8a2e3bc + + return NULL; +} -diff --git a/lib/__mmap.c b/lib/__mmap.c -new file mode 100644 -index 0000000..1b035c3 ---- /dev/null -+++ b/lib/__mmap.c -@@ -0,0 +1,20 @@ -+#include -+#include -+#include -+ -+#ifndef __NR_mmap -+void*__mmap2(void*start,size_t length,int prot,int flags,int fd,off_t pgoffset); -+void *mmap(void *addr, size_t length, int prot, int flags, int fd, -+ off_t offset) -+{ -+ size_t pgsz = 4096; /* TODO: fix for dynamic PAGESIZEs needed? */ -+ void *res; -+ -+ if (__unlikely(offset & (pgsz - 1))) { -+ errno = -EINVAL; -+ res = MAP_FAILED; -+ } else -+ res = __mmap2(addr, length, prot, flags, fd, offset / pgsz); -+ return res; -+} -+#endif diff --git a/lib/__nice.c b/lib/__nice.c index d751104..8e205c0 100644 --- a/lib/__nice.c @@ -1664,69 +1584,22 @@ index d751104..8e205c0 100644 + return getpriority(PRIO_PROCESS,0); } #endif -diff --git a/lib/__time.c b/lib/__time.c -new file mode 100644 -index 0000000..87a6d5d ---- /dev/null -+++ b/lib/__time.c -@@ -0,0 +1,15 @@ -+#include -+#include -+#include -+ -+#ifndef __NR_time -+time_t time(time_t *t) -+{ -+ struct timeval tv; -+ if (__unlikely(gettimeofday(&tv, NULL) < 0)) -+ tv.tv_sec = -1; -+ if (t) -+ *t = tv.tv_sec; -+ 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..0e4d0df ---- /dev/null +index e013265..0e4d0df 100644 +--- a/lib/__utime.c +++ b/lib/__utime.c -@@ -0,0 +1,21 @@ -+#include -+ -+#ifndef __NR_utime +@@ -1,7 +1,10 @@ +-#include + #include + + #ifndef __NR_utime +#define _BSD_SOURCE +#include +#include + -+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 + int utime(const char *filename, const struct utimbuf *times) + { + if (times == NULL) diff --git a/lib/__v_printf.c b/lib/__v_printf.c index 36202f5..964c005 100644 --- a/lib/__v_printf.c @@ -1913,19 +1786,6 @@ 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 @@ -1971,17 +1831,10 @@ index 924f0a8..06d073b 100644 if (errno==ENOSYS) { trygetdents64=0; diff --git a/lib/stack_smash_handler2.c b/lib/stack_smash_handler2.c -index 9e85099..b03c0d5 100644 +index 9e85099..83c0cef 100644 --- a/lib/stack_smash_handler2.c +++ b/lib/stack_smash_handler2.c -@@ -2,11 +2,20 @@ - #include - - void __stack_chk_fail(void); -+void __stack_chk_fail_local(void) __attribute__((__alias__("__stack_chk_fail"))); - - /* earlier versions of ProPolice actually gave the address and function - * name as arguments to the handler, so it could print some useful +@@ -8,5 +8,16 @@ void __stack_chk_fail(void); * diagnostics. No more. :-( */ void __stack_chk_fail(void) { __write2("smashed stack detected, program terminated.\n"); @@ -1993,11 +1846,14 @@ index 9e85099..b03c0d5 100644 + * TODO: limit this to systems which are known to have an MMU (resp. is + * dietlibc with stack-protector used on systems without an MMU?) + */ -+ while (1) -+ *(char *)0 = 0; ++ *(char volatile *)0 = 0; ++ while (1) { ++ asm(""); ++ __builtin_unreachable(); ++ } } diff --git a/lib/stackgap.c b/lib/stackgap.c -index 3ba6954..d4a505b 100644 +index 6f1f5c4..1a3af01 100644 --- a/lib/stackgap.c +++ b/lib/stackgap.c @@ -16,6 +16,7 @@ @@ -2042,7 +1898,7 @@ index 3ba6954..d4a505b 100644 if (!x || !n) return; /* a kernel this old does not support thread local storage anyway */ for (i=0; i - #include +@@ -6,6 +6,9 @@ + #define _GNU_SOURCE + #include +#include "dietelfinfo.h" +#include "dietpagesize.h" @@ -2170,7 +2026,7 @@ index 5a6259c..507de94 100644 extern int __sc_nr_cpus(); static long physpages() { -@@ -40,6 +43,14 @@ long sysconf(int name) +@@ -42,6 +45,14 @@ long sysconf(int name) return limit.rlim_cur; } case _SC_CLK_TCK: @@ -2185,7 +2041,7 @@ index 5a6259c..507de94 100644 #ifdef __alpha__ return 1024; #else -@@ -47,11 +58,7 @@ long sysconf(int name) +@@ -49,11 +60,7 @@ long sysconf(int name) #endif case _SC_PAGESIZE: @@ -2198,6 +2054,104 @@ index 5a6259c..507de94 100644 case _SC_PHYS_PAGES: return physpages(); +diff --git a/libm/ceil.c b/libm/ceil.c +new file mode 100644 +index 0000000..c126b02 +--- /dev/null ++++ b/libm/ceil.c +@@ -0,0 +1,92 @@ ++/* @(#)s_ceil.c 5.1 93/09/24 */ ++/* ++ * ==================================================== ++ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. ++ * ++ * Developed at SunPro, a Sun Microsystems, Inc. business. ++ * Permission to use, copy, modify, and distribute this ++ * software is freely granted, provided that this notice ++ * is preserved. ++ * ==================================================== ++ */ ++ ++/* ++ * ceil(x) ++ * Return x rounded toward -inf to integral value ++ * Method: ++ * Bit twiddling. ++ * Exception: ++ * Inexact flag raised if x not equal to ceil(x). ++ */ ++ ++#include ++ ++typedef union { ++ double value; ++ struct { ++ unsigned int lsw; ++ unsigned int msw; ++ } parts; ++} ieee_double_shape_type; ++ ++/* Get two 32 bit ints from a double. */ ++ ++#define EXTRACT_WORDS(ix0,ix1,d) \ ++do { \ ++ ieee_double_shape_type ew_u; \ ++ ew_u.value = (d); \ ++ (ix0) = ew_u.parts.msw; \ ++ (ix1) = ew_u.parts.lsw; \ ++} while (0) ++ ++#define INSERT_WORDS(d,ix0,ix1) \ ++do { \ ++ ieee_double_shape_type iw_u; \ ++ iw_u.parts.msw = (ix0); \ ++ iw_u.parts.lsw = (ix1); \ ++ (d) = iw_u.value; \ ++} while (0) ++ ++static const double huge = 1.0e300; ++ ++double ceil(double x) ++{ ++ int i0,i1,j0; ++ unsigned int i,j; ++ EXTRACT_WORDS(i0,i1,x); ++ j0 = ((i0>>20)&0x7ff)-0x3ff; ++ if(j0<20) { ++ if(j0<0) { /* raise inexact if x != 0 */ ++ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ ++ if(i0<0) {i0=0x80000000;i1=0;} ++ else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;} ++ } ++ } else { ++ i = (0x000fffff)>>j0; ++ if(((i0&i)|i1)==0) return x; /* x is integral */ ++ if(huge+x>0.0) { /* raise inexact flag */ ++ if(i0>0) i0 += (0x00100000)>>j0; ++ i0 &= (~i); i1=0; ++ } ++ } ++ } else if (j0>51) { ++ if(j0==0x400) return x+x; /* inf or NaN */ ++ else return x; /* x is integral */ ++ } else { ++ i = ((unsigned int)(0xffffffff))>>(j0-20); ++ if((i1&i)==0) return x; /* x is integral */ ++ if(huge+x>0.0) { /* raise inexact flag */ ++ if(i0>0) { ++ if(j0==20) i0+=1; ++ else { ++ j = i1 + (1<<(52-j0)); ++ if(j --#include -- --time_t time(time_t *t) { -- struct timeval tv; -- if (gettimeofday(&tv, 0) == -1) -- tv.tv_sec=-1; -- if (t) *t=tv.tv_sec; -- return tv.tv_sec; --} diff --git a/s390x/start.S b/s390x/start.S index 25895a6..15ad1f9 100644 --- a/s390x/start.S @@ -2502,13 +2440,6 @@ index a7841e3..bb463c9 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/sparc64/__time.c b/sparc64/__time.c -deleted file mode 100644 -index efa1e8b..0000000 ---- a/sparc64/__time.c -+++ /dev/null -@@ -1 +0,0 @@ --#include "alpha/__time.c" diff --git a/sparc64/start.S b/sparc64/start.S index a79c4e7..a884658 100644 --- a/sparc64/start.S @@ -2531,30 +2462,6 @@ 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 @@ -2587,87 +2494,32 @@ index a4dd95e..294f2d4 100644 +.size __elfinfo,.-__elfinfo +#endif diff --git a/syscalls.s/fadvise64.S b/syscalls.s/fadvise64.S -index 0f96da9..fe448b1 100644 +index eab3986..fe448b1 100644 --- a/syscalls.s/fadvise64.S +++ b/syscalls.s/fadvise64.S -@@ -1,3 +1,11 @@ +@@ -1,12 +1,11 @@ #include "syscalls.h" +#ifdef __NR_fadvise64 - syscall(fadvise64,fadvise64) ++syscall(fadvise64,fadvise64) + -+#ifndef __NR_fadvise64_64 + #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 + .globl posix_fadvise +-.type posix_fadvise,@function +-posix_fadvise: #endif -diff --git a/syscalls.s/getrlimit.S b/syscalls.s/getrlimit.S -index 1c63c01..3341add 100644 ---- a/syscalls.s/getrlimit.S -+++ b/syscalls.s/getrlimit.S -@@ -1,3 +1,11 @@ - #include "syscalls.h" -+#ifdef __NR_ugetrlimit -+ -+syscall(ugetrlimit,getrlimit) -+ -+#elif defined(__NR_getrlimit) -+ - syscall(getrlimit,getrlimit) -+ -+#endif -diff --git a/syscalls.s/mmap.S b/syscalls.s/mmap.S -index 2e57fbb..486b531 100644 ---- a/syscalls.s/mmap.S -+++ b/syscalls.s/mmap.S -@@ -1,3 +1,7 @@ - #include "syscalls.h" - -+#ifdef __NR_mmap -+ - 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 +-#ifdef __NR_fadvise64 +-syscall(fadvise64,fadvise64) +- + #endif diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 -index 0000000..9d74220 +index 0000000..92c5678 --- /dev/null +++ b/test/.gitignore -@@ -0,0 +1,81 @@ +@@ -0,0 +1,85 @@ +/adjtime +/alarm +/argv @@ -2679,10 +2531,12 @@ index 0000000..9d74220 +/confstr +/cycles +/empty ++/fadvise +/ffs +/flush +/fnmatch +/fputc ++/ftruncate +/ftw +/fwrite +/getaddrinfo @@ -2730,7 +2584,9 @@ index 0000000..9d74220 +/select +/sendfile +/servent ++/setjmp +/siglist ++/sigsetjmp +/speed +/spent +/sprintf @@ -2750,23 +2606,24 @@ index 0000000..9d74220 +/utime +/waitpid diff --git a/test/Makefile b/test/Makefile -index eea0075..8f5b964 100644 +index 2e406f3..152cf5a 100644 --- a/test/Makefile +++ b/test/Makefile -@@ -7,14 +7,14 @@ CFLAGS=-nostdinc -Wall - +@@ -8,13 +8,13 @@ CFLAGS=-nostdinc -Wall 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 fadvise flush fnmatch \ - fputc ftw fwrite getaddrinfo getenv getgrnam gethostbyaddr gethostbyname \ + TESTPROGRAMS=adjtime alarm argv asprintf atexit bsearch byteswap calloc confstr cycles empty fadvise flush fnmatch \ +-fputc ftw fwrite getaddrinfo getenv getgrnam gethostbyaddr gethostbyname \ ++fputc ftruncate 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 \ +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 sysenter ungetc waitpid +-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 utime waitpid ++protoent prototypes putenv pwent rand48 read1 readdir regex select sendfile servent setjmp siglist \ ++sigsetjmp speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr \ +strstr strtol sysconf sysenter ungetc utime waitpid test: $(TESTPROGRAMS) @@ -2802,76 +2659,6 @@ index d42d129..8d7a016 100644 + 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 ---- /dev/null -+++ b/test/alarm.c -@@ -0,0 +1,64 @@ -+#include -+#include -+ -+#include -+#include -+#include -+ -+static volatile int alrm_triggered; -+ -+static void sig_alrm(int s) -+{ -+ alrm_triggered = 1; -+} -+ -+int main() -+{ -+ int rc; -+ time_t end; -+ sighandler_t old_sig; -+ -+ alarm(50); -+ -+ old_sig = signal(SIGALRM, &sig_alrm); -+ assert(old_sig != SIG_ERR); -+ -+ /* check whether alarm() returns correct number of remaining -+ * seconds */ -+ rc = alarm(2); -+ assert(rc > 40 && rc <= 50); -+ -+ /* check whether SIGALRM is triggered within the set time */ -+ end = time(NULL) + 5; -+ while (!alrm_triggered && time(NULL) < end) { -+ /* noop */ -+ } -+ assert(alrm_triggered); -+ -+ /* there should be no pending alarm */ -+ rc = alarm(0); -+ assert(rc == 0); -+ -+ alrm_triggered = 0; -+ -+ /* test whether alarm can be canceled */ -+ rc = alarm(2); -+ assert(rc == 0); -+ -+ rc = alarm(0); -+ assert(rc > 0 && rc < 4); -+ assert(!alrm_triggered); -+ -+ /* there should not happen an alarm */ -+ end = time(NULL) + 5; -+ while (!alrm_triggered && time(NULL) < end) { -+ /* noop */ -+ } -+ assert(!alrm_triggered); -+ -+ /* there should be no pending alarm */ -+ rc = alarm(0); -+ assert(rc == 0); -+ -+ return EXIT_SUCCESS; -+} diff --git a/test/asprintf.c b/test/asprintf.c index 996a5aa..0d4f2eb 100644 --- a/test/asprintf.c @@ -2963,30 +2750,62 @@ index 0000000..eea7a22 @@ -0,0 +1,2 @@ +/opendir-tst1 +/tst-seekdir -diff --git a/test/fadvise.c b/test/fadvise.c +diff --git a/test/ftruncate.c b/test/ftruncate.c new file mode 100644 -index 0000000..cdd6428 +index 0000000..53b70bd --- /dev/null -+++ b/test/fadvise.c -@@ -0,0 +1,21 @@ ++++ b/test/ftruncate.c +@@ -0,0 +1,53 @@ +#define _GNU_SOURCE +#define _XOPEN_SOURCE 600 ++#define _FILE_OFFSET_BITS 64 + +#include +#include +#include +#include + ++#define CHECK(_sz) \ ++ assert(ftruncate(fd, (_sz)) == 0); \ ++ assert(fstat(fd, &st) == 0); \ ++ assert(st.st_size == (_sz)); \ ++ ++#define CHECK64(_sz) \ ++ assert(ftruncate64(fd, (_sz)) == 0); \ ++ assert(fstat64(fd, &st64) == 0); \ ++ assert(st64.st_size == (_sz)); \ ++ +int main(void) +{ + char file[] = "/tmp/dietlibc-fadvise-test.XXXXXX"; + int fd; ++ struct stat st; + + fd = mkstemp(file); + unlink(file); + -+ assert(posix_fadvise(fd, 23, 42, POSIX_FADV_RANDOM) == 0); -+ close(fd); ++ assert(ftruncate(fd, 500000) == 0); ++ assert(fstat(fd, &st) == 0); ++ ++ if (st.st_blocks > 1) { ++ /* spare files not supported by filesystem :( */ ++ return EXIT_SUCCESS; ++ } ++ ++ CHECK(1); ++ CHECK(0x7fffffff); ++ ++#if __WORDSIZE == 32 ++ { ++ struct stat64 st64; ++ CHECK64(1); ++ CHECK64(0x7fffffff); ++ CHECK64(0x80000001ul); ++ CHECK64(0x17fffffffull); ++ } ++#else ++ CHECK(0x17fffffffull); ++#endif + + return EXIT_SUCCESS; +} @@ -3269,14 +3088,14 @@ index 4f5b08f..1e67632 100644 return 0; } diff --git a/test/runtests.sh b/test/runtests.sh -index 6d89efb..4703888 100644 +index d6fb19b..15b70b1 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 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" +-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 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 utime waitpid" ++TESTPROGRAMS="adjtime alarm argv atexit bsearch byteswap calloc confstr empty fadvise flush fputc ffs fnmatch ftruncate 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 setjmp siglist sigsetjmp speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysconf sysenter ungetc utime waitpid" STDIN="read1" PASS="getpass" @@ -3291,6 +3110,264 @@ index d43cdd2..28b3af5 100644 -return 0; + return ret<0 ? 1 : 0; } +diff --git a/test/setjmp.c b/test/setjmp.c +new file mode 100644 +index 0000000..15951e5 +--- /dev/null ++++ b/test/setjmp.c +@@ -0,0 +1,106 @@ ++#include ++#include ++#include ++#include ++ ++static int Xmemcmp(void const volatile *a, void const volatile *b, size_t l) ++{ ++ return memcmp((void const *)a, (void const *)b, l); ++} ++ ++int main(void) ++{ ++ char volatile a[8] = "testbufA"; ++ jmp_buf env; ++ char volatile b[8] = "testbufB"; ++ ++ assert(Xmemcmp(a, "testbufA", 8) == 0); ++ assert(Xmemcmp(b, "testbufB", 8) == 0); ++ ++ ++ /* Test 1: not calling longjmp */ ++ if (setjmp(env) == 0) { ++ char volatile somebuf[128]; ++ ++ memset((void *)somebuf, 0xde, sizeof somebuf); ++ ++ assert(Xmemcmp(a, "testbufA", 8) == 0); ++ assert(Xmemcmp(b, "testbufB", 8) == 0); ++ } else ++ assert(0); ++ ++ assert(Xmemcmp(a, "testbufA", 8) == 0); ++ assert(Xmemcmp(b, "testbufB", 8) == 0); ++ ++ ++ /* Test 2: calling longjmp */ ++ switch (setjmp(env)) { ++ case 0: { ++ char volatile somebuf[128]; ++ ++ memset((void *)somebuf, 0xde, sizeof somebuf); ++ ++ assert(Xmemcmp(a, "testbufA", 8) == 0); ++ assert(Xmemcmp(b, "testbufB", 8) == 0); ++ ++ longjmp(env, 23); ++ ++ a[0] = 'X'; ++ b[0] = 'X'; ++ } ++ ++ case 23: ++ break; ++ ++ default: ++ assert(0); ++ } ++ ++ assert(Xmemcmp(a, "testbufA", 8) == 0); ++ assert(Xmemcmp(b, "testbufB", 8) == 0); ++ ++ ++ /* Test 3: calling longjmp again with dirty env */ ++ switch (setjmp(env)) { ++ case 0: { ++ char volatile somebuf[128]; ++ ++ memset((void *)somebuf, 0xde, sizeof somebuf); ++ ++ assert(Xmemcmp(a, "testbufA", 8) == 0); ++ assert(Xmemcmp(b, "testbufB", 8) == 0); ++ ++ longjmp(env, 23); ++ ++ a[0] = 'X'; ++ b[0] = 'X'; ++ } ++ ++ case 23: ++ break; ++ ++ default: ++ assert(0); ++ } ++ ++ assert(Xmemcmp(a, "testbufA", 8) == 0); ++ assert(Xmemcmp(b, "testbufB", 8) == 0); ++ ++ ++ /* Test 4: not calling longjmp, but dirty env */ ++ if (setjmp(env) == 0) { ++ char volatile somebuf[128]; ++ ++ memset((void *)somebuf, 0xde, sizeof somebuf); ++ ++ assert(Xmemcmp(a, "testbufA", 8) == 0); ++ assert(Xmemcmp(b, "testbufB", 8) == 0); ++ } else ++ assert(0); ++ ++ assert(Xmemcmp(a, "testbufA", 8) == 0); ++ assert(Xmemcmp(b, "testbufB", 8) == 0); ++ ++ ++ return EXIT_SUCCESS; ++} +diff --git a/test/sigsetjmp.c b/test/sigsetjmp.c +new file mode 100644 +index 0000000..3fa71bb +--- /dev/null ++++ b/test/sigsetjmp.c +@@ -0,0 +1,140 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define TEST_PATTERN \ ++ "0123456789abcdefghijklmnopqrstuv" \ ++ "ZYXWVUTSRQPONMLKJIHGFEDCBA987654" \ ++ "456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ ++ "vutsrqponmlkjihgfedcba9876543210" \ ++ "0123456789ABCDEFGHIJKLMNOPQRSTUV" \ ++ "zyxwvutsrqponmlkjihgfedcba987654" \ ++ "456789abcdefghijklmnopqrstuvwxyz" \ ++ "VUTSRQPONMLKJIHGFEDCBA987654321" \ ++ ++static struct { ++ char volatile a[256]; ++ sigjmp_buf env; ++ char volatile b[256]; ++} sigenv = { ++ .a = TEST_PATTERN "<", ++ .b = TEST_PATTERN ">", ++}; ++ ++static int volatile sig_seen; ++ ++#define VALIDATE_BUFFERS(_sig_exp) do { \ ++ assert(Xmemcmp(sigenv.a, TEST_PATTERN "<", sizeof sigenv.a) == 0); \ ++ assert(Xmemcmp(sigenv.b, TEST_PATTERN ">", sizeof sigenv.b) == 0); \ ++ assert(sig_seen == (_sig_exp)); \ ++ } while (0) ++ ++static int Xmemcmp(void const volatile *a, void const volatile *b, size_t l) ++{ ++ return memcmp((void const *)a, (void const *)b, l); ++} ++ ++static void do_test(int sig_num, int do_save, int block_sig) ++{ ++ int rc; ++ sigset_t block_set; ++ sigset_t cur_set; ++ ++ printf("%s(%d,%d,%d)... ", __func__, sig_num, do_save, block_sig); ++ fflush(stdout); ++ ++ VALIDATE_BUFFERS(0); ++ ++ sigemptyset(&block_set); ++ assert(sigprocmask(SIG_SETMASK, NULL, &cur_set) == 0); ++ ++ /* verify that tested signal is not blocked */ ++ if (sig_num != 0) ++ assert(!sigismember(&cur_set, sig_num)); ++ ++ /* verify that blocked signal is not already blocked and fill signal set */ ++ if (block_sig != 0) { ++ assert(!sigismember(&cur_set, block_sig)); ++ sigaddset(&block_set, block_sig); ++ } ++ ++ sig_seen = 0; ++ rc = sigsetjmp(sigenv.env, do_save); ++ if (rc == 0) { ++ char volatile somebuf[128]; ++ ++ memset((void *)somebuf, 0x42, sizeof somebuf); ++ VALIDATE_BUFFERS(0); ++ ++ /* modify signal mask */ ++ if (block_sig != 0) ++ assert(sigprocmask(SIG_BLOCK, &block_set, NULL) == 0); ++ ++ /* raise a signal which triggers a siglongjmp */ ++ if (sig_num != 0) { ++ raise(sig_num); ++ sigenv.a[0] = 'X'; ++ sigenv.b[0] = 'X'; ++ assert(0); ++ } ++ } else if (rc != sig_num) ++ /* sigsetjmp() returned with an unexpected value */ ++ assert(0); ++ ++ VALIDATE_BUFFERS(sig_num); ++ sig_seen = 0; ++ ++ /* check whether current signal mask contains the blocked signal; it should ++ be there iff sigsetjmp() was triggered and sigmask was saved. */ ++ if (block_sig != 0) { ++ sigset_t cur_set; ++ assert(sigprocmask(SIG_SETMASK, NULL, &cur_set) == 0); ++ ++ if (do_save && rc != 0) ++ assert(!sigismember(&cur_set, block_sig)); ++ else { ++ assert( sigismember(&cur_set, block_sig)); ++ sigprocmask(SIG_UNBLOCK, &block_set, NULL); ++ } ++ } ++ ++ printf(" ok\n"); ++}; ++ ++static void sig_handler(int num) ++{ ++ assert(sig_seen == 0); ++ sig_seen = num; ++ siglongjmp(sigenv.env, num); ++} ++ ++int main(void) ++{ ++ struct sigaction sigact = { ++ .sa_handler = sig_handler, ++ .sa_flags = SA_NODEFER, /* raised signal will be in blocked mask else */ ++ }; ++ ++ /* verify our assumptions about the memory layout */ ++ assert(sizeof sigenv.a == 256); ++ assert(sizeof sigenv.b == 256); ++ assert(offsetof(__typeof__(sigenv), env) == sizeof sigenv.a); ++ assert(offsetof(__typeof__(sigenv), b) == sizeof sigenv.a + sizeof sigenv.env); ++ ++ sigaction(SIGBUS, &sigact, NULL); ++ sigaction(SIGUSR1, &sigact, NULL); ++ ++ do_test(0, 0, 0); ++ do_test(0, 0, SIGUSR1); ++ do_test(0, 1, 0); ++ do_test(0, 1, SIGUSR1); ++ do_test(SIGBUS, 0, 0); ++ do_test(SIGBUS, 0, SIGUSR1); ++ do_test(SIGBUS, 1, 0); ++ do_test(SIGBUS, 1, SIGUSR1); ++ ++ return EXIT_SUCCESS; ++} diff --git a/test/speed.c b/test/speed.c index 674b9a8..22249a7 100644 --- a/test/speed.c @@ -3664,49 +3741,6 @@ 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 @@ -3722,28 +3756,18 @@ index fe2cb5b..92c0b0e 100644 } diff --git a/x86_64/__time.S b/x86_64/__time.S new file mode 100644 -index 0000000..9d2d4b4 +index 0000000..774b67f --- /dev/null +++ b/x86_64/__time.S -@@ -0,0 +1,21 @@ +@@ -0,0 +1,11 @@ +/* implement time(2) via gettimeofday(2) on x86-64 because gettimeofday + is a vsyscall (i.e. no actual switch to kernel mode) */ +.text +.global time +.type time,@function +time: -+ push %rdi -+ xor %rsi,%rsi -+ sub $16,%rsp -+ mov %rsp,%rdi -+ call gettimeofday -+ pop %rax -+ pop %rdi -+ pop %rdi -+ test %rdi,%rdi -+ jz 1f -+ mov %rax,(%rdi) -+1: ++ mov $0xffffffffff600400,%rax ++ call *%rax + ret +.Lhere: + .size time,.Lhere-time @@ -3781,29 +3805,19 @@ index adc461a..8b4f3c9 100644 #ifdef PROFILING pushq %rdi /* save reg args */ diff --git a/x86_64/time.S b/x86_64/time.S -index 9d2d4b4..dbe7894 100644 +index 774b67f..690ee30 100644 --- a/x86_64/time.S +++ b/x86_64/time.S -@@ -1,21 +1 @@ +@@ -1,11 +1 @@ -/* implement time(2) via gettimeofday(2) on x86-64 because gettimeofday - is a vsyscall (i.e. no actual switch to kernel mode) */ -.text -.global time -.type time,@function -time: -- push %rdi -- xor %rsi,%rsi -- sub $16,%rsp -- mov %rsp,%rdi -- call gettimeofday -- pop %rax -- pop %rdi -- pop %rdi -- test %rdi,%rdi -- jz 1f -- mov %rax,(%rdi) --1: +- mov $0xffffffffff600400,%rax +- call *%rax - ret -.Lhere: - .size time,.Lhere-time -+ .text /* avoid empty source file */ ++/* avoid empty source file */ diff --git a/dietlibc.spec b/dietlibc.spec index 30ee522..6b85fab 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -7,7 +7,7 @@ %bcond_without noarch ## -%global prerelease 20101223 +%global prerelease 20110311 %global pkglibdir %_prefix/lib/dietlibc %ifarch %ix86 x86_64 @@ -198,6 +198,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Mar 12 2011 Enrico Scholz - 0.33-0.1600.20110311 +- updated to 20110311 CVS snapshot +- rediffed patches + * Sun Feb 20 2011 Enrico Scholz - 0.33-0.1600.20101223 - other ARM enhancements - fixed missing headers in last utime(2) + fadvise(2) patches diff --git a/sources b/sources index 87c5fef..626985e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -44df912e2af432a413930387537d6bb2 dietlibc-0.33.20101223.tar.bz2 +5b0f5f5433db773cd9185c8ed79374f0 dietlibc-0.33.20110311.tar.bz2 From daabea0b25d8564b4aa8b81acf22f37a62090bd0 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 12 Mar 2011 21:31:42 +0100 Subject: [PATCH 095/161] disabled linux 2.2/2.4 compatibility code + valgrind nice mode --- dietlibc.spec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dietlibc.spec b/dietlibc.spec index 6b85fab..c7751e9 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -117,6 +117,10 @@ sed -i -e 's!^#define WANT_SSP$!// \0!g; %global xtra_fixcflags %nil %endif +sed -i \ + -e '/#define \(WANT_LARGEFILE_BACKCOMPAT\|WANT_VALGRIND_SUPPORT\)/d' \ + dietfeatures.h + %ifarch %ix86 sed -i \ -e '/#define WANT_DYN_PAGESIZE/{c\' \ @@ -200,6 +204,7 @@ rm -rf $RPM_BUILD_ROOT %changelog * Sat Mar 12 2011 Enrico Scholz - 0.33-0.1600.20110311 - updated to 20110311 CVS snapshot +- disabled linux 2.2/2.4 compatibility code + valgrind nice mode - rediffed patches * Sun Feb 20 2011 Enrico Scholz - 0.33-0.1600.20101223 From fd647b68b16eabe109b835ca6ce0de7a04c720d5 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 12 Mar 2011 21:32:01 +0100 Subject: [PATCH 096/161] set fixed page size for arm --- dietlibc.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index c7751e9..d2778a9 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -121,7 +121,7 @@ sed -i \ -e '/#define \(WANT_LARGEFILE_BACKCOMPAT\|WANT_VALGRIND_SUPPORT\)/d' \ dietfeatures.h -%ifarch %ix86 +%ifarch %ix86 arm sed -i \ -e '/#define WANT_DYN_PAGESIZE/{c\' \ -e '#define WANT_ELFINFO' \ @@ -204,6 +204,7 @@ rm -rf $RPM_BUILD_ROOT %changelog * Sat Mar 12 2011 Enrico Scholz - 0.33-0.1600.20110311 - updated to 20110311 CVS snapshot +- set fixed page size for arm - disabled linux 2.2/2.4 compatibility code + valgrind nice mode - rediffed patches From 02f25d8def516ca76d67cc4cebddab481dd2a492 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 12 Mar 2011 21:32:12 +0100 Subject: [PATCH 097/161] reduced stack size for testsuite --- dietlibc.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index d2778a9..ab7be6a 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -163,7 +163,7 @@ make %makeflags -C test all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) - make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) || : cd test -ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] +ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 bash ./runtests-X.sh @@ -206,6 +206,7 @@ rm -rf $RPM_BUILD_ROOT - updated to 20110311 CVS snapshot - set fixed page size for arm - disabled linux 2.2/2.4 compatibility code + valgrind nice mode +- reduced stack size for testsuite - rediffed patches * Sun Feb 20 2011 Enrico Scholz - 0.33-0.1600.20101223 From 26c9d4c27f100da4a521095686fac3d8a2377bdf Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 12 Mar 2011 22:28:45 +0100 Subject: [PATCH 098/161] create files in mkstemp() with O_LARGEFILE --- dietlibc-github.patch | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/dietlibc-github.patch b/dietlibc-github.patch index 84a5b44..b6f9402 100644 --- a/dietlibc-github.patch +++ b/dietlibc-github.patch @@ -44,6 +44,7 @@ lib/stackgap.c | 37 ++++++++++- libcompat/syscall.S | 8 ++- libcruft/getpagesize.c | 28 ++++----- + libcruft/mkstemp.c | 1 + libcruft/sysconf.c | 17 ++++-- libm/ceil.c | 92 +++++++++++++++++++++++++++++ libm/gamma.c | 26 ++++---- @@ -71,7 +72,7 @@ test/byteswap.c | 8 +- test/cycles.c | 5 +- test/dirent/.gitignore | 2 + - test/ftruncate.c | 53 +++++++++++++++++ + test/ftruncate.c | 54 +++++++++++++++++ test/getmntent.c | 6 +-- test/getservbyname.c | 1 + test/if_nameindex.c | 4 + @@ -105,7 +106,7 @@ x86_64/__time.S | 11 ++++ x86_64/start.S | 16 +++++ x86_64/time.S | 12 +---- - 107 files changed, 1536 insertions(+), 466 deletions(-) + 108 files changed, 1538 insertions(+), 466 deletions(-) diff --git a/.gitignore b/.gitignore new file mode 100644 @@ -2012,6 +2013,15 @@ index 5ff8973..ac701cf 100644 size_t getpagesize(void) __attribute__((weak,alias("__libc_getpagesize"))); - +diff --git a/libcruft/mkstemp.c b/libcruft/mkstemp.c +index 7dc19d4..226dec4 100644 +--- a/libcruft/mkstemp.c ++++ b/libcruft/mkstemp.c +@@ -1,3 +1,4 @@ ++#define _FILE_OFFSET_BITS 64 + #include + #include + #include diff --git a/libcruft/sysconf.c b/libcruft/sysconf.c index 6865026..089fbd3 100644 --- a/libcruft/sysconf.c @@ -2752,10 +2762,10 @@ index 0000000..eea7a22 +/tst-seekdir diff --git a/test/ftruncate.c b/test/ftruncate.c new file mode 100644 -index 0000000..53b70bd +index 0000000..e0ebb5d --- /dev/null +++ b/test/ftruncate.c -@@ -0,0 +1,53 @@ +@@ -0,0 +1,54 @@ +#define _GNU_SOURCE +#define _XOPEN_SOURCE 600 +#define _FILE_OFFSET_BITS 64 @@ -2764,6 +2774,7 @@ index 0000000..53b70bd +#include +#include +#include ++#include + +#define CHECK(_sz) \ + assert(ftruncate(fd, (_sz)) == 0); \ From 7604e732c27f6bf3568abdb7b2524ffd6525ee6f Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Thu, 12 Jan 2012 18:37:41 -0600 Subject: [PATCH 099/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index ab7be6a..b5ec9fc 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -34,7 +34,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1600 +Release: %release_func 1601 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -202,6 +202,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Fri Jan 13 2012 Fedora Release Engineering - 0.33-0.1601.20110311 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + * Sat Mar 12 2011 Enrico Scholz - 0.33-0.1600.20110311 - updated to 20110311 CVS snapshot - set fixed page size for arm From 566f0a438eda55034cfac7df75a272a5011e41fc Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 14 Jan 2012 14:47:06 +0100 Subject: [PATCH 100/161] generate .xz tarballs --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1af08ee..c64dfb6 100644 --- a/Makefile +++ b/Makefile @@ -9,4 +9,4 @@ _cvs_suffix = ${CVS_BASEVER}.${CVS_DATE} cvs-sources: cd ${DESTDIR} . && $(CVS) -d :pserver:cvs@cvs.fefe.de:/cvs -z9 export -D${CVS_DATE} -d dietlibc-${_cvs_suffix} dietlibc - cd ${DESTDIR} . && $(TAR) cjf dietlibc-${_cvs_suffix}.tar.bz2 dietlibc-${_cvs_suffix} --owner root --group root + cd ${DESTDIR} . && $(TAR) cJf dietlibc-${_cvs_suffix}.tar.xz dietlibc-${_cvs_suffix} --owner root --group root From edbb4f611118a5fff1a47fd2b3266c7033cb19dc Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 14 Jan 2012 14:49:53 +0100 Subject: [PATCH 101/161] verinfo: updated url --- verinfo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/verinfo b/verinfo index cc355f3..fb80d97 100644 --- a/verinfo +++ b/verinfo @@ -1,2 +1,2 @@ -http://www.kernel.org/pub/linux/libs/dietlibc/ -dietlibc-(.*?).tar.bz2 +http://www.fefe.de/dietlibc/ +/dietlibc-(.*?)\.tar\.bz2 From 752d6199deec0a4521f1f60706e40595d62bf697 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 14 Jan 2012 14:52:06 +0100 Subject: [PATCH 102/161] updated to 20111222 CVS snapshot removed github patch from scm and upload it to the source cache --- .gitignore | 6 +- dietlibc-github.patch | 3834 ----------------------------------------- dietlibc.spec | 12 +- sources | 3 +- 4 files changed, 12 insertions(+), 3843 deletions(-) delete mode 100644 dietlibc-github.patch diff --git a/.gitignore b/.gitignore index 7f1ea53..b0869ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -dietlibc-0.32.tar.bz2 -dietlibc-0.32.tar.bz2.sig -/dietlibc-0.33.20101223.tar.bz2 -/dietlibc-0.33.20110311.tar.bz2 +/dietlibc-0.33.20111222.tar.xz +/dietlibc-github.patch.gz diff --git a/dietlibc-github.patch b/dietlibc-github.patch deleted file mode 100644 index b6f9402..0000000 --- a/dietlibc-github.patch +++ /dev/null @@ -1,3834 +0,0 @@ - .gitignore | 1 + - Makefile | 76 +++++++++++++---------- - alpha/start.S | 9 +++ - arm/__aeabi_unwind_cpp.S | 25 +++----- - arm/__fadvise.c | 5 +- - arm/__guard.S | 3 + - arm/__longjmp.S | 13 +++-- - arm/__testandset.S | 16 ++++- - arm/arm-features.h | 103 ++++++++++++++++++++++++++++++++ - arm/clone.S | 22 ++++---- - arm/dyn_syscalls.S | 18 ++++-- - arm/mcount.S | 10 +-- - arm/md5asm.S | 26 +++----- - arm/mmap.S | 42 ------------- - arm/setjmp.S | 29 +++++---- - arm/start.S | 65 +++++++++++++-------- - arm/strcpy.S | 12 +--- - arm/strlen.S | 15 +---- - arm/syscalls.h | 65 ++++---------------- - arm/unified.S | 45 +++++++++----- - arm/waitpid.S | 19 ++---- - dietdirent.h | 6 ++- - dietelfinfo.h | 20 ++++++ - dietfeatures.h | 14 +++++ - dietpagesize.h | 31 ++++++++++ - dynlinker/ldso_start.S | 9 +++ - i386/start.S | 8 ++- - ia64/start.S | 10 +++ - include/paths.h | 2 +- - include/stdlib.h | 8 ++- - include/sys/shm.h | 9 --- - lib/__dtostr.c | 18 ++++-- - lib/__get_elf_aux_value.c | 14 +++++ - lib/__nice.c | 8 ++- - lib/__utime.c | 5 +- - lib/__v_printf.c | 59 ++++++++++--------- - lib/alloc.c | 9 ++- - lib/closedir.c | 4 +- - lib/mmap64.c | 6 +- - lib/opendir.c | 4 +- - lib/readdir.c | 2 +- - lib/readdir64.c | 6 +- - lib/stack_smash_handler2.c | 13 ++++- - lib/stackgap.c | 37 ++++++++++- - libcompat/syscall.S | 8 ++- - libcruft/getpagesize.c | 28 ++++----- - libcruft/mkstemp.c | 1 + - libcruft/sysconf.c | 17 ++++-- - libm/ceil.c | 92 +++++++++++++++++++++++++++++ - libm/gamma.c | 26 ++++---- - librpc/clnt_raw.c | 11 ++- - librpc/clnt_udp.c | 2 +- - libugly/strftime.c | 1 + - libugly/strptime.c | 5 +- - mips/start.S | 9 +++ - parisc/start.S | 10 +++ - ppc/start.S | 9 +++ - ppc64/start.S | 9 +++ - s390/start.S | 11 ++++ - s390x/start.S | 11 ++++ - sparc/shmat.c | 8 +-- - sparc/start.S | 11 ++++ - sparc64/start.S | 11 ++++ - syscalls.s/environ.S | 16 +++++ - syscalls.s/fadvise64.S | 9 +-- - test/.gitignore | 85 ++++++++++++++++++++++++++ - test/Makefile | 10 ++-- - test/adjtime.c | 18 +++++- - test/asprintf.c | 2 +- - test/atexit.c | 2 +- - test/bsearch.c | 2 +- - test/byteswap.c | 8 +- - test/cycles.c | 5 +- - test/dirent/.gitignore | 2 + - test/ftruncate.c | 54 +++++++++++++++++ - test/getmntent.c | 6 +-- - test/getservbyname.c | 1 + - test/if_nameindex.c | 4 + - test/malloc-debugger.c | 2 +- - test/math.c | 29 +++++++++ - test/mktime.c | 6 +- - test/mmap_test.c | 2 +- - test/pipe.c | 3 + - test/printf.c | 44 ++++++++++++-- - test/printftest.c | 6 +- - test/rand48.c | 12 ++-- - test/runtests.sh | 2 +- - test/sendfile.c | 2 +- - test/setjmp.c | 106 +++++++++++++++++++++++++++++++++ - test/sigsetjmp.c | 140 ++++++++++++++++++++++++++++++++++++++++++++ - test/speed.c | 4 +- - test/stdio/.gitignore | 14 +++++ - test/stdio/tstscanf.c | 4 +- - test/stdlib/.gitignore | 13 ++++ - test/stdlib/testsort.c | 2 + - test/stdlib/tst-calloc.c | 2 + - test/stdlib/tst-malloc.c | 6 ++- - test/stdlib/tst-strtod.c | 4 +- - test/string/.gitignore | 16 +++++ - test/sysconf.c | 80 +++++++++++++++++++++++++ - test/sysenter.c | 6 +- - test/time/.gitignore | 4 + - test/time/tst-strftime.c | 6 +- - test/time/tst-strptime.c | 23 ++++++- - test/waitpid.c | 2 +- - x86_64/__time.S | 11 ++++ - x86_64/start.S | 16 +++++ - x86_64/time.S | 12 +---- - 108 files changed, 1538 insertions(+), 466 deletions(-) - -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 -+++ b/Makefile -@@ -88,7 +88,7 @@ ILIBDIR=$(LIBDIR)-$(ARCH) - - HOME=$(shell pwd) - --WHAT= $(OBJDIR) $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \ -+WHAT= $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \ - $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a \ - $(OBJDIR)/libcompat.a $(OBJDIR)/libm.a \ - $(OBJDIR)/librpc.a $(OBJDIR)/libpthread.a \ -@@ -105,6 +105,7 @@ CROSS= - - CC=gcc - INC=-I. -isystem include -+STRIP=$(CROSS)strip - - VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:libcompat:libdl:librpc:libregex:libm:profiling - -@@ -128,6 +129,8 @@ LIBPTHREAD_OBJS=$(patsubst libpthread/%.c,$(OBJDIR)/%.o,$(shell ./threadsafe.sh) - - LIBGMON_OBJS=$(OBJDIR)/__mcount.o $(OBJDIR)/monitor.o $(OBJDIR)/profil.o - -+NO_STACK_PROTECTOR=stackgap.o __get_elf_aux_value.o -+ - include $(ARCH)/Makefile.add - - LIBMATHOBJ=$(patsubst %,$(OBJDIR)/%,$(LIBMATH)) -@@ -150,34 +153,36 @@ PWD=$(shell pwd) - # added real dynamic dietlibc.so - PICODIR = pic-$(ARCH) - --$(OBJDIR) $(PICODIR): -- mkdir $@ -- - % :: %,v - --$(OBJDIR)/%.o: $(OBJDIR) -+%/.dirstamp: -+ mkdir $* -+ @touch $@ - - ifeq ($(CC),tcc) --$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h -+$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp - $(CROSS)cpp $(INC) $< | $(CROSS)as -o $@ - --$(OBJDIR)/%.o: %.c -+$(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp - tcc -I. -Iinclude -c $< -o $@ -- $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ -+ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ - else --$(OBJDIR)/pstart.o: start.S -+$(OBJDIR)/pstart.o: start.S $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -DPROFILING -c $< -o $@ - --$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h -+$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ - --$(OBJDIR)/pthread_%.o: libpthread/pthread_%.c -+$(OBJDIR)/pthread_%.o: libpthread/pthread_%.c $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -- $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ -+ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ -+$(OBJDIR)/stack_smash_handler2.o: XCFLAGS:=-fno-omit-frame-pointer - --$(OBJDIR)/%.o: %.c -- $(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__ -- $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@ -+$(OBJDIR)/%.o: %.c $(OBJDIR)/.dirstamp -+ $(CROSS)$(CC) $(INC) $(CFLAGS) $(XCFLAGS) -c $< -o $@ -D__dietlibc__ -+ $(COMMENT) -$(STRIP) -x -R .comment -R .note $@ -+ -+$(addprefix $(OBJDIR)/,$(NO_STACK_PROTECTOR)): XCFLAGS+=-fno-stack-protector - endif - - ifeq ($(shell $(CC) -v 2>&1 | grep "gcc version"),gcc version 4.0.0) -@@ -190,7 +195,7 @@ endif - - CC+=-D__dietlibc__ - --$(OBJDIR)/crypt.o: libcrypt/crypt.c -+$(OBJDIR)/crypt.o: libcrypt/crypt.c $(OBJDIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(SAFER_CFLAGS) -c $< -o $@ - - DIETLIBC_OBJ = $(OBJDIR)/unified.o \ -@@ -205,7 +210,7 @@ $(OBJDIR)/dietlibc.a: $(DIETLIBC_OBJ) $(OBJDIR)/start.o - $(OBJDIR)/librpc.a: $(LIBRPCOBJ) - $(CROSS)ar cru $@ $(LIBRPCOBJ) - --$(OBJDIR)/libcrypt.a: -+$(OBJDIR)/libcrypt.a: $(OBJDIR)/.dirstamp - touch dummy.c - $(CROSS)$(CC) -c dummy.c - $(CROSS)ar cru $@ dummy.o -@@ -237,28 +242,28 @@ dyn: dyn_lib - $(OBJDIR)/libdl.a: $(LIBDLOBJ) - $(CROSS)ar cru $@ $(LIBDLOBJ) - --dyn_lib: $(PICODIR) $(PICODIR)/libc.so $(PICODIR)/dstart.o \ -+dyn_lib: $(PICODIR)/libc.so $(PICODIR)/dstart.o \ - $(PICODIR)/dyn_so_start.o $(PICODIR)/dyn_start.o $(PICODIR)/dyn_stop.o \ - $(PICODIR)/libpthread.so $(PICODIR)/libdl.so $(PICODIR)/libcompat.so \ - $(PICODIR)/libm.so $(PICODIR)/diet-dyn $(PICODIR)/diet-dyn-i - --$(PICODIR)/%.o: %.S $(ARCH)/syscalls.h -+$(PICODIR)/%.o: %.S $(ARCH)/syscalls.h $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ - --$(PICODIR)/pthread_%.o: libpthread/pthread_%.c -+$(PICODIR)/pthread_%.o: libpthread/pthread_%.c $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ -- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ -+ $(COMMENT) $(STRIP) -x -R .comment -R .note $@ - --$(PICODIR)/%.o: %.c -+$(PICODIR)/%.o: %.c $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ -- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ -+ $(COMMENT) $(STRIP) -x -R .comment -R .note $@ - --$(PICODIR)/dstart.o: start.S -+$(PICODIR)/dstart.o: start.S $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ - --$(PICODIR)/dyn_so_start.o: dyn_start.c -+$(PICODIR)/dyn_so_start.o: dyn_start.c $(PICODIR)/.dirstamp - $(CROSS)$(CC) $(INC) $(CFLAGS) -fPIC -D__DYN_LIB -D__DYN_LIB_SHARED -c $< -o $@ -- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ -+ $(COMMENT) $(STRIP) -x -R .comment -R .note $@ - - DYN_LIBC_PIC = $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \ - $(LIBCRUFTOBJ) $(LIBCRYPTOBJ) $(LIBSHELLOBJ) $(LIBREGEXOBJ) -@@ -274,13 +279,13 @@ DYN_LIBCOMPAT_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBCOMPATOBJ)) - - DYN_LIBMATH_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBMATHOBJ)) - --$(PICODIR)/libc.so: $(PICODIR) $(DYN_LIBC_OBJ) -+$(PICODIR)/libc.so: $(DYN_LIBC_OBJ) - $(LD_UNSET) $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBC_OBJ) -lgcc -Wl,-soname=libc.so - - $(PICODIR)/libpthread.so: $(DYN_PTHREAD_OBJS) dietfeatures.h - $(LD_UNSET) $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_PTHREAD_OBJS) -L$(PICODIR) -lc -Wl,-soname=libpthread.so - --$(PICODIR)/libdl.so: libdl/_dl_main.c dietfeatures.h -+$(PICODIR)/libdl.so: libdl/_dl_main.c dietfeatures.h $(PICODIR)/.dirstamp - $(LD_UNSET) $(CROSS)$(CC) -D__OD_CLEAN_ROOM -DNODIETREF -fPIC -nostdlib -shared -Bsymbolic -Wl,-Bsymbolic \ - -o $@ $(SAFE_CFLAGS) $(INC) libdl/_dl_main.c -Wl,-soname=libdl.so - -@@ -310,19 +315,19 @@ CURNAME=$(notdir $(shell pwd)) - - $(OBJDIR)/diet: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o - $(CROSS)$(CC) -isystem include $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -DVERSION=\"$(VERSION)\" -lgcc -- $(CROSS)strip -R .comment -R .note $@ -+ $(STRIP) -R .comment -R .note $@ - - $(OBJDIR)/diet-i: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o - $(CROSS)$(CC) -isystem include $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -DVERSION=\"$(VERSION)\" -DINSTALLVERSION -lgcc -- $(CROSS)strip -R .comment -R .note $@ -+ $(STRIP) -R .comment -R .note $@ - - $(PICODIR)/diet-dyn: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c - $(LD_UNSET) $(CROSS)$(CC) -isystem include $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(HOME)/$(PICODIR)/libdl.so -- $(CROSS)strip -R .command -R .note $@ -+ $(STRIP) -R .command -R .note $@ - - $(PICODIR)/diet-dyn-i: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c - $(LD_UNSET) $(CROSS)$(CC) -isystem include $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(ILIBDIR)/libdl.so -DINSTALLVERSION -- $(CROSS)strip -R .command -R .note $@ -+ $(STRIP) -R .command -R .note $@ - - $(OBJDIR)/djb: $(OBJDIR)/compile $(OBJDIR)/load - -@@ -335,7 +340,7 @@ $(OBJDIR)/load: - chmod 755 $@ - - clean: -- rm -f *.o *.a t t1 compile load elftrunc exports mapfile libdietc.so -+ rm -f *.o *.a t t1 compile load elftrunc exports mapfile libdietc.so .dirstamp - rm -rf bin-* pic-* - $(MAKE) -C examples clean - $(MAKE) -C dynlinker clean -@@ -531,3 +536,8 @@ $(OBJDIR)/stackgap.o: dietfeatures.h - - # WANT_MALLOC_ZERO - $(OBJDIR)/strndup.o: dietfeatures.h -+ -+ -+GIT_CVSIMPORT=git cvsimport -+cvsimport: -+ $(GIT_CVSIMPORT) -k -p '--cvs-direct' -d :pserver:cvs@cvs.fefe.de:/cvs dietlibc -diff --git a/alpha/start.S b/alpha/start.S -index 7e7cf9b..b13c9c9 100644 ---- a/alpha/start.S -+++ b/alpha/start.S -@@ -24,6 +24,15 @@ _start: - - stq $18, environ - -+#ifdef WANT_ELFINFO -+# warning "MAKE ME alpha ASSEMBLER!" -+1: ldq $19, $18 ; load *envp into $19 -+ addq $18, 1, $18 ; increment *envp -+ orr $19, $19, $19 -+ jne 1b -+ stq $18, __elfinfo -+#endif -+ - #ifdef WANT_DYNAMIC - /* in v0 ($0) is the ld.so _fini pointer */ - mov $0, $19 /* mov v0(dynload) to a3 */ -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 -index 0aa1246..c6748c4 100644 ---- a/arm/__fadvise.c -+++ b/arm/__fadvise.c -@@ -1,7 +1,10 @@ --#include - #include "syscalls.h" - - #ifndef __NR_fadvise64 -+#define _LINUX_SOURCE -+#include -+#include -+ - 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); -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..ba03146 100644 ---- a/arm/__longjmp.S -+++ b/arm/__longjmp.S -@@ -1,11 +1,14 @@ --.text --.global __longjmp --.type __longjmp,function --__longjmp: -+#include "arm-features.h" -+ -+FUNC_START __longjmp - mov ip, r0 - movs r0, r1 - moveq r0, #1 - #ifndef __SOFTFP__ -- lfm f4, 4, [ip], #48 -+ lfm f4, 4, [ip, #10*4] -+#endif -+#ifdef __IWMMXT__ -+# warning "sigjmp will not restore iwmmxt coprocessor registers" - #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" -+ -+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 -+ ldrd r4, [sp,#16] -+#endif -+.endm -+ -+#endif /* __ASSEMBLER__ */ -+ -+#endif /* H_DIETLIBC_ARM_FEATURES_H */ -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 a4baf28..a8fe803 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" -@@ -280,9 +286,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 ---- a/arm/mmap.S -+++ /dev/null -@@ -1,42 +0,0 @@ --#include --#include "syscalls.h" -- --.text -- --@ --@ 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. --@ -- --.global mmap -- --#ifdef __ARM_EABI__ -- --mmap: -- str r5, [sp, #-4]! -- ldr r5, [sp, #8] -- str r4, [sp, #-4]! -- ldr r4, [sp, #8] -- mov ip, r7 -- mov r7, #__NR_mmap2 -- svc 0x00000000 -- mov r7, ip -- ldr r4, [sp], #4 -- ldr r5, [sp], #4 -- cmn r0, #4096 -- mov pc, lr @ return -- --#else -- --mmap: -- stmdb sp!, {r0, r1, r2, r3} -- mov r0, sp -- swi __NR_mmap -- add sp, sp, #16 -- b __unified_syscall -- --#endif -diff --git a/arm/setjmp.S b/arm/setjmp.S -index 6b850d4..e7503b2 100644 ---- a/arm/setjmp.S -+++ b/arm/setjmp.S -@@ -1,17 +1,20 @@ --.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 -+ stmia r0, {r4-r11, sp, lr} - #ifndef __SOFTFP__ -- sfm f4, 4, [r0], #48 -+ sfm f4, 4, [r0, #10*4] -+#endif -+#ifdef __IWMMXT__ -+# warning "setjmp will not save iwmmxt coprocessor registers" - #endif -- stmia r0, {r4-r11, sp, lr} -- sub r0, r0, #48 - b __sigjmp_save -- -+FUNC_END __sigsetjmp -+FUNC_END sigsetjmp -diff --git a/arm/start.S b/arm/start.S -index d68d49d..cfb298c 100644 ---- a/arm/start.S -+++ b/arm/start.S -@@ -1,23 +1,11 @@ - - #include "dietfeatures.h" - #include "syscalls.h" -+#include "arm-features.h" - -- .text - #ifdef __ARM_EABI__ -- .align 4 --#else -- .align 2 --#endif -- -- .global _start -- .weak exit -- .global _exit -- -- --#ifdef __ARM_EABI__ -- --_start: - -+FUNC_START _start - mov fp, #0 @ clear the frame pointer - ldr a1, [sp] @ argc - add a2, sp, #4 @ argv -@@ -25,6 +13,17 @@ _start: - add a3, a2, a1, lsl #2 @ &argv[argc] - add a3, a3, #4 @ envp - str a3, [ip, #0] @ environ = envp -+ -+#ifdef WANT_ELFINFO -+ mov r6, a3 @ work on a copy of a3 so that common -+ @ 'main(argc, argv, envp)' function -+ @ stays valid -+1: ldr r5, [r6], #4 @ load *envp and increment it -+ cmp r5, #0 @ read value==0? -+ bne 1b -+ str r6, [ip, #4] @ __elfinfo = envp -+#endif -+ - bl main - - @ -@@ -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 -- str a3, [sl, ip] @ environ = envp -+ str a3, [ip, sl]! @ environ = envp; ip = GOT(environ) - #else - str a3, [ip, #0] @ environ = envp - #endif - -+#ifdef WANT_ELFINFO -+ mov r6, a3 @ work on a copy of a3 so that common -+ @ 'main(argc, argv, envp)' function -+ @ stays valid -+1: ldr r5, [r6], #4 @ load *envp and increment it -+ cmp r5, #0 @ read value==0? -+ bne 1b -+#ifdef __DYN_LIB -+ str r6, [ip, sl] @ __elfinfo = envp -+#else -+ str r6, [ip, #4] @ __elfinfo = envp -+#endif -+#endif -+ - #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..7a86562 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,5 @@ 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 d092f55..21a6dcc 100644 ---- a/arm/syscalls.h -+++ b/arm/syscalls.h -@@ -700,9 +700,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 -@@ -771,70 +771,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__ - - #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 - --#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 - .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} -@@ -846,6 +806,7 @@ - .else - b __unified_syscall - .endif -+FUNC_END \sym - .endm - - #endif -diff --git a/arm/unified.S b/arm/unified.S -index e6ea3f6..bd5b987 100644 ---- a/arm/unified.S -+++ b/arm/unified.S -@@ -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,17 +32,18 @@ __unified_syscall: - .balign 4 - 1: - .word errno -+FUNC_END __unified_syscall - --/* here we go and "reuse" the return for weak-void functions */ - #include "dietuglyweaks.h" - -- mov pc, lr @ return -+ RET - - #else - --__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. - -@@ -53,10 +61,13 @@ __unified_syscall: - /* here we go and "reuse" the return for weak-void functions */ - #include "dietuglyweaks.h" - -- mov pc, lr @ return -+ RET - - #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/dietdirent.h b/dietdirent.h -index dbd7206..3e823f8 100644 ---- a/dietdirent.h -+++ b/dietdirent.h -@@ -1,8 +1,12 @@ - #include - -+#include "dietpagesize.h" -+ - struct __dirstream { - int fd; -- char buf[PAGE_SIZE-(sizeof (int)*3)]; - unsigned int num; - unsigned int cur; -+ char buf[] __attribute__((__aligned__(8))); - }; /* stream data from opendir() */ -+ -+#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf)) -diff --git a/dietelfinfo.h b/dietelfinfo.h -new file mode 100644 -index 0000000..de8c717 ---- /dev/null -+++ b/dietelfinfo.h -@@ -0,0 +1,20 @@ -+#include "dietfeatures.h" -+ -+#ifdef WANT_ELFINFO -+#include -+#include -+#include -+ -+/* TODO: exported interface from has been changed in 2.6.25 so -+ * the 'elf_addr_t' type is not available anymore. Hence, derive it from -+ * __WORDSIZE__. */ -+ -+#if __WORDSIZE == 64 -+typedef uint64_t __diet_elf_addr_t; -+#elif __WORDSIZE == 32 -+typedef uint32_t __diet_elf_addr_t; -+#endif -+ -+__diet_elf_addr_t const * __get_elf_aux_value(unsigned int tag) -+ __attribute__((__visibility__("hidden"),__const__)) __pure; -+#endif -diff --git a/dietfeatures.h b/dietfeatures.h -index dcdda39..0d44425 100644 ---- a/dietfeatures.h -+++ b/dietfeatures.h -@@ -138,6 +138,16 @@ - #define WANT_SSP - #endif - -+/* Some platforms like x86_64, ppc* or mips do not have a fixed PAGE_SIZE. -+ * Select WANT_DYN_PAGESIZE to detect the current PAGE_SIZE at runtime. Else, -+ * define WANT_STATIC_PAGESIZE to a proper value (must be a power of 2) -+ * matching the configured pagesize of the kernel where your binaries are -+ * running on. -+ * -+ * Selecting WANT_DYN_PAGESIZE enlarges the startup code by around 1-3 -+ * instructions and might add an additional __elfinfo symbol */ -+#define WANT_DYN_PAGESIZE -+/* #define WANT_STATIC_PAGESIZE 0x10000UL */ - - - /* stop uncommenting here ;-) */ -@@ -169,4 +179,8 @@ - #endif - #endif - -+#ifdef WANT_DYN_PAGESIZE -+#define WANT_ELFINFO -+#endif -+ - #endif -diff --git a/dietpagesize.h b/dietpagesize.h -new file mode 100644 -index 0000000..8ce6ce7 ---- /dev/null -+++ b/dietpagesize.h -@@ -0,0 +1,31 @@ -+#ifndef H_DIETLIBC_DIETPAGESIZE_H -+#define H_DIETLIBC_DIETPAGESIZE_H -+ -+#include -+#include "dietfeatures.h" -+ -+extern size_t __libc_getpagesize(void) __attribute__((__const__)) __pure; -+ -+#if defined(WANT_STATIC_PAGESIZE) -+# define __DIET_PAGE_SIZE_PREDEF (WANT_STATIC_PAGESIZE) -+# define __DIET_PAGE_SHIFT_PREDEF (ffs(__DIET_PAGE_SIZE_PREDEF)-1) -+#elif defined(__alpha__) || defined(__sparc__) -+# define __DIET_PAGE_SIZE_PREDEF (8192UL) -+# define __DIET_PAGE_SHIFT_PREDEF (13) -+#elif defined(__powerpc64__) -+# define __DIET_PAGE_SIZE_PREDEF (65536UL) -+# define __DIET_PAGE_SHIFT_PREDEF (16) -+#else -+# define __DIET_PAGE_SIZE_PREDEF (4096UL) -+# define __DIET_PAGE_SHIFT_PREDEF (12) -+#endif -+ -+#ifdef WANT_DYN_PAGESIZE -+# define __DIET_PAGE_SIZE (__libc_getpagesize()) -+# define __DIET_PAGE_SHIFT (ffs(__DIET_PAGE_SIZE)-1) -+#else -+# define __DIET_PAGE_SIZE __DIET_PAGE_SIZE_PREDEF -+# define __DIET_PAGE_SHIFT __DIET_PAGE_SHIFT_PREDEF -+#endif -+ -+#endif /* H_DIETLIBC_DIETPAGESIZE_H */ -diff --git a/dynlinker/ldso_start.S b/dynlinker/ldso_start.S -index ca278d7..da36845 100644 ---- a/dynlinker/ldso_start.S -+++ b/dynlinker/ldso_start.S -@@ -86,6 +86,15 @@ __environ: - .long 0 - #endif - -+/* __elfinfo must follow __environ immediately */ -+.global __elfinfo -+__elfinfo: -+#if __WORDSIZE == 64 -+ .quad 0 -+#else -+ .long 0 -+#endif -+ - .global fini_entry - fini_entry: - .long 0 -diff --git a/i386/start.S b/i386/start.S -index 361af3d..b681d05 100644 ---- a/i386/start.S -+++ b/i386/start.S -@@ -20,12 +20,18 @@ _start: - PIC_INIT /* non-PIC: this is an empty line */ - PUT_VAR %esi, environ, %ecx /* non-PIC: movl %esi,environ */ - --#ifdef WANT_SYSENTER -+#if defined(WANT_ELFINFO) || defined(WANT_SYSENTER) - /* skip environment, scan for NULL */ - 1: - lodsl - testl %eax,%eax - jnz 1b -+# ifdef WANT_ELFINFO -+ PUT_VAR %esi, __elfinfo, %ecx -+# endif -+#endif -+ -+#ifdef WANT_SYSENTER - /* The ELF auxvec follows the environment, consists of key/value pairs. - We are looking for key 32, which stands for the vsyscall page */ - 1: -diff --git a/ia64/start.S b/ia64/start.S -index 50fd015..c917721 100644 ---- a/ia64/start.S -+++ b/ia64/start.S -@@ -40,6 +40,16 @@ _start: - ;; - st8 [r14] = out2 /* store envp in environ */ - -+#ifdef WANT_ELFINFO -+# warning "MAKE ME IE64 CODE!" -+1: ld8 r9 = [out2], 8 /* load *envp and increment it */ -+ orr r9 = r9, r9 /* test for NULL */ -+ bne 1b -+ -+ adds r14 = 8, r14 /* __elfinfo = environ + 8 */ -+ st8 [r14] = out2 /* store envp in __elfinfo */ -+#endif -+ - #ifdef WANT_DYNAMIC - /* FIXME: dl_init parameter ??? */ - br.call.sptk.few rp = _dyn_start -diff --git a/include/paths.h b/include/paths.h -index 553b4fa..9bf216f 100644 ---- a/include/paths.h -+++ b/include/paths.h -@@ -2,7 +2,7 @@ - #define _PATHS_H - - #define _PATH_BSHELL "/bin/sh" --#define _PATH_DEFPATH "/bin:/usr/bin:" -+#define _PATH_DEFPATH "/bin:/usr/bin" - - #define _PATH_DEVNULL "/dev/null" - -diff --git a/include/stdlib.h b/include/stdlib.h -index 4976f86..1dd10ff 100644 ---- a/include/stdlib.h -+++ b/include/stdlib.h -@@ -28,8 +28,12 @@ long double strtold(const char *nptr, char **endptr) __THROW; - long int strtol(const char *nptr, char **endptr, int base) __THROW; - unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW; - -+/* HACK: used flags in __dtostr -+ 0x01 ... 'g' -+ 0x02 ... uppercase -+ Define some constants somewhere... */ - extern int __ltostr(char *s, unsigned int size, unsigned long i, unsigned int base, int UpCase) __THROW; --extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int g) __THROW; -+extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int flags) __THROW; - - #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L - __extension__ long long int strtoll(const char *nptr, char **endptr, int base) __THROW; -@@ -43,7 +47,7 @@ double atof(const char *nptr) __THROW; - __extension__ long long int atoll(const char *nptr); - - void exit(int status) __THROW __attribute__((__noreturn__)); --void abort(void) __THROW; -+void abort(void) __THROW __attribute__((__noreturn__)); - - extern int rand(void) __THROW; - extern int rand_r(unsigned int *seed) __THROW; -diff --git a/include/sys/shm.h b/include/sys/shm.h -index 9b2d04d..70bb17e 100644 ---- a/include/sys/shm.h -+++ b/include/sys/shm.h -@@ -60,15 +60,6 @@ struct shm_info { - unsigned long swap_successes; - }; - --#if defined(__i386__) || defined(__mips__) || defined(__arm__) || defined(__powerpc__) || defined (__powerpc64__) || defined(__s390__) || defined(__hppa__) || defined(__x86_64__) || defined(__ia64__) --#define PAGE_SIZE 4096UL --#define PAGE_SHIFT 12 --#elif defined(__alpha__) || defined(__sparc__) --/* sun4* has 4k except sun4 architecture, sparc64 has 8k */ --#define PAGE_SIZE 8192UL --#define PAGE_SHIFT 13 --#endif -- - 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/lib/__dtostr.c b/lib/__dtostr.c -index 1d082e3..bc61200 100644 ---- a/lib/__dtostr.c -+++ b/lib/__dtostr.c -@@ -5,13 +5,15 @@ - - static int copystring(char* buf,int maxlen, const char* s) { - int i; -- for (i=0; i<3&&i0?"inf":"-inf"); -- if (isnan(d)) return copystring(buf,maxlen,"nan"); -+ if (isinf(d)) -+ return copystring(buf,maxlen, -+ (d<0)? -+ (flags&0x02?"-INF":"-inf"): -+ (flags&0x02?"INF":"inf")); -+ if (isnan(d)) return copystring(buf,maxlen,flags&0x02?"NAN":"nan"); - e10=1+(long)(e*0.30102999566398119802); /* log10(2) */ - /* Wir iterieren von Links bis wir bei 0 sind oder maxlen erreicht - * ist. Wenn maxlen erreicht ist, machen wir das nochmal in -@@ -126,7 +132,7 @@ int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned i - if (prec2 || prec>(unsigned int)(buf-oldbuf)+1) { /* more digits wanted */ - if (!maxlen) return 0; --maxlen; - *buf='.'; ++buf; -- if (g) { -+ if ((flags & 0x01)) { - if (prec2) prec=prec2; - prec-=buf-oldbuf-1; - } else { -diff --git a/lib/__get_elf_aux_value.c b/lib/__get_elf_aux_value.c -new file mode 100644 -index 0000000..8a2e3bc ---- /dev/null -+++ b/lib/__get_elf_aux_value.c -@@ -0,0 +1,14 @@ -+#include -+#include "../dietelfinfo.h" -+ -+__diet_elf_addr_t const *__get_elf_aux_value(unsigned int tag) -+{ -+ extern __diet_elf_addr_t const * const __elfinfo; -+ __diet_elf_addr_t const *aux_ptr; -+ -+ for (aux_ptr = __elfinfo; aux_ptr[0]!=AT_NULL; aux_ptr += 2) -+ if (aux_ptr[0]==tag) -+ return aux_ptr+1; -+ -+ return NULL; -+} -diff --git a/lib/__nice.c b/lib/__nice.c -index d751104..8e205c0 100644 ---- a/lib/__nice.c -+++ b/lib/__nice.c -@@ -1,9 +1,13 @@ - #include "syscalls.h" --#include -+#include - #include - - #ifndef __NR_nice - int nice(int i) { -- return setpriority(PRIO_PROCESS,0,getpriority(PRIO_PROCESS,0)+i); -+ if (setpriority(PRIO_PROCESS,0,getpriority(PRIO_PROCESS,0)+i) == -1) { -+ errno=EPERM; -+ return -1; -+ } -+ return getpriority(PRIO_PROCESS,0); - } - #endif -diff --git a/lib/__utime.c b/lib/__utime.c -index e013265..0e4d0df 100644 ---- a/lib/__utime.c -+++ b/lib/__utime.c -@@ -1,7 +1,10 @@ --#include - #include - - #ifndef __NR_utime -+#define _BSD_SOURCE -+#include -+#include -+ - int utime(const char *filename, const struct utimbuf *times) - { - if (times == NULL) -diff --git a/lib/__v_printf.c b/lib/__v_printf.c -index 36202f5..964c005 100644 ---- a/lib/__v_printf.c -+++ b/lib/__v_printf.c -@@ -4,6 +4,7 @@ - #include - #include - #include -+#include - #include "dietstdio.h" - #include "dietwarning.h" - -@@ -346,45 +347,49 @@ num_printf: - #ifdef WANT_FLOATING_POINT_IN_PRINTF - /* print a floating point value */ - case 'f': -+ case 'F': - case 'g': -+ case 'G': - { -- int g=(ch=='g'); -+ int flags=(((ch&0x5f)=='G') ? 0x01 : 0x00) | ((ch&0x20) ? 0x00 : 0x02); - double d=va_arg(arg_ptr,double); - s=buf+1; - if (width==0) width=1; - if (!flag_dot) preci=6; - if (flag_sign || d < +0.0) flag_in_sign=1; - -- sz=__dtostr(d,s,sizeof(buf)-1,width,preci,g); -- -- if (flag_dot) { -- char *tmp; -- if ((tmp=strchr(s,'.'))) { -- if (preci || flag_hash) ++tmp; -- while (preci>0 && *++tmp) --preci; -- *tmp=0; -- } else if (flag_hash) { -- s[sz]='.'; -- s[++sz]='\0'; -+ sz=__dtostr(d,s,sizeof(buf)-1,width,preci,flags); -+ -+ if (!isnan(d) && !isinf(d)) { /* skip NaN + INF values */ -+ if (flag_dot) { -+ char *tmp; -+ if ((tmp=strchr(s,'.'))) { -+ if (preci || flag_hash) ++tmp; -+ while (preci>0 && *++tmp) --preci; -+ *tmp=0; -+ } else if (flag_hash) { -+ s[sz]='.'; -+ s[++sz]='\0'; -+ } - } -- } - -- if (g) { -- char *tmp,*tmp1; /* boy, is _this_ ugly! */ -- if ((tmp=strchr(s,'.'))) { -- tmp1=strchr(tmp,'e'); -- while (*tmp) ++tmp; -- if (tmp1) tmp=tmp1; -- while (*--tmp=='0') ; -- if (*tmp!='.') ++tmp; -- *tmp=0; -- if (tmp1) strcpy(tmp,tmp1); -+ if ((flags&0x01)) { -+ char *tmp,*tmp1; /* boy, is _this_ ugly! */ -+ if ((tmp=strchr(s,'.'))) { -+ tmp1=strchr(tmp,'e'); -+ while (*tmp) ++tmp; -+ if (tmp1) tmp=tmp1; -+ while (*--tmp=='0') ; -+ if (*tmp!='.') ++tmp; -+ *tmp=0; -+ if (tmp1) strcpy(tmp,tmp1); -+ } - } -- } - -- if ((flag_sign || flag_space) && d>=0) { -- *(--s)=(flag_sign)?'+':' '; -- ++sz; -+ if ((flag_sign || flag_space) && d>=0) { -+ *(--s)=(flag_sign)?'+':' '; -+ ++sz; -+ } - } - - sz=strlen(s); -diff --git a/lib/alloc.c b/lib/alloc.c -index 9690565..3f0cedb 100644 ---- a/lib/alloc.c -+++ b/lib/alloc.c -@@ -18,8 +18,7 @@ - #include - #include - --#include /* for PAGE_SIZE */ -- -+#include "../dietpagesize.h" - - /* -- HELPER CODE --------------------------------------------------------- */ - -@@ -39,7 +38,7 @@ typedef struct { - #define BLOCK_START(b) (((void*)(b))-sizeof(__alloc_t)) - #define BLOCK_RET(b) (((void*)(b))+sizeof(__alloc_t)) - --#define MEM_BLOCK_SIZE PAGE_SIZE -+#define MEM_BLOCK_SIZE __DIET_PAGE_SIZE - #define PAGE_ALIGN(s) (((s)+MEM_BLOCK_SIZE-1)&(unsigned long)(~(MEM_BLOCK_SIZE-1))) - - /* a simple mmap :) */ -@@ -66,7 +65,9 @@ static __alloc_t* __small_mem[8]; - - #define FIRST_SMALL(p) (((unsigned long)(p))&(~(MEM_BLOCK_SIZE-1))) - --static inline int __ind_shift() { return (MEM_BLOCK_SIZE==4096)?4:5; } -+static inline int __ind_shift() { -+ return __DIET_PAGE_SHIFT - sizeof(__small_mem)/sizeof(__small_mem[0]); -+} - - static size_t REGPARM(1) get_index(size_t _size) { - register size_t idx=0; -diff --git a/lib/closedir.c b/lib/closedir.c -index 3aade81..21de234 100644 ---- a/lib/closedir.c -+++ b/lib/closedir.c -@@ -4,8 +4,10 @@ - #include - #include - -+#include "../dietpagesize.h" -+ - int closedir (DIR* d) { - int res=close(d->fd); -- munmap (d, PAGE_SIZE); -+ munmap (d, __DIET_PAGE_SIZE); - return res; - } -diff --git a/lib/mmap64.c b/lib/mmap64.c -index 0ab29a6..5012394 100644 ---- a/lib/mmap64.c -+++ b/lib/mmap64.c -@@ -4,16 +4,18 @@ - #include - #include - -+#include "../dietpagesize.h" -+ - #ifdef __NR_mmap2 - void*__mmap2(void*start,size_t length,int prot,int flags,int fd,off_t pgoffset); - - void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset); - void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) { -- if (offset&(PAGE_SIZE-1)) { -+ if (offset&(__DIET_PAGE_SIZE)) { - errno=-EINVAL; - return MAP_FAILED; - } -- return __mmap2(addr,len,prot,flags,fd,offset>>PAGE_SHIFT); -+ return __mmap2(addr,len,prot,flags,fd,offset>>__DIET_PAGE_SHIFT); - } - - void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) -diff --git a/lib/opendir.c b/lib/opendir.c -index 2530d1a..847685e 100644 ---- a/lib/opendir.c -+++ b/lib/opendir.c -@@ -5,6 +5,8 @@ - #include - #include - -+#include "../dietpagesize.h" -+ - DIR* opendir ( const char* name ) { - int fd = open (name, O_RDONLY | O_DIRECTORY); - DIR* t = NULL; -@@ -12,7 +14,7 @@ DIR* opendir ( const char* name ) { - if ( fd >= 0 ) { - if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) - goto lose; -- t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, -+ t = (DIR *) mmap (NULL, __DIET_PAGE_SIZE, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (t == MAP_FAILED) - lose: -diff --git a/lib/readdir.c b/lib/readdir.c -index ed885a5..d80a406 100644 ---- a/lib/readdir.c -+++ b/lib/readdir.c -@@ -5,7 +5,7 @@ - - struct dirent* readdir(DIR *d) { - if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { -- int res=getdents(d->fd,(struct dirent*)d->buf,sizeof (d->buf)-1); -+ int res=getdents(d->fd,(struct dirent*)d->buf,__DIRSTREAM_BUF_SIZE-1); - if (res<=0) return 0; - d->num=res; d->cur=0; - } -diff --git a/lib/readdir64.c b/lib/readdir64.c -index 924f0a8..06d073b 100644 ---- a/lib/readdir64.c -+++ b/lib/readdir64.c -@@ -14,7 +14,7 @@ - #ifndef WANT_LARGEFILE_BACKCOMPAT - struct dirent64* readdir64(DIR *d) { - if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) { -- int res=getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1); -+ int res=getdents64(d->fd,(struct dirent64*)d->buf, __DIRSTREAM_BUF_SIZE-1); - if (res<=0) return 0; - d->num=res; d->cur=0; - } -@@ -32,7 +32,7 @@ again: - if (!trygetdents64) { - #endif - if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { -- int res=getdents(d->fd,(struct dirent*)d->buf, sizeof (d->buf)-1); -+ int res=getdents(d->fd,(struct dirent*)d->buf, __DIRSTREAM_BUF_SIZE-1); - if (res<=0) return 0; - d->num=res; d->cur=0; - } -@@ -46,7 +46,7 @@ again: - #ifdef __NR_getdents64 - } - if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) { -- int res=getdents64(d->fd,(struct dirent64*)d->buf,sizeof (d->buf)); -+ int res=getdents64(d->fd,(struct dirent64*)d->buf,__DIRSTREAM_BUF_SIZE); - if (res<=0) { - if (errno==ENOSYS) { - trygetdents64=0; -diff --git a/lib/stack_smash_handler2.c b/lib/stack_smash_handler2.c -index 9e85099..83c0cef 100644 ---- a/lib/stack_smash_handler2.c -+++ b/lib/stack_smash_handler2.c -@@ -8,5 +8,16 @@ void __stack_chk_fail(void); - * diagnostics. No more. :-( */ - void __stack_chk_fail(void) { - __write2("smashed stack detected, program terminated.\n"); -- _exit(127); -+ -+ /* trigger a segfault which can be inspected within a debugger (inclusive -+ * stack-trace). 'abort(3)' at this place would be too heavy weighted. -+ * -+ * TODO: limit this to systems which are known to have an MMU (resp. is -+ * dietlibc with stack-protector used on systems without an MMU?) -+ */ -+ *(char volatile *)0 = 0; -+ while (1) { -+ asm(""); -+ __builtin_unreachable(); -+ } - } -diff --git a/lib/stackgap.c b/lib/stackgap.c -index 6f1f5c4..1a3af01 100644 ---- a/lib/stackgap.c -+++ b/lib/stackgap.c -@@ -16,6 +16,7 @@ - #include - #include - #include "dietfeatures.h" -+#include "dietelfinfo.h" - - #ifdef WANT_GNU_STARTUP_BLOAT - char* program_invocation_name; -@@ -48,11 +49,12 @@ void* __tdataptr; - - static void findtlsdata(long* auxvec) { - #if (__WORDSIZE == 64) -- Elf64_Phdr* x=0; -+ Elf64_Phdr const * x=0; - #else -- Elf32_Phdr* x=0; -+ Elf32_Phdr const * x=0; - #endif - size_t i,n=0; -+#ifndef WANT_ELFINFO - while (*auxvec) { - if (auxvec[0]==3) { /* AT_PHDR */ - x=(void*)auxvec[1]; -@@ -63,6 +65,18 @@ static void findtlsdata(long* auxvec) { - } - auxvec+=2; - } /* if we don't find the entry, the kernel let us down */ -+#else -+ { -+ __diet_elf_addr_t const *x_addr = __get_elf_aux_value(AT_PHDR); -+ __diet_elf_addr_t const *n_addr = __get_elf_aux_value(AT_PHNUM); -+ -+ (void)auxvec; -+ if (x_addr) -+ x = (__typeof__(x)) *x_addr; -+ if (n_addr) -+ n = *n_addr; -+ } -+#endif - if (!x || !n) return; /* a kernel this old does not support thread local storage anyway */ - for (i=0; i512*1024*1024) || - __unlikely(__tmemsize<__tdatasize)) -diff --git a/libcompat/syscall.S b/libcompat/syscall.S -index c9f72bb..4188167 100644 ---- a/libcompat/syscall.S -+++ b/libcompat/syscall.S -@@ -130,6 +130,12 @@ syscall: - b __unified_syscall - - #else -- /* arch not implemented yet */ -+#include -+ .section .comment -+#if (__WORDSIZE == 64) -+ .quad __syscall_2_not_implemented_for_this_arch -+#else -+ .long __syscall_2_not_implemented_for_this_arch -+#endif - #endif - .size syscall, . - syscall -diff --git a/libcruft/getpagesize.c b/libcruft/getpagesize.c -index 5ff8973..ac701cf 100644 ---- a/libcruft/getpagesize.c -+++ b/libcruft/getpagesize.c -@@ -1,25 +1,23 @@ - #include - #include - #include --/* for environ: */ --#include - --#ifndef PAGE_SIZE --#define PAGE_SIZE 4096 --#endif -+#include "../dietelfinfo.h" -+#include "../dietpagesize.h" - --size_t __libc_getpagesize(void); - size_t __libc_getpagesize(void) { -- long* x=(long*)environ; -- int fd; -- while (*x) ++x; ++x; /* skip envp to get to auxvec */ -- while (*x) { -- if (*x==6) -- return x[1]; -- x+=2; -+#ifdef WANT_DYN_PAGESIZE -+ static size_t pgsz; -+ -+ if (__unlikely(pgsz==0)) { -+ __diet_elf_addr_t const *v = __get_elf_aux_value(AT_PAGESZ); -+ pgsz = *v; /* causes segfault when 'v==NULL' */ - } -- return PAGE_SIZE; -+ -+ return pgsz; -+#else -+ return __DIET_PAGE_SIZE_PREDEF; -+#endif - } - - size_t getpagesize(void) __attribute__((weak,alias("__libc_getpagesize"))); -- -diff --git a/libcruft/mkstemp.c b/libcruft/mkstemp.c -index 7dc19d4..226dec4 100644 ---- a/libcruft/mkstemp.c -+++ b/libcruft/mkstemp.c -@@ -1,3 +1,4 @@ -+#define _FILE_OFFSET_BITS 64 - #include - #include - #include -diff --git a/libcruft/sysconf.c b/libcruft/sysconf.c -index 6865026..089fbd3 100644 ---- a/libcruft/sysconf.c -+++ b/libcruft/sysconf.c -@@ -6,6 +6,9 @@ - #define _GNU_SOURCE - #include - -+#include "dietelfinfo.h" -+#include "dietpagesize.h" -+ - extern int __sc_nr_cpus(); - - static long physpages() { -@@ -42,6 +45,14 @@ long sysconf(int name) - return limit.rlim_cur; - } - case _SC_CLK_TCK: -+#ifdef WANT_ELFINFO -+ { -+ __diet_elf_addr_t const *v = __get_elf_aux_value(AT_CLKTCK); -+ if (v) -+ return *v; -+ } -+#endif -+ - #ifdef __alpha__ - return 1024; - #else -@@ -49,11 +60,7 @@ long sysconf(int name) - #endif - - case _SC_PAGESIZE: --#if ( defined(__alpha__) || defined(__sparc__) ) -- return 8192; --#else -- return 4096; --#endif -+ return __libc_getpagesize(); - - case _SC_PHYS_PAGES: - return physpages(); -diff --git a/libm/ceil.c b/libm/ceil.c -new file mode 100644 -index 0000000..c126b02 ---- /dev/null -+++ b/libm/ceil.c -@@ -0,0 +1,92 @@ -+/* @(#)s_ceil.c 5.1 93/09/24 */ -+/* -+ * ==================================================== -+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. -+ * -+ * Developed at SunPro, a Sun Microsystems, Inc. business. -+ * Permission to use, copy, modify, and distribute this -+ * software is freely granted, provided that this notice -+ * is preserved. -+ * ==================================================== -+ */ -+ -+/* -+ * ceil(x) -+ * Return x rounded toward -inf to integral value -+ * Method: -+ * Bit twiddling. -+ * Exception: -+ * Inexact flag raised if x not equal to ceil(x). -+ */ -+ -+#include -+ -+typedef union { -+ double value; -+ struct { -+ unsigned int lsw; -+ unsigned int msw; -+ } parts; -+} ieee_double_shape_type; -+ -+/* Get two 32 bit ints from a double. */ -+ -+#define EXTRACT_WORDS(ix0,ix1,d) \ -+do { \ -+ ieee_double_shape_type ew_u; \ -+ ew_u.value = (d); \ -+ (ix0) = ew_u.parts.msw; \ -+ (ix1) = ew_u.parts.lsw; \ -+} while (0) -+ -+#define INSERT_WORDS(d,ix0,ix1) \ -+do { \ -+ ieee_double_shape_type iw_u; \ -+ iw_u.parts.msw = (ix0); \ -+ iw_u.parts.lsw = (ix1); \ -+ (d) = iw_u.value; \ -+} while (0) -+ -+static const double huge = 1.0e300; -+ -+double ceil(double x) -+{ -+ int i0,i1,j0; -+ unsigned int i,j; -+ EXTRACT_WORDS(i0,i1,x); -+ j0 = ((i0>>20)&0x7ff)-0x3ff; -+ if(j0<20) { -+ if(j0<0) { /* raise inexact if x != 0 */ -+ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ -+ if(i0<0) {i0=0x80000000;i1=0;} -+ else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;} -+ } -+ } else { -+ i = (0x000fffff)>>j0; -+ if(((i0&i)|i1)==0) return x; /* x is integral */ -+ if(huge+x>0.0) { /* raise inexact flag */ -+ if(i0>0) i0 += (0x00100000)>>j0; -+ i0 &= (~i); i1=0; -+ } -+ } -+ } else if (j0>51) { -+ if(j0==0x400) return x+x; /* inf or NaN */ -+ else return x; /* x is integral */ -+ } else { -+ i = ((unsigned int)(0xffffffff))>>(j0-20); -+ if((i1&i)==0) return x; /* x is integral */ -+ if(huge+x>0.0) { /* raise inexact flag */ -+ if(i0>0) { -+ if(j0==20) i0+=1; -+ else { -+ j = i1 + (1<<(52-j0)); -+ if(j - #include - --#define B0 + 1.0l/ 6/ 1/ 2 --#define B1 - 1.0l/ 30/ 3/ 4 --#define B2 + 1.0l/ 42/ 5/ 6 --#define B3 - 1.0l/ 30/ 7/ 8 --#define B4 + 5.0l/ 66/ 9/10 --#define B5 - 691.0l/2730/11/12 --#define B6 + 7.0l/ 6/13/14 --#define B7 - 3617.0l/ 510/15/16 --#define B8 + 43867.0l/ 798/17/18 --#define B9 - 174611.0l/ 330/19/20 --#define B10 + 854513.0l/ 138/21/22 --#define B11 - 236364091.0l/2730/23/24 --#define B12 + 8553103.0l/ 6/25/26 -+#define B0 + 1.0/ 6/ 1/ 2 -+#define B1 - 1.0/ 30/ 3/ 4 -+#define B2 + 1.0/ 42/ 5/ 6 -+#define B3 - 1.0/ 30/ 7/ 8 -+#define B4 + 5.0/ 66/ 9/10 -+#define B5 - 691.0/2730/11/12 -+#define B6 + 7.0/ 6/13/14 -+#define B7 - 3617.0/ 510/15/16 -+#define B8 + 43867.0/ 798/17/18 -+#define B9 - 174611.0/ 330/19/20 -+#define B10 + 854513.0/ 138/21/22 -+#define B11 - 236364091.0/2730/23/24 -+#define B12 + 8553103.0/ 6/25/26 - - static const double coeff[] = { B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 }; - int signgam; -diff --git a/librpc/clnt_raw.c b/librpc/clnt_raw.c -index 042d130..1e89ac0 100644 ---- a/librpc/clnt_raw.c -+++ b/librpc/clnt_raw.c -@@ -53,7 +53,10 @@ static struct clntraw_private { - CLIENT client_object; - XDR xdr_stream; - char _raw_buf[UDPMSGSIZE]; -- char mashl_callmsg[MCALL_MSG_SIZE]; -+ union { -+ struct rpc_msg msg; -+ char buf[MCALL_MSG_SIZE]; -+ } mashl_call; - unsigned int mcnt; - } *clntraw_private; - -@@ -101,7 +104,7 @@ unsigned long vers; - call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; - call_msg.rm_call.cb_prog = prog; - call_msg.rm_call.cb_vers = vers; -- xdrmem_create(xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE); -+ xdrmem_create(xdrs, clp->mashl_call.buf, MCALL_MSG_SIZE, XDR_ENCODE); - if (!xdr_callhdr(xdrs, &call_msg)) { - perror("clnt_raw.c - Fatal header serialization error."); - } -@@ -145,8 +148,8 @@ struct timeval timeout; - */ - xdrs->x_op = XDR_ENCODE; - XDR_SETPOS(xdrs, 0); -- ((struct rpc_msg *) clp->mashl_callmsg)->rm_xid++; -- if ((!XDR_PUTBYTES(xdrs, clp->mashl_callmsg, clp->mcnt)) || -+ clp->mashl_call.msg.rm_xid++; -+ if ((!XDR_PUTBYTES(xdrs, clp->mashl_call.buf, clp->mcnt)) || - (!XDR_PUTLONG(xdrs, (long *) &proc)) || - (!AUTH_MARSHALL(h->cl_auth, xdrs)) || (!(*xargs) (xdrs, argsp))) { - return (RPC_CANTENCODEARGS); -diff --git a/librpc/clnt_udp.c b/librpc/clnt_udp.c -index ae7f3d8..003edf5 100644 ---- a/librpc/clnt_udp.c -+++ b/librpc/clnt_udp.c -@@ -335,7 +335,7 @@ struct timeval utimeout; /* seconds to wait before giving up */ - if (inlen < 4) - continue; - /* see if reply transaction id matches sent id */ -- if (*((uint32_t *) (cu->cu_inbuf)) != *((uint32_t *) (cu->cu_outbuf))) -+ if (memcmp(cu->cu_inbuf, cu->cu_outbuf, 4) != 0) - continue; - /* we now assume we have the proper reply */ - break; -diff --git a/libugly/strftime.c b/libugly/strftime.c -index 56ae082..cf16f37 100644 ---- a/libugly/strftime.c -+++ b/libugly/strftime.c -@@ -55,6 +55,7 @@ again: - case 'x': src = "%b %a %d"; goto _strf; - case 'X': src = "%k:%M:%S"; goto _strf; - case 'D': src = "%m/%d/%y"; goto _strf; -+ case 'F': src = "%Y-%m-%d"; goto _strf; - case 'T': src = "%H:%M:%S"; - _strf: p += strftime (p, (size_t)(dst+max-p), src, tm); break; - case 'a': src = sweekdays [tm->tm_wday]; goto _str; -diff --git a/libugly/strptime.c b/libugly/strptime.c -index 9d7f530..d19f309 100644 ---- a/libugly/strptime.c -+++ b/libugly/strptime.c -@@ -119,10 +119,11 @@ char* strptime(const char* s,const char* format, struct tm* tm) { - ++s; - break; - case 'x': -- s=strptime(s,"%b %a %d",tm); -+ /* see SUSv2, Ch.7 "LC_TIME Category in the POSIX Locale" */ -+ s=strptime(s,"%m/%d/%y",tm); - break; - case 'X': -- s=strptime(s,"%k:%M:%S",tm); -+ s=strptime(s,"%H:%M:%S",tm); - break; - case 'y': - i=getint(&s,2); -diff --git a/mips/start.S b/mips/start.S -index 57144b3..3cf3433 100644 ---- a/mips/start.S -+++ b/mips/start.S -@@ -47,6 +47,15 @@ __start: - #endif - add $a2, $a2, $a1 - sw $a2, environ -+#ifdef WANT_ELFINFO -+# warning "MAKE ME MIPS CODE!" -+1: addu $a2, $a2, 4 /* increment envp */ -+ lw $4, -4($a2) /* load envp[-1]; TODO: is $4 a proper -+ temporary register? */ -+ bnz 1b /* ... until envp[-1]==NULL -+ TODO: use proper 'bnz' operation */ -+ sw $a2, __elfinfo -+#endif - jalr $25 - la $25, exit - move $4,$2 -diff --git a/parisc/start.S b/parisc/start.S -index 69d9cce..894255c 100644 ---- a/parisc/start.S -+++ b/parisc/start.S -@@ -34,6 +34,16 @@ _start: - ldil LP%environ, %r19 - ldo RP%environ(%r19), %r19 - -+#ifdef WANT_ELFINFO -+# warning "MAKE ME PARISC CODE!" -+1: add %r20, %r19, %r19 ; envp += 4 -+ ldw -4(0,%r19), %r21 ; load envp[-4] into %r21 -+ comibf =,0, 0,%21,1b ; compare %21 with 0 without nullification -+ -+ ldil LP%__elfinfo, %r19 -+ ldo RP%__elfinfo(%r19), %r19 -+#endif -+ - /* Expand the stack to store the 5th through 7th args */ - ldo 64(%sp), %sp - -diff --git a/ppc/start.S b/ppc/start.S -index 771f1ad..3b5cab1 100644 ---- a/ppc/start.S -+++ b/ppc/start.S -@@ -31,6 +31,15 @@ _start: - lis 14,environ@ha - stw 5,environ@l(14) - -+#ifdef WANT_ELFINFO -+1: lwzu 15,0(5) -+ addi 5, 5, 4 -+ cmpwi 15,0 -+ bne 1b -+ -+ stw 5,__elfinfo@l(14) -+#endif -+ - #ifdef WANT_DYNAMIC - mr 6,7 - bl _dyn_start -diff --git a/ppc64/start.S b/ppc64/start.S -index a9208ff..46b4bf0 100644 ---- a/ppc64/start.S -+++ b/ppc64/start.S -@@ -58,6 +58,15 @@ _start: - oris 14,14,environ@ha - std 5,environ@l(14) - -+#ifdef WANT_ELFINFO -+1: ldu 15,0(5) -+ addi 5, 5, 8 -+ cmpdi 15,0 -+ bne 1b -+ -+ std 5,__elfinfo@l(14) -+#endif -+ - #ifdef WANT_DYNAMIC - /* #warning dynamic */ - mr 6,7 -diff --git a/s390/start.S b/s390/start.S -index c0f971f..585faf7 100644 ---- a/s390/start.S -+++ b/s390/start.S -@@ -30,6 +30,17 @@ _start: - l %r1,8(%r13) - st %r4,0(%r1) - -+#ifdef WANT_ELFINFO -+# warning "VERIFY ME!" -+1: ahi %r4, 4 # increment envp -+ l %r12, -4(0,%r4) # load envp[-1] into %r12 -+ or %r12, %r12 # test %r12 for NULL -+ brc 1, 1b -+ -+ ahi %r1, 4 -+ st %r4,0(%r1) -+#endif -+ - /* call main or _dyn_start */ - l %r1,0(%r13) - basr %r14,%r1 -diff --git a/s390x/start.S b/s390x/start.S -index 25895a6..15ad1f9 100644 ---- a/s390x/start.S -+++ b/s390x/start.S -@@ -26,6 +26,17 @@ _start: - larl %r13,environ - stg %r4,0(%r13) - -+#ifdef WANT_ELFINFO -+# warning "VERIFY ME!" -+1: aghi %r4, 8 # increment envp -+ lg %r12, -8(0,%r4) # load envp[-1] into %r12 -+ ogr %r12, %r12 # test %r12 for NULL -+ brc 1, 1b -+ -+ aghi %r13, 8 -+ stg %r4,0(%r13) -+#endif -+ - /* call main or _dyn_start */ - #ifdef WANT_DYNAMIC - brasl %r14,_dyn_start -diff --git a/sparc/shmat.c b/sparc/shmat.c -index b7dce2e..ce3bfcb 100644 ---- a/sparc/shmat.c -+++ b/sparc/shmat.c -@@ -3,17 +3,15 @@ - #include - #include - --extern void* __ipc(); -+#include "../dietpagesize.h" - --#ifndef PAGE_SIZE --#define PAGE_SIZE 4096 --#endif -+extern void* __ipc(); - - void* shmat(int shmid,const void* shmaddr,int shmflg) { - void* raddr; - register void* result; - result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr); -- if ((unsigned long)result <= -(unsigned long)PAGE_SIZE) -+ if ((unsigned long)result <= -(unsigned long)__DIET_PAGE_SIZE) - result=raddr; - return result; - } -diff --git a/sparc/start.S b/sparc/start.S -index a7841e3..bb463c9 100644 ---- a/sparc/start.S -+++ b/sparc/start.S -@@ -25,6 +25,17 @@ _start: - or %o3, %lo(environ), %o3 - st %o2, [%o3] - -+#ifdef WANT_ELFINFO -+# warning "VERIFY ME!" -+1: add %o2, %o2, 4 -+ ld [%o2-4], %o4 -+ orcc %o4, %o4, %o4 -+ bne 1b -+ -+ add %o3, %o3, 4 -+ st %o2, [%o3] -+#endif -+ - /* 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/sparc64/start.S b/sparc64/start.S -index a79c4e7..a884658 100644 ---- a/sparc64/start.S -+++ b/sparc64/start.S -@@ -25,6 +25,17 @@ _start: - or %o3, %lo(environ), %o3 - stx %o2, [%o3] - -+#ifdef WANT_ELFINFO -+# warning "VERIFY ME!" -+1: add %o2, %o2, 8 -+ ldx [%o2-8], %o4 -+ orcc %o4, %o4, %o4 -+ bne 1b -+ -+ add %o3, %o3, 8 -+ stx %o2, [%o3] -+#endif -+ - /* 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/environ.S b/syscalls.s/environ.S -index a4dd95e..294f2d4 100644 ---- a/syscalls.s/environ.S -+++ b/syscalls.s/environ.S -@@ -1,6 +1,7 @@ - .section ".bss" - .align 8 - #include -+#include - - .type environ,object - .weak environ -@@ -15,3 +16,18 @@ environ: - #endif - .size environ,.-environ - .size __environ,.-__environ -+ -+/* __elfinfo will be initialized in start.S to point to the -+ terminating NULL of the environment. */ -+ -+#ifdef WANT_ELFINFO -+.type __elfinfo,object -+.weak __elfinfo -+__elfinfo: -+#if __WORDSIZE == 64 -+ .quad 0 -+#else -+ .long 0 -+#endif -+.size __elfinfo,.-__elfinfo -+#endif -diff --git a/syscalls.s/fadvise64.S b/syscalls.s/fadvise64.S -index eab3986..fe448b1 100644 ---- a/syscalls.s/fadvise64.S -+++ b/syscalls.s/fadvise64.S -@@ -1,12 +1,11 @@ - #include "syscalls.h" - -+#ifdef __NR_fadvise64 -+syscall(fadvise64,fadvise64) -+ - #ifndef __NR_fadvise64_64 -+.set posix_fadvise, fadvise64 - .globl posix_fadvise --.type posix_fadvise,@function --posix_fadvise: - #endif - --#ifdef __NR_fadvise64 --syscall(fadvise64,fadvise64) -- - #endif -diff --git a/test/.gitignore b/test/.gitignore -new file mode 100644 -index 0000000..92c5678 ---- /dev/null -+++ b/test/.gitignore -@@ -0,0 +1,85 @@ -+/adjtime -+/alarm -+/argv -+/asprintf -+/atexit -+/bsearch -+/byteswap -+/calloc -+/confstr -+/cycles -+/empty -+/fadvise -+/ffs -+/flush -+/fnmatch -+/fputc -+/ftruncate -+/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 -+/setjmp -+/siglist -+/sigsetjmp -+/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 2e406f3..152cf5a 100644 ---- a/test/Makefile -+++ b/test/Makefile -@@ -8,13 +8,13 @@ CFLAGS=-nostdinc -Wall - LCOMPAT=-lcompat - - TESTPROGRAMS=adjtime alarm argv asprintf atexit bsearch byteswap calloc confstr cycles empty fadvise flush fnmatch \ --fputc ftw fwrite getaddrinfo getenv getgrnam gethostbyaddr gethostbyname \ -+fputc ftruncate 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 \ -+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 sysenter ungetc utime waitpid -+protoent prototypes putenv pwent rand48 read1 readdir regex select sendfile servent setjmp siglist \ -+sigsetjmp speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr \ -+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/asprintf.c b/test/asprintf.c -index 996a5aa..0d4f2eb 100644 ---- a/test/asprintf.c -+++ b/test/asprintf.c -@@ -13,7 +13,7 @@ int main(int argc, char **argv) { - assert(strlen(path) == asprintlen); - - printf("%s\n", path); -- asprintlen=asprintf(&path, "/proc" "/%d/stat", strlen(argv[1])); -+ asprintlen=asprintf(&path, "/proc" "/%zu/stat", strlen(argv[1])); - assert(strlen(path) == asprintlen); - printf("%s\n", path); - -diff --git a/test/atexit.c b/test/atexit.c -index 709a3e4..79ee392 100644 ---- a/test/atexit.c -+++ b/test/atexit.c -@@ -2,7 +2,7 @@ - #include - - void blah(void) { -- write(2,"atexit\n",7); -+ write(1,"atexit\n",7); - } - - int main() { -diff --git a/test/bsearch.c b/test/bsearch.c -index 961ad35..ede4c88 100644 ---- a/test/bsearch.c -+++ b/test/bsearch.c -@@ -35,7 +35,7 @@ int main() { - die("bsearch returned NULL\n"); - } - if (k != array+i) die("bsearch found wrong element\n"); -- printf("%d\n",k-array); -+ printf("%ld\n",k-array); - } - } - return 0; -diff --git a/test/byteswap.c b/test/byteswap.c -index 19239dd..6f43c25 100644 ---- a/test/byteswap.c -+++ b/test/byteswap.c -@@ -9,12 +9,12 @@ int main() { - snprintf(buf,100,"%x %x", bswap_16(0x1234), bswap_16(0x5678)); - assert(strcmp(buf, "3412 7856") == 0); - -- printf("%lx\n",bswap_32(0x12345678)); -- snprintf(buf,100,"%lx", bswap_32(0x12345678)); -+ printf("%x\n",(unsigned int)bswap_32(0x12345678)); -+ snprintf(buf,100,"%x", (unsigned int)bswap_32(0x12345678)); - assert(strcmp(buf, "78563412") == 0); - -- printf("%qx\n",bswap_64(0x123456789ABCDEFull)); -- snprintf(buf,100,"%qx", bswap_64(0x123456789ABCDEFull)); -+ printf("%llx\n",(unsigned long long)bswap_64(0x123456789ABCDEFull)); -+ snprintf(buf,100,"%llx", (unsigned long long)bswap_64(0x123456789ABCDEFull)); - assert(strcmp(buf, "efcdab8967452301") == 0); - return 0; - } -diff --git a/test/cycles.c b/test/cycles.c -index 35547f8..46b2f32 100644 ---- a/test/cycles.c -+++ b/test/cycles.c -@@ -13,7 +13,8 @@ - dst = (((uint64_t)h) << 32) | l; \ - } while (0) - #else --#error "Unimplemented rdtsc" -+#warning "Unimplemented rdtsc" -+#define RDTSC(dst) dst = 0 - #endif - - extern char **environ; -@@ -24,7 +25,7 @@ int main(int argc,char* argv[]) { - if (!fork()) { execve(argv[1],argv+1,environ); exit(1); } - wait(0); - RDTSC(b); -- printf("%llu cycles\n",b-a); -+ printf("%llu cycles\n",(unsigned long long)(b-a)); - - 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/ftruncate.c b/test/ftruncate.c -new file mode 100644 -index 0000000..e0ebb5d ---- /dev/null -+++ b/test/ftruncate.c -@@ -0,0 +1,54 @@ -+#define _GNU_SOURCE -+#define _XOPEN_SOURCE 600 -+#define _FILE_OFFSET_BITS 64 -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define CHECK(_sz) \ -+ assert(ftruncate(fd, (_sz)) == 0); \ -+ assert(fstat(fd, &st) == 0); \ -+ assert(st.st_size == (_sz)); \ -+ -+#define CHECK64(_sz) \ -+ assert(ftruncate64(fd, (_sz)) == 0); \ -+ assert(fstat64(fd, &st64) == 0); \ -+ assert(st64.st_size == (_sz)); \ -+ -+int main(void) -+{ -+ char file[] = "/tmp/dietlibc-fadvise-test.XXXXXX"; -+ int fd; -+ struct stat st; -+ -+ fd = mkstemp(file); -+ unlink(file); -+ -+ assert(ftruncate(fd, 500000) == 0); -+ assert(fstat(fd, &st) == 0); -+ -+ if (st.st_blocks > 1) { -+ /* spare files not supported by filesystem :( */ -+ return EXIT_SUCCESS; -+ } -+ -+ CHECK(1); -+ CHECK(0x7fffffff); -+ -+#if __WORDSIZE == 32 -+ { -+ struct stat64 st64; -+ CHECK64(1); -+ CHECK64(0x7fffffff); -+ CHECK64(0x80000001ul); -+ CHECK64(0x17fffffffull); -+ } -+#else -+ CHECK(0x17fffffffull); -+#endif -+ -+ return EXIT_SUCCESS; -+} -diff --git a/test/getmntent.c b/test/getmntent.c -index fc17a83..1039d06 100644 ---- a/test/getmntent.c -+++ b/test/getmntent.c -@@ -33,10 +33,6 @@ while ((e = getmntent(fstab))) { - - printf("closing /etc/fstab\n"); - assert ( 1 == endmntent(fstab)); -- printf("closing /etc/fstab again\n"); -- assert ( 1 == endmntent(fstab)); /* endmntent must always return 1 */ -- printf("entmntent(0)\n"); -- assert ( 1 == endmntent(0)); /* causes a segfault with diet libc */ -+ - return 0; - } -- -diff --git a/test/getservbyname.c b/test/getservbyname.c -index b70ca19..caf1c9f 100644 ---- a/test/getservbyname.c -+++ b/test/getservbyname.c -@@ -1,5 +1,6 @@ - #include - #include -+#include - - 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 -+++ b/test/malloc-debugger.c -@@ -4,7 +4,7 @@ - int main() { - char* c=malloc(13); - char* tmp; -- fprintf(stderr,"got %p\n",c); -+ fprintf(stdout,"got %p\n",c); - c[0]=14; - // c[15]=0; - tmp=realloc(c,12345); -diff --git a/test/math.c b/test/math.c -new file mode 100644 -index 0000000..687103c ---- /dev/null -+++ b/test/math.c -@@ -0,0 +1,29 @@ -+#include -+#include -+#include -+ -+int main() -+{ -+ extern int __isinf(double d); -+ extern int __isnan(double d); -+ -+#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) -+ assert(__isinf(__builtin_inff()) == +1); -+ assert(__isinf(-__builtin_inff()) == -1); -+ -+ assert(__isinf(__builtin_inf()) == +1); -+ assert(__isinf(-__builtin_inf()) == -1); -+ -+ assert(__isnan(__builtin_nan(""))); -+#endif -+ -+ assert(__isinf((DBL_MAX * DBL_MAX)) == +1); -+ assert(__isinf(-(DBL_MAX * DBL_MAX)) == -1); -+ -+ assert(isinf((DBL_MAX * DBL_MAX))); -+ assert(isinf(-(DBL_MAX * DBL_MAX))); -+ -+ //assert(isnan(nan(""))); -+ -+ return 0; -+} -diff --git a/test/mktime.c b/test/mktime.c -index 5e9e65c..9b4bd5e 100644 ---- a/test/mktime.c -+++ b/test/mktime.c -@@ -9,15 +9,15 @@ int main() { - t.tm_mday=29; - t.tm_mon=2; - t.tm_year=100; -- printf("%d\n",mktime(&t)); -+ printf("%ld\n",(long)mktime(&t)); - t.tm_mday=1; - t.tm_mon=3; - t.tm_year=102; -- printf("%d\n",mktime(&t)); -+ printf("%ld\n",(long)mktime(&t)); - t.tm_mday=1; - t.tm_mon=6; - t.tm_year=102; -- printf("%d\n",mktime(&t)); -+ printf("%ld\n",(long)mktime(&t)); - 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 -+++ b/test/printf.c -@@ -2,11 +2,26 @@ - #include - #include - #include -+#include -+#include - #include - #include - - #define ALGN 5 - -+#ifndef INFINITY -+# if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) -+# define INFINITY (__builtin_inf()) -+# endif -+#endif -+ -+#ifndef NAN -+# if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) -+# define NAN (__builtin_nan("")) -+# endif -+#endif -+ -+ - // https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=112986 - #if 0 - #undef assert -@@ -60,7 +75,7 @@ - TEST_SNPRINTF(EXP, 0, __VA_ARGS__); \ - TEST_SNPRINTF(EXP, sizeof(EXP)+ALGN, __VA_ARGS__); \ - TEST_SNPRINTF_NULL(EXP, __VA_ARGS__) -- -+ - - int main() - { -@@ -101,7 +116,7 @@ int main() - TEST("42.23", "%5.2f", 42.23); - TEST("42.23", "%5.4g", 42.23); - TEST(" 42.2", "%5.3g", 42.23); -- -+ - TEST(" 1", "%*i", 4, 1); - TEST(" 1", "%4i", 1); - TEST("1 ", "%-4i", 1); -@@ -131,13 +146,32 @@ int main() - TEST("-01234", "%6.5i", -1234); - TEST(" 1234", "%6.5s", "1234"); - -+#ifdef INFINITY -+ TEST("inf", "%f", INFINITY); -+ TEST("-inf", "%f", -INFINITY); -+ TEST("INF", "%F", INFINITY); -+ TEST("-INF", "%F", -INFINITY); -+ -+ TEST("inf", "%g", INFINITY); -+ TEST("-inf", "%g", -INFINITY); -+ TEST("INF", "%G", INFINITY); -+ TEST("-INF", "%G", -INFINITY); -+#endif -+ -+#ifdef NAN -+ TEST("nan", "%f", NAN); -+ TEST("NAN", "%F", NAN); -+ TEST("nan", "%g", NAN); -+ TEST("NAN", "%G", NAN); -+#endif -+ - #ifdef XSI_TESTS - setlocale(LC_ALL, "de_DE"); -- -+ - TEST("1.234", "%'u", 1234); - TEST("2 1", "%2$u %1$u", 1, 2); - #endif -- -- -+ -+ - return EXIT_SUCCESS; - } -diff --git a/test/printftest.c b/test/printftest.c -index 4743279..47d9580 100644 ---- a/test/printftest.c -+++ b/test/printftest.c -@@ -101,8 +101,8 @@ int main() - printf("#%i#\n",18); - printf("#%d#\n",18); - printf("#%u#\n",18); -- printf("#%lu#\n",18); -- printf("#%li#\n",18); -+ printf("#%lu#\n",18l); -+ printf("#%li#\n",18l); - printf("#%-+#06d#\n", -123); - printf("#%-+#6d#\n", -123); - printf("#%+#06d#\n", -123); -@@ -142,7 +142,7 @@ int main() - buf); - memset(buf2,0,sizeof(buf)); - i=snprintf(buf2, 256, "%.9999u", 10); -- printf("%i %i\n",i,strlen(buf2)); -+ printf("%i %li\n",i,strlen(buf2)); - - printf ("snprintf (\"%%.999999u\", 10) == %d\n", - snprintf(buf2, sizeof(buf2), "%.999999u", 10)); -diff --git a/test/rand48.c b/test/rand48.c -index 4f5b08f..1e67632 100644 ---- a/test/rand48.c -+++ b/test/rand48.c -@@ -6,16 +6,16 @@ main (void) - { - static unsigned short data[7] = { 1, 2, 3, 4, 5, 6, 7 }; - -- printf ("one %X\n", mrand48 ()); -- printf ("two %X\n", mrand48 ()); -- printf ("three %X\n", mrand48 ()); -+ printf ("one %lX\n", mrand48 ()); -+ printf ("two %lX\n", mrand48 ()); -+ printf ("three %lX\n", mrand48 ()); - - lcong48 (data); - printf ("after lcong48:\n"); - -- printf ("one %X\n", mrand48 ()); -- printf ("two %X\n", mrand48 ()); -- printf ("three %X\n", mrand48 ()); -+ printf ("one %lX\n", mrand48 ()); -+ printf ("two %lX\n", mrand48 ()); -+ printf ("three %lX\n", mrand48 ()); - - return 0; - } -diff --git a/test/runtests.sh b/test/runtests.sh -index d6fb19b..15b70b1 100644 ---- a/test/runtests.sh -+++ b/test/runtests.sh -@@ -1,6 +1,6 @@ - SUBDIRS="dirent inet stdio string stdlib time" - --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 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 utime waitpid" -+TESTPROGRAMS="adjtime alarm argv atexit bsearch byteswap calloc confstr empty fadvise flush fputc ffs fnmatch ftruncate 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 setjmp siglist sigsetjmp speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysconf sysenter ungetc utime waitpid" - - STDIN="read1" - PASS="getpass" -diff --git a/test/sendfile.c b/test/sendfile.c -index d43cdd2..28b3af5 100644 ---- a/test/sendfile.c -+++ b/test/sendfile.c -@@ -11,5 +11,5 @@ int main() { - - printf("sendfile returned %d\n",ret); - --return 0; -+ return ret<0 ? 1 : 0; - } -diff --git a/test/setjmp.c b/test/setjmp.c -new file mode 100644 -index 0000000..15951e5 ---- /dev/null -+++ b/test/setjmp.c -@@ -0,0 +1,106 @@ -+#include -+#include -+#include -+#include -+ -+static int Xmemcmp(void const volatile *a, void const volatile *b, size_t l) -+{ -+ return memcmp((void const *)a, (void const *)b, l); -+} -+ -+int main(void) -+{ -+ char volatile a[8] = "testbufA"; -+ jmp_buf env; -+ char volatile b[8] = "testbufB"; -+ -+ assert(Xmemcmp(a, "testbufA", 8) == 0); -+ assert(Xmemcmp(b, "testbufB", 8) == 0); -+ -+ -+ /* Test 1: not calling longjmp */ -+ if (setjmp(env) == 0) { -+ char volatile somebuf[128]; -+ -+ memset((void *)somebuf, 0xde, sizeof somebuf); -+ -+ assert(Xmemcmp(a, "testbufA", 8) == 0); -+ assert(Xmemcmp(b, "testbufB", 8) == 0); -+ } else -+ assert(0); -+ -+ assert(Xmemcmp(a, "testbufA", 8) == 0); -+ assert(Xmemcmp(b, "testbufB", 8) == 0); -+ -+ -+ /* Test 2: calling longjmp */ -+ switch (setjmp(env)) { -+ case 0: { -+ char volatile somebuf[128]; -+ -+ memset((void *)somebuf, 0xde, sizeof somebuf); -+ -+ assert(Xmemcmp(a, "testbufA", 8) == 0); -+ assert(Xmemcmp(b, "testbufB", 8) == 0); -+ -+ longjmp(env, 23); -+ -+ a[0] = 'X'; -+ b[0] = 'X'; -+ } -+ -+ case 23: -+ break; -+ -+ default: -+ assert(0); -+ } -+ -+ assert(Xmemcmp(a, "testbufA", 8) == 0); -+ assert(Xmemcmp(b, "testbufB", 8) == 0); -+ -+ -+ /* Test 3: calling longjmp again with dirty env */ -+ switch (setjmp(env)) { -+ case 0: { -+ char volatile somebuf[128]; -+ -+ memset((void *)somebuf, 0xde, sizeof somebuf); -+ -+ assert(Xmemcmp(a, "testbufA", 8) == 0); -+ assert(Xmemcmp(b, "testbufB", 8) == 0); -+ -+ longjmp(env, 23); -+ -+ a[0] = 'X'; -+ b[0] = 'X'; -+ } -+ -+ case 23: -+ break; -+ -+ default: -+ assert(0); -+ } -+ -+ assert(Xmemcmp(a, "testbufA", 8) == 0); -+ assert(Xmemcmp(b, "testbufB", 8) == 0); -+ -+ -+ /* Test 4: not calling longjmp, but dirty env */ -+ if (setjmp(env) == 0) { -+ char volatile somebuf[128]; -+ -+ memset((void *)somebuf, 0xde, sizeof somebuf); -+ -+ assert(Xmemcmp(a, "testbufA", 8) == 0); -+ assert(Xmemcmp(b, "testbufB", 8) == 0); -+ } else -+ assert(0); -+ -+ assert(Xmemcmp(a, "testbufA", 8) == 0); -+ assert(Xmemcmp(b, "testbufB", 8) == 0); -+ -+ -+ return EXIT_SUCCESS; -+} -diff --git a/test/sigsetjmp.c b/test/sigsetjmp.c -new file mode 100644 -index 0000000..3fa71bb ---- /dev/null -+++ b/test/sigsetjmp.c -@@ -0,0 +1,140 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define TEST_PATTERN \ -+ "0123456789abcdefghijklmnopqrstuv" \ -+ "ZYXWVUTSRQPONMLKJIHGFEDCBA987654" \ -+ "456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ -+ "vutsrqponmlkjihgfedcba9876543210" \ -+ "0123456789ABCDEFGHIJKLMNOPQRSTUV" \ -+ "zyxwvutsrqponmlkjihgfedcba987654" \ -+ "456789abcdefghijklmnopqrstuvwxyz" \ -+ "VUTSRQPONMLKJIHGFEDCBA987654321" \ -+ -+static struct { -+ char volatile a[256]; -+ sigjmp_buf env; -+ char volatile b[256]; -+} sigenv = { -+ .a = TEST_PATTERN "<", -+ .b = TEST_PATTERN ">", -+}; -+ -+static int volatile sig_seen; -+ -+#define VALIDATE_BUFFERS(_sig_exp) do { \ -+ assert(Xmemcmp(sigenv.a, TEST_PATTERN "<", sizeof sigenv.a) == 0); \ -+ assert(Xmemcmp(sigenv.b, TEST_PATTERN ">", sizeof sigenv.b) == 0); \ -+ assert(sig_seen == (_sig_exp)); \ -+ } while (0) -+ -+static int Xmemcmp(void const volatile *a, void const volatile *b, size_t l) -+{ -+ return memcmp((void const *)a, (void const *)b, l); -+} -+ -+static void do_test(int sig_num, int do_save, int block_sig) -+{ -+ int rc; -+ sigset_t block_set; -+ sigset_t cur_set; -+ -+ printf("%s(%d,%d,%d)... ", __func__, sig_num, do_save, block_sig); -+ fflush(stdout); -+ -+ VALIDATE_BUFFERS(0); -+ -+ sigemptyset(&block_set); -+ assert(sigprocmask(SIG_SETMASK, NULL, &cur_set) == 0); -+ -+ /* verify that tested signal is not blocked */ -+ if (sig_num != 0) -+ assert(!sigismember(&cur_set, sig_num)); -+ -+ /* verify that blocked signal is not already blocked and fill signal set */ -+ if (block_sig != 0) { -+ assert(!sigismember(&cur_set, block_sig)); -+ sigaddset(&block_set, block_sig); -+ } -+ -+ sig_seen = 0; -+ rc = sigsetjmp(sigenv.env, do_save); -+ if (rc == 0) { -+ char volatile somebuf[128]; -+ -+ memset((void *)somebuf, 0x42, sizeof somebuf); -+ VALIDATE_BUFFERS(0); -+ -+ /* modify signal mask */ -+ if (block_sig != 0) -+ assert(sigprocmask(SIG_BLOCK, &block_set, NULL) == 0); -+ -+ /* raise a signal which triggers a siglongjmp */ -+ if (sig_num != 0) { -+ raise(sig_num); -+ sigenv.a[0] = 'X'; -+ sigenv.b[0] = 'X'; -+ assert(0); -+ } -+ } else if (rc != sig_num) -+ /* sigsetjmp() returned with an unexpected value */ -+ assert(0); -+ -+ VALIDATE_BUFFERS(sig_num); -+ sig_seen = 0; -+ -+ /* check whether current signal mask contains the blocked signal; it should -+ be there iff sigsetjmp() was triggered and sigmask was saved. */ -+ if (block_sig != 0) { -+ sigset_t cur_set; -+ assert(sigprocmask(SIG_SETMASK, NULL, &cur_set) == 0); -+ -+ if (do_save && rc != 0) -+ assert(!sigismember(&cur_set, block_sig)); -+ else { -+ assert( sigismember(&cur_set, block_sig)); -+ sigprocmask(SIG_UNBLOCK, &block_set, NULL); -+ } -+ } -+ -+ printf(" ok\n"); -+}; -+ -+static void sig_handler(int num) -+{ -+ assert(sig_seen == 0); -+ sig_seen = num; -+ siglongjmp(sigenv.env, num); -+} -+ -+int main(void) -+{ -+ struct sigaction sigact = { -+ .sa_handler = sig_handler, -+ .sa_flags = SA_NODEFER, /* raised signal will be in blocked mask else */ -+ }; -+ -+ /* verify our assumptions about the memory layout */ -+ assert(sizeof sigenv.a == 256); -+ assert(sizeof sigenv.b == 256); -+ assert(offsetof(__typeof__(sigenv), env) == sizeof sigenv.a); -+ assert(offsetof(__typeof__(sigenv), b) == sizeof sigenv.a + sizeof sigenv.env); -+ -+ sigaction(SIGBUS, &sigact, NULL); -+ sigaction(SIGUSR1, &sigact, NULL); -+ -+ do_test(0, 0, 0); -+ do_test(0, 0, SIGUSR1); -+ do_test(0, 1, 0); -+ do_test(0, 1, SIGUSR1); -+ do_test(SIGBUS, 0, 0); -+ do_test(SIGBUS, 0, SIGUSR1); -+ do_test(SIGBUS, 1, 0); -+ do_test(SIGBUS, 1, SIGUSR1); -+ -+ return EXIT_SUCCESS; -+} -diff --git a/test/speed.c b/test/speed.c -index 674b9a8..22249a7 100644 ---- a/test/speed.c -+++ b/test/speed.c -@@ -7,10 +7,10 @@ int main() { - int i; - time_t t; - -- printf("%d\n", time(0)); -+ printf("%ld\n", (long)time(0)); - for (i=0; i<10000000; ++i) - t=time(0); - -- printf("%d\n", time(0)); -+ 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 -+++ b/test/stdio/tstscanf.c -@@ -338,14 +338,14 @@ main (int argc, char **argv) - int res; - - res = sscanf ("-InF", "%f", &value); -- if (res != 1 || isinf (value) != -1) -+ if (res != 1 || !isinf (value) || !(value<0)) - { - fputs ("test failed!\n", stdout); - result = 1; - } - - res = sscanf ("+InfiNiTY", "%f", &value); -- if (res != 1 || isinf (value) != 1) -+ if (res != 1 || !isinf (value) || !(value>0)) - { - 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 -+++ b/test/stdlib/testsort.c -@@ -1,3 +1,5 @@ -+#define _BSD_SOURCE -+ - #include - #include - #include -diff --git a/test/stdlib/tst-calloc.c b/test/stdlib/tst-calloc.c -index a9b9e2a..049117b 100644 ---- a/test/stdlib/tst-calloc.c -+++ b/test/stdlib/tst-calloc.c -@@ -17,6 +17,8 @@ - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -+#define _BSD_SOURCE -+ - #include - #include - #include -diff --git a/test/stdlib/tst-malloc.c b/test/stdlib/tst-malloc.c -index 09fbb1f..4a491d9 100644 ---- a/test/stdlib/tst-malloc.c -+++ b/test/stdlib/tst-malloc.c -@@ -21,13 +21,15 @@ - #include - #include - -+#include "../../dietfeatures.h" -+ - static int errors = 0; - - static void - merror (const char *msg) - { - ++errors; -- printf ("Error: %s\n", msg); -+ fprintf (stderr, "Error: %s\n", msg); - } - - int -@@ -56,9 +58,11 @@ main (void) - if (p != NULL) - merror ("realloc (p, 0) failed."); - -+#ifdef WANT_MALLOC_ZERO - p = malloc (0); - if (p == NULL) - merror ("malloc (0) failed."); -+#endif - - p = realloc (p, 0); - if (p != NULL) -diff --git a/test/stdlib/tst-strtod.c b/test/stdlib/tst-strtod.c -index 630a8fc..bacdca7 100644 ---- a/test/stdlib/tst-strtod.c -+++ b/test/stdlib/tst-strtod.c -@@ -149,10 +149,10 @@ main (int argc, char ** argv) - } - - const char input2[] = "+1.000000000116415321826934814453125"; -- if (strtold (input2, NULL) != +1.000000000116415321826934814453125) -+ if (strtold (input2, NULL) != +1.000000000116415321826934814453125L) - { - printf ("input2: %La != %La\n", strtold (input2, NULL), -- +1.000000000116415321826934814453125); -+ +1.000000000116415321826934814453125L); - 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 ---- /dev/null -+++ b/test/sysconf.c -@@ -0,0 +1,80 @@ -+#include -+#include -+#include -+#include -+#include -+ -+#include "../dietpagesize.h" -+ -+static long exec_getconf(char const *var) -+{ -+ char buf[128]; -+ pid_t pid; -+ int fd[2]; -+ int status; -+ ssize_t l; -+ -+ if (pipe(fd)<0 || (pid = fork())<0) -+ abort(); -+ -+ if (pid==0) { -+ close(fd[0]); -+ -+ if (fd[1]!=1) { -+ dup2(fd[1], 1); -+ close(fd[1]); -+ } -+ -+ execlp("getconf", "getconf", var, NULL); -+ _exit(1); -+ } -+ -+ close(fd[1]); -+ l = read(fd[0], buf, sizeof(buf)-1); -+ if (l<0) { -+ perror("read()"); -+ goto err; -+ } else if (l==sizeof(buf)-1) -+ goto err; -+ close(fd[0]); -+ -+ buf[l] = '\0'; -+ -+ if (waitpid(pid, &status, 0)<0) -+ goto err; -+ -+ if (!WIFEXITED(status) || WEXITSTATUS(status)!=0) -+ goto err; -+ -+ return strtol(buf, NULL, 10); -+ -+ err: -+ kill(pid, SIGKILL); -+ abort(); -+} -+ -+static unsigned int do_check(char const *var, long exp) -+{ -+ long cur = exec_getconf(var); -+ -+ if (cur!=exp) { -+ fprintf(stderr, "%s mismatch: got %ld, expected %ld\n", -+ var, cur, exp); -+ return 1; -+ } -+ -+ return 0; -+} -+ -+int main(int argc, char *argv[]) -+{ -+ unsigned int err = 0; -+ -+ assert(sysconf(_SC_PAGESIZE) == __DIET_PAGE_SIZE); -+ assert(__DIET_PAGE_SIZE == (1<<__DIET_PAGE_SHIFT)); -+ -+ err += do_check("PAGE_SIZE", sysconf(_SC_PAGESIZE)); -+ err += do_check("CLK_TCK", sysconf(_SC_CLK_TCK)); -+ -+ return err; -+} -diff --git a/test/sysenter.c b/test/sysenter.c -index a8fa3a8..3d85916 100644 ---- a/test/sysenter.c -+++ b/test/sysenter.c -@@ -11,11 +11,11 @@ int main() { - int i; - for (i=0; environ[i]; ++i) ; - for (x=(struct elf_aux*)(environ+i+1); x->type; ++x) { -- printf("%d %x\n",x->type,x->value); -+ printf("%ld %lx\n",x->type,x->value); - if (x->type==AT_PAGESZ) -- printf("pagesize %d\n",x->value); -+ printf("pagesize %ld\n",x->value); - else if (x->type==AT_SYSINFO) -- printf("vsyscall %p\n",x->value); -+ printf("vsyscall %p\n",(void *)x->value); - } - 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 -+++ b/test/time/tst-strftime.c -@@ -49,18 +49,18 @@ int main (void) { - - if (res == 0) - { -- printf ("%Zu: %s: res == 0 despite size == %Zu\n", -+ printf ("%zu: %s: res == 0 despite size == %zu\n", - cnt, tests[cnt].fmt, size); - result = 1; - } - else if (size < tests[cnt].min) - { -- printf ("%Zu: %s: size == %Zu was enough\n", -+ printf ("%zu: %s: size == %zu was enough\n", - cnt, tests[cnt].fmt, size); - result = 1; - } - else -- printf ("%Zu: %s: size == %Zu: OK\n", cnt, tests[cnt].fmt, size); -+ printf ("%zu: %s: size == %zu: OK\n", cnt, tests[cnt].fmt, size); - - free (buf); - } -diff --git a/test/time/tst-strptime.c b/test/time/tst-strptime.c -index 6277ea6..2773180 100644 ---- a/test/time/tst-strptime.c -+++ b/test/time/tst-strptime.c -@@ -41,10 +41,12 @@ static const struct - { "C", "03/03/00", "%D", 5, 62, 2, 3 }, - { "C", "9/9/99", "%x", 4, 251, 8, 9 }, - { "C", "19990502123412", "%Y%m%d%H%M%S", 0, 121, 4, 2 }, -+#if 0 /* dietlibc does not support %U/%W/%j and non-POSIX locales */ - { "C", "2001 20 Mon", "%Y %U %a", 1, 140, 4, 21 }, - { "C", "2001 21 Mon", "%Y %W %a", 1, 140, 4, 21 }, - { "ja_JP.EUC-JP", "2001 20 \xb7\xee", "%Y %U %a", 1, 140, 4, 21 }, - { "ja_JP.EUC-JP", "2001 21 \xb7\xee", "%Y %W %a", 1, 140, 4, 21 }, -+#endif - }; - - -@@ -72,9 +74,16 @@ test_tm (void) - - for (i = 0; i < sizeof (tm_tests) / sizeof (tm_tests[0]); ++i) - { -+ char *pres; - memset (&tm, '\0', sizeof (tm)); -- -- if (strptime (tm_tests[i].input, tm_tests[i].format, &tm) != '\0') -+ -+ pres = strptime (tm_tests[i].input, tm_tests[i].format, &tm); -+ if (!pres) -+ { -+ fprintf(stderr, "failed to parse '%s'\n", day_tests[i].input); -+ result = 1; -+ } -+ else if (*pres != '\0') - { - printf ("not all of `%s' read\n", tm_tests[i].input); - result = 1; -@@ -118,6 +127,7 @@ int main (void) { - - for (i = 0; i < sizeof (day_tests) / sizeof (day_tests[0]); ++i) - { -+ char *pres; - memset (&tm, '\0', sizeof (tm)); - - if (setlocale (LC_ALL, day_tests[i].locale) == NULL) -@@ -125,7 +135,14 @@ int main (void) { - printf ("cannot set locale %s: %m\n", day_tests[i].locale); - } - -- if (*strptime (day_tests[i].input, day_tests[i].format, &tm) != '\0') -+ pres = strptime (day_tests[i].input, day_tests[i].format, &tm); -+ if (!pres) -+ { -+ fprintf(stderr, "failed to parse '%s' for locale '%s'\n", -+ day_tests[i].input, day_tests[i].locale); -+ result = 1; -+ } -+ else if (*pres != '\0') - { - printf ("not all of `%s' read\n", day_tests[i].input); - result = 1; -diff --git a/test/waitpid.c b/test/waitpid.c -index fe2cb5b..92c0b0e 100644 ---- a/test/waitpid.c -+++ b/test/waitpid.c -@@ -11,7 +11,7 @@ int main() { - perror("fork"); - _exit(1); - case 0: -- fprintf(stderr,"child, my pid is %u\n",getpid()); -+ fprintf(stdout,"child, my pid is %u\n",getpid()); - sleep(1); - _exit(23); - } -diff --git a/x86_64/__time.S b/x86_64/__time.S -new file mode 100644 -index 0000000..774b67f ---- /dev/null -+++ b/x86_64/__time.S -@@ -0,0 +1,11 @@ -+/* implement time(2) via gettimeofday(2) on x86-64 because gettimeofday -+ is a vsyscall (i.e. no actual switch to kernel mode) */ -+.text -+.global time -+.type time,@function -+time: -+ mov $0xffffffffff600400,%rax -+ call *%rax -+ ret -+.Lhere: -+ .size time,.Lhere-time -diff --git a/x86_64/start.S b/x86_64/start.S -index adc461a..8b4f3c9 100644 ---- a/x86_64/start.S -+++ b/x86_64/start.S -@@ -12,12 +12,28 @@ _start: - - leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */ - -+ -+#ifdef WANT_ELFINFO -+#ifdef __DYN_LIB -+ movq environ@GOTPCREL(%rip), %rax -+#else -+ leaq environ(%rip), %rax -+#endif -+ movq %rdx, (%rax) /* environ */ -+ -+1: add $8, %rdx /* increment envp */ -+ cmpq $0, -8(%rdx) /* load envp[-1] */ -+ jne 1b /* ... until envp[-1]==NULL */ -+ -+ movq %rdx, 8(%rax) /* __elfinfo */ -+#else - #ifdef __DYN_LIB - movq environ@GOTPCREL(%rip), %rax - movq %rdx, (%rax) - #else - movq %rdx, environ(%rip) - #endif -+#endif - - #ifdef PROFILING - pushq %rdi /* save reg args */ -diff --git a/x86_64/time.S b/x86_64/time.S -index 774b67f..690ee30 100644 ---- a/x86_64/time.S -+++ b/x86_64/time.S -@@ -1,11 +1 @@ --/* implement time(2) via gettimeofday(2) on x86-64 because gettimeofday -- is a vsyscall (i.e. no actual switch to kernel mode) */ --.text --.global time --.type time,@function --time: -- mov $0xffffffffff600400,%rax -- call *%rax -- ret --.Lhere: -- .size time,.Lhere-time -+/* avoid empty source file */ diff --git a/dietlibc.spec b/dietlibc.spec index b5ec9fc..3803fc7 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -7,7 +7,7 @@ %bcond_without noarch ## -%global prerelease 20110311 +%global prerelease 20111222 %global pkglibdir %_prefix/lib/dietlibc %ifarch %ix86 x86_64 @@ -34,7 +34,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1601 +Release: %release_func 1700 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -43,11 +43,11 @@ Source0: http://www.kernel.org/pub/linux/libs/dietlibc/%name-%version.tar.bz2 Source1: http://www.fefe.de/dietlibc/%name-%version.tar.bz2.sig %else # generated by 'make cvs-sources [CVS_DATE=....]' -Source0: %name-%version.%prerelease.tar.bz2 +Source0: %name-%version.%prerelease.tar.xz %endif Source10: runtests-X.sh ## CVS..master diff from https://github.com/ensc/dietlibc -Patch0: dietlibc-github.patch +Patch0: dietlibc-github.patch.gz BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -202,6 +202,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Jan 14 2012 Enrico Scholz - 0.33-0.1700.20111222 +- updated to 20111222 CVS snapshot +- rediffed + updated patchset + * Fri Jan 13 2012 Fedora Release Engineering - 0.33-0.1601.20110311 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild diff --git a/sources b/sources index 626985e..f956b98 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -5b0f5f5433db773cd9185c8ed79374f0 dietlibc-0.33.20110311.tar.bz2 +13401ee8360ac03aa862840b2a2cae47 dietlibc-0.33.20111222.tar.xz +03d26bdc779a9abf62792ca4c449f182 dietlibc-github.patch.gz From 2ed074850186d436b065d0581b1e1ca58ae17fcf Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 31 Mar 2012 16:01:11 +0200 Subject: [PATCH 103/161] makefile: added target to fetch the github patch --- Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Makefile b/Makefile index c64dfb6..b274c60 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,25 @@ MAKEFILE_COMMON = $(HOME)/.fedora/common.mk -include $(MAKEFILE_COMMON) CVS ?= cvs +GIT ?= git TAR ?= tar +GZIP ?= gzip CVS_BASEVER = 0.33 CVS_DATE := $(shell date +'%Y%m%d' -d '-1 day') +GIT_URL = git://github.com/ensc/dietlibc.git +GIT_DIFF_OPTS = --summary --stat --patch +GIT_BRANCH_OLD = CVS +GIT_BRANCH_NEW = master _cvs_suffix = ${CVS_BASEVER}.${CVS_DATE} cvs-sources: cd ${DESTDIR} . && $(CVS) -d :pserver:cvs@cvs.fefe.de:/cvs -z9 export -D${CVS_DATE} -d dietlibc-${_cvs_suffix} dietlibc cd ${DESTDIR} . && $(TAR) cJf dietlibc-${_cvs_suffix}.tar.xz dietlibc-${_cvs_suffix} --owner root --group root + +git-patch: + cd ${DESTDIR} . && $(GIT) clone --mirror $(GIT_URL) dietlibc.git + cd ${DESTDIR} . && cd dietlibc.git && { \ + ref=`git ls-remote . refs/heads/$(GIT_BRANCH_NEW) | cut -f 1` && \ + $(GIT) diff $(GIT_DIFF_OPTS) $(GIT_BRANCH_OLD)..$(GIT_BRANCH_NEW) > diff && \ + $(GZIP) -c < diff > ../dietlibc-github-$$ref.patch.gz ; } + cd ${DESTDIR} . && rm -rf dietlibc.git From 022e9e26422466a52c3d72f8f06c93dd31a933fc Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 31 Mar 2012 16:04:45 +0200 Subject: [PATCH 104/161] - updated to 20120330 CVS snapshot - versionized the patchset fetched from github --- .gitignore | 4 ++-- dietlibc.spec | 12 +++++++++--- sources | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index b0869ba..1b6e4d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -/dietlibc-0.33.20111222.tar.xz -/dietlibc-github.patch.gz +/dietlibc-0.33.20120330.tar.xz +/dietlibc-github-e3675c7d1939de7fa679f6a80372ac35d0848589.patch.gz diff --git a/dietlibc.spec b/dietlibc.spec index 3803fc7..e3e1640 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -7,7 +7,8 @@ %bcond_without noarch ## -%global prerelease 20111222 +%global prerelease 20120330 +%global githubref e3675c7d1939de7fa679f6a80372ac35d0848589 %global pkglibdir %_prefix/lib/dietlibc %ifarch %ix86 x86_64 @@ -34,7 +35,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1700 +Release: %release_func 1800 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -47,7 +48,7 @@ Source0: %name-%version.%prerelease.tar.xz %endif Source10: runtests-X.sh ## CVS..master diff from https://github.com/ensc/dietlibc -Patch0: dietlibc-github.patch.gz +Patch0: dietlibc-github-%githubref.patch.gz BuildRoot: %_tmppath/%name-%version-%release-buildroot %{?with_dynamic:Requires: dietlibc-lib = %version-%release} %{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} @@ -202,6 +203,11 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Mar 31 2012 Enrico Scholz - 0.33-0.1800.20120330 +- updated to 20120330 CVS snapshot +- versionized the patchset fetched from github +- fixed build on armv7+ systems (#800601) + * Sat Jan 14 2012 Enrico Scholz - 0.33-0.1700.20111222 - updated to 20111222 CVS snapshot - rediffed + updated patchset diff --git a/sources b/sources index f956b98..b9c6c67 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -13401ee8360ac03aa862840b2a2cae47 dietlibc-0.33.20111222.tar.xz -03d26bdc779a9abf62792ca4c449f182 dietlibc-github.patch.gz +a6f2dac580cff9bb79da5d3a75c7cc8a dietlibc-0.33.20120330.tar.xz +7e2bd759a5fc8699b845b6162f945cb5 dietlibc-github-e3675c7d1939de7fa679f6a80372ac35d0848589.patch.gz From 031e2ffc833d2b52e05754c599b18120809d5810 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Thu, 5 Apr 2012 14:52:00 +0200 Subject: [PATCH 105/161] - updated git-patch (fstatat(2) implementation + actime_r(3) fixes) - removed local runtests-X.sh; it is in git already --- .gitignore | 2 +- dietlibc.spec | 13 ++++----- runtests-X.sh | 80 --------------------------------------------------- sources | 2 +- 4 files changed, 8 insertions(+), 89 deletions(-) delete mode 100644 runtests-X.sh diff --git a/.gitignore b/.gitignore index 1b6e4d9..32cf102 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /dietlibc-0.33.20120330.tar.xz -/dietlibc-github-e3675c7d1939de7fa679f6a80372ac35d0848589.patch.gz +/dietlibc-github-236455eac1d2ed2e2004a89b85f904f3ab27e0da.patch.gz diff --git a/dietlibc.spec b/dietlibc.spec index e3e1640..e40f032 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -8,7 +8,7 @@ ## %global prerelease 20120330 -%global githubref e3675c7d1939de7fa679f6a80372ac35d0848589 +%global githubref 236455eac1d2ed2e2004a89b85f904f3ab27e0da %global pkglibdir %_prefix/lib/dietlibc %ifarch %ix86 x86_64 @@ -35,7 +35,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1800 +Release: %release_func 1801 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -46,7 +46,6 @@ Source1: http://www.fefe.de/dietlibc/%name-%version.tar.bz2.sig # generated by 'make cvs-sources [CVS_DATE=....]' Source0: %name-%version.%prerelease.tar.xz %endif -Source10: runtests-X.sh ## CVS..master diff from https://github.com/ensc/dietlibc Patch0: dietlibc-github-%githubref.patch.gz BuildRoot: %_tmppath/%name-%version-%release-buildroot @@ -134,10 +133,6 @@ sed -i \ %global basemakeflags prefix=%pkglibdir BINDIR=%_bindir MAN1DIR=%_mandir/man1 CFLAGS="$RPM_OPT_FLAGS %fixcflags $XTRA_CFLAGS" PDIET=%pkglibdir STRIP=: %global makeflags %basemakeflags -for i in `find test -name 'runtests.sh'`; do - ln -s %SOURCE10 `dirname $i`/runtests-X.sh -done - %build make %makeflags all %{?_smp_mflags} @@ -203,6 +198,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Thu Apr 5 2012 Enrico Scholz - 0.33-0.1801.20120330 +- updated git-patch (fstatat(2) implementation + actime_r(3) fixes) +- removed local runtests-X.sh; it is in git already + * Sat Mar 31 2012 Enrico Scholz - 0.33-0.1800.20120330 - updated to 20120330 CVS snapshot - versionized the patchset fetched from github diff --git a/runtests-X.sh b/runtests-X.sh deleted file mode 100644 index a0dbfc4..0000000 --- a/runtests-X.sh +++ /dev/null @@ -1,80 +0,0 @@ -#! /bin/bash - -eval $(grep '^\(TESTPROGRAMS\|SUBDIRS\)=' runtests.sh) - -FAILURES_BOGUS=( - ":gethostbyname" # network test; net might not be available in test environment - - ":stdlib:tst-environ" # test uses environ function in unsupported ways (dup keys) - ":stdlib:tst-rand48" # platform dependent; does not give reliable results - ":stdlib:tst-strtod" # infinite recursion in __dtostr() - ":time:tst-mktime" # dietlibc does not support $TZ env - ":time:tst-posixtz" # dietlibc does not support $TZ env - ":time:tst-strftime" # dietlibc does not support glibc specific format specifications -) - -FAILURES_KNOWN=( - ":sendfile" # stdin/stdout not supported; test must be wrapped - ":stdio:tstdiomisc" # scanf(3) fails on some constructs - ":stdio:tst-fphex" # printf(3) does not support %a specifiers - ":stdio:tst-printf" # printf(3) does not support some floating point ops - ":stdio:tst-sscanf" # scanf(3) fails on double input - ":stdlib:test-canon" # realpath(3) is broken... -) - -function is_in() { - local val=$1 - local i - shift - - for i; do - test x"$i" != x"$val" || return 0 - done - return 1 -} - -rc=0 - -: ${RUNTEST_INDENT=0} -export RUNTEST_INDENT -export RUNTEST_NS - -for p in $TESTPROGRAMS; do - ! tty -s || printf '%*s%-20s' $RUNTEST_INDENT '' "$p" - - is_in "$RUNTEST_NS:$p" "${FAILURES_BOGUS[@]}" && fail_bogus=true || fail_bogus=false - is_in "$RUNTEST_NS:$p" "${FAILURES_KNOWN[@]}" && fail_known=true || fail_known=false - ./$p >/dev/null && failed=false || failed=true - - case $failed:$fail_known:$fail_bogus in - (false:false:*) res='OK';; - (false:true:true) res='OK (bogus)';; - (false:true:false) res="OK (unexpected)"; let ++rc;; - (true:*:true) res='FAIL (bogus)';; - (true:true:*) res="FAIL (known)";; - (true:false:*) res='FAIL'; let ++rc;; - esac - - ! tty -s || printf '\r' - - printf '%*s%-20s%s\n' $RUNTEST_INDENT '' "$p" "$res" -done - -test $rc -eq 0 || \ - printf "%*s--> %u tests failed\n" $RUNTEST_INDENT '' $rc - -for d in $SUBDIRS; do - echo "--- entering directory $d ---" - let RUNTEST_INDENT+=2 - old_ns=$RUNTEST_NS - RUNTEST_NS=$RUNTEST_NS:$d - - cd $d && bash ./runtests-X.sh || let ++rc - - RUNTEST_NS=$old_ns - let RUNTEST_INDENT-=2 - - cd $OLDPWD || exit 1 -done - -test $rc -eq 0 && exit 0 || exit 1 diff --git a/sources b/sources index b9c6c67..103e4aa 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ a6f2dac580cff9bb79da5d3a75c7cc8a dietlibc-0.33.20120330.tar.xz -7e2bd759a5fc8699b845b6162f945cb5 dietlibc-github-e3675c7d1939de7fa679f6a80372ac35d0848589.patch.gz +f481faef12b80822f0197b014438ac5e dietlibc-github-236455eac1d2ed2e2004a89b85f904f3ab27e0da.patch.gz From ab2b604420e46a693e061ac8061d77a435c45b0f Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 29 Apr 2012 14:52:12 +0200 Subject: [PATCH 106/161] removed shipped linux headers --- dietlibc.spec | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dietlibc.spec b/dietlibc.spec index e40f032..676f04d 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -109,6 +109,11 @@ This package contains the dynamic libraries for dietlibc. %apply -n0 -p1 +## Shipped linux headers are outdated and do not work well with those +## from recent kernels +rm -rf include/linux + + %if %{without ssp} sed -i -e 's!^#define WANT_SSP$!// \0!g; s!.*\(#define WANT_STACKGAP\).*!\1!g' dietfeatures.h @@ -198,6 +203,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun Apr 29 2012 Enrico Scholz +- removed local include/linux headers; shipped ones are outdated and + do not work well with those from the kernel-headers package + * Thu Apr 5 2012 Enrico Scholz - 0.33-0.1801.20120330 - updated git-patch (fstatat(2) implementation + actime_r(3) fixes) - removed local runtests-X.sh; it is in git already From a9e78e341ccfdea3515565d70c9f0dc24f0ce5d0 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 29 Apr 2012 14:53:03 +0200 Subject: [PATCH 107/161] added some -Wno-* build flags --- dietlibc.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 676f04d..97a4213 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -134,7 +134,7 @@ sed -i \ dietfeatures.h %endif -%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -g3 -Werror-implicit-function-declaration +%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -g3 -Werror-implicit-function-declaration -Wno-unused -Wno-switch %global basemakeflags prefix=%pkglibdir BINDIR=%_bindir MAN1DIR=%_mandir/man1 CFLAGS="$RPM_OPT_FLAGS %fixcflags $XTRA_CFLAGS" PDIET=%pkglibdir STRIP=: %global makeflags %basemakeflags @@ -206,6 +206,7 @@ rm -rf $RPM_BUILD_ROOT * Sun Apr 29 2012 Enrico Scholz - removed local include/linux headers; shipped ones are outdated and do not work well with those from the kernel-headers package +- added some '-Wno-*' build flags * Thu Apr 5 2012 Enrico Scholz - 0.33-0.1801.20120330 - updated git-patch (fstatat(2) implementation + actime_r(3) fixes) From 55acbe41bb59bc3e1a8fc7cabb5d9e758bccbf23 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 29 Apr 2012 14:53:58 +0200 Subject: [PATCH 108/161] make: embedded monotic increasing number into github patch --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b274c60..53a32bd 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ git-patch: cd ${DESTDIR} . && $(GIT) clone --mirror $(GIT_URL) dietlibc.git cd ${DESTDIR} . && cd dietlibc.git && { \ ref=`git ls-remote . refs/heads/$(GIT_BRANCH_NEW) | cut -f 1` && \ + cnt=`git rev-list refs/heads/$(GIT_BRANCH_NEW) | wc -l` && \ $(GIT) diff $(GIT_DIFF_OPTS) $(GIT_BRANCH_OLD)..$(GIT_BRANCH_NEW) > diff && \ - $(GZIP) -c < diff > ../dietlibc-github-$$ref.patch.gz ; } + $(GZIP) -c < diff > ../dietlibc-g$$cnt+$$ref.patch.gz ; } cd ${DESTDIR} . && rm -rf dietlibc.git From 08122db4c1eed04691d13c4f9d8a5bd366ec7a2b Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 29 Apr 2012 14:54:20 +0200 Subject: [PATCH 109/161] bumped release --- dietlibc.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 97a4213..9d2fc6f 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -35,7 +35,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1801 +Release: %release_func 1802 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -203,7 +203,7 @@ rm -rf $RPM_BUILD_ROOT %changelog -* Sun Apr 29 2012 Enrico Scholz +* Sun Apr 29 2012 Enrico Scholz - 0.33-0.1802.20120330 - removed local include/linux headers; shipped ones are outdated and do not work well with those from the kernel-headers package - added some '-Wno-*' build flags From 1b41fd7205b6bce6a82de40e878f396027dd69ed Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Mon, 30 Apr 2012 12:11:45 +0200 Subject: [PATCH 110/161] reverted removal of kernel headers; causes too much trouble --- dietlibc.spec | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 9d2fc6f..2a843cc 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -35,7 +35,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1802 +Release: %release_func 1803 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -109,11 +109,6 @@ This package contains the dynamic libraries for dietlibc. %apply -n0 -p1 -## Shipped linux headers are outdated and do not work well with those -## from recent kernels -rm -rf include/linux - - %if %{without ssp} sed -i -e 's!^#define WANT_SSP$!// \0!g; s!.*\(#define WANT_STACKGAP\).*!\1!g' dietfeatures.h @@ -203,6 +198,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun Apr 29 2012 Enrico Scholz - 0.33-0.1803.20120330 +- reverted removal of kernel headers; causes too much trouble + * Sun Apr 29 2012 Enrico Scholz - 0.33-0.1802.20120330 - removed local include/linux headers; shipped ones are outdated and do not work well with those from the kernel-headers package From afb79389e92eabbee53dec3e5f2f6d239461f6ce Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Wed, 18 Jul 2012 15:42:16 -0500 Subject: [PATCH 111/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 2a843cc..ef41600 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -35,7 +35,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1803 +Release: %release_func 1804 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -198,6 +198,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Wed Jul 18 2012 Fedora Release Engineering - 0.33-0.1804.20120330 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + * Sun Apr 29 2012 Enrico Scholz - 0.33-0.1803.20120330 - reverted removal of kernel headers; causes too much trouble From 48316be399fb8c7a1e01737373a446298473d3ea Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sun, 26 Aug 2012 16:22:30 +0200 Subject: [PATCH 112/161] updated to recent snapshot --- .gitignore | 2 ++ dietlibc.spec | 10 +++++++--- sources | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 32cf102..5946530 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /dietlibc-0.33.20120330.tar.xz /dietlibc-github-236455eac1d2ed2e2004a89b85f904f3ab27e0da.patch.gz +/dietlibc-0.33.20120825.tar.xz +/dietlibc-github-c3f1cf67fcc186bb859e64a085bf98aaa6182a82.patch.gz diff --git a/dietlibc.spec b/dietlibc.spec index ef41600..d894a35 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -7,8 +7,8 @@ %bcond_without noarch ## -%global prerelease 20120330 -%global githubref 236455eac1d2ed2e2004a89b85f904f3ab27e0da +%global prerelease 20120825 +%global githubref c3f1cf67fcc186bb859e64a085bf98aaa6182a82 %global pkglibdir %_prefix/lib/dietlibc %ifarch %ix86 x86_64 @@ -35,7 +35,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1804 +Release: %release_func 1900 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -198,6 +198,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun Aug 26 2012 Enrico Scholz - 0.33-0.1900.20120825 +- updated to recent snapshot +- fixed s390 issues (reported and patched by Dan Horák) + * Wed Jul 18 2012 Fedora Release Engineering - 0.33-0.1804.20120330 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild diff --git a/sources b/sources index 103e4aa..d998747 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -a6f2dac580cff9bb79da5d3a75c7cc8a dietlibc-0.33.20120330.tar.xz -f481faef12b80822f0197b014438ac5e dietlibc-github-236455eac1d2ed2e2004a89b85f904f3ab27e0da.patch.gz +016865b8c40d40a57b2ddb5862f2e338 dietlibc-0.33.20120825.tar.xz +734e14b59b7f017ae5843ee9b9b6d34e dietlibc-github-c3f1cf67fcc186bb859e64a085bf98aaa6182a82.patch.gz From 2173c640795f0ac4379ce50d7fbbe40195e1fee8 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Wed, 13 Feb 2013 13:42:44 -0600 Subject: [PATCH 113/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index d894a35..03a5135 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -35,7 +35,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1900 +Release: %release_func 1901 License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -198,6 +198,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Wed Feb 13 2013 Fedora Release Engineering - 0.33-0.1901.20120825 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + * Sun Aug 26 2012 Enrico Scholz - 0.33-0.1900.20120825 - updated to recent snapshot - fixed s390 issues (reported and patched by Dan Horák) From c0f10d1aae4762598d937e4ff13d0d5fcb9eadce Mon Sep 17 00:00:00 2001 From: Jon Ciesla Date: Wed, 27 Mar 2013 16:11:45 -0500 Subject: [PATCH 114/161] Spec cleanup. --- dietlibc.spec | 97 ++++++++++++++++++--------------------------------- 1 file changed, 34 insertions(+), 63 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 03a5135..bca637c 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -1,15 +1,10 @@ ## This package understands the following switches: ## --with[out] ssp ... enable/disable SSP; default depends ## on target architecture -## --with dynamic ... enable dynamic lib support - -## Fedora Extras specific customization below... -%bcond_without noarch -## %global prerelease 20120825 %global githubref c3f1cf67fcc186bb859e64a085bf98aaa6182a82 -%global pkglibdir %_prefix/lib/dietlibc +%global pkglibdir %{_prefix}/lib/dietlibc %ifarch %ix86 x86_64 %bcond_without ssp @@ -17,65 +12,51 @@ %bcond_with ssp %endif -%ifarch %ix86 x86_64 arm -%bcond_with dynamic -%endif - %ifarch %ix86 %global target_cpu i386 %else %global target_cpu %_target_cpu %endif -%{?with_noarch:%global noarch BuildArch: noarch} -%{!?release_func:%global release_func() %%{?prerelease:0.}%1%%{?prerelease:.%%prerelease}%%{?dist}} %{!?apply:%global apply(p:n:b:) %patch%%{-n:%%{-n*}} %%{-p:-p %%{-p*}} %%{-b:-b %%{-b*}} \ %nil} Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: %release_func 1901 +Release: 0.1902.%prerelease%{?dist} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} -Source0: http://www.kernel.org/pub/linux/libs/dietlibc/%name-%version.tar.bz2 -Source1: http://www.fefe.de/dietlibc/%name-%version.tar.bz2.sig +Source0: http://www.kernel.org/pub/linux/libs/dietlibc/%{name}-%{version}.tar.bz2 +Source1: http://www.fefe.de/dietlibc/%{name}-%{version}.tar.bz2.sig %else # generated by 'make cvs-sources [CVS_DATE=....]' -Source0: %name-%version.%prerelease.tar.xz +Source0: %{name}-%{version}.%prerelease.tar.xz %endif ## CVS..master diff from https://github.com/ensc/dietlibc Patch0: dietlibc-github-%githubref.patch.gz -BuildRoot: %_tmppath/%name-%version-%release-buildroot -%{?with_dynamic:Requires: dietlibc-lib = %version-%release} -%{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release} +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +#Requires: dietlibc-lib = %{version}-%{release}} +Obsoletes: dietlibc-lib < %{version}-%{release}} -Requires: %name-devel = %version-%release +Requires: %{name}-devel = %{version}-%{release} BuildRequires: gdb %package devel Summary: dietlibc development files Group: Development/Libraries -Requires: %name = %version-%release -Requires: %name-header = %version-%release -Provides: %name-static = %version-%release -Provides: %name-static%{?_isa} = %version-%release - -%package header -Summary: dietlibc header files -Group: Development/Libraries -Requires: %name = %version-%release -Requires(pre): %name-devel = %version-%release -Requires: %name-devel = %version-%release -%{?noarch} +Requires: %{name} = %{version}-%{release} +Obsoletes: %{name}-header < %{version}-%{release} +Provides: %{name}-header = %{version}-%{release} +Provides: %{name}-static = %{version}-%{release} +Provides: %{name}-static%{?_isa} = %{version}-%{release} %package lib Summary: Dynamic libraries for dietlibc Group: System Environment/Libraries -Conflicts: %name < %version-%release -Conflicts: %name > %version-%release +Requires: %{name} = %{version}-%{release} %description The diet libc is a libc that is optimized for small size. It can be @@ -89,13 +70,6 @@ arm, hppa, ia64, i386, mips, s390, sparc, sparc64, ppc and x86_64. This package contains the object files for dietlibc. -%description header -The diet libc is a libc that is optimized for small size. It can be -used to create small statically linked binaries for Linux on alpha, -arm, hppa, ia64, i386, mips, s390, sparc, sparc64, ppc and x86_64. - -This package contains the header files for dietlibc. - %description lib The diet libc is a libc that is optimized for small size. It can be used to create small statically linked binaries for Linux on alpha, @@ -105,7 +79,7 @@ This package contains the dynamic libraries for dietlibc. %prep -%setup -q %{?prerelease:-n %name-%version.%prerelease} +%setup -q %{?prerelease:-n %{name}-%{version}.%prerelease} %apply -n0 -p1 @@ -130,7 +104,7 @@ sed -i \ %endif %global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -g3 -Werror-implicit-function-declaration -Wno-unused -Wno-switch -%global basemakeflags prefix=%pkglibdir BINDIR=%_bindir MAN1DIR=%_mandir/man1 CFLAGS="$RPM_OPT_FLAGS %fixcflags $XTRA_CFLAGS" PDIET=%pkglibdir STRIP=: +%global basemakeflags prefix=%pkglibdir BINDIR=%{_bindir} MAN1DIR=%{_mandir}/man1 CFLAGS="$RPM_OPT_FLAGS %fixcflags $XTRA_CFLAGS" PDIET=%pkglibdir STRIP=: %global makeflags %basemakeflags @@ -138,7 +112,7 @@ sed -i \ make %makeflags all %{?_smp_mflags} # 'dyn' target is not SMP safe -%{?with_dynamic:make %makeflags dyn} +#make %makeflags dyn %install @@ -147,10 +121,10 @@ rm -rf $RPM_BUILD_ROOT install -d -m755 $RPM_BUILD_ROOT/etc make %makeflags DESTDIR=$RPM_BUILD_ROOT install -ln -s lib-%_arch ${RPM_BUILD_ROOT}%pkglibdir/lib-%_arch-%_vendor +ln -s lib-%{_arch} ${RPM_BUILD_ROOT}%pkglibdir/lib-%{_arch}-%{_vendor} chmod a-x $RPM_BUILD_ROOT%pkglibdir/lib-*/*.o -rm -f $RPM_BUILD_ROOT%_bindir/dnsd +rm -f $RPM_BUILD_ROOT%{_bindir}/dnsd %check @@ -171,33 +145,30 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root,-) %doc AUTHOR BUGS CAVEAT CHANGES COPYING FAQ PORTING README* %doc SECURITY THANKS TODO -%doc %_mandir/*/* -%_bindir/* - - -%files header -%defattr(-,root,root,-) -%pkglibdir/include +%doc %{_mandir}/*/* +%{_bindir}/* %files devel %defattr(-,root,root,-) %pkglibdir -%exclude %pkglibdir/include -%{?with_dynamic:%exclude %pkglibdir/*/*.so} +%exclude %pkglibdir/*/*.so} -%if %{with dynamic} -%files lib -%defattr(-,root,root,-) -%config(noreplace) %_sysconfdir/* -%dir %pkglibdir -%dir %pkglibdir/lib-* -%pkglibdir/lib-%target_cpu/*.so -%endif +#%files lib +#%defattr(-,root,root,-) +#%config(noreplace) %{_sysconfdir}/* +#%dir %pkglibdir +#%dir %pkglibdir/lib-* +#%pkglibdir/lib-%target_cpu/*.so %changelog +* Wed Mar 20 2013 Jon Ciesla - 0.33-0.1902.20120825 +- Macro cleanup. +- Merge header subpackage into devel. +- Converted lib <> Conflicts to Requires =. + * Wed Feb 13 2013 Fedora Release Engineering - 0.33-0.1901.20120825 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild From 2acfe430ea891a6abd36bbd83bbabb59d899b3af Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sat, 3 Aug 2013 02:12:25 -0500 Subject: [PATCH 115/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index bca637c..1254a47 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 0.1902.%prerelease%{?dist} +Release: 0.1903.%prerelease%{?dist} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -164,6 +164,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Aug 03 2013 Fedora Release Engineering - 0.33-0.1903.20120825 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + * Wed Mar 20 2013 Jon Ciesla - 0.33-0.1902.20120825 - Macro cleanup. - Merge header subpackage into devel. From 1553e83649fb0b504a0264976b32594e75b4abb7 Mon Sep 17 00:00:00 2001 From: Jon Ciesla Date: Tue, 17 Sep 2013 07:39:03 -0500 Subject: [PATCH 116/161] Fix type in files. --- dietlibc.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 1254a47..fbb3055 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 0.1903.%prerelease%{?dist} +Release: 0.1904.%prerelease%{?dist} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -152,7 +152,7 @@ rm -rf $RPM_BUILD_ROOT %files devel %defattr(-,root,root,-) %pkglibdir -%exclude %pkglibdir/*/*.so} +%exclude %pkglibdir/*/*.so #%files lib @@ -164,10 +164,13 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Tue Sep 17 2013 Jon Ciesla - 0.33-0.1904.20120825 +- Fix typo in %%files, BZ 1008729. + * Sat Aug 03 2013 Fedora Release Engineering - 0.33-0.1903.20120825 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild -* Wed Mar 20 2013 Jon Ciesla - 0.33-0.1902.20120825 +* Wed Mar 20 2013 Jon Ciesla - 0.33-0.1902.20120825 - Macro cleanup. - Merge header subpackage into devel. - Converted lib <> Conflicts to Requires =. From 50f75fadec9c7cb8a282821a50b73abde7fa534d Mon Sep 17 00:00:00 2001 From: Jon Ciesla Date: Mon, 5 May 2014 12:23:11 -0500 Subject: [PATCH 117/161] Update to latest. --- dietlibc.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index fbb3055..8e8e543 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -2,8 +2,8 @@ ## --with[out] ssp ... enable/disable SSP; default depends ## on target architecture -%global prerelease 20120825 -%global githubref c3f1cf67fcc186bb859e64a085bf98aaa6182a82 +#%global prerelease 20120825 +#%global githubref c3f1cf67fcc186bb859e64a085bf98aaa6182a82 %global pkglibdir %{_prefix}/lib/dietlibc %ifarch %ix86 x86_64 @@ -24,7 +24,8 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 0.1904.%prerelease%{?dist} +Release: 1%{?dist} +#Release: 0.1904.%%prerelease%%{?dist} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -164,6 +165,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Thu Apr 24 2014 Jon Ciesla - 0.33-1 +- Latest upstream. + * Tue Sep 17 2013 Jon Ciesla - 0.33-0.1904.20120825 - Fix typo in %%files, BZ 1008729. From fd5b87ad1b9238e28ed79ccb36338c7614cdd9de Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sat, 7 Jun 2014 02:23:05 -0500 Subject: [PATCH 118/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 8e8e543..5eb3ccb 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 1%{?dist} +Release: 2%{?dist} #Release: 0.1904.%%prerelease%%{?dist} License: GPLv2 Group: Development/Libraries @@ -165,6 +165,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Jun 07 2014 Fedora Release Engineering - 0.33-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + * Thu Apr 24 2014 Jon Ciesla - 0.33-1 - Latest upstream. From 5c717e2ad751eea2904bb74087f12f2a3caf5922 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 16 Aug 2014 02:48:02 +0000 Subject: [PATCH 119/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 5eb3ccb..2b584c4 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 2%{?dist} +Release: 3%{?dist} #Release: 0.1904.%%prerelease%%{?dist} License: GPLv2 Group: Development/Libraries @@ -165,6 +165,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Aug 16 2014 Fedora Release Engineering - 0.33-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + * Sat Jun 07 2014 Fedora Release Engineering - 0.33-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild From 6f331cb433ce1aaf343a0d563d376df672b28954 Mon Sep 17 00:00:00 2001 From: Jon Ciesla Date: Mon, 6 Oct 2014 13:07:11 -0500 Subject: [PATCH 120/161] Pull extra cl macro --- dietlibc.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 5eb3ccb..0b35854 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -245,7 +245,6 @@ rm -rf $RPM_BUILD_ROOT * Fri Dec 24 2010 Enrico Scholz - 0.33-0.1500.20101223 - updated to 20101223 CVS snapshot -%changelog * Fri Jul 9 2010 Enrico Scholz - 0.32-1400 - added -static provides (#609606) - use %%apply, not %%patch From 64344f85c63846371e2960fee5b805a09130095c Mon Sep 17 00:00:00 2001 From: Jon Ciesla Date: Mon, 17 Nov 2014 11:52:05 -0600 Subject: [PATCH 121/161] Fix FTBFS. --- .gitignore | 1 + dietlibc.spec | 18 ++++++++++++------ sources | 3 +-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 5946530..58b919b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /dietlibc-github-236455eac1d2ed2e2004a89b85f904f3ab27e0da.patch.gz /dietlibc-0.33.20120825.tar.xz /dietlibc-github-c3f1cf67fcc186bb859e64a085bf98aaa6182a82.patch.gz +/dietlibc.tar.gz diff --git a/dietlibc.spec b/dietlibc.spec index 218459c..ef42cb6 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 3%{?dist} +Release: 4%{?dist} #Release: 0.1904.%%prerelease%%{?dist} License: GPLv2 Group: Development/Libraries @@ -34,10 +34,12 @@ Source0: http://www.kernel.org/pub/linux/libs/dietlibc/%{name}-%{version}.tar.bz Source1: http://www.fefe.de/dietlibc/%{name}-%{version}.tar.bz2.sig %else # generated by 'make cvs-sources [CVS_DATE=....]' -Source0: %{name}-%{version}.%prerelease.tar.xz +#Source0: %{name}-%{version}.%prerelease.tar.xz +#$ cvs -d :pserver:cvs@cvs.fefe.de:/cvs -z9 co dietlibc on 2014-11-17 approx 16:50 UTC +Source0: dietlibc.tar.gz %endif ## CVS..master diff from https://github.com/ensc/dietlibc -Patch0: dietlibc-github-%githubref.patch.gz +#Patch0: dietlibc-github-%githubref.patch.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot #Requires: dietlibc-lib = %{version}-%{release}} Obsoletes: dietlibc-lib < %{version}-%{release}} @@ -80,9 +82,10 @@ This package contains the dynamic libraries for dietlibc. %prep -%setup -q %{?prerelease:-n %{name}-%{version}.%prerelease} +#%setup -q %{?prerelease:-n %{name}-%{version}.%prerelease} +%setup -qn dietlibc -%apply -n0 -p1 +#%apply -n0 -p1 %if %{without ssp} sed -i -e 's!^#define WANT_SSP$!// \0!g; @@ -136,7 +139,7 @@ make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) cd test ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 -bash ./runtests-X.sh +#bash ./runtests-X.sh %clean @@ -165,6 +168,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Mon Nov 17 2014 Jon Ciesla - 0.33-4 +- Fix FTBFS using latest official cvs which drops a test script. + * Sat Aug 16 2014 Fedora Release Engineering - 0.33-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild diff --git a/sources b/sources index d998747..101e56c 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -016865b8c40d40a57b2ddb5862f2e338 dietlibc-0.33.20120825.tar.xz -734e14b59b7f017ae5843ee9b9b6d34e dietlibc-github-c3f1cf67fcc186bb859e64a085bf98aaa6182a82.patch.gz +7f282043b5043e4229e897726469281a dietlibc.tar.gz From 2a9f7fbc8727bbe4057c6f6f4bcc760fc8bbd580 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Wed, 17 Jun 2015 04:04:31 +0000 Subject: [PATCH 122/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index ef42cb6..45b55b0 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 4%{?dist} +Release: 5%{?dist} #Release: 0.1904.%%prerelease%%{?dist} License: GPLv2 Group: Development/Libraries @@ -168,6 +168,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Wed Jun 17 2015 Fedora Release Engineering - 0.33-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + * Mon Nov 17 2014 Jon Ciesla - 0.33-4 - Fix FTBFS using latest official cvs which drops a test script. From 2eb5c9ba3a54e29aed0b9e72a48432328e81a660 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Wed, 3 Feb 2016 18:44:04 +0000 Subject: [PATCH 123/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 45b55b0..e227d13 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 5%{?dist} +Release: 6%{?dist} #Release: 0.1904.%%prerelease%%{?dist} License: GPLv2 Group: Development/Libraries @@ -168,6 +168,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Wed Feb 03 2016 Fedora Release Engineering - 0.33-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + * Wed Jun 17 2015 Fedora Release Engineering - 0.33-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild From 1f59733a5171c3ba63719d8852edf637289535b4 Mon Sep 17 00:00:00 2001 From: Jon Ciesla Date: Thu, 7 Apr 2016 11:14:07 -0400 Subject: [PATCH 124/161] Spec cleanup. --- dietlibc.spec | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index e227d13..13d3036 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 6%{?dist} +Release: 7%{?dist} #Release: 0.1904.%%prerelease%%{?dist} License: GPLv2 Group: Development/Libraries @@ -156,18 +156,11 @@ rm -rf $RPM_BUILD_ROOT %files devel %defattr(-,root,root,-) %pkglibdir -%exclude %pkglibdir/*/*.so - - -#%files lib -#%defattr(-,root,root,-) -#%config(noreplace) %{_sysconfdir}/* -#%dir %pkglibdir -#%dir %pkglibdir/lib-* -#%pkglibdir/lib-%target_cpu/*.so - %changelog +* Thu Apr 07 2016 Jon Ciesla - 0.33-7 +- Spec cleanup. + * Wed Feb 03 2016 Fedora Release Engineering - 0.33-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild From 5a591d76c9bac6f6c23b9b1c83f1616d9502e3f2 Mon Sep 17 00:00:00 2001 From: Jon Ciesla Date: Mon, 25 Jul 2016 12:09:34 -0500 Subject: [PATCH 125/161] Patch for insecure defpath. --- dietlibc-insecure-defpath.patch | 11 +++++++++++ dietlibc.spec | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 dietlibc-insecure-defpath.patch diff --git a/dietlibc-insecure-defpath.patch b/dietlibc-insecure-defpath.patch new file mode 100644 index 0000000..340d5f3 --- /dev/null +++ b/dietlibc-insecure-defpath.patch @@ -0,0 +1,11 @@ +--- include/paths.h~ 2008-02-22 18:09:54.000000000 -0600 ++++ include/paths.h 2016-07-25 12:03:25.144058895 -0500 +@@ -2,7 +2,7 @@ + #define _PATHS_H + + #define _PATH_BSHELL "/bin/sh" +-#define _PATH_DEFPATH "/bin:/usr/bin:" ++#define _PATH_DEFPATH "/bin:/usr/bin" + + #define _PATH_DEVNULL "/dev/null" + diff --git a/dietlibc.spec b/dietlibc.spec index 13d3036..c4016f7 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 7%{?dist} +Release: 8%{?dist} #Release: 0.1904.%%prerelease%%{?dist} License: GPLv2 Group: Development/Libraries @@ -40,9 +40,11 @@ Source0: dietlibc.tar.gz %endif ## CVS..master diff from https://github.com/ensc/dietlibc #Patch0: dietlibc-github-%githubref.patch.gz +Patch1: dietlibc-insecure-defpath.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot #Requires: dietlibc-lib = %{version}-%{release}} Obsoletes: dietlibc-lib < %{version}-%{release}} +ExcludeArch: ppc64 Requires: %{name}-devel = %{version}-%{release} BuildRequires: gdb @@ -86,6 +88,7 @@ This package contains the dynamic libraries for dietlibc. %setup -qn dietlibc #%apply -n0 -p1 +%patch1 -p0 %if %{without ssp} sed -i -e 's!^#define WANT_SSP$!// \0!g; @@ -158,6 +161,9 @@ rm -rf $RPM_BUILD_ROOT %pkglibdir %changelog +* Mon Jul 25 2016 Jon Ciesla - 0.33-8 +- Patch for insecure defpath, BZ 1359768. + * Thu Apr 07 2016 Jon Ciesla - 0.33-7 - Spec cleanup. From abcee70778bea2e2ab059fcdfb2d48542ae7b5c9 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 13 Aug 2016 00:28:59 +0100 Subject: [PATCH 126/161] Exclude aarch64 Power64 s390x --- dietlibc.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index c4016f7..98c8c50 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 8%{?dist} +Release: 9%{?dist} #Release: 0.1904.%%prerelease%%{?dist} License: GPLv2 Group: Development/Libraries @@ -44,7 +44,7 @@ Patch1: dietlibc-insecure-defpath.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot #Requires: dietlibc-lib = %{version}-%{release}} Obsoletes: dietlibc-lib < %{version}-%{release}} -ExcludeArch: ppc64 +ExcludeArch: aarch64 %{power64} s390x Requires: %{name}-devel = %{version}-%{release} BuildRequires: gdb @@ -161,6 +161,9 @@ rm -rf $RPM_BUILD_ROOT %pkglibdir %changelog +* Fri Aug 12 2016 Peter Robinson 0.33-9 +- Exclude aarch64 Power64 s390x + * Mon Jul 25 2016 Jon Ciesla - 0.33-8 - Patch for insecure defpath, BZ 1359768. From 4938e95ef02856dac94bcc8b42b3a402dd82f528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 15 Sep 2016 12:39:24 +0200 Subject: [PATCH 127/161] - Enable s390x build --- dietlibc.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 98c8c50..cc17cb8 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 9%{?dist} +Release: 10%{?dist} #Release: 0.1904.%%prerelease%%{?dist} License: GPLv2 Group: Development/Libraries @@ -44,7 +44,7 @@ Patch1: dietlibc-insecure-defpath.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot #Requires: dietlibc-lib = %{version}-%{release}} Obsoletes: dietlibc-lib < %{version}-%{release}} -ExcludeArch: aarch64 %{power64} s390x +ExcludeArch: aarch64 %{power64} Requires: %{name}-devel = %{version}-%{release} BuildRequires: gdb @@ -161,7 +161,10 @@ rm -rf $RPM_BUILD_ROOT %pkglibdir %changelog -* Fri Aug 12 2016 Peter Robinson 0.33-9 +* Thu Sep 16 2016 Dan Horák - 0.33-10 +- Enable s390x build + +* Fri Aug 12 2016 Peter Robinson - 0.33-9 - Exclude aarch64 Power64 s390x * Mon Jul 25 2016 Jon Ciesla - 0.33-8 From 513dd712731003148b59c80f852fab33d77aaa0c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 10 Feb 2017 08:23:38 +0000 Subject: [PATCH 128/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index cc17cb8..794fdda 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.33 -Release: 10%{?dist} +Release: 11%{?dist} #Release: 0.1904.%%prerelease%%{?dist} License: GPLv2 Group: Development/Libraries @@ -161,6 +161,9 @@ rm -rf $RPM_BUILD_ROOT %pkglibdir %changelog +* Fri Feb 10 2017 Fedora Release Engineering - 0.33-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + * Thu Sep 16 2016 Dan Horák - 0.33-10 - Enable s390x build From 37f0b67b43d61d144cdd2e0ea1c38d14bca07267 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 18 Mar 2017 12:39:34 -0400 Subject: [PATCH 129/161] Move to much newer upstream version which supports aarch64 and POWER. - Fix bogus date in changelog. --- .gitignore | 2 ++ Makefile | 2 +- dietlibc.spec | 24 ++++++++++++------------ sources | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 58b919b..b57ef4a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /dietlibc-0.33.20120825.tar.xz /dietlibc-github-c3f1cf67fcc186bb859e64a085bf98aaa6182a82.patch.gz /dietlibc.tar.gz +/dietlibc-0.33.20170317.tar.xz +/dietlibc-0.34.20170317.tar.xz diff --git a/Makefile b/Makefile index 53a32bd..d9d53d7 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ CVS ?= cvs GIT ?= git TAR ?= tar GZIP ?= gzip -CVS_BASEVER = 0.33 +CVS_BASEVER = 0.34 CVS_DATE := $(shell date +'%Y%m%d' -d '-1 day') GIT_URL = git://github.com/ensc/dietlibc.git GIT_DIFF_OPTS = --summary --stat --patch diff --git a/dietlibc.spec b/dietlibc.spec index 794fdda..76a3308 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -2,7 +2,7 @@ ## --with[out] ssp ... enable/disable SSP; default depends ## on target architecture -#%global prerelease 20120825 +%global prerelease 20170317 #%global githubref c3f1cf67fcc186bb859e64a085bf98aaa6182a82 %global pkglibdir %{_prefix}/lib/dietlibc @@ -23,9 +23,8 @@ Summary: Small libc implementation Name: dietlibc -Version: 0.33 -Release: 11%{?dist} -#Release: 0.1904.%%prerelease%%{?dist} +Version: 0.34 +Release: 0.1.%prerelease%{?dist} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -34,17 +33,14 @@ Source0: http://www.kernel.org/pub/linux/libs/dietlibc/%{name}-%{version}.tar.bz Source1: http://www.fefe.de/dietlibc/%{name}-%{version}.tar.bz2.sig %else # generated by 'make cvs-sources [CVS_DATE=....]' -#Source0: %{name}-%{version}.%prerelease.tar.xz -#$ cvs -d :pserver:cvs@cvs.fefe.de:/cvs -z9 co dietlibc on 2014-11-17 approx 16:50 UTC -Source0: dietlibc.tar.gz +Source0: %{name}-%{version}.%prerelease.tar.xz %endif ## CVS..master diff from https://github.com/ensc/dietlibc -#Patch0: dietlibc-github-%githubref.patch.gz +#Patch0: dietlibc-github-%githubref.patch.gz Patch1: dietlibc-insecure-defpath.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot #Requires: dietlibc-lib = %{version}-%{release}} Obsoletes: dietlibc-lib < %{version}-%{release}} -ExcludeArch: aarch64 %{power64} Requires: %{name}-devel = %{version}-%{release} BuildRequires: gdb @@ -84,8 +80,8 @@ This package contains the dynamic libraries for dietlibc. %prep -#%setup -q %{?prerelease:-n %{name}-%{version}.%prerelease} -%setup -qn dietlibc +%setup -q %{?prerelease:-n %{name}-%{version}.%prerelease} +#%setup -qn dietlibc #%apply -n0 -p1 %patch1 -p0 @@ -161,10 +157,14 @@ rm -rf $RPM_BUILD_ROOT %pkglibdir %changelog +* Sat Feb 18 2017 Richard W.M. Jones - 0.34-0.1 +- Move to much newer upstream version which supports aarch64 and POWER. +- Fix bogus date in changelog. + * Fri Feb 10 2017 Fedora Release Engineering - 0.33-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild -* Thu Sep 16 2016 Dan Horák - 0.33-10 +* Thu Sep 15 2016 Dan Horák - 0.33-10 - Enable s390x build * Fri Aug 12 2016 Peter Robinson - 0.33-9 diff --git a/sources b/sources index 101e56c..1f4624e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -7f282043b5043e4229e897726469281a dietlibc.tar.gz +SHA512 (dietlibc-0.34.20170317.tar.xz) = 082962cdc4fe8812dcd30eaddabd705953da5b9e144f58251f32e763d15fe814328f2b87a9c0afe932c795c558d41b8db09ea53aaed80ebe7f2a3dceda4c4820 From a8cf0df9e83fb1e7e2eeb2617b96dcbbab7a8be2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 26 Jul 2017 06:13:19 +0000 Subject: [PATCH 130/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 76a3308..c5d01cd 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 0.1.%prerelease%{?dist} +Release: 0.2.%prerelease%{?dist} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -157,6 +157,9 @@ rm -rf $RPM_BUILD_ROOT %pkglibdir %changelog +* Wed Jul 26 2017 Fedora Release Engineering - 0.34-0.2.20170317 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + * Sat Feb 18 2017 Richard W.M. Jones - 0.34-0.1 - Move to much newer upstream version which supports aarch64 and POWER. - Fix bogus date in changelog. From d73454b1b3d716f9b3b6b0dc906fb38b8bc08f7c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 2 Aug 2017 19:35:49 +0000 Subject: [PATCH 131/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index c5d01cd..e3ef6c5 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 0.2.%prerelease%{?dist} +Release: 0.3.%prerelease%{?dist} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -157,6 +157,9 @@ rm -rf $RPM_BUILD_ROOT %pkglibdir %changelog +* Wed Aug 02 2017 Fedora Release Engineering - 0.34-0.3.20170317 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + * Wed Jul 26 2017 Fedora Release Engineering - 0.34-0.2.20170317 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild From 3c79ceed2c914fb762d69ec004cf4237e56c2b79 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 7 Feb 2018 06:50:47 +0000 Subject: [PATCH 132/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index e3ef6c5..ce967de 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 0.3.%prerelease%{?dist} +Release: 0.4.%prerelease%{?dist} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -157,6 +157,9 @@ rm -rf $RPM_BUILD_ROOT %pkglibdir %changelog +* Wed Feb 07 2018 Fedora Release Engineering - 0.34-0.4.20170317 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + * Wed Aug 02 2017 Fedora Release Engineering - 0.34-0.3.20170317 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild From 88c9dd69d565b356bcc6d5d23975d0feb03b3fa4 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 9 Feb 2018 09:04:20 +0100 Subject: [PATCH 133/161] Escape macros in %changelog Reference: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/Y2ZUKK2B7T2IKXPMODNF6HB2O5T5TS6H/ Signed-off-by: Igor Gnatenko --- dietlibc.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index ce967de..bab3eb8 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 0.4.%prerelease%{?dist} +Release: 0.5.%prerelease%{?dist} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -40,7 +40,7 @@ Source0: %{name}-%{version}.%prerelease.tar.xz Patch1: dietlibc-insecure-defpath.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot #Requires: dietlibc-lib = %{version}-%{release}} -Obsoletes: dietlibc-lib < %{version}-%{release}} +Obsoletes: dietlibc-lib < %{version}-%{release} Requires: %{name}-devel = %{version}-%{release} BuildRequires: gdb @@ -157,6 +157,9 @@ rm -rf $RPM_BUILD_ROOT %pkglibdir %changelog +* Fri Feb 09 2018 Igor Gnatenko - 0.34-0.5.20170317 +- Escape macros in %%changelog + * Wed Feb 07 2018 Fedora Release Engineering - 0.34-0.4.20170317 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild @@ -344,7 +347,7 @@ rm -rf $RPM_BUILD_ROOT * Wed Feb 13 2008 Enrico Scholz - 0.31-1.20080212 - updated to CVS snapshot 20080212 -- fixed printf regression for '%+04i' style formats +- fixed printf regression for '%%+04i' style formats - added %%check and run a testsuite; it does not succeed now so it is for informational purposes only... - added bunch of patches to fixes big-endian issues in string routines From 9466fb9d018882560db8025ad984e2bb8f5ce946 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 13 Feb 2018 23:13:15 +0100 Subject: [PATCH 134/161] Remove BuildRoot definition None of currently supported distributions need that. It was needed last for EL5 which is EOL now Signed-off-by: Igor Gnatenko --- dietlibc.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index bab3eb8..1857244 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -38,7 +38,6 @@ Source0: %{name}-%{version}.%prerelease.tar.xz ## CVS..master diff from https://github.com/ensc/dietlibc #Patch0: dietlibc-github-%githubref.patch.gz Patch1: dietlibc-insecure-defpath.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot #Requires: dietlibc-lib = %{version}-%{release}} Obsoletes: dietlibc-lib < %{version}-%{release} From 62d80f22b3ad91b22139eb9c2692d89425c86a71 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 14 Feb 2018 07:57:42 +0100 Subject: [PATCH 135/161] Remove %clean section None of currently supported distributions need that. Last one was EL5 which is EOL for a while. Signed-off-by: Igor Gnatenko --- dietlibc.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 1857244..dedbd97 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -140,9 +140,6 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 #bash ./runtests-X.sh -%clean -rm -rf $RPM_BUILD_ROOT - %files %defattr(-,root,root,-) %doc AUTHOR BUGS CAVEAT CHANGES COPYING FAQ PORTING README* From 0d1a23dd91340f28f4bb902097a5515d7ca80337 Mon Sep 17 00:00:00 2001 From: Jason Tibbitts Date: Tue, 10 Jul 2018 00:38:24 -0500 Subject: [PATCH 136/161] Remove needless use of %defattr --- dietlibc.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index dedbd97..82591e2 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -141,7 +141,6 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %files -%defattr(-,root,root,-) %doc AUTHOR BUGS CAVEAT CHANGES COPYING FAQ PORTING README* %doc SECURITY THANKS TODO %doc %{_mandir}/*/* @@ -149,7 +148,6 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %files devel -%defattr(-,root,root,-) %pkglibdir %changelog From 26e18673c6d4a458c0af532cba1aec193ecb828d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 12 Jul 2018 22:52:39 +0000 Subject: [PATCH 137/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 82591e2..95f54b7 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 0.5.%prerelease%{?dist} +Release: 0.6.%prerelease%{?dist} License: GPLv2 Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ @@ -151,6 +151,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Thu Jul 12 2018 Fedora Release Engineering - 0.34-0.6.20170317 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Fri Feb 09 2018 Igor Gnatenko - 0.34-0.5.20170317 - Escape macros in %%changelog From 0bc39a612ba76c4056da847d024f848ebe5fb918 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 18 Jul 2018 11:23:39 +0200 Subject: [PATCH 138/161] add BuildRequires: gcc Reference: https://fedoraproject.org/wiki/Changes/Remove_GCC_from_BuildRoot --- dietlibc.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/dietlibc.spec b/dietlibc.spec index 95f54b7..34b1f00 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -42,6 +42,7 @@ Patch1: dietlibc-insecure-defpath.patch Obsoletes: dietlibc-lib < %{version}-%{release} Requires: %{name}-devel = %{version}-%{release} +BuildRequires: gcc BuildRequires: gdb %package devel From 3f44ee2d4d01c7f5ffc00a67db85f48ca47286b7 Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Tue, 25 Sep 2018 08:21:42 -0500 Subject: [PATCH 139/161] 0.34 --- .gitignore | 2 ++ dietlibc.spec | 24 +++++++++++------------- sources | 3 ++- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index b57ef4a..1ce8451 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ /dietlibc.tar.gz /dietlibc-0.33.20170317.tar.xz /dietlibc-0.34.20170317.tar.xz +/dietlibc-0.34.tar.xz +/dietlibc-0.34.tar.xz.sig diff --git a/dietlibc.spec b/dietlibc.spec index 34b1f00..50e0173 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -2,8 +2,8 @@ ## --with[out] ssp ... enable/disable SSP; default depends ## on target architecture -%global prerelease 20170317 -#%global githubref c3f1cf67fcc186bb859e64a085bf98aaa6182a82 +#%%global prerelease 20170317 +#%%global githubref c3f1cf67fcc186bb859e64a085bf98aaa6182a82 %global pkglibdir %{_prefix}/lib/dietlibc %ifarch %ix86 x86_64 @@ -24,21 +24,20 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 0.6.%prerelease%{?dist} +Release: 1%{?dist} License: GPLv2 -Group: Development/Libraries URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} -Source0: http://www.kernel.org/pub/linux/libs/dietlibc/%{name}-%{version}.tar.bz2 -Source1: http://www.fefe.de/dietlibc/%{name}-%{version}.tar.bz2.sig +Source0: https://www.fefe.de/dietlibc/%{name}-%{version}.tar.xz +Source1: http://www.fefe.de/dietlibc/%{name}-%{version}.tar.xz.sig %else # generated by 'make cvs-sources [CVS_DATE=....]' Source0: %{name}-%{version}.%prerelease.tar.xz %endif ## CVS..master diff from https://github.com/ensc/dietlibc -#Patch0: dietlibc-github-%githubref.patch.gz +#Patch0: dietlibc-github-%%githubref.patch.gz Patch1: dietlibc-insecure-defpath.patch -#Requires: dietlibc-lib = %{version}-%{release}} +#Requires: dietlibc-lib = %%{version}-%%{release}} Obsoletes: dietlibc-lib < %{version}-%{release} Requires: %{name}-devel = %{version}-%{release} @@ -47,7 +46,6 @@ BuildRequires: gdb %package devel Summary: dietlibc development files -Group: Development/Libraries Requires: %{name} = %{version}-%{release} Obsoletes: %{name}-header < %{version}-%{release} Provides: %{name}-header = %{version}-%{release} @@ -56,7 +54,6 @@ Provides: %{name}-static%{?_isa} = %{version}-%{release} %package lib Summary: Dynamic libraries for dietlibc -Group: System Environment/Libraries Requires: %{name} = %{version}-%{release} %description @@ -115,12 +112,10 @@ sed -i \ make %makeflags all %{?_smp_mflags} # 'dyn' target is not SMP safe -#make %makeflags dyn +#make %%makeflags dyn %install -rm -rf $RPM_BUILD_ROOT - install -d -m755 $RPM_BUILD_ROOT/etc make %makeflags DESTDIR=$RPM_BUILD_ROOT install @@ -152,6 +147,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Tue Sep 25 2018 Gwyn Ciesla - 0.34-1 +- 0.34 + * Thu Jul 12 2018 Fedora Release Engineering - 0.34-0.6.20170317 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild diff --git a/sources b/sources index 1f4624e..a734b2e 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -SHA512 (dietlibc-0.34.20170317.tar.xz) = 082962cdc4fe8812dcd30eaddabd705953da5b9e144f58251f32e763d15fe814328f2b87a9c0afe932c795c558d41b8db09ea53aaed80ebe7f2a3dceda4c4820 +SHA512 (dietlibc-0.34.tar.xz) = 2b38528c0ccf50e426f587b6448fed997fab1147eecc9e1af2f3fb3efe3d8f3997656d8e66e7cf1045ceb1f602cef43456c62ba83ff494f9c9816721bdb4d6c6 +SHA512 (dietlibc-0.34.tar.xz.sig) = 0428f1a7430b335f527ceb0fb347d50846c25aff38e32ca961f07ca3fc7dc4ca657c09c0797c7bb38b5c126a21e3d6a96f76e6d511e5121bd500276a9ded2a4c From 096728f597b774822fc780784fbcf0ffbd299871 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 31 Jan 2019 17:13:42 +0000 Subject: [PATCH 140/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 50e0173..101255a 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -147,6 +147,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Thu Jan 31 2019 Fedora Release Engineering - 0.34-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Tue Sep 25 2018 Gwyn Ciesla - 0.34-1 - 0.34 From 6e06a6e767360f5f5367cf64ee86788081a4e620 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 24 Jul 2019 21:59:29 +0000 Subject: [PATCH 141/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 101255a..1b8100a 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2 URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -147,6 +147,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Wed Jul 24 2019 Fedora Release Engineering - 0.34-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + * Thu Jan 31 2019 Fedora Release Engineering - 0.34-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild From b43fb6b695aef3c605d9c24ce1edb3f7f21415b3 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 28 Jan 2020 15:50:43 +0000 Subject: [PATCH 142/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 1b8100a..d1de6d7 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2 URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -147,6 +147,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Tue Jan 28 2020 Fedora Release Engineering - 0.34-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Wed Jul 24 2019 Fedora Release Engineering - 0.34-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild From 3a8f67ea003ee515b9d0e79cb12364c2a3c4ad0f Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 13 Jul 2020 09:50:39 -0600 Subject: [PATCH 143/161] Disable LTO --- dietlibc.spec | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index d1de6d7..80b4809 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2 URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -109,6 +109,11 @@ sed -i \ %build +# This package strips .o files as they are created which removes the LTO +# sections. It's likely this would work if those strip commands were +# changed to leave the LTO sections alone. For now, disable LTO +%define _lto_cflags %{nil} + make %makeflags all %{?_smp_mflags} # 'dyn' target is not SMP safe @@ -147,6 +152,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Mon Jul 13 2020 Jeff Law - 0.34-5 +- Disable LTO + * Tue Jan 28 2020 Fedora Release Engineering - 0.34-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild From ab48481a71c28d1a6129e032e0ef1c773f9076af Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Mon, 27 Jul 2020 15:23:31 +0000 Subject: [PATCH 144/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 80b4809..32be1a9 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2 URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -152,6 +152,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Mon Jul 27 2020 Fedora Release Engineering - 0.34-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Mon Jul 13 2020 Jeff Law - 0.34-5 - Disable LTO From 849d5cbf119e2f5ad1ef9d347c052fb1ff91c3fb Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 17 Dec 2020 04:31:53 +0000 Subject: [PATCH 145/161] Add BuildRequires: make https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot --- dietlibc.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/dietlibc.spec b/dietlibc.spec index 32be1a9..55f7497 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -43,6 +43,7 @@ Obsoletes: dietlibc-lib < %{version}-%{release} Requires: %{name}-devel = %{version}-%{release} BuildRequires: gcc BuildRequires: gdb +BuildRequires: make %package devel Summary: dietlibc development files From f77cb95d5d642d0827f804ce8d8b489c76c92218 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 26 Jan 2021 03:24:19 +0000 Subject: [PATCH 146/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 55f7497..57a7fc8 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2 URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -153,6 +153,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Tue Jan 26 2021 Fedora Release Engineering - 0.34-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Mon Jul 27 2020 Fedora Release Engineering - 0.34-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From 04074347b3e27b119730aa508018fde636596563 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 21 Jul 2021 20:47:11 +0000 Subject: [PATCH 147/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 57a7fc8..cb0132c 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv2 URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -153,6 +153,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Wed Jul 21 2021 Fedora Release Engineering - 0.34-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Tue Jan 26 2021 Fedora Release Engineering - 0.34-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild From fad7e2992f9c5477058e00438d89fe197451299b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jan 2022 00:39:53 +0000 Subject: [PATCH 148/161] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index cb0132c..425f10c 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv2 URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -153,6 +153,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Thu Jan 20 2022 Fedora Release Engineering - 0.34-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Wed Jul 21 2021 Fedora Release Engineering - 0.34-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild From 2c7928ccf4dd10aa76df7c89ccaec436b802ee88 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 21 Jul 2022 00:27:34 +0000 Subject: [PATCH 149/161] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 425f10c..5c4881c 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv2 URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -153,6 +153,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Thu Jul 21 2022 Fedora Release Engineering - 0.34-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Thu Jan 20 2022 Fedora Release Engineering - 0.34-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild From 44061c3b491c0f93a8357effe435cb72d9b9ca6a Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 23 Dec 2022 18:36:43 +0100 Subject: [PATCH 150/161] C99 compatibility fixes (#2156074) Related to: --- dietlibc-c99.patch | 33 +++++++++++++++++++++++++++++++++ dietlibc.spec | 7 ++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 dietlibc-c99.patch diff --git a/dietlibc-c99.patch b/dietlibc-c99.patch new file mode 100644 index 0000000..218c679 --- /dev/null +++ b/dietlibc-c99.patch @@ -0,0 +1,33 @@ +Changes to avoid implicit function declarations: +provides a declaration of noths. -D_BSD_SOURCE enables declarations +of random, srandom. + +diff -ur dietlibc-0.34.orig/test/getservbyname.c dietlibc-0.34/test/getservbyname.c +--- dietlibc-0.34.orig/test/getservbyname.c 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.34/test/getservbyname.c 2022-12-23 18:17:26.645479365 +0100 +@@ -1,5 +1,6 @@ + #include + #include ++#include + + int main(int argc,char *argv[]) { + struct servent* se; +diff -ur dietlibc-0.34.orig/test/stdlib/testsort.c dietlibc-0.34/test/stdlib/testsort.c +--- dietlibc-0.34.orig/test/stdlib/testsort.c 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.34/test/stdlib/testsort.c 2022-12-23 18:16:33.758018509 +0100 +@@ -1,3 +1,4 @@ ++#define _BSD_SOURCE + #include + #include + #include +diff -ur dietlibc-0.34.orig/test/stdlib/tst-calloc.c dietlibc-0.34/test/stdlib/tst-calloc.c +--- dietlibc-0.34.orig/test/stdlib/tst-calloc.c 2003-12-15 14:07:42.000000000 +0100 ++++ dietlibc-0.34/test/stdlib/tst-calloc.c 2022-12-23 18:16:49.272860349 +0100 +@@ -17,6 +17,7 @@ + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + ++#define _BSD_SOURCE + #include + #include + #include diff --git a/dietlibc.spec b/dietlibc.spec index 5c4881c..68de74d 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 10%{?dist} +Release: 11%{?dist} License: GPLv2 URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -37,6 +37,7 @@ Source0: %{name}-%{version}.%prerelease.tar.xz ## CVS..master diff from https://github.com/ensc/dietlibc #Patch0: dietlibc-github-%%githubref.patch.gz Patch1: dietlibc-insecure-defpath.patch +Patch2: dietlibc-c99.patch #Requires: dietlibc-lib = %%{version}-%%{release}} Obsoletes: dietlibc-lib < %{version}-%{release} @@ -83,6 +84,7 @@ This package contains the dynamic libraries for dietlibc. #%apply -n0 -p1 %patch1 -p0 +%patch2 -p1 %if %{without ssp} sed -i -e 's!^#define WANT_SSP$!// \0!g; @@ -153,6 +155,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Fri Dec 23 2022 Florian Weimer - 0.34-11 +- C99 compatibility fixes (#2156074) + * Thu Jul 21 2022 Fedora Release Engineering - 0.34-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From e8ece41b1b740618478f4805622b1b531f09f36c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 19 Jan 2023 01:23:49 +0000 Subject: [PATCH 151/161] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 68de74d..2fbd2c1 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 11%{?dist} +Release: 12%{?dist} License: GPLv2 URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -155,6 +155,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Thu Jan 19 2023 Fedora Release Engineering - 0.34-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Fri Dec 23 2022 Florian Weimer - 0.34-11 - C99 compatibility fixes (#2156074) From 0292476790823724d0c16a4b14849b6aca47e77a Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Tue, 7 Mar 2023 15:38:18 -0600 Subject: [PATCH 152/161] migrated to SPDX license --- dietlibc.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 2fbd2c1..76f12a1 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,8 +24,8 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 12%{?dist} -License: GPLv2 +Release: 13%{?dist} +License: GPL-2.0-only URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} Source0: https://www.fefe.de/dietlibc/%{name}-%{version}.tar.xz @@ -155,6 +155,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Tue Mar 07 2023 Gwyn Ciesla - 0.34-13 +- migrated to SPDX license + * Thu Jan 19 2023 Fedora Release Engineering - 0.34-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From 0fa1d76227b6d162c08dcfc134f13652a6a39df3 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 19 Jul 2023 17:27:23 +0000 Subject: [PATCH 153/161] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 76f12a1..ef44ca3 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -24,7 +24,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 13%{?dist} +Release: 14%{?dist} License: GPL-2.0-only URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -155,6 +155,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Wed Jul 19 2023 Fedora Release Engineering - 0.34-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Tue Mar 07 2023 Gwyn Ciesla - 0.34-13 - migrated to SPDX license From a202e428764d1868dbe4832101ac3eeb3d70bec8 Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Thu, 24 Aug 2023 11:43:07 -0500 Subject: [PATCH 154/161] Fix FTBFS --- dietlibc.spec | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index ef44ca3..229bfba 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -2,6 +2,9 @@ ## --with[out] ssp ... enable/disable SSP; default depends ## on target architecture +# Disabled per upstream to fix FTBFS. +%undefine _hardened_build + #%%global prerelease 20170317 #%%global githubref c3f1cf67fcc186bb859e64a085bf98aaa6182a82 %global pkglibdir %{_prefix}/lib/dietlibc @@ -24,7 +27,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 14%{?dist} +Release: 15%{?dist} License: GPL-2.0-only URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -83,8 +86,8 @@ This package contains the dynamic libraries for dietlibc. #%setup -qn dietlibc #%apply -n0 -p1 -%patch1 -p0 -%patch2 -p1 +%patch -P 1 -p0 +%patch -P 2 -p1 %if %{without ssp} sed -i -e 's!^#define WANT_SSP$!// \0!g; @@ -155,6 +158,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Thu Aug 24 2023 Gwyn Ciesla - 0.34-15 +- Fix FTBFS + * Wed Jul 19 2023 Fedora Release Engineering - 0.34-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 7fba8dced8108b29ee04b17996a90adccc5a9e36 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 19 Jan 2024 17:09:33 +0000 Subject: [PATCH 155/161] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 229bfba..010b39f 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -27,7 +27,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 15%{?dist} +Release: 16%{?dist} License: GPL-2.0-only URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -158,6 +158,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Fri Jan 19 2024 Fedora Release Engineering - 0.34-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Thu Aug 24 2023 Gwyn Ciesla - 0.34-15 - Fix FTBFS From 8b585bcf2f5407f06b5b2017d486730f63eb53cd Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 24 Jan 2024 09:26:16 +0000 Subject: [PATCH 156/161] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 010b39f..7e246fd 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -27,7 +27,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 16%{?dist} +Release: 17%{?dist} License: GPL-2.0-only URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -158,6 +158,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Wed Jan 24 2024 Fedora Release Engineering - 0.34-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Fri Jan 19 2024 Fedora Release Engineering - 0.34-16 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 054a3b9eb7336186e6f3e537bfd065ca7120fd55 Mon Sep 17 00:00:00 2001 From: Michal Domonkos Date: Fri, 31 May 2024 13:33:10 +0200 Subject: [PATCH 157/161] Fix improperly commented out macros in %prep Since RPM 4.20, %prep is no longer implemented as a special "hack" [1] but is now a regular build scriptlet, meaning that %setup or %patch are now treated as regular macros and thus will be expanded even in comments (as documented in [2]). Our spec has these so fix them up to unbreak the build on F41. [1] https://github.com/rpm-software-management/rpm/issues/2205 [2] https://rpm-software-management.github.io/rpm/manual/spec.html --- dietlibc.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dietlibc.spec b/dietlibc.spec index 7e246fd..06ca234 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -83,9 +83,9 @@ This package contains the dynamic libraries for dietlibc. %prep %setup -q %{?prerelease:-n %{name}-%{version}.%prerelease} -#%setup -qn dietlibc +%dnl %setup -qn dietlibc -#%apply -n0 -p1 +%dnl %apply -n0 -p1 %patch -P 1 -p0 %patch -P 2 -p1 From e396f8ce414519a2f062c70bdd82132da341b7c9 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 17 Jul 2024 20:58:15 +0000 Subject: [PATCH 158/161] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 06ca234..4c9d37f 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -27,7 +27,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 17%{?dist} +Release: 18%{?dist} License: GPL-2.0-only URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -158,6 +158,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Wed Jul 17 2024 Fedora Release Engineering - 0.34-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Wed Jan 24 2024 Fedora Release Engineering - 0.34-17 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From caa2e140a781548bd1a4497ebaecd18212aa63bc Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jan 2025 15:45:00 +0000 Subject: [PATCH 159/161] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 4c9d37f..0821b32 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -27,7 +27,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 18%{?dist} +Release: 19%{?dist} License: GPL-2.0-only URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -158,6 +158,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Thu Jan 16 2025 Fedora Release Engineering - 0.34-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Wed Jul 17 2024 Fedora Release Engineering - 0.34-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From d48a6a0274454b4e78505999d9dd6c3cfedce97f Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Mon, 3 Feb 2025 11:35:11 -0600 Subject: [PATCH 160/161] Fix FTBFS --- dietlibc.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index 0821b32..de5daa6 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -109,7 +109,7 @@ sed -i \ dietfeatures.h %endif -%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -g3 -Werror-implicit-function-declaration -Wno-unused -Wno-switch +%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -g3 -Werror-implicit-function-declaration -Wno-unused -Wno-switch -std=gnu17 %global basemakeflags prefix=%pkglibdir BINDIR=%{_bindir} MAN1DIR=%{_mandir}/man1 CFLAGS="$RPM_OPT_FLAGS %fixcflags $XTRA_CFLAGS" PDIET=%pkglibdir STRIP=: %global makeflags %basemakeflags From 30bc22cffeb998867faba7a476c9286f5b748e89 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 23 Jul 2025 19:16:41 +0000 Subject: [PATCH 161/161] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- dietlibc.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietlibc.spec b/dietlibc.spec index de5daa6..37aa2d9 100644 --- a/dietlibc.spec +++ b/dietlibc.spec @@ -27,7 +27,7 @@ Summary: Small libc implementation Name: dietlibc Version: 0.34 -Release: 19%{?dist} +Release: 20%{?dist} License: GPL-2.0-only URL: http://www.fefe.de/dietlibc/ %if !0%{?prerelease:1} @@ -158,6 +158,9 @@ ulimit -m $[ 128*1024 ] -v $[ 256*1024 ] -d $[ 128*1024 ] -s 512 %pkglibdir %changelog +* Wed Jul 23 2025 Fedora Release Engineering - 0.34-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Thu Jan 16 2025 Fedora Release Engineering - 0.34-19 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild