File: lddcheck

package info (click to toggle)
kopanocore 8.7.0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,400 kB
  • sloc: cpp: 175,422; python: 24,623; perl: 7,319; php: 6,056; sh: 2,172; makefile: 1,294; xml: 45; ansic: 1
file content (34 lines) | stat: -rwxr-xr-x 600 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

if [ -z "$1" ]; then
	exit 0
fi
libtool="$1"; shift
input="$1"; shift
output="$1"; shift

case "$input" in #((
	*.la)
		. "$input"
		if test -z "$dlname"; then
			exit 0
		fi
		real=$(dirname "$input")"/.libs/$dlname"
		# ldd loads all dependencies, which nm would not do.
		if ldd -r "$real" 2>/dev/null | c++filt | grep "undefined symbol"; then
			rm "$output"
			exit 1
		fi
		;;
	*)
		if "${libtool}" --mode=execute ldd -r "$input" 2>/dev/null | c++filt | \
		   grep "undefined symbol"; then
			rm "$output"
			exit 1
		fi
		;;
esac
if test -n "$output"; then
	>"$output"
fi
exit 0