diff --git a/compiler/ppcriscv64.lpi b/compiler/ppcriscv64.lpi
index 479f39e551..04ff31e24d 100644
--- a/compiler/ppcriscv64.lpi
+++ b/compiler/ppcriscv64.lpi
@@ -23,9 +23,6 @@
-
-
-
@@ -74,7 +71,8 @@
-
+
diff --git a/compiler/riscv64/cgcpu.pas b/compiler/riscv64/cgcpu.pas
index 3e58547145..04db2fa21a 100644
--- a/compiler/riscv64/cgcpu.pas
+++ b/compiler/riscv64/cgcpu.pas
@@ -566,13 +566,15 @@ implementation
if Count > 0 then
begin
tmpreg1 := GetIntRegister(list, OS_INT);
- for count2 := 1 to Count do
- begin
- list.concat(taicpu.op_reg_ref(A_LD, tmpreg1, src));
- list.concat(taicpu.op_reg_ref(A_SD, tmpreg1, dst));
- Inc(src.offset, 8);
- Inc(dst.offset, 8);
- end;
+ count2 := 1;
+ while count2 <= Count do
+ begin
+ list.concat(taicpu.op_reg_ref(A_LD, tmpreg1, src));
+ list.concat(taicpu.op_reg_ref(A_SD, tmpreg1, dst));
+ Inc(src.offset, 8);
+ Inc(dst.offset, 8);
+ Inc(count2);
+ end;
len := len mod 8;
end;
if (len and 4) <> 0 then
diff --git a/rtl/linux/riscv64/cprt0.as b/rtl/linux/riscv64/cprt0.as
index d6f1065ce8..522e484b85 100644
--- a/rtl/linux/riscv64/cprt0.as
+++ b/rtl/linux/riscv64/cprt0.as
@@ -50,9 +50,9 @@ _start:
1:auipc gp, %pcrel_hi(__global_pointer$)
addi gp, gp, %pcrel_lo(1b)
.option pop
-
+
/* Clear the frame pointer since this is the outermost frame. */
- addi fp, x0, 0
+ addi x8, x0, 0
ld a2, 0(sp)
addi sp, sp, 8