From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 636562550AD for ; Wed, 29 Oct 2025 12:47:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761742034; cv=none; b=hNw5Y0eBfocjebEa1JRcrzE744AaGUsweta3I7qmNJ0o46gMg0betd5lciZoQfnPa2nzRN528MwKa8eTtG+Ugzo76PLcSkbugYLF6HbLXxJjNpjcIWE5exRTymfz+oKG44YksyJmKJJ+yJE1BwfJ6pSflpl2oIcwWPHbPratmZw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761742034; c=relaxed/simple; bh=RZ1c8In1gMlq9FbCVcEzVNRcgJEWOIyiWryo2vurgBU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=PtZtAoa7tRR6wB0f7zhWHbQm8B+XVWuw9S6pi+nF2A4D0lC34kgk7MfsEn5klRq0Ishyo31JEgxXF/TwqOrUAnjjveBZJhwyKTj0sFPEl6al2oM75Xp4TquzwtHf2/4MJyrMzc87dLiTiJIB3M7DaSrbbYUYEEAF1wrQRIaFD00= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=CQbPVJly; arc=none smtp.client-ip=209.85.221.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CQbPVJly" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-429b2172196so203737f8f.0 for ; Wed, 29 Oct 2025 05:47:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1761742031; x=1762346831; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=xtXJvTcq7PSogsyLbiFNIiSa3aMDytmkSsBCAXBdzyM=; b=CQbPVJlyM9PbzgrJMatYwu5IELIalkeSMjDpVDvFBHy/SlkiMqlLRRqx24HEOi1ti8 fmxoITHvV735Q2lXLR/LQ2HiLmUNshJVTf7+JQrza6VQ9hGl6bmqkwXY5RT42rbsmy10 DziG2VgNlRJC0zv3EAmrnt4np58Q12nP4PuXrsOMaz2ABE93miqAI+4xaeif7aGBTv03 VH3cm1l/099XAm6jin/REUu1PhKOJmbnnskbvD9Rk5e1AfsNL2FxdzB6KNQIquzkX8rH BYimfcWHGR2KMK+Z+iNSa9FeLNnFXLrLFNHdUPAn793MVSbYVk64P6jQEd3Ebt/QAxX+ 5z7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761742031; x=1762346831; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xtXJvTcq7PSogsyLbiFNIiSa3aMDytmkSsBCAXBdzyM=; b=FwQVt/Qii+iBY7ifsuP2oLfZP+5j37TAoUrHLXU3sqt3xIaHM86PTpL+rJSmhN8xph AnLDbizOdm6ycPeZSmaS0OH2OvmEVVVy/IrOOVENzSgxwt15KdmjRljSB/2Pjzh9w3R1 uPYA62+XEsJJswEbtguBcfoDqyMKu9af1bBF5CySHPl5Sx7aCNUUMDJIlMDgYMySVXN6 f9PhxYLnedkU27gNOPwOuXmOG8PtfcqKj31lg8PgDZFmDRPDlCBRy9W5lHyGsx9AYk0f 2P0ECtwmp22bIL+yEI8Ny8m/4TuH+FgVwaoiG7rH/gBhxAy/q4T2xM3Mg/TVIvgEZp6Y BciA== X-Forwarded-Encrypted: i=1; AJvYcCVnvJgHulRl9Nf96kogT7oVnOJeFlkK4S8BI+/YIrEmz/XlJ7K2pnfiye3VF/c491GFtts3xD6Ca0E=@vger.kernel.org X-Gm-Message-State: AOJu0Yx3GRFeHMcEF6E5Yt4S1LA3j4Cxunz48tYe5LUjwzfe0D0CfAvF JCLSJhr1KNGGa1cT1PQzGlB7hjI0/4tcnYSjRLkELxkci6n18yX4/c/S4xNrtN4lqNSCtMdjw/U vGpc784GOjmohEb+XYQ== X-Google-Smtp-Source: AGHT+IEv3fbqpyMJagFo6xGiSAp4ZJfz/NOzhfXNsSPeWdIojUeQVslwvThMYOlDlFUMgf9NEYTALza+RhxNeRs= X-Received: from wrrx8.prod.google.com ([2002:a5d:4448:0:b0:425:6e00:e053]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:25ca:b0:428:4004:8226 with SMTP id ffacd0b85a97d-429aefb2a9dmr1848797f8f.34.1761742030807; Wed, 29 Oct 2025 05:47:10 -0700 (PDT) Date: Wed, 29 Oct 2025 12:47:09 +0000 In-Reply-To: <20251028-pwm_fixes-v1-1-25a532d31998@samsung.com> Precedence: bulk X-Mailing-List: linux-pwm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251028-pwm_fixes-v1-0-25a532d31998@samsung.com> <20251028-pwm_fixes-v1-1-25a532d31998@samsung.com> Message-ID: Subject: Re: [PATCH 1/4] rust: macros: Add support for 'imports_ns' to module! From: Alice Ryhl To: Michal Wilczynski Cc: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Drew Fustini , Guo Ren , Fu Wei , "Uwe =?utf-8?Q?Kleine-K=C3=B6nig?=" , Stephen Rothwell , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org, linux-riscv@lists.infradead.org Content-Type: text/plain; charset="utf-8" On Tue, Oct 28, 2025 at 01:22:32PM +0100, Michal Wilczynski wrote: > Kernel modules that use C symbols exported via `EXPORT_SYMBOL_NS` must > declare this dependency for `modpost` verification. C modules achieve > this by using the `MODULE_IMPORT_NS(NAMESPACE)` macro, which embeds an > `import_ns=` tag into the `.modinfo` section. > > The Rust `module!` macro lacked the ability to generate these tags, > resulting in build warnings for Rust drivers (like the PWM driver) that > call namespaced C functions. > > Modify the `module!` macro's internal parser (`ModuleInfo`) to accept a > new optional field `imports_ns`, which takes an array of namespace > strings. Update the code generator (`ModInfoBuilder::emit`) loop to > iterate over these strings and emit the corresponding > `import_ns=` tags into the `.modinfo` section using the > existing `#[link_section]` mechanism. > > This provides the necessary infrastructure for Rust modules to correctly > declare their C namespace dependencies. > > Signed-off-by: Michal Wilczynski Reviewed-by: Alice Ryhl From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A46B6CCF9E9 for ; Wed, 29 Oct 2025 12:47:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=T4jkM5oQB702JDFyQhCNEOU0D1wguOFO3CTqne8kb7w=; b=Ymnmjda3WxmgWsmvLxocyXIZdU Y7HResa9j3nieyUhYHG9d8tdnPBjgtoAbBUT6r9V5q0MOMObyPhKTQ1kvF0MdlXDWdzRgbUupK2li FbGgHICW5W/lH3mfNztXS82o6GfcMMm0xtrpHRH14Y6sfNiXsxPYUe75TaxseSDiEFPiORh+Yp5f5 4xnFjY7u6UGVhQA/1SwVXCoxi9F8Cl+JmcK1Br7+tz2JDxqVVPb57Upcmeh/NJNh8iPu1400GT5th RVIEhdSteJIpc5aqWrIQFxAQhGWlis6x/nHomAshj2vgZjcrHZhXqQnnOGjPdwu4BAqiea19wLqtC siEjO0IQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vE5a8-00000001DMU-0YjQ; Wed, 29 Oct 2025 12:47:16 +0000 Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vE5a5-00000001DLf-2cPC for linux-riscv@lists.infradead.org; Wed, 29 Oct 2025 12:47:14 +0000 Received: by mail-wm1-x349.google.com with SMTP id 5b1f17b1804b1-475de0566adso39319465e9.0 for ; Wed, 29 Oct 2025 05:47:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1761742031; x=1762346831; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=xtXJvTcq7PSogsyLbiFNIiSa3aMDytmkSsBCAXBdzyM=; b=NeW5w5LnSM3tZ7SpFnGpDMxdGr+yL0d7ReyyLB+KTuu7FLWNLR3u8nHdJ4BlzoziGB UYEhAT4X5iX5jBTwwRnVzDjkZ7DcJSA/uD+OdTuUoUuBEn9ovFvKD4RELNuXWjaQXW8r hmiJQfCX4GqU+bGPfQb82ObEPfdH400O+ymMqWtf/Qj4xpVKgjzHc7hhEzKuefFNMjiD Pv8B8fk/rNxD3pU1cvwMdlkApkFWqRNhenGz6uQBhQsPYDGAXc5C06YF26dBcCtYlflA axVZv6c+Mh1kFfvHjB2t9h1LmnQeGW89JE8e13JB+AmyBBUPGPKgfATsl1rJlegX1KO8 8otw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761742031; x=1762346831; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xtXJvTcq7PSogsyLbiFNIiSa3aMDytmkSsBCAXBdzyM=; b=dyBUkSdFe/8lqytY2SlzslMJnuum7a0hhKhvSKoBUzqHbhTJg4kJ+CQx2k3hJHCtnt CNeS2XacJ7GHlXfWUW3xtKvYkXSPTHHCuo/n9ElPcbk0wsVX59ZGsbnSYWs7hNYckFBT z382vpUurGYY9bJe2oI1ZBgXaAWwLTCHG6m/zxTCModUaWPB/pH7MTDWMs7IBteY3AdU W9f6h5AaC2YOGnceXktRZEmlMQNX2vkeaIkXg7Us+YAiyx/eLLbJ/9vBFlK3MrAINOl/ I6R4qcRZH9nhRiy+o5WASRgoS3Vrd0ogmE43sCJDEOS7kLk78hCaEaVNmgenvx6WvcJN LruQ== X-Forwarded-Encrypted: i=1; AJvYcCVPPFEIkYmTP2RSnxW3l+6zAoPF6guiOM6yQz0SBaJA6EYNNjJ5wsLO1wrjiD+L5AobdiuxXDSVdgZceQ==@lists.infradead.org X-Gm-Message-State: AOJu0YzjT9oIZXilgxuOWqyczf62uNGNrWKoiGVNTdBWhalObcsgROfV NukmVqINbH3Gm0cQDbMsND0YxgRZH6nMNMdunriSNHgO/qONCEH54V0RZjou4+ZLFDMRWj8TokI sypzKWuZGjZ/pYC8gvw== X-Google-Smtp-Source: AGHT+IEv3fbqpyMJagFo6xGiSAp4ZJfz/NOzhfXNsSPeWdIojUeQVslwvThMYOlDlFUMgf9NEYTALza+RhxNeRs= X-Received: from wrrx8.prod.google.com ([2002:a5d:4448:0:b0:425:6e00:e053]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:25ca:b0:428:4004:8226 with SMTP id ffacd0b85a97d-429aefb2a9dmr1848797f8f.34.1761742030807; Wed, 29 Oct 2025 05:47:10 -0700 (PDT) Date: Wed, 29 Oct 2025 12:47:09 +0000 In-Reply-To: <20251028-pwm_fixes-v1-1-25a532d31998@samsung.com> Mime-Version: 1.0 References: <20251028-pwm_fixes-v1-0-25a532d31998@samsung.com> <20251028-pwm_fixes-v1-1-25a532d31998@samsung.com> Message-ID: Subject: Re: [PATCH 1/4] rust: macros: Add support for 'imports_ns' to module! From: Alice Ryhl To: Michal Wilczynski Cc: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Drew Fustini , Guo Ren , Fu Wei , "Uwe =?utf-8?Q?Kleine-K=C3=B6nig?=" , Stephen Rothwell , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251029_054713_673053_B9502C55 X-CRM114-Status: GOOD ( 10.93 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Tue, Oct 28, 2025 at 01:22:32PM +0100, Michal Wilczynski wrote: > Kernel modules that use C symbols exported via `EXPORT_SYMBOL_NS` must > declare this dependency for `modpost` verification. C modules achieve > this by using the `MODULE_IMPORT_NS(NAMESPACE)` macro, which embeds an > `import_ns=` tag into the `.modinfo` section. > > The Rust `module!` macro lacked the ability to generate these tags, > resulting in build warnings for Rust drivers (like the PWM driver) that > call namespaced C functions. > > Modify the `module!` macro's internal parser (`ModuleInfo`) to accept a > new optional field `imports_ns`, which takes an array of namespace > strings. Update the code generator (`ModInfoBuilder::emit`) loop to > iterate over these strings and emit the corresponding > `import_ns=` tags into the `.modinfo` section using the > existing `#[link_section]` mechanism. > > This provides the necessary infrastructure for Rust modules to correctly > declare their C namespace dependencies. > > Signed-off-by: Michal Wilczynski Reviewed-by: Alice Ryhl _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv