Search code examples
linkerarmmbed

Understanding Linker output (Elf2Bin)


I'm doing some development using Mbed Studio and after linking I see this sort of output:

Elf2Bin: test-sp2
| Module               |         .text |   .data |       .bss |
|----------------------|---------------|---------|------------|
| [lib]\c_w.l          |    5900(+196) |  16(+0) |    348(+0) |
| [lib]\fz_wv.l        |        26(+0) |   0(+0) |      0(+0) |
| [lib]\libcpp_w.l     |         1(+0) |   0(+0) |      0(+0) |
| [lib]\libcppabi_w.l  |        44(+0) |   0(+0) |      0(+0) |
| anon$$obj.o          |       94(+94) |   0(+0) |   2048(+0) |
| main.o               |      1798(+0) |   0(+0) |    460(+0) |
| mbed-os\cmsis        |     13531(+0) | 168(+0) |   6609(+0) |
| mbed-os\connectivity |   70226(+140) | 295(+0) | 45532(+40) |
| mbed-os\drivers      |     3852(-16) |   0(+0) |      0(+0) |
| mbed-os\events       |      2016(+0) |   0(+0) |   3104(+0) |
| mbed-os\hal          |      2090(+0) |   8(+0) |    115(+0) |
| mbed-os\platform     |      9442(+0) |  64(+0) |   1104(+0) |
| mbed-os\rtos         |      1792(+0) |   0(+0) |      8(+0) |
| mbed-os\targets      |  34347(+1459) | 296(+0) |    394(+0) |
| Subtotals            | 145159(+1873) | 847(+0) | 59722(+40) |
Total Static RAM memory (data + bss): 60569(+40) bytes
Total Flash memory (text + data): 146006(+1873) bytes

I understand what this output means, mostly. But what do the (+xxx) next to the byte counts mean? For example, in
| mbed-os\connectivity | 70226(+140) | 295(+0) | 45532(+40) |

What does the (+140) in the .text section mean? Could it be the change in size from the last link?


Solution

  • Could it be the change in size from the last link?

    Yes.