mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
To make the behaviour of the linkerscript consistent, every section read from an object file must have an unique name. This is needed as the linkerscript uses the name of sections to place them and it expects every section to have a different name. This doesn't break compatibility with the old behaviour that allowed to continue sections if they had the same name, bank number and starting address. That's still allowed because `rgbasm` outputs a single section if this functionality is used, it is transparent to `rgblink`. Signed-off-by: AntonioND <antonio_nd@outlook.com>
51 lines
1.2 KiB
C
51 lines
1.2 KiB
C
#ifndef RGBDS_LINK_ASSIGN_H
|
|
#define RGBDS_LINK_ASSIGN_H
|
|
|
|
#include "mylink.h"
|
|
#include "types.h"
|
|
|
|
enum eBankCount {
|
|
BANK_COUNT_ROM0 = 1,
|
|
BANK_COUNT_ROMX = 511,
|
|
BANK_COUNT_WRAM0 = 1,
|
|
BANK_COUNT_WRAMX = 7,
|
|
BANK_COUNT_VRAM = 2,
|
|
BANK_COUNT_OAM = 1,
|
|
BANK_COUNT_HRAM = 1,
|
|
BANK_COUNT_SRAM = 16
|
|
};
|
|
|
|
enum eBankDefine {
|
|
BANK_ROM0 = 0,
|
|
BANK_ROMX = BANK_ROM0 + BANK_COUNT_ROM0,
|
|
BANK_WRAM0 = BANK_ROMX + BANK_COUNT_ROMX,
|
|
BANK_WRAMX = BANK_WRAM0 + BANK_COUNT_WRAM0,
|
|
BANK_VRAM = BANK_WRAMX + BANK_COUNT_WRAMX,
|
|
BANK_OAM = BANK_VRAM + BANK_COUNT_VRAM,
|
|
BANK_HRAM = BANK_OAM + BANK_COUNT_OAM,
|
|
BANK_SRAM = BANK_HRAM + BANK_COUNT_HRAM
|
|
};
|
|
|
|
#define MAXBANKS (BANK_COUNT_ROM0 + BANK_COUNT_ROMX + BANK_COUNT_WRAM0 + BANK_COUNT_WRAMX \
|
|
+ BANK_COUNT_VRAM + BANK_COUNT_OAM + BANK_COUNT_HRAM + BANK_COUNT_SRAM)
|
|
|
|
extern SLONG area_Avail(SLONG bank);
|
|
extern void AssignSections(void);
|
|
extern void CreateSymbolTable(void);
|
|
extern SLONG MaxBankUsed;
|
|
extern SLONG MaxAvail[MAXBANKS];
|
|
|
|
int
|
|
IsSectionNameInUse(const char *name);
|
|
|
|
void
|
|
SetLinkerscriptName(char *tzLinkerscriptFile);
|
|
|
|
int
|
|
IsSectionSameTypeBankAndFloating(const char *name, enum eSectionType type, int bank);
|
|
|
|
unsigned int
|
|
AssignSectionAddressByName(const char *name, unsigned int address);
|
|
|
|
#endif
|