blob: fce95e6af99398e0145f7366d82a3f542bdca362 [file] [log] [blame]
Brian Silverman95de0622015-03-08 22:04:06 -04001#!/bin/dash
2
3set -e
4
5OBJCOPY=$1
6shift
7
8# The arguments after any -o flags.
9OUTPUT=`echo "$@" | awk \
10 'BEGIN { RS=" " }; output { print ; output = 0 }; /-o/ { output = 1 }'`
11DEBUG_DIR=$(dirname $(dirname ${OUTPUT}))/unstripped_files
12mkdir -p ${DEBUG_DIR}
13DEBUG_FILE=${DEBUG_DIR}/$(basename ${OUTPUT}).full
14
15"$@"
16
17cp ${OUTPUT} ${DEBUG_FILE}
18${OBJCOPY} --strip-debug --add-gnu-debuglink=${DEBUG_FILE} ${OUTPUT}