@@ -50,6 +50,10 @@ $ cargo build --example foo
5050$ rust-size target/examples/foo
5151```
5252
53+ These commands take similar options to ` cargo build ` and you can specify
54+ a specific binary with ` --bin NAME ` , an example with ` --example NAME `
55+ or the default binary by not passing ` --bin ` or ` --example ` .
56+
5357In the case of ` cargo-objdump ` the architecture of the compilation target is
5458passed as ` -arch-name=$target ` to ` llvm-objdump ` . ` -arch-name ` specifies to
5559which architecture disassemble the object file to.
@@ -78,7 +82,7 @@ these tools may change as new Rust releases are made.
7882List all symbols in an executable
7983
8084``` console
81- $ cargo nm --bin app -- release
85+ $ cargo nm --release
82860800040a T BusFault
83870800040a T DebugMonitor
84880800040a T DefaultHandler
@@ -100,7 +104,7 @@ $ cargo nm --bin app --release
100104List all symbols in an executable sorted by size (smallest first).
101105
102106``` console
103- $ cargo nm --bin app -- release -- -print-size -size-sort
107+ $ cargo nm --release -- -print-size -size-sort
1041080800040a 00000002 T DefaultHandler
10510908000408 00000002 T UserHardFault
10611008000004 00000004 R __RESET_VECTOR
@@ -115,7 +119,7 @@ $ cargo nm --bin app --release -- -print-size -size-sort
115119Transform the output of Cargo (ELF) into binary format.
116120
117121``` console
118- $ cargo objcopy --bin app -- release -- -O binary app.bin
122+ $ cargo objcopy --release -- -O binary app.bin
119123
120124$ stat --printf=" %s\n" app.bin
1211251642
@@ -126,7 +130,7 @@ $ stat --printf="%s\n" app.bin
126130Disassemble a binary.
127131
128132``` console
129- $ cargo objdump --bin app -- release -- -disassemble -no-show-raw-insn
133+ $ cargo objdump --release -- -disassemble -no-show-raw-insn
130134target/thumbv7m-none-eabi/debug/app: file format ELF32-arm-little
131135
132136Disassembly of section .text:
@@ -155,7 +159,7 @@ Reset:
155159Print binary size in System V format
156160
157161``` console
158- $ cargo size --bin app -- release -- -A -x
162+ $ cargo size --release -- -A -x
159163target/thumbv7m-none-eabi/release/app :
160164section size addr
161165.vector_table 0x400 0x8000000
@@ -186,7 +190,7 @@ Strip all symbols from the build artifact
186190$ stat --printf=" %s\n" target/release/hello
1871914094240
188192
189- $ cargo-strip --bin hello -- release -- -strip-all -O smaller-hello
193+ $ cargo-strip --release -- -strip-all -O smaller-hello
190194
191195$ stat --printf=" %s\n" smaller-hello
192196424432
0 commit comments