ath9k: optimize waking tx queues, slightly improves performance under load
[openwrt.git] / scripts / strip-kmod.sh
1 #!/usr/bin/env bash
2 [ -n "$CROSS" ] || {
3 echo "The variable CROSS must be set to point to the cross-compiler prefix"
4 exit 1
5 }
6
7 MODULE="$1"
8
9 [ "$#" -ne 1 ] && {
10 echo "Usage: $0 <module>"
11 exit 1
12 }
13
14 ARGS=
15 [ -n "$KEEP_SYMBOLS" ] || ARGS="-x -G __this_module --strip-unneeded"
16
17 ${CROSS}objcopy \
18 -R .comment \
19 -R .pdr \
20 -R .mdebug.abi32 \
21 -R .note.gnu.build-id \
22 -R .gnu.attributes \
23 -R .reginfo \
24 $ARGS \
25 "$MODULE" "$MODULE.tmp"
26
27 [ -n "$NO_RENAME" ] && {
28 mv "${MODULE}.tmp" "$MODULE"
29 exit 0
30 }
31
32 ${CROSS}nm "$MODULE.tmp" | awk '
33 BEGIN {
34 n = 0
35 }
36
37 $3 && $2 ~ /[brtd]/ && $3 !~ /\$LC/ {
38 print "--redefine-sym "$3"=_"n;
39 n = n + 1
40 }
41 ' > "$MODULE.tmp1"
42
43 ${CROSS}objcopy `cat ${MODULE}.tmp1` ${MODULE}.tmp ${MODULE}.out
44 mv "${MODULE}.out" "${MODULE}"
45 rm -f "${MODULE}".t*
This page took 0.041217 seconds and 5 git commands to generate.