From nobody Thu Aug 22 19:37:01 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WqYP93dFhz5TWD3; Thu, 22 Aug 2024 19:37:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WqYP9192Zz4Q3R; Thu, 22 Aug 2024 19:37:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724355421; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ogYqeeVVGaZ1GurMS35gJkdgm/VkHUT6wtYoBH+IeeA=; b=mz6KSVV4IdMtR+XNobRf4MboI+DYZYmeP8agxGJQzXR1vk+eskOB8LoLKq6SGHjJ4UVrdG n64Nb0+cBzp7NzLGdnA0cW1cgihnRFQWSsWYEpXqpSz6djzZWclGdPfq3TtgSYyf3si/+X bH/06ES7pKYmN8vAZVHJDfzvAvPzQob8Omlk6TYHXNwBr1tlWmxY1TVMhz+aR8Smu5ERm1 0mTxRe1ey7oB9FJUJ3rgF+wiHdiippbp9CFLcc210VDku5E96WDR/p27EoBG+CLioiqgZG 17OaadYMuIjPQUql4FXlohnHQlSjlBW2fGdOPb/I1U/cnF2OK52F3wnbBFE1oA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724355421; a=rsa-sha256; cv=none; b=HwNUovn5Ps/N4mVOn0kcvQ8I8cphGcxdBnAC+mTT7UHtWWoUL6c2FgF9hjtO1baYOkAOy3 9L8Dj/Y65q+O3hULpYGu02/gQNsKCARlt7kwPg+EJCMAbb/WFH2eBfs2qPFJVF+NpsjqHr 0L6z3CXG0XZP4Y8VyVLwZ8a9XlSmdVSTC/e1U1NqqpUzlmbZKis8bKINos1zmH24W6AHiN qTCCl5Og0nwgcpz1HAOJETtUo3oPQnjyBzzf7pMZMoxS0jQjcLQgE/+hJr3PbIB93SFuSg Uca+7Tu+OmhdH3dQKOiAsCbYZHq1Iz9qeQnpPa2QC48LQvTn1KLTeljM7TSMEA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724355421; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ogYqeeVVGaZ1GurMS35gJkdgm/VkHUT6wtYoBH+IeeA=; b=umGZlL8i3GSQtQ4OMkroSDLJ1QfXj3rZPmLmBw+lyrdawc7J6swNsIqCT25uTcxzyT0ncT UMTNV8rbhZeOz7KJcX4KSvf7NDCMa8WPP5YI5PxlnCsHW0rwFuRMFztuREdNG4LX7y7mKL Km1cf1qbIqaO344Z+DZC7gyMspBpnkAW2Fn5NUiJWdiH12DDA/m2e1IzOUMm5/Hd4eYIa9 CIu0wquKJ+g7a6W35Dg0Tuz18eeNQyWUEYu4U+j/YvDpja19Vov3gpuvdyBBvU7Xtjovq0 +TItPxxVRf5HAncNWm8gCHPbjyMzDfZiGfAz65VnRz+Qlbi6yKPdKxkxeTZxCw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WqYP90gnKzh42; Thu, 22 Aug 2024 19:37:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47MJb1bP034931; Thu, 22 Aug 2024 19:37:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47MJb1OP034928; Thu, 22 Aug 2024 19:37:01 GMT (envelope-from git) Date: Thu, 22 Aug 2024 19:37:01 GMT Message-Id: <202408221937.47MJb1OP034928@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 8afae0caf4c4 - main - riscv: Add machine/ifunc.h corresponding to rtld-elf's resolver interface List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8afae0caf4c4816eb56b732fcd1a4b185e86098a Auto-Submitted: auto-generated The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=8afae0caf4c4816eb56b732fcd1a4b185e86098a commit 8afae0caf4c4816eb56b732fcd1a4b185e86098a Author: Jessica Clarke AuthorDate: 2024-08-22 19:36:45 +0000 Commit: Jessica Clarke CommitDate: 2024-08-22 19:36:45 +0000 riscv: Add machine/ifunc.h corresponding to rtld-elf's resolver interface Reviewed by: kib, mhorne MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D46279 --- sys/riscv/include/ifunc.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/sys/riscv/include/ifunc.h b/sys/riscv/include/ifunc.h new file mode 100644 index 000000000000..0f9747a2aa14 --- /dev/null +++ b/sys/riscv/include/ifunc.h @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2015-2018 The FreeBSD Foundation + * Copyright (c) 2024 Jessica Clarke + * + * Part of this software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __RISCV_IFUNC_H +#define __RISCV_IFUNC_H + +#define DEFINE_IFUNC(qual, ret_type, name, args) \ + static ret_type (*name##_resolver(void))args __used; \ + qual ret_type name args __attribute__((ifunc(#name "_resolver"))); \ + static ret_type (*name##_resolver(void))args + +#define DEFINE_UIFUNC(qual, ret_type, name, args) \ + static ret_type (*name##_resolver(unsigned long, unsigned long, \ + unsigned long, unsigned long, unsigned long, unsigned long, \ + unsigned long, unsigned long))args __used; \ + qual ret_type name args __attribute__((ifunc(#name "_resolver"))); \ + static ret_type (*name##_resolver(unsigned long elf_hwcap __unused, \ + unsigned long _arg2 __unused, unsigned long _arg3 __unused, \ + unsigned long _arg4 __unused, unsigned long _arg5 __unused, \ + unsigned long _arg6 __unused, unsigned long _arg7 __unused, \ + unsigned long _arg8 __unused))args + +#endif