e2fsprogs: fix glibc compile issue (FS#1749,FS#1796)
[openwrt/openwrt.git] / scripts / strip-kmod.sh
index 2a75e39821121b7992f3ba66687077fa7a649a74..313015b909af6957d8b24f36b489c5b1c7e11974 100755 (executable)
@@ -18,13 +18,18 @@ else
        ARGS="-x -G __this_module --strip-unneeded"
 fi
 
+if [ -z "$KEEP_BUILD_ID" ]; then
+    ARGS="$ARGS -R .note.gnu.build-id"
+fi
+
 ${CROSS}objcopy \
        -R .comment \
        -R .pdr \
        -R .mdebug.abi32 \
-       -R .note.gnu.build-id \
        -R .gnu.attributes \
        -R .reginfo \
+       -R .MIPS.abiflags \
+       -R .note.GNU-stack \
        $ARGS \
        "$MODULE" "$MODULE.tmp"
 
@@ -38,9 +43,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"