[hackers] [scc] [cc2-z80] Export/Import symbols || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 25 Jan 2016 11:00:38 +0100 (CET)

commit 55210afb602705a30acb416bc224664ed56dfb67
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sun Jan 24 22:32:01 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sun Jan 24 22:32:01 2016 +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.

diff --git a/cc2/arch/z80/code.c b/cc2/arch/z80/code.c
index 448b988..cfe2228 100644
--- a/cc2/arch/z80/code.c
+++ b/cc2/arch/z80/code.c
_AT_@ -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)
_AT_@ -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
Received on Mon Jan 25 2016 - 11:00:38 CET

This archive was generated by hypermail 2.3.0 : Mon Jan 25 2016 - 11:12:27 CET