Add IWRAM section attribute macro to mimic -ffunction-sections

See the comment added in this commit for details. Currently unused.
Would save some IWRAM usage in the matrix implementation at the cost of
readability. If one operation on a matrix size is used, most other
operations will likely be used too, so in practice this may not change
IWRAM usage much. Only including the matrix sizes that are used in the
final binary would likely have a greater impact. FURTHER TESTING
REQUIRED.
This commit is contained in:
Myles Busig 2024-10-08 00:00:22 -07:00
parent 3a297fc1e3
commit 92d788a7f8

View File

@ -27,6 +27,11 @@
#ifdef __GBA__ #ifdef __GBA__
// If a section attribute is used, the symbol will be placed in the section
// exactly as specified. This means that when -ffunction-sections is used, functions
// will no longer be placed in separate sections. This macro is used to mimic
// the effect of -ffunction-sections while still placing the function in IWRAM.
#define GBA_IWRAM_FUNC(f) [[gnu::section(".iwram." #f), gnu::long_call]]
#define GBA_IWRAM [[gnu::section(".iwram"), gnu::long_call]] #define GBA_IWRAM [[gnu::section(".iwram"), gnu::long_call]]
#define GBA_EWRAM [[gnu::section(".ewram"), gnu::long_call]] #define GBA_EWRAM [[gnu::section(".ewram"), gnu::long_call]]
#define GBA_IWRAM_DATA [[gnu::section(".iwram")]] #define GBA_IWRAM_DATA [[gnu::section(".iwram")]]