From ef6a97f90fece7355463263fff12b2349b091299 Mon Sep 17 00:00:00 2001 From: guenther Date: Tue, 24 May 2022 17:21:17 +0000 Subject: [PATCH] Set the correct alignment on __jmpxor (.align's meaning is MD!) Put .L_setjmp_magic in the correct ELF section for duplicate suppression Rename the "botch" label to delete it from the symbol table ok kettenis@ miod@ --- lib/libc/arch/arm/gen/_setjmp.S | 17 ++++++++++------- lib/libc/arch/arm/gen/setjmp.S | 8 ++++---- lib/libc/arch/arm/gen/sigsetjmp.S | 4 +++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/libc/arch/arm/gen/_setjmp.S b/lib/libc/arch/arm/gen/_setjmp.S index 4e6f05e5c40..8a8c86b467d 100644 --- a/lib/libc/arch/arm/gen/_setjmp.S +++ b/lib/libc/arch/arm/gen/_setjmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: _setjmp.S,v 1.6 2018/06/22 15:18:50 kettenis Exp $ */ +/* $OpenBSD: _setjmp.S,v 1.7 2022/05/24 17:21:17 guenther Exp $ */ /* $NetBSD: _setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */ /* @@ -37,7 +37,7 @@ #include .section .openbsd.randomdata,"aw",%progbits - .align 4 + .balign 4 .globl __jmpxor __jmpxor: .zero 4*2 /* (sp, lr) */ @@ -85,17 +85,20 @@ ENTRY(_setjmp) mov r3, r0 mov pc, lr -.L_setjmp_magic: - .word _JB_MAGIC__SETJMP .L_jmpxor_setjmp: .word __jmpxor - 1b END_STRONG(_setjmp) + .section .rodata.cst4, "aM", %progbits, 4 + .balign 4 +.L_setjmp_magic: + .word _JB_MAGIC__SETJMP + ENTRY(_longjmp) ldr r2, .L_setjmp_magic ldr r3, [r0], #4 teq r2, r3 - bne botch + bne .Lbotch #ifdef SOFTFLOAT add r0, r0, #68 @@ -121,7 +124,7 @@ ENTRY(_longjmp) /* Validate sp and lr */ teq sp, #0 teqne lr, #0 - beq botch + beq .Lbotch /* Set return value */ mov r0, r1 @@ -133,7 +136,7 @@ ENTRY(_longjmp) .word __jmpxor - 1b /* validation failed, die die die. */ -botch: +.Lbotch: bl _HIDDEN(abort) b . - 8 /* Cannot get here */ END_STRONG(_longjmp) diff --git a/lib/libc/arch/arm/gen/setjmp.S b/lib/libc/arch/arm/gen/setjmp.S index 03ed693520c..a3dd3895687 100644 --- a/lib/libc/arch/arm/gen/setjmp.S +++ b/lib/libc/arch/arm/gen/setjmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: setjmp.S,v 1.7 2018/06/22 15:18:50 kettenis Exp $ */ +/* $OpenBSD: setjmp.S,v 1.8 2022/05/24 17:21:17 guenther Exp $ */ /* $NetBSD: setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */ /* @@ -96,7 +96,7 @@ ENTRY(longjmp) ldr r2, .Lsetjmp_magic ldr r3, [r0] teq r2, r3 - bne botch + bne .Lbotch /* Fetch signal mask and call sigprocmask */ mov r3, r0 /* r3 = jmpbuf */ @@ -130,7 +130,7 @@ ENTRY(longjmp) /* Validate sp and lr */ teq sp, #0 teqne lr, #0 - beq botch + beq .Lbotch /* Set return value */ mov r0, r12 @@ -142,7 +142,7 @@ ENTRY(longjmp) .word __jmpxor - 1b /* validation failed, die die die. */ -botch: +.Lbotch: bl _HIDDEN(abort) b . - 8 /* Cannot get here */ END_STRONG(longjmp) diff --git a/lib/libc/arch/arm/gen/sigsetjmp.S b/lib/libc/arch/arm/gen/sigsetjmp.S index 0a2162d6a07..f79e9e7e1e9 100644 --- a/lib/libc/arch/arm/gen/sigsetjmp.S +++ b/lib/libc/arch/arm/gen/sigsetjmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsetjmp.S,v 1.4 2022/05/24 17:15:23 guenther Exp $ */ +/* $OpenBSD: sigsetjmp.S,v 1.5 2022/05/24 17:21:17 guenther Exp $ */ /* $NetBSD: sigsetjmp.S,v 1.3 2002/08/17 19:54:30 thorpej Exp $ */ /* @@ -52,6 +52,8 @@ ENTRY_NB(sigsetjmp) b _HIDDEN(setjmp) END_WEAK(sigsetjmp) + .section .rodata.cst4, "aM", %progbits, 4 + .balign 4 .L_setjmp_magic: .word _JB_MAGIC__SETJMP -- 2.20.1