aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2022-01-23 15:46:05 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2022-01-23 15:46:05 +0100
commit33a9f34df5c53d3dd074a2168ff40d612a36667a (patch)
treec37af771951fe38fe5232b37ea2f07cf3e68fcec
parent39369ff460f3e2dbfec7f6be181b2fb98f3c1867 (diff)
downloadbusybox-w32-33a9f34df5c53d3dd074a2168ff40d612a36667a.tar.gz
busybox-w32-33a9f34df5c53d3dd074a2168ff40d612a36667a.tar.bz2
busybox-w32-33a9f34df5c53d3dd074a2168ff40d612a36667a.zip
add busybox_ldscript.README.txt
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--busybox_ldscript.README.txt47
1 files changed, 47 insertions, 0 deletions
diff --git a/busybox_ldscript.README.txt b/busybox_ldscript.README.txt
new file mode 100644
index 000000000..1625a970a
--- /dev/null
+++ b/busybox_ldscript.README.txt
@@ -0,0 +1,47 @@
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
17/* To reduce the number of VMAs each bbox process has,
18## move *(.bss SORT_BY_ALIGNMENT(.bss.*) ...)
19## part from .bss : {...} block to .data : { ... } block.
20## (This usually increases .data section by only one page).
21## Result:
22##
23## text data bss dec hex filename
24## 1050792 560 7580 1058932 102874 busybox.bss
25## 1050792 8149 0 1058941 10287d busybox.nobss
26##
27## $ exec busybox.bss pmap $$
28## 0000000008048000 1028K r-xp /path/to/busybox.bss
29## 0000000008149000 8K rw-p /path/to/busybox.bss
30## 000000000814b000 4K rw-p [ anon ] <---- this VMA is eliminated
31## 00000000085f5000 4K ---p [heap]
32## 00000000085f6000 4K rw-p [heap]
33## 00000000f7778000 8K rw-p [ anon ]
34## 00000000f777a000 12K r--p [vvar]
35## 00000000f777d000 8K r-xp [vdso]
36## 00000000ff7e9000 132K rw-p [stack]
37##
38## $ exec busybox.nobss pmap $$
39## 0000000008048000 1028K r-xp /path/to/busybox.nobss
40## 0000000008149000 12K rw-p /path/to/busybox.nobss
41## 00000000086f0000 4K ---p [heap]
42## 00000000086f1000 4K rw-p [heap]
43## 00000000f7783000 8K rw-p [ anon ]
44## 00000000f7785000 12K r--p [vvar]
45## 00000000f7788000 8K r-xp [vdso]
46## 00000000ffac0000 132K rw-p [stack]
47*/