mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-14 15:14:23 -04:00
kern: put rela in bss
NOTE: This saves ~0x4000 of space at the cost of crimes against the linker script.
This commit is contained in:
parent
fba962ef11
commit
960ba52a43
4 changed files with 25 additions and 19 deletions
|
@ -207,13 +207,15 @@ namespace ams::kern::init::loader {
|
|||
/* NOTE: Nintendo does this only on 10.0.0+ */
|
||||
init_pt.PhysicallyRandomize(virtual_base_address + rx_offset, bss_end_offset - rx_offset, true);
|
||||
|
||||
/* Clear kernel .bss. */
|
||||
std::memset(GetVoidPointer(virtual_base_address + bss_offset), 0, bss_end_offset - bss_offset);
|
||||
|
||||
/* Apply relocations to the kernel. */
|
||||
const Elf::Dyn *kernel_dynamic = reinterpret_cast<const Elf::Dyn *>(GetInteger(virtual_base_address) + dynamic_offset);
|
||||
Elf::ApplyRelocations(GetInteger(virtual_base_address), kernel_dynamic);
|
||||
|
||||
/* Clear kernel .bss. */
|
||||
/* NOTE: The kernel does this before applying relocations, but we do it after. */
|
||||
/* This allows us to place our relocations in space overlapping with .bss...and thereby reclaim the memory that would otherwise be wasted. */
|
||||
std::memset(GetVoidPointer(virtual_base_address + bss_offset), 0, bss_end_offset - bss_offset);
|
||||
|
||||
/* Call the kernel's init array functions. */
|
||||
/* NOTE: The kernel does this after reprotecting .rodata, but we do it before. */
|
||||
/* This allows our global constructors to edit .rodata, which is valuable for editing the SVC tables to support older firmwares' ABIs. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue