Correct problem in riscv64 dtors execution load the function pointer
authordrahn <drahn@openbsd.org>
Sun, 16 May 2021 16:00:50 +0000 (16:00 +0000)
committerdrahn <drahn@openbsd.org>
Sun, 16 May 2021 16:00:50 +0000 (16:00 +0000)
correctly and do not overwrite it in csu.
allows most ld.so regressions to pass
confirmed by jsg@, ok kettenis

lib/csu/riscv64/md_init.h
libexec/ld.so/riscv64/ldasm.S

index 83d3b45..8328b83 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: md_init.h,v 1.1 2021/04/28 00:11:11 drahn Exp $ */
+/* $OpenBSD: md_init.h,v 1.2 2021/05/16 16:00:50 drahn Exp $ */
 /*
  * Copyright (c) 2020 Dale Rahn <drahn@openbsd.org>
  *
@@ -62,7 +62,6 @@
        "       .type   __start, @function                              \n" \
        "_start:                                                        \n" \
        "__start:                                                       \n" \
-       "       mv      a3, a2  # cleanup                               \n" \
        "/* Get argc/argv/envp from stack */                            \n" \
        "       ld      a0, (sp)                                        \n" \
        "       addi    a1, sp, 0x8                                     \n" \
index d620c6c..d51e82c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ldasm.S,v 1.1 2021/04/28 15:16:26 drahn Exp $ */
+/*     $OpenBSD: ldasm.S,v 1.2 2021/05/16 16:00:50 drahn Exp $ */
 
 /*
  * Copyright (c) 2016,2021 Dale Rahn <drahn@openbsd.org>
@@ -66,7 +66,7 @@ _dl_start:
        mv      sp, fp                          // move stack back
        mv      fp, zero                        // clear frame back pointer
 
-2:     auipc   a3, %got_pcrel_hi(_dl_dtors)            /* cleanup */
+2:     auipc   a3, %pcrel_hi(_dl_dtors)                /* cleanup */
        addi    a3, a3, %pcrel_lo(2b)
 
        jr      a0