summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/arch/arm/DEFS.h54
-rw-r--r--lib/libc/arch/arm/gen/byte_swap_2.S16
-rw-r--r--lib/libc/arch/arm/gen/byte_swap_4.S16
-rw-r--r--lib/libc/arch/arm/gen/sigsetjmp.S8
-rw-r--r--lib/libc/arch/arm/string/bcopy.S4
-rw-r--r--lib/libc/arch/arm/string/bzero.S4
-rw-r--r--lib/libc/arch/arm/sys/brk.S4
-rw-r--r--lib/libc/arch/arm/sys/sbrk.S4
-rw-r--r--libexec/ld.so/arm/Makefile.inc4
-rw-r--r--sys/arch/arm/include/asm.h10
10 files changed, 42 insertions, 82 deletions
diff --git a/lib/libc/arch/arm/DEFS.h b/lib/libc/arch/arm/DEFS.h
deleted file mode 100644
index a758b0f9ea0..00000000000
--- a/lib/libc/arch/arm/DEFS.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $OpenBSD: DEFS.h,v 1.3 2017/12/16 09:25:43 kettenis Exp $ */
-/*
- * Copyright (c) 2016 Philip Guenther <guenther@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <machine/asm.h>
-
-/*
- * We define a hidden alias with the prefix "_libc_" for each global symbol
- * that may be used internally. By referencing _libc_x instead of x, other
- * parts of libc prevent overriding by the application and avoid unnecessary
- * relocations.
- */
-#define _HIDDEN(x) _libc_##x
-#define _HIDDEN_ALIAS(x,y) \
- STRONG_ALIAS(_HIDDEN(x),y); \
- .hidden _HIDDEN(x)
-#define _HIDDEN_FALIAS(x,y) \
- _HIDDEN_ALIAS(x,y); \
- .type _HIDDEN(x),#function
-
-/*
- * For functions implemented in ASM that aren't syscalls.
- * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names
- * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names
- * END_BUILTIN(x) If compiling with clang, then just END() and
- * mark it .protected, else be like END_STRONG();
- * for clang builtins like memcpy
- * If a 'BUILTIN' function needs be referenced by other ASM code, then use
- * _BUILTIN(x) If compiled with clang, then just x, otherwise
- * _HIDDEN(x)
- */
-#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x))
-#define END_WEAK(x) END_STRONG(x); .weak x
-
-#ifdef __clang__
-#define END_BUILTIN(x) END(x); .protected x
-#define _BUILTIN(x) x
-#else
-#define END_BUILTIN(x) END_STRONG(x)
-#define _BUILTIN(x) _HIDDEN(x)
-#endif
diff --git a/lib/libc/arch/arm/gen/byte_swap_2.S b/lib/libc/arch/arm/gen/byte_swap_2.S
index 7915ae87df2..3429741ed9e 100644
--- a/lib/libc/arch/arm/gen/byte_swap_2.S
+++ b/lib/libc/arch/arm/gen/byte_swap_2.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: byte_swap_2.S,v 1.3 2008/06/26 05:42:04 ray Exp $ */
+/* $OpenBSD: byte_swap_2.S,v 1.4 2022/05/24 17:15:23 guenther Exp $ */
/* $NetBSD: byte_swap_2.S,v 1.3 2003/04/05 23:08:51 bjh21 Exp $ */
/*-
@@ -30,13 +30,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <machine/asm.h>
+#include "DEFS.h"
-_ENTRY(_C_LABEL(__bswap16))
-_ENTRY(_C_LABEL(ntohs))
-_ENTRY(_C_LABEL(htons))
-_PROF_PROLOGUE
+_ENTRY(__bswap16)
+_ENTRY_NB(ntohs)
+ENTRY_NB(htons)
and r1, r0, #0xff
mov r0, r0, lsr #8
orr r0, r0, r1, lsl #8
mov pc, lr
+END(htons)
+_END(ntohs)
+_END(__bswap16)
+ .weak htons
+ .weak ntohs
diff --git a/lib/libc/arch/arm/gen/byte_swap_4.S b/lib/libc/arch/arm/gen/byte_swap_4.S
index e31199a3730..408e95448ae 100644
--- a/lib/libc/arch/arm/gen/byte_swap_4.S
+++ b/lib/libc/arch/arm/gen/byte_swap_4.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: byte_swap_4.S,v 1.3 2008/06/26 05:42:04 ray Exp $ */
+/* $OpenBSD: byte_swap_4.S,v 1.4 2022/05/24 17:15:23 guenther Exp $ */
/* $NetBSD: byte_swap_4.S,v 1.2 2003/04/05 23:08:51 bjh21 Exp $ */
/*-
@@ -30,14 +30,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <machine/asm.h>
+#include "DEFS.h"
-_ENTRY(_C_LABEL(__bswap32))
-_ENTRY(_C_LABEL(ntohl))
-_ENTRY(_C_LABEL(htonl))
-_PROF_PROLOGUE
+_ENTRY(__bswap32)
+_ENTRY_NB(ntohl)
+ENTRY_NB(htonl)
eor r1, r0, r0, ror #16
bic r1, r1, #0x00FF0000
mov r0, r0, ror #8
eor r0, r0, r1, lsr #8
mov pc, lr
+END(htonl)
+_END(ntohl)
+_END(__bswap32)
+ .weak htonl
+ .weak ntohl
diff --git a/lib/libc/arch/arm/gen/sigsetjmp.S b/lib/libc/arch/arm/gen/sigsetjmp.S
index 52e32c7d248..0a2162d6a07 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.3 2016/08/06 19:16:09 guenther Exp $ */
+/* $OpenBSD: sigsetjmp.S,v 1.4 2022/05/24 17:15:23 guenther Exp $ */
/* $NetBSD: sigsetjmp.S,v 1.3 2002/08/17 19:54:30 thorpej Exp $ */
/*
@@ -46,17 +46,19 @@
* The previous signal state is restored.
*/
-ENTRY(sigsetjmp)
+ENTRY_NB(sigsetjmp)
teq r1, #0
beq _HIDDEN(_setjmp)
b _HIDDEN(setjmp)
+END_WEAK(sigsetjmp)
.L_setjmp_magic:
.word _JB_MAGIC__SETJMP
-ENTRY(siglongjmp)
+ENTRY_NB(siglongjmp)
ldr r2, .L_setjmp_magic
ldr r3, [r0]
teq r2, r3
beq _HIDDEN(_longjmp)
b _HIDDEN(longjmp)
+END_WEAK(siglongjmp)
diff --git a/lib/libc/arch/arm/string/bcopy.S b/lib/libc/arch/arm/string/bcopy.S
index 88b08cbaa37..e5cae17f4a6 100644
--- a/lib/libc/arch/arm/string/bcopy.S
+++ b/lib/libc/arch/arm/string/bcopy.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcopy.S,v 1.6 2017/10/29 02:21:33 guenther Exp $ */
+/* $OpenBSD: bcopy.S,v 1.7 2022/05/24 17:15:23 guenther Exp $ */
/* $NetBSD: bcopy.S,v 1.2 2001/07/16 05:50:06 matt Exp $ */
/*-
@@ -34,7 +34,7 @@
/* bcopy = memcpy/memmove with arguments reversed. */
-ENTRY(bcopy)
+ENTRY_NB(bcopy)
/* switch the source and destination registers */
eor r0, r1, r0
eor r1, r0, r1
diff --git a/lib/libc/arch/arm/string/bzero.S b/lib/libc/arch/arm/string/bzero.S
index ff7fb97221e..0bc5a421075 100644
--- a/lib/libc/arch/arm/string/bzero.S
+++ b/lib/libc/arch/arm/string/bzero.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: bzero.S,v 1.6 2017/12/16 09:25:43 kettenis Exp $ */
+/* $OpenBSD: bzero.S,v 1.7 2022/05/24 17:15:23 guenther Exp $ */
/* $NetBSD: bzero.S,v 1.2 2001/07/16 05:50:06 matt Exp $ */
/*-
@@ -32,7 +32,7 @@
#include "DEFS.h"
-ENTRY(bzero)
+ENTRY_NB(bzero)
mov r2, r1
mov r1, #0
b _BUILTIN(memset)
diff --git a/lib/libc/arch/arm/sys/brk.S b/lib/libc/arch/arm/sys/brk.S
index a33c2995142..038f6dbc389 100644
--- a/lib/libc/arch/arm/sys/brk.S
+++ b/lib/libc/arch/arm/sys/brk.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: brk.S,v 1.11 2021/10/25 14:38:10 jca Exp $ */
+/* $OpenBSD: brk.S,v 1.12 2022/05/24 17:15:23 guenther Exp $ */
/* $NetBSD: brk.S,v 1.7 2003/12/26 11:23:44 martin Exp $ */
/*-
@@ -47,7 +47,7 @@ __minbrk:
/*
* Change the data segment size
*/
-ENTRY(brk)
+ENTRY_NB(brk)
#ifdef __PIC__
/* Setup the GOT */
ldr r3, .Lgot
diff --git a/lib/libc/arch/arm/sys/sbrk.S b/lib/libc/arch/arm/sys/sbrk.S
index 107091bf621..dc840fb9454 100644
--- a/lib/libc/arch/arm/sys/sbrk.S
+++ b/lib/libc/arch/arm/sys/sbrk.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbrk.S,v 1.11 2021/10/25 14:38:10 jca Exp $ */
+/* $OpenBSD: sbrk.S,v 1.12 2022/05/24 17:15:23 guenther Exp $ */
/* $NetBSD: sbrk.S,v 1.7 2003/08/07 16:42:05 agc Exp $ */
/*-
@@ -48,7 +48,7 @@ __curbrk:
/*
* Change the data segment size
*/
-ENTRY(sbrk)
+ENTRY_NB(sbrk)
#ifdef __PIC__
/* Setup the GOT */
ldr r3, .Lgot
diff --git a/libexec/ld.so/arm/Makefile.inc b/libexec/ld.so/arm/Makefile.inc
index 4000170d918..72fae823cb5 100644
--- a/libexec/ld.so/arm/Makefile.inc
+++ b/libexec/ld.so/arm/Makefile.inc
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile.inc,v 1.8 2019/10/20 03:44:49 guenther Exp $
+# $OpenBSD: Makefile.inc,v 1.9 2022/05/24 17:15:22 guenther Exp $
CFLAGS += -fpic -msoft-float
AFLAGS += -D_STANDALONE
LD_SCRIPT = ${.CURDIR}/${MACHINE_CPU}/ld.script
-CPPFLAGS += -I${.CURDIR}/../../lib/libc/arch/arm
+CPPFLAGS += -I${.CURDIR}/../../lib/libc/arch/arm -I${.CURDIR}/../../lib/libc/arch
SRCS+= divsi3.S
LIBCSRCDIR=${.CURDIR}/../../lib/libc
.PATH: ${LIBCSRCDIR}/arch/arm/gen
diff --git a/sys/arch/arm/include/asm.h b/sys/arch/arm/include/asm.h
index 1fc98c14e88..27e55be5b6f 100644
--- a/sys/arch/arm/include/asm.h
+++ b/sys/arch/arm/include/asm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: asm.h,v 1.10 2022/02/24 07:08:21 guenther Exp $ */
+/* $OpenBSD: asm.h,v 1.11 2022/05/24 17:15:22 guenther Exp $ */
/* $NetBSD: asm.h,v 1.4 2001/07/16 05:43:32 matt Exp $ */
/*
@@ -61,8 +61,11 @@
*/
#define _ASM_TYPE_FUNCTION #function
#define _ASM_TYPE_OBJECT #object
-#define _ENTRY(x) \
- .text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x:
+
+/* NB == No Binding: use .globl or .weak as necessary */
+#define _ENTRY_NB(x) \
+ .text; _ALIGN_TEXT; .type x,_ASM_TYPE_FUNCTION; x:
+#define _ENTRY(x) .globl x; _ENTRY_NB(x)
#if defined(PROF) || defined(GPROF)
# define _PROF_PROLOGUE \
@@ -73,6 +76,7 @@
#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
#define ENTRY_NP(y) _ENTRY(_C_LABEL(y))
+#define ENTRY_NB(y) _ENTRY_NB(y); _PROF_PROLOGUE
#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
#define ASENTRY_NP(y) _ENTRY(_ASM_LABEL(y))
#define END(y) .size y, . - y