From cb9d1f53717dd67892ba943626f3d1b46f3e760b Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 6 Nov 2019 04:33:22 +0100 Subject: riscv64: lazy relocations do not work like sparc/m68k --- libc/misc/internals/__uClibc_main.c | 2 +- libc/sysdeps/linux/riscv64/crt1.S | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'libc') diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 6611090bd..affa0ce0a 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -500,6 +500,7 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, #endif } # endif +#endif /* Note: It is possible that any initialization done above could * have resulted in errno being set nonzero, so set it to 0 before @@ -511,7 +512,6 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, /* Set h_errno to 0 as well */ if (likely(not_null_ptr(__h_errno_location))) *(__h_errno_location()) = 0; -#endif #if defined HAVE_CLEANUP_JMP_BUF && defined __UCLIBC_HAS_THREADS_NATIVE__ /* Memory for the cancellation buffer. */ diff --git a/libc/sysdeps/linux/riscv64/crt1.S b/libc/sysdeps/linux/riscv64/crt1.S index 1e8403d26..15aa0763c 100644 --- a/libc/sysdeps/linux/riscv64/crt1.S +++ b/libc/sysdeps/linux/riscv64/crt1.S @@ -45,6 +45,9 @@ .globl _start .type _start,%function + .weak _init + .weak _fini + _start: call .Lload_gp mv a5, a0 /* rtld_fini. */ @@ -52,12 +55,9 @@ _start: la a0, main REG_L a1, 0(sp) /* argc. */ addi a2, sp, SZREG /* argv. */ - /* - * No support fo app_init/app_fini as we don't support shared libraries. - */ - mv a3, zero - mv a4, zero andi sp, sp, ALMASK /* Align stack. */ + lla a3, _init + lla a4, _fini mv a6, sp /* stack_end. */ tail __uClibc_main@plt -- cgit v1.2.3