This option was introduced in GNU ld in
https://sourceware.org/legacy-ml/binutils/2015-06/msg00086.html and is
often used in embedded development. This change implements this option
in LLD matching the GNU ld output verbatim.
Details
- Reviewers
MaskRay peter.smith - Commits
- rG811cbfc26233: [lld][ELF] Implement –print-memory-usage
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looks like a useful feature to add, and I agree that keeping the same syntax as GNU is worthwhile.
lld/ELF/LinkerScript.cpp | ||
---|---|---|
1450 | Wondering whether it is worth making length() and usedLength() member functions of MemoryRegion. I think the (m->length)().getValue() is used at least once in LinkerScript.cpp. Not got a strong opinion here, it would just hide a bit of the code needed to access the expression. | |
lld/test/ELF/linkerscript/print-memory-usage1.s | ||
3 ↗ | (On Diff #522462) | More recent tests have used the split-file command to have the linker script and the assembler in the same file without needing a large echo command. This makes a bit easier to edit. Will be worth checking with MaskRay to see his preference is though. |
lld/test/ELF/linkerscript/print-memory-usage1.s | ||
---|---|---|
3 ↗ | (On Diff #522462) | The linker script seems too long. Using split-file should be clearer for this test. And consider combining print-memory-usage1.s and print-memory-usage2.s and print-memory-usage3.s into one file. |