Index: dietfeatures.h =================================================================== RCS file: /cvs/dietlibc/dietfeatures.h,v retrieving revision 1.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- dietfeatures.h 21 Jun 2010 16:40:06 -0000 1.68 +++ dietfeatures.h 1 Aug 2010 19:56:21 -0000 1.69 @@ -121,6 +121,12 @@ * `main' can not be found. */ /* #define WANT_STACKGAP */ +/* #define this if you want GNU bloat like program_invocation_short_name + * and program_invocation_name to be there. This functionality is not + * portable and adds useless bloat to libc. Help stomp out code + * depending on this! util-linux, I'm looking at you here! */ +#define WANT_GNU_STARTUP_BLOAT + /* Include support for ProPolice/SSP, calls guard_setup */ /* ProPolice is part of gcc 4.1 and up, there were patches for earlier * versions. To make use of this, compile your application with Index: include/errno.h =================================================================== RCS file: /cvs/dietlibc/include/errno.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- include/errno.h 14 May 2005 23:35:39 -0000 1.22 +++ include/errno.h 1 Aug 2010 19:56:21 -0000 1.23 @@ -720,6 +720,11 @@ extern int sys_nerr __attribute_dontuse__; #endif +#ifdef _GNU_SOURCE +extern char* program_invocation_name __attribute_dontuse__; +extern char* program_invocation_short_name __attribute_dontuse__; +#endif + __END_DECLS #endif Index: include/stdint.h =================================================================== RCS file: /cvs/dietlibc/include/stdint.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- include/stdint.h 15 Mar 2005 08:51:22 -0000 1.8 +++ include/stdint.h 1 Aug 2010 19:56:21 -0000 1.9 @@ -2,6 +2,7 @@ #define _STDINT_H #include +#include __BEGIN_DECLS @@ -44,6 +45,39 @@ WINT_MIN, WINT_MAX */ +#define INT8_MIN (-0x80) +#define INT16_MIN (-0x7fff-1) +#define INT32_MIN (-0x7fffffffl-1) +#define INT64_MIN (-0x7fffffffffffffffll-1) + +#define INT8_MAX 0x7f +#define INT16_MAX 0x7fff +#define INT32_MAX 0x7fffffffl +#define INT32_MAX 0x7fffffffffffffffll + +#define UINT8_MAX 0xff +#define UINT16_MAX 0xffff +#define UINT32_MAX 0xfffffffful +#define UINT64_MAX 0xffffffffffffffffull + +#if __WORDSIZE == 64 +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX +#else +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#endif + +#define SIZE_MAX UINTPTR_MAX +#define PTRDIFF_MIN INTPTR_MIN +#define PTRDIFF_MAX INTPTR_MAX + +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + #endif /* C++ && limit macros */ Index: include/string.h =================================================================== RCS file: /cvs/dietlibc/include/string.h,v retrieving revision 1.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- include/string.h 15 May 2009 03:24:27 -0000 1.53 +++ include/string.h 1 Aug 2010 19:56:21 -0000 1.54 @@ -56,7 +56,7 @@ int strerror_r(int errnum,char* buf,size_t n) __THROW __attribute_dontuse__; #ifdef _GNU_SOURCE -const char *strsignal(int signum) __THROW __attribute_const__; +char *strsignal(int signum) __THROW __attribute_const__; void *memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen) __THROW __nonnull((1,3)); void* mempcpy(void* __restrict__ dest,const void* __restrict__ src,size_t n) __THROW __nonnull((1,2)); Index: lib/stackgap.c =================================================================== RCS file: /cvs/dietlibc/lib/stackgap.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- lib/stackgap.c 2 Jun 2010 20:22:07 -0000 1.15 +++ lib/stackgap.c 1 Aug 2010 19:56:21 -0000 1.16 @@ -17,6 +17,11 @@ #include #include "dietfeatures.h" +#ifdef WANT_GNU_STARTUP_BLOAT +char* program_invocation_name; +char* program_invocation_short_name; +#endif + extern int main(int argc,char* argv[],char* envp[]); #if defined(WANT_SSP) @@ -178,6 +183,14 @@ __valgrind=(v && strstr(v,"valgrind")); } #endif +#ifdef WANT_GNU_STARTUP_BLOAT + program_invocation_name=argv[0]; + { + char* c; + for (c=program_invocation_short_name=program_invocation_name; *c; ++c) + if (*c=='/') program_invocation_short_name=c+1; + } +#endif return main(argc,argv,envp); } Index: libugly/strsignal.c =================================================================== RCS file: /cvs/dietlibc/libugly/strsignal.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- libugly/strsignal.c 15 Aug 2006 16:07:15 -0000 1.9 +++ libugly/strsignal.c 1 Aug 2010 19:56:21 -0000 1.10 @@ -2,9 +2,9 @@ #include #include -const char* strsignal(int sig) { +char* strsignal(int sig) { if ((unsigned int)sig<=SIGRTMAX) - return sys_siglist[sig]; + return (char*)sys_siglist[sig]; else - return "(unknown signal)"; + return (char*)"(unknown signal)"; }