3
0

busybox_ldscript.README.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Add SORT_BY_ALIGNMENT to linker script (found in busybox_unstripped.out):
  2. ## .rodata : { *(.rodata SORT_BY_ALIGNMENT(.rodata.*) .gnu.linkonce.r.*) }
  3. ## .data : { *(.data SORT_BY_ALIGNMENT(.data.*) .gnu.linkonce.d.*) }
  4. ## .bss : { *(.bss SORT_BY_ALIGNMENT(.bss.*) .gnu.linkonce.b.*) }
  5. ## This will eliminate most of the padding (~3kb).
  6. ## Hmm, "ld --sort-section alignment" should do it too.
  7. ##
  8. ## There is a ld hack which is meant to decrease disk usage
  9. ## at the cost of more RAM usage (??!!) in standard ld script:
  10. ## . = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1)); . = DATA_SEGMENT_ALIGN (0x1000, 0x1000);
  11. ## Replace it with:
  12. ## . = ALIGN (0x1000); . = DATA_SEGMENT_ALIGN (0x1000, 0x1000);
  13. ## to unconditionally align .data to the next page boundary,
  14. ## instead of "next page, plus current offset in this page"
  15. */
  16. /* To reduce the number of VMAs each bbox process has,
  17. ## move *(.bss SORT_BY_ALIGNMENT(.bss.*) ...)
  18. ## part from .bss : {...} block to .data : { ... } block.
  19. ## (This usually increases .data section by only one page).
  20. ## Result:
  21. ##
  22. ## text data bss dec hex filename
  23. ## 1050792 560 7580 1058932 102874 busybox.bss
  24. ## 1050792 8149 0 1058941 10287d busybox.nobss
  25. ##
  26. ## $ exec busybox.bss pmap $$
  27. ## 0000000008048000 1028K r-xp /path/to/busybox.bss
  28. ## 0000000008149000 8K rw-p /path/to/busybox.bss
  29. ## 000000000814b000 4K rw-p [ anon ] <---- this VMA is eliminated
  30. ## 00000000085f5000 4K ---p [heap]
  31. ## 00000000085f6000 4K rw-p [heap]
  32. ## 00000000f7778000 8K rw-p [ anon ]
  33. ## 00000000f777a000 12K r--p [vvar]
  34. ## 00000000f777d000 8K r-xp [vdso]
  35. ## 00000000ff7e9000 132K rw-p [stack]
  36. ##
  37. ## $ exec busybox.nobss pmap $$
  38. ## 0000000008048000 1028K r-xp /path/to/busybox.nobss
  39. ## 0000000008149000 12K rw-p /path/to/busybox.nobss
  40. ## 00000000086f0000 4K ---p [heap]
  41. ## 00000000086f1000 4K rw-p [heap]
  42. ## 00000000f7783000 8K rw-p [ anon ]
  43. ## 00000000f7785000 12K r--p [vvar]
  44. ## 00000000f7788000 8K r-xp [vdso]
  45. ## 00000000ffac0000 132K rw-p [stack]
  46. */