commit 55210afb602705a30acb416bc224664ed56dfb67
parent d2b15f1ea22699cecc79a9cf2a10c236b807a191
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 24 Jan 2016 22:32:01 +0100
[cc2-z80] Export/Import symbols
EXTRN is used to declared variables that are defined in another
module (or maybe in the same module), while PUBLIC it is used
to declare that a variable defined in the module must be
exported and being public for the other modules.
Diffstat:
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/cc2/arch/z80/code.c b/cc2/arch/z80/code.c
@@ -38,7 +38,9 @@ void
label(Symbol *sym)
{
int seg, flags = sym->type.flags;
+ char *name = symname(sym);
+ putchar('\n');
if (flags & FUNF)
seg = CODESEG;
else if (flags & INITF)
@@ -47,7 +49,16 @@ label(Symbol *sym)
seg = BSSSEG;
segment(seg);
- printf("%s:\n", symname(sym));
+ switch (sym->kind) {
+ case EXTRN:
+ printf("\tEXTRN %s\n", name);
+ return;
+ case GLOB:
+ printf("\tPUBLIC %s\n", name);
+ break;
+ }
+
+ printf("%s:\n", name);
}
static void