[orion] update wrt350nv2-builder to v2.4 and use new functionality for target orion_g...
[openwrt.git] / scripts / strip-kmod.sh
index 57207e3..13e6b58 100755 (executable)
@@ -11,16 +11,22 @@ MODULE="$1"
        exit 1
 }
 
+ARGS=
+if [ -n "$KEEP_SYMBOLS" ]; then
+       ARGS="-X --strip-debug"
+else
+       ARGS="-x -G __this_module --strip-unneeded"
+fi
+
 ${CROSS}objcopy \
-       --strip-unneeded \
        -R .comment \
        -R .pdr \
        -R .mdebug.abi32 \
        -R .note.gnu.build-id \
        -R .gnu.attributes \
        -R .reginfo \
-       -G __this_module \
-       -x "$MODULE" "$MODULE.tmp"
+       $ARGS \
+       "$MODULE" "$MODULE.tmp"
 
 [ -n "$NO_RENAME" ] && {
        mv "${MODULE}.tmp" "$MODULE"
@@ -32,9 +38,10 @@ BEGIN {
        n = 0
 }
 
-$3 && $2 ~ /[brtd]/ && $3 !~ /\$LC/ {
+$3 && $2 ~ /[brtd]/ && $3 !~ /\$LC/ && !def[$3] {
        print "--redefine-sym "$3"=_"n;
        n = n + 1
+       def[$3] = 1
 }
 ' > "$MODULE.tmp1"
 
This page took 0.019522 seconds and 4 git commands to generate.