]> git.proxmox.com Git - mirror_qemu.git/commitdiff
tcg/sparc: Convert patch_reloc to return bool
authorRichard Henderson <richard.henderson@linaro.org>
Sat, 5 Feb 2022 05:12:30 +0000 (08:12 +0300)
committerRichard Henderson <richard.henderson@linaro.org>
Tue, 8 Feb 2022 21:59:06 +0000 (08:59 +1100)
Since 7ecd02a06f8, if patch_reloc fails we restart translation
with a smaller TB.  SPARC had its function signature changed,
but not the logic.  Replace assert with return false.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tcg/sparc/tcg-target.c.inc

index ed2f4ecc403d61263f265fb3cb65c3c443aca050..213aba4be68a0d5e101ae0b54f7489129bc7a0da 100644 (file)
@@ -323,12 +323,16 @@ static bool patch_reloc(tcg_insn_unit *src_rw, int type,
 
     switch (type) {
     case R_SPARC_WDISP16:
-        assert(check_fit_ptr(pcrel >> 2, 16));
+        if (!check_fit_ptr(pcrel >> 2, 16)) {
+            return false;
+        }
         insn &= ~INSN_OFF16(-1);
         insn |= INSN_OFF16(pcrel);
         break;
     case R_SPARC_WDISP19:
-        assert(check_fit_ptr(pcrel >> 2, 19));
+        if (!check_fit_ptr(pcrel >> 2, 19)) {
+            return false;
+        }
         insn &= ~INSN_OFF19(-1);
         insn |= INSN_OFF19(pcrel);
         break;