diff options
Diffstat (limited to 'fake-src/strip')
-rw-r--r-- | fake-src/strip | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fake-src/strip b/fake-src/strip new file mode 100644 index 00000000..0d1e739d --- /dev/null +++ b/fake-src/strip @@ -0,0 +1,20 @@ +#!/bin/bash +[ "$1" != "-f" -a "$2" != "-f" ] && exec strip "$@" +if [ "$1" = "-f" ]; then + opts= + debug="$2" + file="$3" + [ $# -ne 3 ] && exit 1 + file "$file" 2>/dev/null | grep -q relocatable && opts=-g +elif [ "$1" = "-g" ]; then + opts=-g + debug="$3" + file="$4" + [ $# -ne 4 ] && exit 1 +else + exit 1 +fi +set -e +objcopy --only-keep-debug "$file" "$debug" +strip $opts "$file" +objcopy --add-gnu-debuglink="$debug" "$file" |