Skip to content

Commit

Permalink
tcg/sparc: Convert patch_reloc to return bool
Browse files Browse the repository at this point in the history
Since 7ecd02a, 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>
  • Loading branch information
rth7680 committed Feb 8, 2022
1 parent 684db2a commit 6a6bfa3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tcg/sparc/tcg-target.c.inc
Expand Up @@ -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;
Expand Down

0 comments on commit 6a6bfa3

Please sign in to comment.