From 72250bece23918040204ca8ae7422cf36a380782 Mon Sep 17 00:00:00 2001 From: herman ten brugge Date: Mon, 7 Dec 2020 11:36:54 +0100 Subject: [PATCH] riscv64 relocation fix --- tccelf.c | 5 +++++ 1 file changed, 5 insertions(+) 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++) {