mailing list of musl libc
 help / color / mirror / code / Atom feed
* patch: make the size of errbuf configurable
@ 2013-05-19 20:12 Z. Gilboa
  2013-05-19 21:03 ` Rich Felker
  2013-05-19 21:05 ` Szabolcs Nagy
  0 siblings, 2 replies; 12+ messages in thread
From: Z. Gilboa @ 2013-05-19 20:12 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 371 bytes --]

Greetings,

When a shared library that resides in a deeply nested folder contains 
unresolved (long-named, mangled) symbols, the displayed name of the 
library and/or symbol might get truncated.  The attached patch makes the 
size of errbuf (ldso/dynlink.c) configurable (--with-ld-errbuf-size), 
while yet leaving the default size of 128 unaffected.

Best regards,
Zvi


[-- Attachment #2: ld_errbuf_size.patch --]
[-- Type: text/x-patch, Size: 2139 bytes --]

From 03e738888958d04b6c1bb900d571fb342916bc84 Mon Sep 17 00:00:00 2001
From: Z. Gilboa <zg7s@virginia.edu>
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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-05-20  0:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-19 20:12 patch: make the size of errbuf configurable Z. Gilboa
2013-05-19 21:03 ` Rich Felker
2013-05-19 21:51   ` Z. Gilboa
2013-05-19 22:09     ` Rich Felker
2013-05-19 22:26       ` Z. Gilboa
2013-05-19 23:22         ` Rich Felker
2013-05-20  0:09           ` Z. Gilboa
2013-05-20  0:21             ` Rich Felker
2013-05-20  0:37               ` Z. Gilboa
2013-05-19 21:05 ` Szabolcs Nagy
2013-05-19 21:36   ` Luca Barbato
2013-05-19 21:48     ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).