Skip to content

Commit

Permalink
riscv: Add .option assembly directive (unimp)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekaitz-zarraga committed Mar 21, 2024
1 parent 618c173 commit cbe70fa
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
11 changes: 11 additions & 0 deletions riscv64-tok.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,4 +411,15 @@
DEF_ASM(snez)
DEF_ASM(tail)

/* Possible values for .option directive */
DEF_ASM(arch)
DEF_ASM(rvc)
DEF_ASM(norvc)
DEF_ASM(pic)
DEF_ASM(nopic)
DEF_ASM(relax)
DEF_ASM(norelax)
DEF_ASM(push)
DEF_ASM(pop)

#undef DEF_ASM_WITH_SUFFIX
23 changes: 23 additions & 0 deletions tccasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,29 @@ static void asm_parse_directive(TCCState *s1, int global)
case TOK_ASMDIR_code64:
next();
break;
#endif
#ifdef TCC_TARGET_RISCV64
case TOK_ASMDIR_option:
next();
switch(tok){
case TOK_ASM_pic:
case TOK_ASM_nopic:
case TOK_ASM_relax:
case TOK_ASM_norelax:
case TOK_ASM_push:
case TOK_ASM_pop:
/* TODO: unimplemented */
next();
break;
case TOK_ASM_arch:
/* TODO: unimplemented, requires extra parsing */
tcc_error("unimp .option '.%s'", get_tok_str(tok, NULL));
break;
default:
tcc_error("unknown .option '.%s'", get_tok_str(tok, NULL));
break;
}
break;
#endif
default:
tcc_error("unknown assembler directive '.%s'", get_tok_str(tok, NULL));
Expand Down
5 changes: 4 additions & 1 deletion tcctok.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@
/* pragma */
DEF(TOK_pack, "pack")
#if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_X86_64) && \
!defined(TCC_TARGET_ARM) && !defined(TCC_TARGET_ARM64)
!defined(TCC_TARGET_ARM) && !defined(TCC_TARGET_ARM64) && \
!defined(TCC_TARGET_RISCV64)
/* already defined for assembler */
DEF(TOK_ASM_push, "push")
DEF(TOK_ASM_pop, "pop")
Expand Down Expand Up @@ -401,6 +402,8 @@
DEF_ASMDIR(code32)
#elif defined(TCC_TARGET_X86_64)
DEF_ASMDIR(code64)
#elif defined(TCC_TARGET_RISCV64)
DEF_ASMDIR(option)
#endif
DEF_ASMDIR(short)
DEF_ASMDIR(long)
Expand Down

0 comments on commit cbe70fa

Please sign in to comment.