@@ -11,6 +11,7 @@ __code_signature_length = 0x20;
1111__stack_length = 0x400000 ;
1212__heap_end = __user_ram_end - __stack_length;
1313
14+ /* see https://github.com/llvm/llvm-project/blob/main/libunwind/src/AddressSpace.hpp#L78 */
1415__eh_frame_hdr_start = SIZEOF (.eh_frame_hdr) > 0 ? ADDR (.eh_frame_hdr) : 0 ;
1516__eh_frame_hdr_end = SIZEOF (.eh_frame_hdr) > 0 ? . : 0 ;
1617
@@ -19,6 +20,13 @@ MEMORY {
1920}
2021
2122SECTIONS {
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+ */
2230 .code_signature : {
2331 KEEP (*(.code_signature ))
2432 . = __user_ram_start + __code_signature_length;
@@ -29,6 +37,7 @@ SECTIONS {
2937 *(.text .text .*)
3038 } > USER_RAM
3139
40+ /* Global/uninitialized/static/constant data sections. */
3241 .rodata : {
3342 *(.rodata .rodata .*)
3443 } > USER_RAM
@@ -43,8 +52,10 @@ SECTIONS {
4352 __bss_end = .;
4453 } > USER_RAM
4554
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+ */
4859 .eh_frame_hdr : {
4960 KEEP (*(.eh_frame_hdr ))
5061 } > USER_RAM
@@ -67,6 +78,7 @@ SECTIONS {
6778 __extab_end = .;
6879 } > USER_RAM
6980
81+ /* Active memory regions for the stack/heap. */
7082 .heap (NOLOAD) : ALIGN (4 ) {
7183 __heap_start = .;
7284 . = __heap_end;
@@ -78,6 +90,10 @@ SECTIONS {
7890 __stack_top = .;
7991 } > USER_RAM
8092
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+ */
8197 /DISCARD/ : {
8298 *(.ARM .attributes *)
8399 }
0 commit comments