blob: 0d1e739de71dd22cc0ecbf9e3b6c3fceaf05df1c [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001#!/bin/bash
2[ "$1" != "-f" -a "$2" != "-f" ] && exec strip "$@"
3if [ "$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
9elif [ "$1" = "-g" ]; then
10 opts=-g
11 debug="$3"
12 file="$4"
13 [ $# -ne 4 ] && exit 1
14else
15 exit 1
16fi
17set -e
18objcopy --only-keep-debug "$file" "$debug"
19strip $opts "$file"
20objcopy --add-gnu-debuglink="$debug" "$file"