ref: 1bc2ce4189efa355a5ca0b845fd93fa3ace6092d
parent: 0298b8c6607844bc77deb5d21da651a4954af076
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Dec 11 16:30:29 EST 2017
[as] Remove attrbute flagsfrom symbol These flags must go in the section structure, and not in the symbol section, because every symbol (excep temporary symbols) go into some section, so it doesn't make sense to use the symbol flags fo this reason.
--- a/as/as.h
+++ b/as/as.h
@@ -3,29 +3,27 @@
* type of segment
*/
enum symtype {
- TUNDEF = 0,
- TABS = 1,
- TTEXT = 2,
- TBSS = 3,
- TDATA = 4,
- TREG = 5,
- TMASK = 7,
+ TUNDEF = 1 << 0,
+ TREG = 1 << 1,
+ TMASK = 0x3,
};
-enum secflags {
- SRELOC = 1 << 4,
- SREAD = 1 << 5,
- SWRITE = 1 << 6,
- SFILE = 1 << 7,
-};
-
enum symflags {
- FCOMMON = 1 << 4,
- FLOCAL = 1 << 5,
+ FCOMMON = 1 << 2,
+ FLOCAL = 1 << 3,
FEXTERN = 1 << 6,
FUNDEF = 1 << 7,
};
+enum secflags {
+ SREAD = 1 << 0,
+ SWRITE = 1 << 1,
+ SEXEC = 1 << 2,
+ SLOAD = 1 << 3,
+ SFILE = 1 << 4,
+ SABS = 1 << 5,
+};
+
enum endianess {
BIG_ENDIAN = -1,
LITTLE_ENDIAN = 1
@@ -110,6 +108,7 @@
unsigned char pass;
unsigned char argtype;
TUINT value;
+ Section *section;
struct symbol *next;
struct symbol *hash;
};
--- a/as/myro.c
+++ b/as/myro.c
@@ -57,6 +57,12 @@
flags |= MYROSEC_WRITE;
if (sp->flags & SFILE)
flags |= MYROSEC_FILE;
+ if (sp->flags & SEXEC)
+ flags |= MYROSEC_EXEC;
+ if (sp->flags & SLOAD)
+ flags |= MYROSEC_LOAD;
+ if (sp->flags & SABS)
+ flags |= MYROSEC_ABS;
return flags;
}
--- a/as/symbol.c
+++ b/as/symbol.c
@@ -13,24 +13,24 @@
static Section abss = {
.name = (String) {"abs"},
- .flags = TABS|SREAD|SWRITE,
+ .flags = SABS|SREAD|SWRITE|SFILE|SLOAD,
};
static Section bss = {
.name = (String) {"bss"},
- .flags = TBSS|SRELOC|SREAD|SWRITE,
+ .flags = SREAD|SWRITE|SLOAD,
.next = &abss,
};
static Section data = {
.name = (String) {"data"},
- .flags = TDATA|SRELOC|SREAD|SWRITE|SFILE,
+ .flags = SREAD|SWRITE|SFILE|SLOAD,
.next = &bss,
};
static Section text = {
.name = (String) {"text"},
- .flags = TTEXT|SRELOC|SFILE,
+ .flags = SREAD|SEXEC|SLOAD|SFILE,
.next = &data,
};
@@ -197,7 +197,7 @@
sec->name = newstring(name);
sec->base = sec->max = sec->pc = sec->curpc = 0;
sec->next = seclist;
- sec->flags = SRELOC|SREAD|SWRITE|SFILE;
+ sec->flags = 0;
sec->fill = 0;
sec->aligment = 0;
}
@@ -230,7 +230,7 @@
tmpalloc = alloc(sizeof(*sym), NALLOC);
sym = new(tmpalloc);
sym->value = val;
- sym->flags = TABS;
+ sym->section = NULL;
return sym;
}