04-archive-strip-debug.sh (659B)
1 # Archive: --strip-debug runs on each object member, the symbol index is 2 # refreshed. 3 4 cat > a.c <<'EOF' 5 int aaa(void) { return 1; } 6 EOF 7 cat > b.c <<'EOF' 8 int bbb(void) { return 2; } 9 EOF 10 "$KIT" cc -g -c a.c -o a.o 11 "$KIT" cc -g -c b.c -o b.o 12 "$KIT" ar rcs lib.a a.o b.o 13 "$KIT" strip --strip-debug lib.a -o lib.stripped.a 14 15 echo "== members ==" 16 "$KIT" ar t lib.stripped.a 17 18 # Extract each member and confirm the debug sections are gone. 19 mkdir x 20 ( cd x && "$KIT" ar x ../lib.stripped.a ) 21 echo "== a.o sections ==" 22 "$KIT" objdump -h x/a.o | awk '/^ *[0-9]+ /{print $2}' | sort 23 echo "== b.o sections ==" 24 "$KIT" objdump -h x/b.o | awk '/^ *[0-9]+ /{print $2}' | sort