|
1 | | -SECTIONS |
| 1 | +PHDRS |
2 | 2 | { |
3 | | - . = 0; |
| 3 | + text PT_LOAD FLAGS(5) /* Read | Execute */; |
| 4 | + rodata PT_LOAD FLAGS(4) /* Read */; |
| 5 | + data PT_LOAD FLAGS(6) /* Read | Write */; |
| 6 | + bss PT_LOAD FLAGS(6) /* Read | Write */; |
| 7 | + dynamic PT_DYNAMIC; |
| 8 | +} |
4 | 9 |
|
| 10 | +SECTIONS |
| 11 | +{ |
5 | 12 | /* Code and file header */ |
| 13 | + . = 0; |
6 | 14 |
|
7 | | - .text : { |
| 15 | + .text : ALIGN(0x1000) { |
8 | 16 | HIDDEN(__text_start = .); |
9 | 17 | KEEP(*(.text.jmp)) |
10 | 18 |
|
11 | 19 | . = 0x80; |
12 | 20 |
|
13 | 21 | *(.text .text.*) |
| 22 | + *(.plt .plt.*) |
14 | 23 |
|
15 | | - . = ALIGN(0x1000); |
16 | 24 | HIDDEN(__text_end = .); |
17 | 25 | HIDDEN(__text_size = . - __text_start); |
18 | 26 | } |
19 | 27 |
|
20 | 28 | /* Read-only sections */ |
| 29 | + . = ALIGN(0x1000); |
21 | 30 |
|
22 | | - .rodata : { |
23 | | - HIDDEN(__rodata_start = .); |
24 | | - |
25 | | - *(.rodata .rodata.*) |
26 | | - |
27 | | - *(.got) |
| 31 | + HIDDEN(__rodata_start = .); |
| 32 | + .rodata : { *(.rodata .rodata.*) } :rodata |
28 | 33 |
|
| 34 | + .mod0 : { |
29 | 35 | KEEP(crt0.nso.o(.data.mod0)) |
30 | 36 | KEEP(crt0.nro.o(.data.mod0)) |
31 | 37 | KEEP(crt0.lib.nro.o(.data.mod0)) |
32 | | - KEEP(*(.data.mod0)) |
| 38 | + } |
33 | 39 |
|
34 | | - HIDDEN(__dynamic_start = .); |
35 | | - *(.dynamic) |
| 40 | + .dynsym : { *(.dynsym) } :rodata |
| 41 | + .dynstr : { *(.dynstr) } :rodata |
| 42 | + .rela.dyn : { *(.rela.*) } :rodata |
36 | 43 |
|
37 | | - . = ALIGN(0x1000); |
38 | | - HIDDEN(__rodata_end = .); |
39 | | - HIDDEN(__rodata_size = . - __rodata_start); |
40 | | - } |
| 44 | + HIDDEN(__rodata_end = .); |
| 45 | + HIDDEN(__rodata_size = . - __rodata_start); |
41 | 46 |
|
42 | 47 | /* Read-write sections */ |
| 48 | + . = ALIGN(0x1000); |
43 | 49 |
|
44 | 50 | .data : { |
45 | 51 | HIDDEN(__data_start = .); |
46 | 52 |
|
47 | 53 | *(.data .data.*) |
| 54 | + *(.got .got.*) |
| 55 | + *(.got.plt .got.plt.*) |
48 | 56 |
|
49 | 57 | HIDDEN(__data_end = .); |
50 | 58 | HIDDEN(__data_size = . - __data_start); |
| 59 | + } :data |
| 60 | + |
| 61 | + .dynamic : { |
| 62 | + HIDDEN(__dynamic_start = .); |
| 63 | + *(.dynamic) |
51 | 64 | } |
52 | 65 |
|
53 | 66 | /* BSS section */ |
54 | | - |
| 67 | + . = ALIGN(0x1000); |
55 | 68 | .bss : { |
56 | 69 | HIDDEN(__bss_start = .); |
57 | 70 |
|
58 | 71 | *(.bss .bss.*) |
59 | 72 | *(COMMON) |
| 73 | + . = ALIGN(8); |
60 | 74 |
|
61 | 75 | HIDDEN(__bss_end = .); |
62 | 76 | HIDDEN(__bss_size = . - __bss_start); |
63 | | - } |
| 77 | + } : bss |
64 | 78 |
|
65 | 79 | /DISCARD/ : |
66 | 80 | { |
67 | 81 | *(.eh_frame) /* This is probably unnecessary and bloats the binary. */ |
| 82 | + *(.eh_frame_hdr) |
68 | 83 | } |
69 | 84 | } |
0 commit comments