>From 03e738888958d04b6c1bb900d571fb342916bc84 Mon Sep 17 00:00:00 2001 From: Z. Gilboa Date: Sun, 19 May 2013 15:33:09 -0400 Subject: [PATCH] ld: errbuf: make the buffer size configurable modified: configure modified: src/ldso/dynlink.c --- configure | 9 +++++++++ src/ldso/dynlink.c | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 96f93b2..b063d37 100755 --- a/configure +++ b/configure @@ -30,6 +30,9 @@ Optional features: --disable-shared inhibit building shared library [enabled] --disable-static inhibit building static library [enabled] +Configurable settings: + --with-ld-errbuf-size set the size of the dynamic loader's error buffer [128] + Some influential environment variables: CC C compiler command [detected] CFLAGS C compiler flags [-Os -pipe ...] @@ -120,6 +123,7 @@ case "$arg" in --disable-warnings|--enable-warnings=no) warnings=no ;; --enable-gcc-wrapper|--enable-gcc-wrapper=yes) wrapper=yes ;; --disable-gcc-wrapper|--enable-gcc-wrapper=no) wrapper=no ;; +--with-ld-errbuf-size=*) ld_errbuf_size=${arg#*=} ;; --enable-*|--disable-*|--with-*|--without-*|--*dir=*|--build=*) ;; --host=*|--target=*) target=${arg#*=} ;; -* ) echo "$0: unknown option $arg" ;; @@ -310,7 +314,12 @@ test -z "$LIBCC" && try_libcc=`$CC -print-file-name=libpcc.a 2>/dev/null` \ && tryldflag LIBCC "$try_libcc" printf "using compiler runtime libraries: %s\n" "$LIBCC" +# configurable settings +if [ "$ld_errbuf_size"x != x ]; then + CFLAGS="$CFLAGS -DLD_ERRBUF_SIZE=$ld_errbuf_size" +fi +# generate config.mak printf "creating config.mak... " exec 3>&1 1>config.mak diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index dec9511..59106c5 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -21,8 +21,12 @@ #include "pthread_impl.h" #include "libc.h" +#ifndef LD_ERRBUF_SIZE +#define LD_ERRBUF_SIZE 128 +#endif + static int errflag; -static char errbuf[128]; +static char errbuf[LD_ERRBUF_SIZE]; #ifdef SHARED -- 1.7.9.5