This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 64b6ac3d87 mpfs/mpfs_entrypoints.c: Fix potential R_RISCV_JAL linker 
error
64b6ac3d87 is described below

commit 64b6ac3d87b51ff700ca60114446e7807e53a400
Author: Ville Juven <ville.ju...@unikie.com>
AuthorDate: Wed Oct 11 14:11:40 2023 +0300

    mpfs/mpfs_entrypoints.c: Fix potential R_RISCV_JAL linker error
    
    Change bgtz t0, mpfs_opensbi_prepare_hart to tail-call to ensure there
    will be no link time error due to the jump offset being too large.
---
 arch/risc-v/src/mpfs/mpfs_entrypoints.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/risc-v/src/mpfs/mpfs_entrypoints.c 
b/arch/risc-v/src/mpfs/mpfs_entrypoints.c
index 44fe89f711..c0c4d65cb8 100644
--- a/arch/risc-v/src/mpfs/mpfs_entrypoints.c
+++ b/arch/risc-v/src/mpfs/mpfs_entrypoints.c
@@ -92,7 +92,9 @@ void mpfs_jump_to_app(void)
       "ld   t0, g_hart_use_sbi\n"            /* Load sbi usage bitmask */
       "srl  t0, t0, a0\n"                    /* Shift right by this hart */
       "andi t0, t0, 1\n"                     /* Check the 0 bit */
-      "bgtz t0, mpfs_opensbi_prepare_hart\n" /* If bit was 1, jump to sbi */
+      "beqz t0, 1f\n"                        /* If bit was 1, jump to sbi */
+      "tail mpfs_opensbi_prepare_hart\n"
+      "1:\n"
 #endif
       "slli t1, a0, 3\n"                     /* To entrypoint offset */
       "la   t0, g_app_entrypoints\n"         /* Entrypoint table base */

Reply via email to