build: Allow kernel modules to set build ID debug symbol
[openwrt/openwrt.git] / scripts / strip-kmod.sh
index 13e6b58007f92fa870afcb58da9ac88df7957c19..e3f13bee4766d6611bb526a6b867ee0a3d48f805 100755 (executable)
@@ -18,11 +18,14 @@ 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 \
        $ARGS \