mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "Z. Gilboa" <zg7s@eservices.virginia.edu>
To: <musl@lists.openwall.com>
Subject: patch: make the size of errbuf configurable
Date: Sun, 19 May 2013 16:12:58 -0400	[thread overview]
Message-ID: <5199324A.7020805@eservices.virginia.edu> (raw)

[-- 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


             reply	other threads:[~2013-05-19 20:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-19 20:12 Z. Gilboa [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5199324A.7020805@eservices.virginia.edu \
    --to=zg7s@eservices.virginia.edu \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).