vmbase: Move stack guard page to own section
For clarity in the linker script and resulting ELF.
While here, move init_stack_pointer inside of its SECTION.
Note: No functional change intended.
Bug: 377276983
Bug: 381440625
Test: m {pvmfw,rialto,vmbase_example_{bios,kernel}}_bin
Change-Id: Ibd1d372f89681e28e07dbd63f9328405495e6d8d
diff --git a/libs/libvmbase/sections.ld b/libs/libvmbase/sections.ld
index 7d464bc..5ca5ff4 100644
--- a/libs/libvmbase/sections.ld
+++ b/libs/libvmbase/sections.ld
@@ -96,11 +96,16 @@
bss_end = .;
} >writable_data
- init_stack_pointer = ORIGIN(writable_data) + LENGTH(writable_data);
+ /* Left unmapped, to catch overflows of the stack. */
+ .stack_guard_page (NOLOAD) : ALIGN(4096) {
+ . += 4096;
+ } >writable_data
+
+ /* Stack, mapped read-write (possibly partially). */
.stack (NOLOAD) : ALIGN(4096) {
- . += 4096; /* Ensure we have one guard page for overflow. */
stack_limit = .;
- . = init_stack_pointer;
+ . = ALIGN(LENGTH(writable_data));
+ init_stack_pointer = .;
} >writable_data
/* Make our Bionic stack protector compatible with mainline LLVM */