Good options Command line options, Arm options
-ffunction-sections -fdata-sections -Wl,--gc-sections,--print-gc-sections
Passing linker options through gcc with -Wl,
gcc -Wl,-Tlinkerscript.ld
Passing assembler options through gcc with -Wa,
gcc -Wa,-ag
| Argument | Description | Example |
|---|---|---|
-c | Stop after assembly | # gcc main.c -c -o main.o |
-S | Stop after compile before assembly | # gcc main.c -S -o main.s |
-E | Stop after preprocessor | # gcc main.c -E -o main.pp |
-M | Generate file suitable for Make | # gcc main.c -M -o main.mk |
Understand the linker script – Human readable guide to linker scripts