Browse Source

riscv32: allow ELF PIE noMMU build

Waldemar Brodkorb 6 months ago
parent
commit
4d6636f6b2
3 changed files with 5 additions and 7 deletions
  1. 2 1
      extra/Configs/Config.in
  2. 1 1
      extra/Configs/Config.in.arch
  3. 2 5
      libc/sysdeps/linux/riscv32/crt1.S

+ 2 - 1
extra/Configs/Config.in

@@ -336,7 +336,8 @@ config STATIC_PIE
 	depends on DOPIC && !UCLIBC_FORMAT_FDPIC_ELF && \
 		(TARGET_aarch64 || TARGET_arm || TARGET_i386 || \
 		 TARGET_m68k || TARGET_mips || TARGET_powerpc || \
-		 TARGET_riscv64 || TARGET_x86_64 || TARGET_xtensa)
+		 TARGET_riscv32 || TARGET_riscv64 || TARGET_x86_64 \
+		|| TARGET_xtensa)
 
 config ARCH_HAS_NO_SHARED
 	bool

+ 1 - 1
extra/Configs/Config.in.arch

@@ -13,7 +13,7 @@ choice
 config UCLIBC_FORMAT_ELF
 	bool "ELF (using ELF_FDPIC loader)"
 	depends on !ARCH_USE_MMU && (TARGET_arm || TARGET_m68k || \
-				     TARGET_riscv64)
+				     TARGET_riscv32 || TARGET_riscv64)
 	select DOPIC
 	select STATIC_PIE
 	select ARCH_HAS_NO_SHARED

+ 2 - 5
libc/sysdeps/linux/riscv32/crt1.S

@@ -45,9 +45,6 @@
 	.globl	_start
 	.type	_start,%function
 
-	.weak _init
-	.weak _fini
-
 _start:
 	call  .Lload_gp
 	mv    a5, a0  /* rtld_fini.  */
@@ -55,9 +52,9 @@ _start:
 	la   a0, main
 	REG_L a1, 0(sp)      /* argc.  */
 	addi  a2, sp, SZREG  /* argv.  */
+	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