diff --git a/tccelf.c b/tccelf.c index 6a6aaee0..74e1f008 100644 --- a/tccelf.c +++ b/tccelf.c @@ -2133,6 +2133,9 @@ static int final_sections_reloc(TCCState *s1) if (s1->nb_errors != 0) return -1; + /* Some targets use static data between relocations (riscv64) */ + tcc_enter_state (s1); + /* relocate sections */ /* XXX: ignore sections with allocated relocations ? */ for(i = 1; i < s1->nb_sections; i++) { @@ -2141,6 +2144,8 @@ static int final_sections_reloc(TCCState *s1) relocate_section(s1, s); } + tcc_exit_state(); + /* relocate relocation entries if the relocation tables are allocated in the executable */ for(i = 1; i < s1->nb_sections; i++) {