03-keep-symbol.sh (384B)
1 # --keep-symbol overrides the operation's drop decision. 2 3 cat > smoke.c <<'EOF' 4 int unused(void) { return 1; } 5 int helper(void) { return 42; } 6 int main(void) { return helper(); } 7 EOF 8 "$KIT" cc -c smoke.c -o smoke.o 9 "$KIT" strip --strip-all --keep-symbol=_unused smoke.o -o smoke.stripped.o 10 11 echo "== symbols ==" 12 "$KIT" objdump -t smoke.stripped.o | awk '$NF ~ /^_/{print $NF}' | sort