mem_usage.py: stop parsing file when _end_of_ram is reached

Since commit 5966660c02b3 ("core: move relocation to embedded data
region"), when ASLR is enabled, some sections are stored at the end of
tee.elf for use by gen_tee_bin.py which then discards them. As a
result, they are not present in the final binary and should not be
reported by the memory usage script.

By ignoring any section past the _end_of_ram symbol, we avoid reporting
those discarded sections as well as a hole before them.

 Before:

 $ make -s CFG_CORE_ASLR=y
 $ scripts/mem_usage.py out/arm-plat-vexpress/core/tee.elf
  RAM Usage        0E100000 - 0E301E04 size 00201E04 2056 KiB 514 pages
 .text            0E100000 - 0E12FA68 size 0002FA68 190 KiB
 *hole*           0E12FA68 - 0E130000 size 00000598   1 KiB
 .rodata          0E130000 - 0E140598 size 00010598  65 KiB
 .gnu.hash        0E140598 - 0E1405B0 size 00000018   0 KiB
 .got             0E1405B0 - 0E1406F8 size 00000148   0 KiB
 .ARM.exidx       0E1406F8 - 0E142B78 size 00002480   9 KiB
 .ARM.extab       0E142B78 - 0E143274 size 000006FC   1 KiB
 *hole*           0E143274 - 0E144000 size 00000D8C   3 KiB
 .data            0E144000 - 0E145410 size 00001410   5 KiB
 .bss             0E145410 - 0E1509A8 size 0000B598  45 KiB
 .heap1           0E1509A8 - 0E164000 size 00013658  77 KiB
 .nozi            0E164000 - 0E176B80 size 00012B80  74 KiB
 *hole*           0E176B80 - 0E300000 size 00189480 1573 KiB
 .dynamic         0E300000 - 0E300098 size 00000098   0 KiB
 .hash            0E300098 - 0E3000B0 size 00000018   0 KiB
 .dynsym          0E3000B0 - 0E3000E0 size 00000030   0 KiB
 .dynstr          0E3000E0 - 0E3000E1 size 00000001   0 KiB
 *hole*           0E3000E1 - 0E3000E4 size 00000003   0 KiB
 .rel             0E3000E4 - 0E301E04 size 00001D20   7 KiB

 After:

 $ make -s CFG_CORE_ASLR=y
 $ scripts/mem_usage.py out/arm-plat-vexpress/core/tee.elf
 RAM Usage        0E100000 - 0E176B80 size 00076B80 475 KiB 119 pages
 .text            0E100000 - 0E12FA68 size 0002FA68 190 KiB
 *hole*           0E12FA68 - 0E130000 size 00000598   1 KiB
 .rodata          0E130000 - 0E140598 size 00010598  65 KiB
 .gnu.hash        0E140598 - 0E1405B0 size 00000018   0 KiB
 .got             0E1405B0 - 0E1406F8 size 00000148   0 KiB
 .ARM.exidx       0E1406F8 - 0E142B78 size 00002480   9 KiB
 .ARM.extab       0E142B78 - 0E143274 size 000006FC   1 KiB
 *hole*           0E143274 - 0E144000 size 00000D8C   3 KiB
 .data            0E144000 - 0E145410 size 00001410   5 KiB
 .bss             0E145410 - 0E1509A8 size 0000B598  45 KiB
 .heap1           0E1509A8 - 0E164000 size 00013658  77 KiB
 .nozi            0E164000 - 0E176B80 size 00012B80  74 KiB

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
1 file changed
tree: 21ad4707b71ce0bb69305ce7670cabad34ab6005
  1. .github/
  2. core/
  3. keys/
  4. ldelf/
  5. lib/
  6. mk/
  7. scripts/
  8. ta/
  9. .gitignore
  10. .shippable.yml
  11. .travis.yml
  12. CHANGELOG.md
  13. LICENSE
  14. MAINTAINERS
  15. Makefile
  16. README.md
  17. typedefs.checkpatch
README.md

OP-TEE Trusted OS

This git contains source code for the secure side implementation of OP-TEE project.

All official OP-TEE documentation has moved to http://optee.readthedocs.io.

// OP-TEE core maintainers