agb/gba.ld

74 lines
1.6 KiB
Plaintext
Raw Normal View History

2021-03-07 04:58:59 +11:00
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(__start)
MEMORY {
2021-04-13 10:33:18 +10:00
ewram (w!x) : ORIGIN = 0x02000000, LENGTH = 256K
iwram (w!x) : ORIGIN = 0x03000000, LENGTH = 32K
rom (rx) : ORIGIN = 0x08000000, LENGTH = 32M
2021-03-07 04:58:59 +11:00
}
__text_start = ORIGIN(rom);
SECTIONS {
. = __text_start;
.crt0 : {
2021-04-11 05:02:34 +10:00
KEEP (crt0.o(.text));
2021-03-07 04:58:59 +11:00
. = ALIGN(4);
} > rom
.text : {
*(.text .text*);
. = ALIGN(4);
} > rom
__text_end = .;
.rodata : {
*(.rodata .rodata.*);
. = ALIGN(4);
} > rom
2021-04-13 10:32:40 +10:00
__iwram_rom_start = .;
.iwram : {
__iwram_data_start = ABSOLUTE(.);
*(.iwram .iwram.*);
. = ALIGN(4);
2021-03-07 04:58:59 +11:00
*(.data .data.*);
. = ALIGN(4);
2021-04-13 10:32:40 +10:00
*(.text_iwram .text_iwram.*);
. = ALIGN(4);
__iwram_data_end = ABSOLUTE(.);
} > iwram AT>rom
2021-03-07 04:58:59 +11:00
2021-04-16 14:23:38 +10:00
. = __iwram_rom_start + (__iwram_data_end - __iwram_data_start);
__ewram_rom_start = .;
.ewram : {
__ewram_data_start = ABSOLUTE(.);
*(.ewram .ewram.*);
. = ALIGN(4);
__ewram_data_end = ABSOLUTE(.);
} > ewram AT>rom
2021-03-07 04:58:59 +11:00
.bss : {
*(.bss .bss.*);
. = ALIGN(4);
} > iwram
2021-04-13 10:32:40 +10:00
__iwram_rom_length_bytes = __iwram_data_end - __iwram_data_start;
__iwram_rom_length_halfwords = (__iwram_rom_length_bytes + 1) / 2;
2021-04-16 14:23:38 +10:00
__ewram_rom_length_bytes = __ewram_data_end - __ewram_data_start;
__ewram_rom_length_halfwords = (__ewram_rom_length_bytes + 1) / 2;
2021-03-07 04:58:59 +11:00
/* discard anything not already mentioned */
/DISCARD/ : { *(*) }
}