summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-07-29 00:50:46 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-07-29 00:50:46 -0700
commit05fb0f23df26a1630294273188f740c3e064bf49 (patch)
tree8c390f8708b71fb52a86f402fa4b8b81b3a1e612
parentfee609a4170830e12e360e8c41b398289f525043 (diff)
downloadsamples-05fb0f23df26a1630294273188f740c3e064bf49.tar.gz
samples-05fb0f23df26a1630294273188f740c3e064bf49.tar.xz
samples-05fb0f23df26a1630294273188f740c3e064bf49.zip
exe.ld: allow programs to request optional memory
Adding things to this section will ask for optional memory in the EXE header.
-rw-r--r--exe.ld31
1 files changed, 18 insertions, 13 deletions
diff --git a/exe.ld b/exe.ld
index 9957c11..085c5b9 100644
--- a/exe.ld
+++ b/exe.ld
@@ -78,7 +78,7 @@ SECTIONS
far_BSS ALIGN(16) : {
PROVIDE(___farbss_start = .);
- *(SORT_BY_NAME(SORT_BY_ALIGNMENT([^,]*_BSS*)))
+ *(SORT_BY_NAME(SORT_BY_ALIGNMENT([^.]*_BSS*)))
PROVIDE(___farbss_end = .);
}
@@ -86,6 +86,14 @@ SECTIONS
HIDDEN(___.end = .);
/*
+ * Optional memory section. Allocations requested here are
+ * not necessarily satisfied; the program needs to verify.
+ */
+ _OPTIONAL ALIGN(16) : {
+ *(SORT_BY_NAME(SORT_BY_ALIGNMENT(*_OPTIONAL*)))
+ }
+
+ /*
* Anything beyond this point is used by elf2exe and are not
* part of the final output. However, the linker loudly
* objects if the dynamic section is not part of a loadable
@@ -97,32 +105,29 @@ SECTIONS
/* Special DT tags used by elf2exe */
/* Final file size */
- LONG(0x6bb31701);
- LONG(___.filesize);
+ LONG(0x6bb31701); LONG(___.filesize);
/* Final memory size */
- LONG(0x6bb31702);
- LONG(___.end); /* Final memory size */
+ LONG(0x6bb31702); LONG(___.end);
/* Segment base of entry point (used to compute CS) */
- LONG(0x6bb31703);
- LONG("___start!");
+ LONG(0x6bb31703); LONG("___start!");
/* Segment base of the stack (used to compute SS) */
- LONG(0x6bb31704);
- LONG("___stack_end!");
+ LONG(0x6bb31704); LONG("___stack_end!");
/*
* Base of the stack, used to compute SP, and usable
* as early temp storage as it does not need to be
* zeroed, unlike BSS.
*/
- LONG(0x6bb31705);
- LONG(___stack_start);
+ LONG(0x6bb31705); LONG(___stack_start);
/* Size of the stack */
- LONG(0x6bb31706);
- LONG(___stack_size);
+ LONG(0x6bb31706); LONG(___stack_size);
+
+ /* Requested additional memory */
+ LONG(0x6bb31707); LONG(SIZEOF(_OPTIONAL));
KEEP(*(.dynamic))