libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making hardcode.test more robust [patch against HEAD]


From: libtool
Subject: Making hardcode.test more robust [patch against HEAD]
Date: Sun, 22 Apr 2001 01:38:58 -0500
User-agent: Mutt/1.1.12i

The fgrep of .libs in the executable to detect if .libs was hardcoded
is very weak. Methinks a much better approach is to dump the .dynamic
section of the executable and look at RPATH (or equivalent). Patch
below to override the fgrep test for IRIX 6.x, Solaris 2.x, and Tru64
UNIX 4.x, 5.x.

-- 
albert chin (address@hidden)

-- snip snip
Index: tests/hardcode.test
===================================================================
RCS file: /home/cvs/libtool/tests/hardcode.test,v
retrieving revision 1.4
diff -u -3 -p -r1.4 hardcode.test
--- tests/hardcode.test 2000/09/06 17:31:09     1.4
+++ tests/hardcode.test 2001/04/22 06:37:54
@@ -50,6 +50,9 @@ hardcode_libdir_flag_spec=NONE
 # Suck in all the hardcode_* variable settings.
 eval `egrep -e '^hardcode_' ./libtool 2>/dev/null`
 
+# Suck host host type
+eval `egrep -e '^host=' ./libtool 2>/dev/null`
+
 if test "$hardcode_direct" = NONE; then
   echo "hardcode_direct not set in ../demo/libtool" 1>&2
   status=1
@@ -108,6 +111,33 @@ for file in hc-*; do
     hardcoded=yes
   elif (sed -e '1!d' $file | egrep 'unsupported') >/dev/null 2>&1; then
     hardcoded=unsupported
+  fi
+
+  # Look at .dynamic section where possible
+  if test "x$hardcoded" = "xyes"; then
+    case "$host" in
+    alpha-dec-osf[45]*)
+      hardcoded=no
+      if odump -D $file 2>/dev/null | fgrep RPATH | \
+      fgrep "$objdir" >/dev/null 2>&1; then
+        hardcoded=yes
+      fi
+      ;;
+    mips-sgi-irix6*)
+      hardcoded=no
+      if elfdump -L $file 2>/dev/null | grep RPATH | \
+      fgrep "$objdir" >/dev/null 2>&1; then
+        hardcoded=yes
+      fi
+      ;;
+    *-solaris2*)
+      hardcoded=no
+      if elfdump -d $file 2>/dev/null | grep RPATH | \
+      fgrep "$objdir" >/dev/null 2>&1; then
+        hardcoded=yes
+      fi
+      ;;
+    esac
   fi
 
   # Check the result.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]