]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fixed the static-link check at startup -- it was broken for scripts. Refine
authorNicholas Nethercote <njn@valgrind.org>
Sun, 28 Sep 2003 18:18:47 +0000 (18:18 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Sun, 28 Sep 2003 18:18:47 +0000 (18:18 +0000)
FAQ #5 accordingly.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1854

FAQ.txt
coregrind/valgrind.in

diff --git a/FAQ.txt b/FAQ.txt
index b4d9517d2fb2462d513d21ab0b9c39b1f492b357..e306b209e99388521999154615decd1694ff5b53 100644 (file)
--- a/FAQ.txt
+++ b/FAQ.txt
@@ -87,18 +87,28 @@ A4. Known issue with RHAS 2.1, due to funny stack permissions at
 Q5. I try running "valgrind my_program", but my_program runs normally,
     and Valgrind doesn't emit any output at all.
 
-A5. This should no longer happen, as a check for this takes place
-    when Valgrind starts up.
+A5. Valgrind doesn't work out-of-the-box with programs that are entirely
+    statically linked.  It does a quick test at startup, and if it detects
+    that the program is statically linked, it aborts with an explanation.
+    
+    This test may fail in some obscure cases, eg. if you run a script
+    under Valgrind and the script interpreter is statically linked.
 
-    However, Valgrind still doesn't work with programs that are entirely
-    statically linked.  If you still want static linking, you can ask 
-    gcc to link certain libraries statically.  Try the following options:
+    If you still want static linking, you can ask gcc to link certain
+    libraries statically.  Try the following options:
 
         -Wl,-Bstatic -lmyLibrary1 -lotherLibrary -Wl,-Bdynamic
 
     Just make sure you end with -Wl,-Bdynamic so that libc is dynamically
     linked.
 
+    If you absolutely cannot use dynamic libraries, you can try statically
+    linking together all the .o files in coregrind/, all the .o files of the
+    skin of your choice (eg. those in memcheck/), and the .o files of your
+    program.  You'll end up with a statically linked binary that runs
+    permanently under Valgrind's control.  Note that we haven't tested this
+    procedure thoroughly.
+
 -----------------------------------------------------------------
 
 Q6. I try running "valgrind my_program" and get Valgrind's startup message,
index d8edc05c3a609686cc5e1f93d77ce4c1a9ff624d..789bc3f703da14b89505c50e48737f1f78ec8242 100755 (executable)
@@ -113,8 +113,8 @@ fi
 # Ensure the program isn't statically linked.
 if [ $# != 0 ] ; then
    which_prog="`which $1`"
-   case `ldd "$which_prog"` in
-   *"not a dynamic executable"*)
+   case `file "$which_prog"` in
+   *"statically linked"*)
      echo "\`$which_prog' is statically linked"
      echo "Valgrind only works on dynamically linked executables;  your"
      echo "program must rely on at least one shared object for Valgrind"