~ubuntu-branches/ubuntu/karmic/gears/karmic

« back to all changes in this revision

Viewing changes to gears/tools/list_symbols.sh

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Lesicnik
  • Date: 2009-04-30 19:15:25 UTC
  • Revision ID: james.westby@ubuntu.com-20090430191525-0790sb5wzg8ou0xb
Tags: upstream-0.5.21.0~svn3334+dfsg
ImportĀ upstreamĀ versionĀ 0.5.21.0~svn3334+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
# The first argument specifies the toolchain prefix.
 
4
# If the second argument is "defined", list all symbols defined in these files.
 
5
# If the second argument is "undefined", list all external dependencies.
 
6
# Read all symbols for all files specified in the remaining arguments.
 
7
# Sort, remove duplicates.
 
8
# Output to stdout.
 
9
 
 
10
TOOLCHAIN_PREFIX="$1"
 
11
 
 
12
if [ "$2" = "defined" ]
 
13
then
 
14
  GREP="grep -v" # Filter out lines with "UND" in them
 
15
elif [ "$2" = "undefined" ]
 
16
then
 
17
  GREP="grep" # Keep only lines with "UND" in them
 
18
else
 
19
  echo "Please specify 'defined' or 'undefined'" >&2
 
20
  exit 1
 
21
fi
 
22
 
 
23
# Get rid of arguments 1 and 2.
 
24
shift
 
25
shift
 
26
 
 
27
# Call readelf, process output.
 
28
"${TOOLCHAIN_PREFIX}readelf" -sW $* |
 
29
        egrep '[[:digit:]]+:' |
 
30
        cut -c46- |
 
31
        ${GREP} '^  UND' |
 
32
        cut -c7- |
 
33
        sort |
 
34
        uniq