From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 1E83C498928 for ; Mon, 21 Sep 2026 13:50:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789998612; cv=none; b=EH5Uxa3YbYc/UekbSpv69g+5P7xfis10Eq8+AGDAP2bVJF2iIKbe8f1Amg8EnQieEhqlHWRkaJ+SnN9F89Lt/dyWh9eM0mZMyt1VzKsK7oYI19oRNr72S9RGi5/F0Ijzhvvrjg2eMBKYPHQD4XaKexX1juXUpK9jEwz9lItb/1Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789998612; c=relaxed/simple; bh=5UQ+/b9voSw2XbVSVpGgsHCN+16v45r/eO2PjQuRZp8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iBkV3freJz4yg2PyqNsETsI5vqw3QPUUscgEEIv20UOmVG1y3zSR05aexnNvK5779J+1isY2X26R/F9P+UipScUXTnDi0MxHqa9IFYepBh0ibQfGCcZZm7mJYDe4WiJ4Hgc7luGeOF5JiLMMaI3ITCFnBg/OE9mvPI3PTOy/Hzg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=dA95zy47; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="dA95zy47" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-4843e397f74so1480593f8f.1 for ; Mon, 21 Sep 2026 06:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1789998608; x=1790603408; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=J4xPQrVJdFgFl8luzeo5fY/IUnv52YMtHgLJT02PkgQ=; b=dA95zy47+9E+6Wj7pNYsrxpyB60MgweGLYJbZWECxloBtnCxSAfVgRTPb4n832bVN4 ioIHKLkAkdYc7/JT7hGCtIW/h2DDR9L2+ZHYH1NwtM/zrWohbxtmzZMw6cpxK0JyfEtx AqkpxNrZ4pSf2uRNpuMoQAp9vqC6PLpWHJOOI82PimUrE8ewf1JfOpaqogd3nTsoLHUR 8ZVxLQrp1IZp55/gmH4uCmtu+XrmMNXsUWSLSAA3NFPhfhJvcGZvneivOdCykpCzfQUe 2ywIwODlr+jiLKyVnmujMraj7i+JFm9NAOspeLiIoPsIhZ3Aj9oHVhk+dIPIc5eINdGB UhWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789998608; x=1790603408; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=J4xPQrVJdFgFl8luzeo5fY/IUnv52YMtHgLJT02PkgQ=; b=mpsA/0yvgBQoybyhxlzFB00jP8DO5Z1n+FwLn5IQiDzXyNFjsVpoiOIRBx5ITlxf2x 06LFuTJuADAlO/6IXDKU82Q2W4ilkRfsGLU3y3OEJl2JdB/eF1RuKdGEdDgIlMMdUOS3 wQbUWbYPAkRfjUhMO2R0Dlqu48lnnuMzIBASPsQOZ+tte/tquQuIhiFerDohmuatO8za mrgVev2lhb89q3m3Z2nfHp2g9ZL7HN78VBTvy7jiyOnMRalcL3qtG8mZf6QwQ14JO+u1 cI4S6bT5UVe/lT6TBGIB+tQ5M84J8CWNlX0jYLUue3t7Vm+2AElUwEgHlSfKAK47Yuom 80QQ== X-Forwarded-Encrypted: i=1; AKwUvBxJZYHYWZD4wOdHmZeWVSq7JYa33/UF7P2ccCSfY7wANzk25TzNi9FnxbIXfeFB3reFs8mxqKYKkqBzLUqxLA==@vger.kernel.org X-Gm-Message-State: AFuF++lyeRGWMBDsuKFK0GPMHxysjE9aGRJ9jLLwMUM3OH6l6Vkjw8mm 1yIUxm4F7mFO27JooqdfivS2Q7BweBkUoOSzOSu6xn7c7ZKkz0Dvu2aO21/V4YHbg9k= X-Gm-Gg: AYBFou0Nz/2lR5DlOP0btWUwUBt5dQL7DVGwtP2GnybqVNppg2Xvsl2XM9a+HetL8Cp A63Dt1NTdVYa/gp4Pce3uUmI6xYwoHtqEDLkozCmxmV+rCmXGssASBla6eyjycZQ61GSVMFQQgj kUvQD9J2GnzgCuaEBg9ebfoJi+9xTmx+VYCIzBhPfORzPRdsd/4wZKGKuEtJThfIglJIjuOprwV 4YdlN2oZkWk5d6mZT3ZNSvPXb+k5Ct53O7ytv02a7BqWmpfS+SlRUU1H3W10YU2aucdg+tgjwG9 XsY0L/hkIW4kFSMrx9EvANkrDq0pxDNv5Mt1dYWT8c5quh53Z87wfdSJzMgh6/yob/NZfk3xrUv vctODKFetohuza4u5jr73by1W+H1HVgN+m5TmfWChSTduEzv0AfuFtfeoI3bDZ+4Ncpd0/msSNR r9SItvoVjCA+m83tad1uIYFKJ3r2PzApPuOOCzv6DrfaWySU5cMytY9GhlqzpwFlnvWOMM3NBv/ 03VdqbYiQlO5lbaNANM4VQWBD9da1QpJu0= X-Received: by 2002:a05:6000:64a:b0:487:c3e:d6cc with SMTP id ffacd0b85a97d-48713c7f005mr24266022f8f.31.1789998608134; Mon, 21 Sep 2026 06:50:08 -0700 (PDT) Received: from ?IPV6:2a07:de40:8100:0:89a9:fd0e:583d:4a53? ([2001:af0:8000:1409:193:86:92:181]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48724596604sm23426141f8f.30.2026.09.21.06.50.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Sep 2026 06:50:07 -0700 (PDT) Message-ID: <58605613-8a43-40e7-a00a-b0d09f089ec8@suse.com> Date: Mon, 21 Sep 2026 15:50:06 +0200 Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 13/21] modpost: emit module descriptors as assembly To: "Lorenzo Stoakes (ARM)" Cc: Linus Torvalds , Nathan Chancellor , Nicolas Schier , Nick Desaulniers , Bill Wendling , Justin Stitt , Masahiro Yamada , Alexey Gladkov , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Arnd Bergmann , Catalin Marinas , Will Deacon , Mark Rutland , Ard Biesheuvel , Ilias Apalodimas , Josh Poimboeuf , Peter Zijlstra , Miguel Ojeda , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?UTF-8?Q?Onur_=C3=96zkan?= , Jonathan Corbet , Randy Dunlap , Kees Cook , "Gustavo A. R. Silva" , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-doc@vger.kernel.org, Jens Axboe , linux-hardening@vger.kernel.org References: <20260914-build-speedup-v2-0-39817ec5db23@kernel.org> <20260914-build-speedup-v2-13-39817ec5db23@kernel.org> <95baacfb-d8d9-4d2f-bc89-592df6f6f8e3@suse.com> <2b27bb4b-47e3-45ed-a26a-4b9de2b20542@suse.com> Content-Language: en-US From: Petr Pavlu In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 9/21/26 2:48 PM, Lorenzo Stoakes (ARM) wrote: > On Mon, Sep 21, 2026 at 02:36:30PM +0200, Petr Pavlu wrote: >> On 9/21/26 1:57 PM, Lorenzo Stoakes (ARM) wrote: >>> (note there's a v3 see [0]) >>> >>> [0]: https://lore.kernel.org/linux-kbuild/20260917-build-speedup-v3-0-9ecf4163ff36@kernel.org/ >> >> Thanks, I missed it. >> >>> On Mon, Sep 21, 2026 at 01:25:09PM +0200, Petr Pavlu wrote: >>>> On 9/14/26 11:22 AM, Lorenzo Stoakes (ARM) wrote: >>>>> The sections were confirmed to be byte-for-byte identical to the C version >>>>> produced - each of .modinfo, .gnu.linkonce.this_module, __ksymtab*, >>>>> __ksymtab_strings, __kcrctab*, __kflagstab*, __versions, >>>>> __version_ext_crcs, __version_ext_names and their relocations - for all >>>>> 8,135 modules of a clang allmodconfig build with CONFIG_COMPILE_TEST off >>>>> and CONFIG_MODVERSIONS, CONFIG_EXTENDED_MODVERSIONS and >>>>> CONFIG_MODULE_SRCVERSION_ALL on, and for a sample built with gcc. >>>> >>>> Lowering the data to assembly loses debug information for __this_module, >>>> specifically that it has type `struct module`. It might be worth >>> >>> No, it keeps it - every module includes linux/module.h, and the extern >>> declaration of __this_module carries the type, so all of the stuff gdb >>> needs (e.g. ptype, p & field access), DWARF etc. is all there in the same >>> way as with .mod.c. >>> >>> Have confirmed locally. >> >> An extern declaration alone shouldn't cause its name and type to be >> included in debug information. They should appear only when the variable >> is referenced by some code. > > Ack yeah sorry my mistake, I had the LLM check that and should have known > better than to trust it without reviewing what it said (as I have done for > the most part for everything in this series). > >> >> Testing with a simple module that previously referenced __this_module >> only in .mod.c and in no other file, such as lib/test_module.c, shows >> that the .ko no longer contains debug information for this variable. >> >> I've verified this behavior with GCC 16 and Clang 19. > > Ack confirmed locally. > > Can put a fix in module-common.c. > > The LLM came up with a reference as an alternative: > > static struct module *const __this_module_dbg __used __section(".discard.this_module") = &__this_module; > > Would that work? Or should we go with your original suggestion? - > > __weak __section(".discard.this_module") struct module __this_module; With GCC, the LLM's suggestion produces debug information for both __this_module_dbg and __this_module. However, Clang only generates debug information for __this_module_dbg, so it is not quite what is needed. -- Thanks, Petr