From patchwork Sun Jun 28 07:02:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Huang X-Patchwork-Id: 137960 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AA7594BA2E27 for ; Sun, 28 Jun 2026 07:03:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA7594BA2E27 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=google header.b=XNzYO+gh X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-dl1-x122b.google.com (mail-dl1-x122b.google.com [IPv6:2607:f8b0:4864:20::122b]) by sourceware.org (Postfix) with ESMTPS id 41C254BA23D6 for ; Sun, 28 Jun 2026 07:02:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 41C254BA23D6 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 41C254BA23D6 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::122b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1782630176; cv=none; b=tgqen+nm13bLTMDAmueFgUNJvARJKeroWVVfGv2QxhWFisxmjXwp5vR9PhKFQSspCftP/B/GK21Bi1aCsRuU1iEGMqdb7pYngts5e91BFvobbdT8HD26CpGACsIZv6lApAwhz+mSUUz12ZZQaJ8Re5Rjd1G3Lpqmfg5dJmoSrfI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1782630176; c=relaxed/simple; bh=AKyDAEcQmm67Yc5ruYgjXDr+BaZaUSINTDne1+4yA5w=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Ji5MnF6wk45Cn8nxa4FOacdnkiNUf7dY3PMo+SvL1W7xMUfVvTPJkiVAXpL9NZX3wlDkjol4S8DRbVhfZrN3i4kOQQmfxIyndWM211jtr+kFeffTLWNCRj5YUYpSkq5JWO4/FlYDGktODhr5EPfczHF6vXcDb2KU7O76x2v96rQ= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=google header.b=XNzYO+gh DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 41C254BA23D6 Received: by mail-dl1-x122b.google.com with SMTP id a92af1059eb24-139eee0707bso3194640c88.0 for ; Sun, 28 Jun 2026 00:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1782630175; x=1783234975; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=N6wZrkIEVHrgCYARwYpLYU2l0dF+0llAWaHjAWWH114=; b=XNzYO+gh5YJJWs/As8rFjnf+0qolo1ctf9ExPQTkt13Qn/Q+ap7zL1vo7KKwNYKvT9 YArUoAlB+yJrtrhoAoaUWl0KC0AZBzqQsqZPVCc+XmrCYTeVuDfjztTphtZJ4sA9IdoU CqzGRkvP/vTJhDW7o+BbgkKMCqYt2i2ZBtbVm4CqqMQ4IPRlxtbMGnHOfWRn7UBTWLjU 4UgM/5OMIL1LsI4oFIEHc5JGHUIhPC9cgT9U0vueVWRs0H8ATH9gCMOquqYYBip4GCfH Ber4iylbqTv6jHyeBRifUJQUSNdT2Qd/y2PuMQSKywvYJWtOWnCf+zPJ3RcjiAS/UEIv eJJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782630175; x=1783234975; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=N6wZrkIEVHrgCYARwYpLYU2l0dF+0llAWaHjAWWH114=; b=F8lSOOT0CKCOBKw8A/qPk9h9IlAuoDNufw/IlFPy/L9B38ie72hvMKv49qDC7ggKCA wFaxRS3IzjhCBf2DKSWmvugv+L2KnqR5JhZvXQmImtZlTLvoow55IkPs9YQ5zk5kT2o8 mCyNmEuQxeGUr0ocWjXdAkvz2LCiaiG23qmtM8id+tF81dl8ccPgN+XEulBfcIuN1rTG Yek367A4tHu6EaNko94YeQYfYus7pb0kI28xZPUUIG767n6eITqKz4Sf4VHbFTvLlfom DT2BtPk5yH9WG8FfYrjaIRVur9HHa1v/XmWY4XTmkwzPW01CkeqFhvcGkzU9CwF9VayY 2shA== X-Gm-Message-State: AOJu0YwlANgP0ZD6H/lNJ5KornwKSlRDI2wzi6tyZerOJi+/boMXJZqJ mxGNAe7x/SnLn6tO9dsDmDcM5U2N/YHlT4T9DhoFGpMbEAAab4gOartkQgQXHI6wN+xFWzVghp7 qdF8N6xNuF9KPmhhqvRCoe+GX+RC7q5+oeQOTgDB+w32gvija8yuVHM72fDHOxF5bfdl8ntr3LL 1f4fltcUP7PfbL9yEH/h/20pj3J5JRdXUV8w32Mo10XcaltDNJZg4= X-Gm-Gg: AfdE7cnMlig+pqkYAMNv1euuQsnspAvqWmSJaBHB2iRx6ckUdh6/MCOZL0TxkApl83l 1ggv6z+z6iFyf8nUNku3/iD1SRItvlnL3/IO+k/CFwYxzXfWfqDIf4bDJFn0qD43hxpgE8TKeTu jA0a4ZIlAlPVZQLhhemfTi52ackEFp+qoies0VyujryTBC8nkpuazdJ24zPJgfEdehMSLttuMPM POXv75MYc9u/LL6ltRIpDWu/LDTg5phUmTtuqDPJ56qyUrRcrFKpF08ffHLRfjQd77Ta6hxZI0H IRA27W/oIcGsMNc+1JS7OutDJel5yZNTwz8JiHakd6NCXipsR8TqCA6HE7C+zPU4CCUj+Ig8dBg NJEmdFnMYfeg0/oD34d+Df/C7zjGP+qgBKERDxU2fvToIQ0bmE26xK5wcV0XTEIOnIHyWfnbLVu bKl3uzzL2xQmpsNxAQZRUTitoKTl0ak9Qpn26bX4hP X-Received: by 2002:a05:7022:69a7:b0:139:ed5d:3a2 with SMTP id a92af1059eb24-139ed5d0536mr5004273c88.39.1782630175037; Sun, 28 Jun 2026 00:02:55 -0700 (PDT) Received: from sw08.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30c7c8afc91sm35435166eec.14.2026.06.28.00.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2026 00:02:54 -0700 (PDT) From: Jesse Huang To: libc-alpha@sourceware.org Cc: andrew@sifive.com, darius@bluespec.com, debug@rivosinc.com, jeffreyalaw@gmail.com, kito.cheng@sifive.com, palmer@dabbelt.com, schwab@suse.de, Jesse Huang Subject: [PATCH v5 05/16] riscv: Introduce feature variables for RISC-V GNU properties Date: Sun, 28 Jun 2026 00:02:30 -0700 Message-Id: <20260628070241.88310-6-jesse.huang@sifive.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20260628070241.88310-1-jesse.huang@sifive.com> References: <20260628070241.88310-1-jesse.huang@sifive.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org The l_riscv_feature_1_and member is added to struct link_map. It stores the feature_1_and property information for each object. The new global _dl_riscv_feature_1 stores the features that are finally enabled for this process. Reviewed-by: Deepak Gupta --- sysdeps/riscv/dl-procruntime.c | 60 ++++++++++++++++++++++++++++++++++ sysdeps/riscv/link_map.h | 22 +++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 sysdeps/riscv/dl-procruntime.c create mode 100644 sysdeps/riscv/link_map.h diff --git a/sysdeps/riscv/dl-procruntime.c b/sysdeps/riscv/dl-procruntime.c new file mode 100644 index 0000000000..06a582920e --- /dev/null +++ b/sysdeps/riscv/dl-procruntime.c @@ -0,0 +1,60 @@ +/* Data for processor runtime information. RISC-V version. + Copyright (C) 2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This information must be kept in sync with the _DL_HWCAP_COUNT, + HWCAP_PLATFORMS_START and HWCAP_PLATFORMS_COUNT definitions in + dl-hwcap.h. + + If anything should be added here check whether the size of each string + is still ok with the given array size. + + All the #ifdefs in the definitions are quite irritating but + necessary if we want to avoid duplicating the information. There + are three different modes: + + - PROCINFO_DECL is defined. This means we are only interested in + declarations. + + - PROCINFO_DECL is not defined: + + + if SHARED is defined the file is included in an array + initializer. The .element = { ... } syntax is needed. + + + if SHARED is not defined a normal array initialization is + needed. + */ + +#ifndef PROCINFO_CLASS +# define PROCINFO_CLASS +#endif + +#if !IS_IN (ldconfig) +# if !defined PROCINFO_DECL && defined SHARED + ._dl_riscv_feature_1 +# else +PROCINFO_CLASS unsigned int _dl_riscv_feature_1 +# endif +# ifndef PROCINFO_DECL += 0 +# endif +# if !defined SHARED || defined PROCINFO_DECL +; +# else +, +# endif +#endif diff --git a/sysdeps/riscv/link_map.h b/sysdeps/riscv/link_map.h new file mode 100644 index 0000000000..4a6428bb24 --- /dev/null +++ b/sysdeps/riscv/link_map.h @@ -0,0 +1,22 @@ +/* Additional fields in struct link_map. Linux/RISC-V version. + Copyright (C) 2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* GNU_PROPERTY_RISCV_FEATURE_1_AND of this object. */ +unsigned int l_riscv_feature_1_and; + +#include