ref: dfa4c3e0944308b56ba4c3590c13a5060c56e759
parent: ab99666d785ab77175604d87d9abd204645b040b
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Dec 16 14:25:28 EST 2017
[as/objdump] Add global and extern pseudo instructions These pseudo instructions are needed to implement global variables. Dedup flag is removed because it can be implemented using common. This patch also adds absolute flag in myro files.
--- a/as/as.h
+++ b/as/as.h
@@ -12,7 +12,7 @@
FCOMMON = 1 << 2,
FEXTERN = 1 << 3,
FUNDEF = 1 << 4,
- FDEDUP = 1 << 5,
+ FGLOBAL = 1 << 5,
FRELOC = 1 << 6,
FABS = 1 << 7,
};
--- a/as/ins.c
+++ b/as/ins.c
@@ -159,3 +159,19 @@
{
cursec = sbss;
}
+
+void
+extrn(Op *op, Node **args)
+{
+ Symbol *sym = args[0]->sym;
+
+ sym->flags |= FEXTERN;
+}
+
+void
+global(Op *op, Node **args)
+{
+ Symbol *sym = args[0]->sym;
+
+ sym->flags |= FGLOBAL;
+}
--- a/as/myro.c
+++ b/as/myro.c
@@ -94,8 +94,6 @@
flags |= MYROSYM_EXTERN;
if (sym->flags & FUNDEF)
flags |= MYROSYM_UNDEF;
- if (sym->flags & FDEDUP)
- flags |= MYROSYM_DEDUP;
return flags;
}
--- a/as/target/x80/x80.dat
+++ b/as/target/x80/x80.dat
@@ -24,6 +24,8 @@
.SIZE imm16 0 none size Z80,R800,GB80
.COMM sym,imm16 0 none common Z80,R800,GB80
.COMM imm16 0 none common Z80,R800,GB80
+.GLOBL sym+ 0 none global Z80,R800,GB80
+.EXTERN sym+ 0 none extrn Z80,R800,GB80
NOP none 1 0x00 noargs Z80,R800,GB80
EI none 1 0xfb noargs Z80,R800,GB80
--- a/inc/myro.h
+++ b/inc/myro.h
@@ -56,10 +56,11 @@
};
enum myrosymflg {
- MYROSYM_DEDUP = 1 << 0,
- MYROSYM_COMMON = 1 << 1,
- MYROSYM_EXTERN = 1 << 2,
+ MYROSYM_COMMON = 1 << 0,
+ MYROSYM_EXTERN = 1 << 1,
+ MYROSYM_GLOBAL = 1 << 2,
MYROSYM_UNDEF = 1 << 3,
+ MYROSYM_ABS = 1 << 4,
};
extern int wrmyrohdr(FILE *fp, struct myrohdr *hdr);
--- a/objdump/main.c
+++ b/objdump/main.c
@@ -146,8 +146,6 @@
static char flags[10];
char *s = flags + sizeof(flags);
- if (sym->flags & MYROSYM_DEDUP)
- *--s = 'D';
if (sym->flags & MYROSYM_COMMON)
*--s = 'C';
if (sym->flags & MYROSYM_EXTERN)