-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved allocation of .bss(-like) sections (#505)
* Improved allocation of .bss(-like) sections The existing strategy for allocating `.bss` in RAM has a few problems - only one contiguous `.bss` region per FEM is supported. - alignment was not properly calculated for `.bss`, leading to linker errors This commit generalizes our process for allocating `.text`, `.data`, `.rodata`, etc. to `.bss` and like as well. It also improves our support for different platforms by reducing the use of hardcoded section names for determining behavior in favor of attributes defined by the binary format like `sh_type` and `sh_flags` With the new system, instead of passing `unsafe_bss_segment` to `make_fem`, `.bss` sections are allocated during the `allocate_bom` step. This is supported by free space regions that don't map to any data on the parent resource. Changes (incomplete): - Use SHT_NOBITS type to detect .bss(-like) sections on ELF toolchains - Create `FreeSpaceWithoutData`` tag for allocating regions for .bss. These are created from `MemoryRegion` children of resources with `data_range=None` - Use SHF_ALLOC flag to determine whether section needs to be patched or not instead of hard coded list of names. - Pass flag to compiler to prevent `.eh_frame` generation - Backwards compatible with old bss allocation for now, emits deprecation warnings. * Rename FreeSpaceWithoutData to RuntimeFreeSpace and FreeSpaceAnyData to AnyFreeSpace * Rename NOBITS_LEGACY_VADDR to BSS_LEGACY_VADDR * Allocate non-bss segments before bss segments in case legacy bss allocation used. * Prevent allocate_bom from allocating sections that will be discarded * Test legacy .bss allocation in ofrak_patch_maker_test * Remove workaround for remove_tag bug (fixed in #513) * Fix test_symbol_resolution for new return value of _resolve_symbols_within_BOM * Update notebook to reflect new Segment and AssembledObject definition * Add tests for dataless bss allocation to test_allocatable_allocate.py * Add test cases for RuntimeFreeSpace in the Analyzer * Add test for RuntimeFreeSpace in test_allocation_modifier * Test FreeSpaceModifier for RuntimeFreeSpace creation * Test .bss allocation both the new and old way in patch_maker * Changelog entries
- Loading branch information
Showing
23 changed files
with
573 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.