From abb018e1e46a23269c067b4dcb910c5a532c13e5 Mon Sep 17 00:00:00 2001 From: jca Date: Sat, 3 Dec 2022 15:02:30 +0000 Subject: [PATCH] Add ENTRY_NB() and use it for brk.S and sbrk.S on riscv64 NB for "No Binding". This gets us rid of clang-13 warnings about a global symbol redefined as weak. Mostly a copy of what guenther@ already implemented on other archs. ok guenther@ tb@ --- lib/libc/arch/riscv64/sys/brk.S | 4 ++-- lib/libc/arch/riscv64/sys/sbrk.S | 4 ++-- sys/arch/riscv64/include/asm.h | 10 +++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/libc/arch/riscv64/sys/brk.S b/lib/libc/arch/riscv64/sys/brk.S index f1d75878177..287f28a7ff1 100644 --- a/lib/libc/arch/riscv64/sys/brk.S +++ b/lib/libc/arch/riscv64/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.3 2022/12/02 12:27:08 jca Exp $ */ +/* $OpenBSD: brk.S,v 1.4 2022/12/03 15:02:30 jca Exp $ */ /* * Copyright (c) 2021 Dale Rahn * @@ -26,7 +26,7 @@ __minbrk: .dword _end -ENTRY(brk) +ENTRY_NB(brk) RETGUARD_SETUP(brk, t6) lla t1, __minbrk ld t5, 0(t1) diff --git a/lib/libc/arch/riscv64/sys/sbrk.S b/lib/libc/arch/riscv64/sys/sbrk.S index 40b6f0acb5a..f06cf2cf59a 100644 --- a/lib/libc/arch/riscv64/sys/sbrk.S +++ b/lib/libc/arch/riscv64/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.3 2022/12/02 12:27:08 jca Exp $ */ +/* $OpenBSD: sbrk.S,v 1.4 2022/12/03 15:02:30 jca Exp $ */ /* * Copyright (c) 2021 Dale Rahn * @@ -28,7 +28,7 @@ __curbrk: .dword _end END(__curbrk) -ENTRY(sbrk) +ENTRY_NB(sbrk) RETGUARD_SETUP(sbrk, t6) lla t1, __curbrk diff --git a/sys/arch/riscv64/include/asm.h b/sys/arch/riscv64/include/asm.h index a26c4737580..35b211d2a4a 100644 --- a/sys/arch/riscv64/include/asm.h +++ b/sys/arch/riscv64/include/asm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asm.h,v 1.6 2022/12/02 12:27:08 jca Exp $ */ +/* $OpenBSD: asm.h,v 1.7 2022/12/03 15:02:30 jca Exp $ */ /* * Copyright (c) 2020 Brian Bamsch @@ -53,6 +53,11 @@ # define _ALIGN_TEXT .align 0 #endif +/* NB == No Binding: use .globl or .weak as necessary */ +#define _ENTRY_NB(x) \ + .text; .p2align 1; .type x,@function; x: +#define _ENTRY(x) .globl x; _ENTRY_NB(x) + #if defined(PROF) || defined(GPROF) // XXX Profiler Support #define _PROF_PROLOGUE \ @@ -81,10 +86,9 @@ #define RETGUARD_SYMBOL(x) #endif -#define _ENTRY(x) \ - .text; .globl x; .type x,@function; .p2align 1; x: #define ENTRY(y) _ENTRY(y); _PROF_PROLOGUE #define ENTRY_NP(y) _ENTRY(y) +#define ENTRY_NB(y) _ENTRY_NB(y); _PROF_PROLOGUE #define ASENTRY(y) _ENTRY(y); _PROF_PROLOGUE #define ASENTRY_NP(y) _ENTRY(y) #define END(y) .size y, . - y -- 2.20.1