tbabc / linker-map-summary

Summarizes the size of objects linked into a binary based on the linker map.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linker Map Summary

Summarizes the size of objects linked into a binary based on a linker map generated by GNU ld with --print-map (should work on all platforms), by summing together portions in sections spread throughout the binary. This is useful to see the size impact of different portions of code after the linker has dropped unneeded sections.

Requires python 2.7+ or 3.2+.

Use

python analyze_map.py [--combine] firmware.elf.map

Example Output

(Older output format)

/usr/local/Cellar/arm-none-eabi-gcc/20150921/arm-none-eabi/lib/armv6-m/libm.a(lib_a-kf_rem_pio2.o) 	1888
build-arduino_zero/py/mpprint.o 	1938
build-arduino_zero/py/objset.o 	2018
build-arduino_zero/py/obj.o 	2038
build-arduino_zero/py/objarray.o 	2122
build-arduino_zero/boards/arduino_zero/pins.o 	2144
build-arduino_zero/py/objdict.o 	2146
build-arduino_zero/py/objlist.o 	2210
build-arduino_zero/py/lexer.o 	2405
build-arduino_zero/py/objexcept.o 	2466
build-arduino_zero/asf/sam0/drivers/usb/stack_interface/usb_device_udd.o 	2692
build-arduino_zero/asf/sam0/drivers/usb/usb_sam_d_r/usb.o 	3026
build-arduino_zero/py/emitbc.o 	3166
build-arduino_zero/py/modbuiltins.o 	3219
build-arduino_zero/py/gc.o 	3411
build-arduino_zero/py/objtype.o 	3579
build-arduino_zero/py/vm.o 	4259
build-arduino_zero/py/runtime.o 	4627
build-arduino_zero/py/parse.o 	4676
build-arduino_zero/py/qstr.o 	6589
build-arduino_zero/py/objstr.o 	9070
build-arduino_zero/lib/fatfs/ff.o 	10777
build-arduino_zero/py/compile.o 	11731

An example with --combine:

C:\Program Files\FreeBASIC-1.04.0-2-win32-mingworg\lib\win32\*.o 	     60  (code: 40 data: 20)
c:/mingw/lib/libole32.a                  	     78  (code: 8 data: 70)
c:/mingw/lib/libshell32.a                	    124  (code: 16 data: 108)
c:/mingw/lib/libpsapi.a                  	    132  (code: 16 data: 116)
c:/mingw/lib/libmoldname.a               	    132  (code: 24 data: 108)
c:/mingw/lib/libadvapi32.a               	    168  (code: 24 data: 144)
c:/mingw/lib/libuser32.a                 	    196  (code: 32 data: 164)
*fill*                                   	    432  (code: 28 data: 404)
c:/mingw/lib/gcc/mingw32/4.8.1/*.o       	    552  (code: 260 data: 292)
c:/mingw/lib/*.o                         	    980  (code: 768 data: 212)
c:/mingw/lib/libmsvcrt.a                 	   2790  (code: 680 data: 2110)
c:/mingw/lib/libkernel32.a               	   3140  (code: 624 data: 2516)
c:/mingw/lib/gcc/mingw32/4.8.1/libgcc.a  	   3736  (code: 2476 data: 1260)
c:/mingw/lib/libmingw32.a                	   4232  (code: 2848 data: 1384)
build\lib\*.o                            	   6244  (code: 6224 data: 20)
c:/mingw/lib/gcc/mingw32/4.8.1/libgcc_eh.a 	  21252  (code: 16704 data: 4548)
c:/mingw/lib/libmingwex.a                	  29992  (code: 24704 data: 5288)
c:/mingw/lib/gcc/mingw32/4.8.1\libstdc++.a 	  49144  (code: 31624 data: 17520)
C:\Program Files\FreeBASIC-1.04.0-win32-mingworg\lib\win32/libfbmt.a 	  51688  (code: 46272 data: 5416)
build\*.o                                	 168248  (code: 149456 data: 18792)
TOTAL 343320  (code: 282828 data: 60492)

About

Summarizes the size of objects linked into a binary based on the linker map.

License:MIT License


Languages

Language:Python 100.0%