Hello everyone,
I am developing an application with a GCC platform for STM32F746 and I am trying to optimize the final size of my embedded software. Between 2 versions of my source code, I noticed an increase in the .debug.soar section of more than 240Kb in my .map file. Could someone tell me what this section contains and if there are any good practices to limit its growth?
Thanks in advance
Olivier
Hi,
The .debug.soar
section contains extra application information used by debug tools such as Stack Trace Reader or Heap Dumper. Its size increase as long as the application size increase.
This section is not part of the binary image. You can verify in the ELF file that ir does not set the A
flag (A
stands for allocated). See below an example of ELF section dump.
To summarize,
- If your application is built as Firmware executable, the
.debug.soar
section will not be included in the Firmware binary (.bin
,.hex
… file).
- If your application is built as Linux/QNX executable, you may want to remove all debug sections before transferring it to the device (using the binutils
strip
command for example).
–Frédéric
Appendix: Example of ELF sections dump:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .interp PROGBITS 08048154 000154 000013 00 A 0 0 1
[ 2] .note.ABI-tag NOTE 08048168 000168 000020 00 A 0 0 4
[ 3] .note.gnu.build-id NOTE 08048188 000188 000024 00 A 0 0 4
[ 4] .gnu.hash GNU_HASH 080481ac 0001ac 00002c 04 A 5 0 4
[ 5] .dynsym DYNSYM 080481d8 0001d8 000390 10 A 6 1 4
[ 6] .dynstr STRTAB 08048568 000568 0003ae 00 A 0 0 1
[ 7] .gnu.version VERSYM 08048916 000916 000072 02 A 5 0 2
[ 8] .gnu.version_r VERNEED 08048988 000988 0000e0 00 A 6 4 4
[ 9] .rel.dyn REL 08048a68 000a68 000018 08 A 5 0 4
[10] .rel.plt REL 08048a80 000a80 000188 08 AI 5 24 4
[11] .init PROGBITS 08048c08 000c08 000023 00 AX 0 0 4
[12] .plt PROGBITS 08048c30 000c30 000320 04 AX 0 0 16
[13] .plt.got PROGBITS 08048f50 000f50 000008 00 AX 0 0 8
[14] .text PROGBITS 08048f60 000f60 01ca02 00 AX 0 0 16
[15] .fini PROGBITS 08065964 01d964 000014 00 AX 0 0 4
[16] .rodata PROGBITS 08065980 01d980 00136c 00 AX 0 0 32
[17] .eh_frame_hdr PROGBITS 08066cec 01ecec 00011c 00 A 0 0 4
[18] .eh_frame PROGBITS 08066e08 01ee08 0004d8 00 A 0 0 4
[19] .init_array INIT_ARRAY 08068ef0 01fef0 000004 00 WA 0 0 4
[20] .fini_array FINI_ARRAY 08068ef4 01fef4 000004 00 WA 0 0 4
[21] .jcr PROGBITS 08068ef8 01fef8 000004 00 WA 0 0 4
[22] .dynamic DYNAMIC 08068efc 01fefc 000100 08 WA 6 0 4
[23] .got PROGBITS 08068ffc 01fffc 000004 04 WA 0 0 4
[24] .got.plt PROGBITS 08069000 020000 0000d0 04 WA 0 0 4
[25] .bss NOBITS 080690e0 0200d0 002098 00 WA 0 0 32
[26] ICETEA_HEAP NOBITS 0806b178 0200d0 000944 00 WA 0 0 8
[27] _java_heap NOBITS 0806babc 0200d0 010000 00 WA 0 0 4
[28] _java_immortals NOBITS 0807babc 0200d0 001000 00 WA 0 0 4
[29] .comment PROGBITS 00000000 0200d0 000082 01 MS 0 0 1
[30] .debug_aranges PROGBITS 00000000 020152 0001a0 00 0 0 1
[31] .debug_info PROGBITS 00000000 0202f2 001c90 00 0 0 1
[32] .debug_abbrev PROGBITS 00000000 021f82 00075d 00 0 0 1
[33] .debug_line PROGBITS 00000000 0226df 000957 00 0 0 1
[34] .debug_str PROGBITS 00000000 023036 000e23 01 MS 0 0 1
[35] .debug_ranges PROGBITS 00000000 023e59 000140 00 0 0 1
[36] .debug.soar PROGBITS 00000000 023f9c 01d7e6 00 0 0 4
[37] .shstrtab STRTAB 00000000 06d4ec 000185 00 0 0 1
[38] .symtab SYMTAB 00000000 041784 00b820 10 39 202 4
[39] .strtab STRTAB 00000000 04cfa4 020548 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
p (processor specific)
Thank you for this information!
Frederic