aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc
diff options
context:
space:
mode:
authorKito Cheng <kito.cheng@sifive.com>2025-04-01 22:04:21 +0800
committerJeff Johnston <jjohnstn@redhat.com>2025-04-01 16:08:54 -0400
commite48d2166631fdc71de462b4c7bb72d1f937f1894 (patch)
tree13f977d0ef8d9037e75821fda02ad1356a6357db /newlib/libc
parent2c5f25035d9fba128fb766a371a609b447e0873c (diff)
downloadnewlib-e48d2166631fdc71de462b4c7bb72d1f937f1894.zip
newlib-e48d2166631fdc71de462b4c7bb72d1f937f1894.tar.gz
newlib-e48d2166631fdc71de462b4c7bb72d1f937f1894.tar.bz2
RISC-V: Fix the asm code for large code model
The large code model assume the data may far away from the code, so we must put the address of the target data wihin the `.text` section, normally we will just put within the function or nearby the function to prevent it out-of-range. Report from riscv-gnu-toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1699 Verified with riscv-gnu-toolchain with rv64gc.
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/machine/riscv/strcmp.S9
1 files changed, 8 insertions, 1 deletions
diff --git a/newlib/libc/machine/riscv/strcmp.S b/newlib/libc/machine/riscv/strcmp.S
index 12c39db..cc29b7b 100644
--- a/newlib/libc/machine/riscv/strcmp.S
+++ b/newlib/libc/machine/riscv/strcmp.S
@@ -188,9 +188,16 @@ strcmp:
foundnull 1 3
foundnull 2 3
#endif
+#ifdef __riscv_cmodel_large
+ # Put the data within the funciton for large code model to prevent
+ # the data put too far.
+.align 3
+mask:
+.dword 0x7f7f7f7f7f7f7f7f
+#endif
.size strcmp, .-strcmp
-#if SZREG == 8
+#if SZREG == 8 && !defined(__riscv_cmodel_large)
.section .srodata.cst8,"aM",@progbits,8
.align 3
mask: