native-turbo/objreloc.sh
pan-y ad3e76ddbe sync 23.09 to 22.03-lts-next
(cherry picked from commit fc8a6539055b6cf96eaac20ff4dd67cb68745383)
2024-05-25 09:38:22 +08:00

18 lines
483 B
Bash

#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: $0 <Files to be split>"
exit 1
fi
LIB_FILE="$1"
if [ ! -f "$LIB_FILE" ]; then
echo "Error: $LIB_FILE does not exist"
exit 1
fi
# Remove debug and unnecessary sections, and create relocation and primary files
objcopy --strip-debug --strip-dwo "$LIB_FILE" "$LIB_FILE.relocation"
xz -z "$LIB_FILE.relocation"
mv -f "$LIB_FILE.relocation.xz" "$LIB_FILE.relocation"
# objcopy --remove-relocations=".*" "$LIB_FILE" "$LIB_FILE.prim"