Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 May 2020 15:59:55 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r360783 - stable/12/lib/libc/riscv/gen
Message-ID:  <202005071559.047Fxtp0095560@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Thu May  7 15:59:55 2020
New Revision: 360783
URL: https://svnweb.freebsd.org/changeset/base/360783

Log:
  MFC 355403: Use "far" calls and branches so that lld uses valid relocations.
  
  Conditional branch and jump instructions do not always call via PLT
  stubs and thus will not honor LD_PRELOAD, etc.  lld warns about using
  non-preemptible relocations for preemptible or unknown symbols whereas
  bfd does not (at least for RISC-V).

Modified:
  stable/12/lib/libc/riscv/gen/setjmp.S
  stable/12/lib/libc/riscv/gen/sigsetjmp.S
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/riscv/gen/setjmp.S
==============================================================================
--- stable/12/lib/libc/riscv/gen/setjmp.S	Thu May  7 15:12:56 2020	(r360782)
+++ stable/12/lib/libc/riscv/gen/setjmp.S	Thu May  7 15:59:55 2020	(r360783)
@@ -46,7 +46,7 @@ ENTRY(setjmp)
 	addi	a2, a0, (_JB_SIGMASK * 8)	/* oset */
 	li	a1, 0				/* set */
 	li	a0, 1				/* SIG_BLOCK */
-	jal	sigprocmask
+	call	_C_LABEL(sigprocmask)
 
 	ld	a0, 0(sp)
 	ld	ra, 8(sp)
@@ -110,7 +110,7 @@ ENTRY(longjmp)
 	li	a2, 0				/* oset */
 	addi	a1, a0, (_JB_SIGMASK * 8)	/* set */
 	li	a0, 3				/* SIG_BLOCK */
-	jal	sigprocmask
+	call	_C_LABEL(sigprocmask)
 
 	ld	a1, (2 * 8)(sp)
 	ld	ra, (1 * 8)(sp)

Modified: stable/12/lib/libc/riscv/gen/sigsetjmp.S
==============================================================================
--- stable/12/lib/libc/riscv/gen/sigsetjmp.S	Thu May  7 15:12:56 2020	(r360782)
+++ stable/12/lib/libc/riscv/gen/sigsetjmp.S	Thu May  7 15:59:55 2020	(r360783)
@@ -38,8 +38,10 @@ __FBSDID("$FreeBSD$");
 #include <machine/setjmp.h>
 
 ENTRY(sigsetjmp)
-	beqz	a1, _C_LABEL(_setjmp)
-	j	_C_LABEL(setjmp)
+	beqz	a1, 1f
+	tail	_C_LABEL(setjmp)
+1:
+	tail	_C_LABEL(_setjmp)
 END(sigsetjmp)
 
 ENTRY(siglongjmp)
@@ -48,8 +50,10 @@ ENTRY(siglongjmp)
 	ld	a3, 0(a0)
 
 	/* Check the magic */
-	beq	a2, a3, _C_LABEL(_longjmp)
-	j	_C_LABEL(longjmp)
+	beq	a2, a3, 1f
+	tail	_C_LABEL(longjmp)
+1:
+	tail	_C_LABEL(_longjmp)
 
 	.align	3
 .Lmagic:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005071559.047Fxtp0095560>