aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2024-05-04 03:01:57 +0300
committerMarin Ivanov <[email protected]>2024-05-04 03:01:57 +0300
commit7641aaeb6a59c45baa0d25d27b9e2c6c25e183b8 (patch)
tree1986d4dc138b8b112019354693fcc804a454542e
parentcd21b90feaa9b66296b8614023349fae7d314b4b (diff)
add dummy type and size directives
-rw-r--r--asm.peg7
-rw-r--r--main.c4
-rw-r--r--minias.h2
3 files changed, 13 insertions, 0 deletions
diff --git a/asm.peg b/asm.peg
index bbc00f1..7d644b6 100644
--- a/asm.peg
+++ b/asm.peg
@@ -41,6 +41,10 @@ directive =
{ $$ = fd; }
| sd:section-directive
{ $$ = sd; }
+ | type-directive
+ { $$.kind = ASM_DIR_TYPE; }
+ | size-directive
+ { $$.kind = ASM_DIR_SIZE; }
fill-directive =
"fill" ws r:number ws? "," ws? s:number ws? "," ws? v:number
@@ -62,6 +66,9 @@ section-type =
"@nobits" { $$.i64 = SHT_NOBITS; }
| "@progbits" { $$.i64 = SHT_PROGBITS; }
+type-directive = "type" ws ident "," ws "@function"
+size-directive = "size" ws ident "," ws ".-" ident
+
label =
i:ident ':'
{ $$.label = (Label){.kind = ASM_LABEL, .name = i.charptr}; }
diff --git a/main.c b/main.c
index 56df5b5..eeda181 100644
--- a/main.c
+++ b/main.c
@@ -810,6 +810,10 @@ assemble(void)
sym = getsym(v->set.sym);
sym->value = v->set.value;
break;
+ case ASM_DIR_TYPE:
+ break;
+ case ASM_DIR_SIZE:
+ break;
case ASM_LABEL:
sym = getsym(v->label.name);
if (sym->defined)
diff --git a/minias.h b/minias.h
index 3e4f225..451474a 100644
--- a/minias.h
+++ b/minias.h
@@ -68,6 +68,8 @@ typedef enum {
ASM_DIR_INT,
ASM_DIR_QUAD,
ASM_DIR_BALIGN,
+ ASM_DIR_TYPE,
+ ASM_DIR_SIZE,
// Instructions.
ASM_JMP,
ASM_INSTR,