commit e33fbe2d881dd3035d91e75c59065a5d4fe02034
parent 4bc6e70eee07e3206f82a59fbb3e5e06e74c69dd
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 12 Dec 2017 10:34:45 +0000
[as] Add section id to symbols
Diffstat:
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/as/as.h b/as/as.h
@@ -90,6 +90,7 @@ struct section {
unsigned char flags;
unsigned char fill;
unsigned char aligment;
+ unsigned id;
TUINT base;
TUINT max;
TUINT curpc;
diff --git a/as/myro.c b/as/myro.c
@@ -72,8 +72,12 @@ writesections(FILE *fp)
Section *sp;
size_t off = 0;
struct myrosect sect;
+ unsigned id = 0;;
for (sp = seclist; sp; sp = sp->next) {
+ if (id == MYROMAXSEC)
+ die("too many sections for a myro file");
+ sp->id = id++;
sect.name = sp->name.offset;
sect.flags = getsecflags(sp);
sect.fill = sp->fill;
@@ -114,7 +118,7 @@ writesymbols(FILE *fp)
continue;
symbol.name = sym->name.offset;
symbol.type = -1;
- symbol.section = -1;
+ symbol.section = sym->section->id;
symbol.flags = getsymflags(sym);
symbol.offset = sym->value;
symbol.len = 0;
diff --git a/inc/myro.h b/inc/myro.h
@@ -7,6 +7,8 @@
#define MYROMAGIC_SIZ 4
#define MYROMAGIC "uobj"
+#define MYROMAXSEC 254
+
struct myrohdr {
char magic[4];
unsigned long format;