@@ -11,6 +11,7 @@ __code_signature_length = 0x20;
11
11
__stack_length = 0x400000;
12
12
__heap_end = __user_ram_end - __stack_length;
13
13
14
+ /* see https ://github.com/llvm/llvm-project/blob/main/libunwind/src/AddressSpace.hpp#L78 */
14
15
__eh_frame_hdr_start = SIZEOF (.eh_frame_hdr) > 0 ? ADDR (.eh_frame_hdr) : 0;
15
16
__eh_frame_hdr_end = SIZEOF (.eh_frame_hdr) > 0 ? . : 0;
16
17
@@ -19,6 +20,13 @@ MEMORY {
19
20
}
20
21
21
22
SECTIONS {
23
+ /*
24
+ * VEXos expects program binaries to have a 32-byte header called a "code signature",
25
+ * at their start, which tells the OS that we are a valid program and configures some
26
+ * miscellaneous startup behavior.
27
+ *
28
+ * This section is then initialized as a weak symbol in our PAL.
29
+ */
22
30
.code_signature : {
23
31
KEEP(*(.code_signature))
24
32
. = __user_ram_start + __code_signature_length;
@@ -29,6 +37,7 @@ SECTIONS {
29
37
*(.text .text.*)
30
38
} > USER_RAM
31
39
40
+ /* Global/uninitialized/static/constant data sections. */
32
41
.rodata : {
33
42
*(.rodata .rodata.*)
34
43
} > USER_RAM
@@ -43,8 +52,10 @@ SECTIONS {
43
52
__bss_end = .;
44
53
} > USER_RAM
45
54
46
- /* The unwind tables enabled by "default-uwtable" in the target file live here. */
47
- /* __eh_frame_start and similar symbols are used by libunwind. */
55
+ /*
56
+ * These sections are added by the compiler in some cases to facilitate stack unwinding.
57
+ * __eh_frame_start and similar symbols are used by libunwind.
58
+ */
48
59
.eh_frame_hdr : {
49
60
KEEP(*(.eh_frame_hdr))
50
61
} > USER_RAM
@@ -67,6 +78,7 @@ SECTIONS {
67
78
__extab_end = .;
68
79
} > USER_RAM
69
80
81
+ /* Active memory regions for the stack/heap. */
70
82
.heap (NOLOAD) : ALIGN (4) {
71
83
__heap_start = .;
72
84
. = __heap_end;
@@ -78,6 +90,10 @@ SECTIONS {
78
90
__stack_top = .;
79
91
} > USER_RAM
80
92
93
+ /*
94
+ * `.ARM.attributes` contains arch metadata for compatibility purposes, but we
95
+ * only target one hardware configuration, meaning it'd just take up space.
96
+ */
81
97
/DISCARD/ : {
82
98
*(.ARM.attributes*)
83
99
}
0 commit comments