Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame^] | 1 | #!/bin/bash |
2 | [ "$1" != "-f" -a "$2" != "-f" ] && exec strip "$@" | ||||
3 | if [ "$1" = "-f" ]; then | ||||
4 | opts= | ||||
5 | debug="$2" | ||||
6 | file="$3" | ||||
7 | [ $# -ne 3 ] && exit 1 | ||||
8 | file "$file" 2>/dev/null | grep -q relocatable && opts=-g | ||||
9 | elif [ "$1" = "-g" ]; then | ||||
10 | opts=-g | ||||
11 | debug="$3" | ||||
12 | file="$4" | ||||
13 | [ $# -ne 4 ] && exit 1 | ||||
14 | else | ||||
15 | exit 1 | ||||
16 | fi | ||||
17 | set -e | ||||
18 | objcopy --only-keep-debug "$file" "$debug" | ||||
19 | strip $opts "$file" | ||||
20 | objcopy --add-gnu-debuglink="$debug" "$file" |