From 3782da8d0c92bbd995e5cd6d304008e3b872f7ff Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Thu, 21 Mar 2024 01:29:49 +0100 Subject: [PATCH] riscv: Support $ in identifiers in extended asm. Needed for using `__global_pointer$`. $ don't have special meaning in RISC-V assembly. --- tccasm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tccasm.c b/tccasm.c index c5ee4173..fec30846 100644 --- a/tccasm.c +++ b/tccasm.c @@ -1014,7 +1014,9 @@ static void tcc_assemble_inline(TCCState *s1, char *str, int len, int global) { const int *saved_macro_ptr = macro_ptr; int dotid = set_idnum('.', IS_ID); +#ifndef TCC_TARGET_RISCV64 int dolid = set_idnum('$', 0); +#endif tcc_open_bf(s1, ":asm:", len); memcpy(file->buffer, str, len); @@ -1022,7 +1024,9 @@ static void tcc_assemble_inline(TCCState *s1, char *str, int len, int global) tcc_assemble_internal(s1, 0, global); tcc_close(); +#ifndef TCC_TARGET_RISCV64 set_idnum('$', dolid); +#endif set_idnum('.', dotid); macro_ptr = saved_macro_ptr; }