ref: d24cf11ad43b30e0e9b5e28d39b3baad945ba1cf
parent: 8d89ba39d450bc5bbce15da209039093865abc41
author: Antonio Niño Díaz <[email protected]>
date: Thu Jan 4 17:32:40 EST 2018
Make list of linker symbols common That way the definitions of the assembler and the linker are always the same. Signed-off-by: Antonio Niño Díaz <[email protected]>
--- a/include/asm/mylink.h
+++ /dev/null
@@ -1,62 +1,0 @@
-#ifndef RGBDS_ASM_LINK_H
-#define RGBDS_ASM_LINK_H
-
-enum {
- RPN_ADD = 0,
- RPN_SUB,
- RPN_MUL,
- RPN_DIV,
- RPN_MOD,
- RPN_UNSUB,
-
- RPN_OR,
- RPN_AND,
- RPN_XOR,
- RPN_UNNOT,
-
- RPN_LOGAND,
- RPN_LOGOR,
- RPN_LOGUNNOT,
-
- RPN_LOGEQ,
- RPN_LOGNE,
- RPN_LOGGT,
- RPN_LOGLT,
- RPN_LOGGE,
- RPN_LOGLE,
-
- RPN_SHL,
- RPN_SHR,
-
- RPN_BANK,
-
- RPN_HRAM,
-
- RPN_CONST = 0x80,
- RPN_SYM = 0x81
-};
-
-enum {
- SECT_WRAM0 = 0,
- SECT_VRAM,
- SECT_ROMX,
- SECT_ROM0,
- SECT_HRAM,
- SECT_WRAMX,
- SECT_SRAM,
- SECT_OAM
-};
-
-enum {
- SYM_LOCAL = 0,
- SYM_IMPORT,
- SYM_EXPORT
-};
-
-enum {
- PATCH_BYTE = 0,
- PATCH_WORD_L,
- PATCH_LONG_L
-};
-
-#endif /* RGBDS_ASM_LINK_H */
--- a/include/link/mylink.h
+++ b/include/link/mylink.h
@@ -3,6 +3,8 @@
#include <stdint.h>
+#include "linkdefs.h"
+
extern int32_t options;
#define OPT_TINY 0x01
@@ -11,52 +13,6 @@
#define OPT_CONTWRAM 0x08
#define OPT_DMG_MODE 0x10
-enum eRpnData {
- RPN_ADD = 0,
- RPN_SUB,
- RPN_MUL,
- RPN_DIV,
- RPN_MOD,
- RPN_UNSUB,
-
- RPN_OR,
- RPN_AND,
- RPN_XOR,
- RPN_UNNOT,
-
- RPN_LOGAND,
- RPN_LOGOR,
- RPN_LOGUNNOT,
-
- RPN_LOGEQ,
- RPN_LOGNE,
- RPN_LOGGT,
- RPN_LOGLT,
- RPN_LOGGE,
- RPN_LOGLE,
-
- RPN_SHL,
- RPN_SHR,
-
- RPN_BANK,
-
- RPN_HRAM,
-
- RPN_CONST = 0x80,
- RPN_SYM = 0x81
-};
-
-enum eSectionType {
- SECT_WRAM0,
- SECT_VRAM,
- SECT_ROMX,
- SECT_ROM0,
- SECT_HRAM,
- SECT_WRAMX,
- SECT_SRAM,
- SECT_OAM
-};
-
struct sSection {
int32_t nBank;
int32_t nOrg;
@@ -73,12 +29,6 @@
struct sSection *pNext;
};
-enum eSymbolType {
- SYM_LOCAL,
- SYM_IMPORT,
- SYM_EXPORT
-};
-
struct sSymbol {
char *pzName;
enum eSymbolType Type;
@@ -91,12 +41,6 @@
char *pzObjFileName; /* Object file where the symbol is located. */
char *pzFileName; /* Source file where the symbol was defined. */
uint32_t nFileLine; /* Line where the symbol was defined. */
-};
-
-enum ePatchType {
- PATCH_BYTE = 0,
- PATCH_WORD_L,
- PATCH_LONG_L
};
struct sPatch {
--- /dev/null
+++ b/include/linkdefs.h
@@ -1,0 +1,62 @@
+#ifndef RGBDS_LINKDEFS_H
+#define RGBDS_LINKDEFS_H
+
+enum eRpnData {
+ RPN_ADD = 0,
+ RPN_SUB,
+ RPN_MUL,
+ RPN_DIV,
+ RPN_MOD,
+ RPN_UNSUB,
+
+ RPN_OR,
+ RPN_AND,
+ RPN_XOR,
+ RPN_UNNOT,
+
+ RPN_LOGAND,
+ RPN_LOGOR,
+ RPN_LOGUNNOT,
+
+ RPN_LOGEQ,
+ RPN_LOGNE,
+ RPN_LOGGT,
+ RPN_LOGLT,
+ RPN_LOGGE,
+ RPN_LOGLE,
+
+ RPN_SHL,
+ RPN_SHR,
+
+ RPN_BANK,
+
+ RPN_HRAM,
+
+ RPN_CONST = 0x80,
+ RPN_SYM = 0x81
+};
+
+enum eSectionType {
+ SECT_WRAM0 = 0,
+ SECT_VRAM,
+ SECT_ROMX,
+ SECT_ROM0,
+ SECT_HRAM,
+ SECT_WRAMX,
+ SECT_SRAM,
+ SECT_OAM
+};
+
+enum eSymbolType {
+ SYM_LOCAL = 0,
+ SYM_IMPORT,
+ SYM_EXPORT
+};
+
+enum ePatchType {
+ PATCH_BYTE = 0,
+ PATCH_WORD_L,
+ PATCH_LONG_L
+};
+
+#endif /* RGBDS_LINKDEFS_H */
--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -12,11 +12,12 @@
#include "asm/fstack.h"
#include "asm/lexer.h"
#include "asm/main.h"
-#include "asm/mylink.h"
#include "asm/mymath.h"
#include "asm/output.h"
#include "asm/rpn.h"
#include "asm/symbol.h"
+
+#include "linkdefs.h"
char *tzNewMacro;
uint32_t ulNewMacroSize;
--- a/src/asm/output.c
+++ b/src/asm/output.c
@@ -12,14 +12,14 @@
#include "asm/charmap.h"
#include "asm/fstack.h"
#include "asm/main.h"
-#include "asm/mylink.h"
#include "asm/output.h"
#include "asm/rpn.h"
#include "asm/symbol.h"
-#include "common.h"
-
#include "extern/err.h"
+
+#include "common.h"
+#include "linkdefs.h"
void out_SetCurrentSection(struct Section *pSect);
--- a/src/asm/rpn.c
+++ b/src/asm/rpn.c
@@ -8,9 +8,10 @@
#include "asm/asm.h"
#include "asm/main.h"
-#include "asm/mylink.h"
#include "asm/rpn.h"
#include "asm/symbol.h"
+
+#include "linkdefs.h"
void mergetwoexpressions(struct Expression *expr, const struct Expression *src1,
const struct Expression *src2)