Blob Blame History Raw
diff -Nur abicheck-1.2-orig/abicheck.pl abicheck-1.2/abicheck.pl
--- abicheck-1.2-orig/abicheck.pl	2003-08-26 21:57:51.000000000 +0200
+++ abicheck-1.2/abicheck.pl	2005-08-16 22:49:06.000000000 +0200
@@ -496,7 +496,7 @@
 
 	if ( ! $pid ) {
 		# child here, go run ldd -r with debug env:
-		exec_ldd($file);
+		exec_ldd($file,$file0);
 		exit 1;
 	}
 	
@@ -1241,7 +1241,7 @@
 # will read command output.
 #
 sub exec_ldd {
-	my ($file) = @_;
+	my ($file,$file0) = @_;
 
 	open(STDERR, ">&STDOUT");
 	# need to close stdin on linux for some suid programs e.g. chsh (!)
@@ -1251,10 +1251,27 @@
 		$ENV{LD_LIBRARY_PATH} = $ld_path;
 	}
 
-	# currently, no difference between OSs
-	$ENV{LD_DEBUG} = "files,bindings";
-	exec 'ldd', '-r', $file;
-	exit 1;	# exec failed
+	my $ldlinux = '';
+	open(DLFIND,"ldd $file0 |") or die "open: ldd: $!";
+	while (<DLFIND>) {
+	    /(ld(-linux)*.so.\d+)/ and /(\S+)/ and $ldlinux = $1;
+	}
+	close(DLFIND);
+	if ( $ldlinux =~ /^$/ ) {
+	    # currently, no difference between OSs
+	    $ENV{LD_DEBUG} = "files,bindings";
+	    exec 'ldd', '-r', $file;
+	    exit 1;	# exec failed
+	}
+	else {
+	    $ENV{LD_DEBUG} = "files,bindings";
+	    $ENV{LD_VERBOSE} = "yes";
+	    $ENV{LD_WARN} = "yes";
+	    $ENV{LD_BIND_NOW} = "yes";
+	    $ENV{LD_TRACE_LOADED_OBJECTS} = "1";
+	    exec $ldlinux, $file0;
+	    exit 1;	# exec failed
+	}
 }
 
 #