svn commit: r317530 - in head/lib/libc/riscv: . sys

Ruslan Bukin br at FreeBSD.org
Thu Apr 27 22:40:41 UTC 2017


Author: br
Date: Thu Apr 27 22:40:39 2017
New Revision: 317530
URL: https://svnweb.freebsd.org/changeset/base/317530

Log:
  Use unconditional jr (jump register) so cerror relocation offset fits.
  
  This fixes libc build on riscv64sf.
  
  Reviewed by:	jhb
  Sponsored by:	DARPA, AFRL

Modified:
  head/lib/libc/riscv/SYS.h
  head/lib/libc/riscv/sys/vfork.S

Modified: head/lib/libc/riscv/SYS.h
==============================================================================
--- head/lib/libc/riscv/SYS.h	Thu Apr 27 22:28:49 2017	(r317529)
+++ head/lib/libc/riscv/SYS.h	Thu Apr 27 22:40:39 2017	(r317530)
@@ -54,8 +54,10 @@ END(__sys_##name)
 ENTRY(__sys_##name);						\
 	WEAK_REFERENCE(__sys_##name, _##name);			\
 	_SYSCALL(name);						\
-	bnez	t0, cerror; 					\
+	bnez	t0, 1f; 					\
 	ret;							\
+1:	la	t1, cerror;					\
+	jr	t1;						\
 END(__sys_##name)
 
 #define	RSYSCALL(name)						\
@@ -63,6 +65,8 @@ ENTRY(__sys_##name);						\
 	WEAK_REFERENCE(__sys_##name, name);			\
 	WEAK_REFERENCE(__sys_##name, _##name);			\
 	_SYSCALL(name);						\
-	bnez	t0, cerror; 					\
+	bnez	t0, 1f; 					\
 	ret;							\
+1:	la	t1, cerror;					\
+	jr	t1;						\
 END(__sys_##name)

Modified: head/lib/libc/riscv/sys/vfork.S
==============================================================================
--- head/lib/libc/riscv/sys/vfork.S	Thu Apr 27 22:28:49 2017	(r317529)
+++ head/lib/libc/riscv/sys/vfork.S	Thu Apr 27 22:40:39 2017	(r317530)
@@ -42,10 +42,12 @@ ENTRY(__sys_vfork)
 	mv	a2, ra
 
 	_SYSCALL(vfork)
-	bnez	t0, cerror
+	bnez	t0, 1f
 	addi	a1, a1, -1
 	and	a0, a0, a1
 	mv	ra, a2
 
 	ret
+1:	la	t1, cerror
+	jr	t1
 END(__sys_vfork)


More information about the svn-src-head mailing list