01-strip-debug.sh (465B)
1 # --strip-debug drops every KIT_SEC_DEBUG section but leaves the 2 # symbol table untouched. 3 4 cat > smoke.c <<'EOF' 5 int helper(void) { return 42; } 6 int main(void) { return helper(); } 7 EOF 8 "$KIT" cc -g -c smoke.c -o smoke.o 9 "$KIT" strip --strip-debug smoke.o -o smoke.stripped.o 10 11 echo "== sections ==" 12 "$KIT" objdump -h smoke.stripped.o | awk '/^ *[0-9]+ /{print $2}' | sort 13 echo "== symbols ==" 14 "$KIT" objdump -t smoke.stripped.o | awk '$NF ~ /^_/{print $NF}' | sort