Keep removed headers (#7261)

This commit is contained in:
cawtds
2025-07-02 09:06:23 +02:00
committed by GitHub
parent be2d36b6ee
commit 92b4b7f0a0
8 changed files with 20 additions and 19 deletions

View File

@@ -13,6 +13,7 @@
#define COMMON_DATA __attribute__((section("common_data")))
#define UNUSED __attribute__((unused))
#define USED __attribute__((used))
#define KEEP_SECTION __attribute__((section(".text.consts")))
#define ARM_FUNC __attribute__((target("arm")))

View File

@@ -54,14 +54,15 @@ SECTIONS {
ALIGN(4)
{
src/rom_header.o(.text*);
src/rom_header_gf.o(.text.*);
src/rom_header_rhh.o(.text.*);
KEEP(*.o(.text.header_gf));
KEEP(*.o(.text.header_rhh));
src/crt0.o(.text);
*libagbsyscall.a:*.o(.text*);
*libgcc.a:*.o(.text*);
*libc.a:*.o(.text*);
*libnosys.a:*.o(.text*);
asm/*.o(.text*);
KEEP(*.o(.text.consts));
*.o(.text*);
*.o(.eh_frame);
} > ROM =0

View File

@@ -75,8 +75,9 @@ SECTIONS {
ALIGN(4)
{
src/rom_header.o(.text);
src/rom_header_gf.o(.text.*);
src/rom_header_rhh.o(.text.*);
KEEP(*.o(.text.header_gf));
KEEP(*.o(.text.header_rhh));
KEEP(*.o(.text.consts));
src/*.o(.text);
} > ROM =0

View File

@@ -1,7 +1,7 @@
#include "gba/gba.h"
#include "gba/flash_internal.h"
USED static const char AgbLibFlashVersion[] = "FLASH1M_V103";
KEEP_SECTION USED static const char AgbLibFlashVersion[] = "FLASH1M_V103";
static const struct FlashSetupInfo *const sSetupInfos[] =
{

View File

@@ -7,34 +7,34 @@ Start::
RomHeaderNintendoLogo::
.space 156
RomHeaderGameTitle:
RomHeaderGameTitle::
.space 12
RomHeaderGameCode::
.space 4
RomHeaderMakerCode:
RomHeaderMakerCode::
.space 2
RomHeaderMagic:
RomHeaderMagic::
.byte 0
RomHeaderMainUnitCode:
RomHeaderMainUnitCode::
.byte 0
RomHeaderDeviceType:
RomHeaderDeviceType::
.byte 0
RomHeaderReserved1:
RomHeaderReserved1::
.space 7
RomHeaderSoftwareVersion::
.byte 0
RomHeaderChecksum:
RomHeaderChecksum::
.byte 0
RomHeaderReserved2:
RomHeaderReserved2::
.space 2
.word 0

View File

@@ -97,9 +97,8 @@ struct GFRomHeader
};
// This seems to need to be in the text section for some reason.
// To avoid a changed section attributes warning it's put in a special .text.consts section.
__attribute__((section(".text.consts")))
USED static const struct GFRomHeader sGFRomHeader = {
// To avoid a changed section attributes warning it's put in a special .text.header_gf section.
__attribute__((section(".text.header_gf"))) USED static const struct GFRomHeader sGFRomHeader = {
.version = GAME_VERSION,
.language = GAME_LANGUAGE,
.gameName = "pokemon emerald version",

View File

@@ -27,8 +27,7 @@ struct RHHRomHeader
/*0x17*/ u8 padding;
};
__attribute__((section(".text.consts")))
USED static const struct RHHRomHeader sRHHRomHeader =
__attribute__((section(".text.header_rhh"))) USED static const struct RHHRomHeader sRHHRomHeader =
{
.rhh_magic = { 'R', 'H', 'H', 'E', 'X', 'P' },
.expansionVersionMajor = EXPANSION_VERSION_MAJOR,

View File

@@ -75,7 +75,7 @@ static u8 ReadData();
static void EnableGpioPortRead();
static void DisableGpioPortRead();
USED static const char AgbLibRtcVersion[] = "SIIRTC_V001";
KEEP_SECTION USED static const char AgbLibRtcVersion[] = "SIIRTC_V001";
void SiiRtcUnprotect(void)
{