public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Siddharth Nayyar <sidnayyar@google.com>
To: Luis Chamberlain <mcgrof@kernel.org>,
	Petr Pavlu <petr.pavlu@suse.com>,
	 Daniel Gomez <da.gomez@kernel.org>,
	Sami Tolvanen <samitolvanen@google.com>,
	 Aaron Tomlin <atomlin@atomlin.com>,
	Arnd Bergmann <arnd@arndb.de>,
	 Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nsc@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
	 Shuah Khan <skhan@linuxfoundation.org>
Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org,
	 linux-doc@vger.kernel.org,
	Siddharth Nayyar <sidnayyar@google.com>,
	maennich@google.com,  gprocida@google.com
Subject: [PATCH v4 2/8] linker: add kflagstab section to vmlinux and modules
Date: Thu, 05 Mar 2026 16:54:22 +0000	[thread overview]
Message-ID: <20260305-kflagstab-v4-2-4fe6eea27e30@google.com> (raw)
In-Reply-To: <20260305-kflagstab-v4-0-4fe6eea27e30@google.com>

This section will contain read-only data for values of kernel symbol
flags in the form of an 8-bit bitsets for each kernel symbol. Each bit
in the bitset represents a flag value defined by ksym_flags enumeration.

The kflagstab section introduces a 1-byte overhead for each symbol
exported in the ksymtab. Given that typical kernel builds contain
roughly a few thousand exported symbols, the resulting memory increase
is negligible.

Signed-off-by: Siddharth Nayyar <sidnayyar@google.com>
---
 include/asm-generic/vmlinux.lds.h | 7 +++++++
 scripts/module.lds.S              | 1 +
 2 files changed, 8 insertions(+)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index eeb070f330bd..8f825dcbfae4 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -536,6 +536,13 @@
 		__stop___kcrctab_gpl = .;				\
 	}								\
 									\
+	/* Kernel symbol flags table */					\
+	__kflagstab       : AT(ADDR(__kflagstab) - LOAD_OFFSET) {	\
+		__start___kflagstab = .;				\
+		KEEP(*(SORT(___kflagstab+*)))				\
+		__stop___kflagstab = .;					\
+	}								\
+									\
 	/* Kernel symbol table: strings */				\
         __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) {	\
 		*(__ksymtab_strings)					\
diff --git a/scripts/module.lds.S b/scripts/module.lds.S
index 054ef99e8288..d7a8ba278dfc 100644
--- a/scripts/module.lds.S
+++ b/scripts/module.lds.S
@@ -23,6 +23,7 @@ SECTIONS {
 	__ksymtab_gpl		0 : ALIGN(8) { *(SORT(___ksymtab_gpl+*)) }
 	__kcrctab		0 : ALIGN(4) { *(SORT(___kcrctab+*)) }
 	__kcrctab_gpl		0 : ALIGN(4) { *(SORT(___kcrctab_gpl+*)) }
+	__kflagstab		0 : ALIGN(1) { *(SORT(___kflagstab+*)) }
 
 	.ctors			0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) }
 	.init_array		0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }

-- 
2.53.0.473.g4a7958ca14-goog


  parent reply	other threads:[~2026-03-05 16:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 16:54 [PATCH v4 0/8] scalable symbol flags with __kflagstab Siddharth Nayyar
2026-03-05 16:54 ` [PATCH v4 1/8] define ksym_flags enumeration to represent kernel symbol flags Siddharth Nayyar
2026-03-05 16:54 ` Siddharth Nayyar [this message]
2026-03-05 16:54 ` [PATCH v4 3/8] modpost: populate kflagstab Siddharth Nayyar
2026-03-05 16:54 ` [PATCH v4 4/8] module loader: use kflagstab instead of *_gpl sections Siddharth Nayyar
2026-03-05 16:54 ` [PATCH v4 5/8] modpost: remove fragmentation of ksymtab and kcrctab sections Siddharth Nayyar
2026-03-05 16:54 ` [PATCH v4 6/8] module loader: deprecate usage of *_gpl sections Siddharth Nayyar
2026-03-05 16:54 ` [PATCH v4 7/8] linker: remove *_gpl sections from vmlinux and modules Siddharth Nayyar
2026-03-05 16:54 ` [PATCH v4 8/8] documentation: remove references to *_gpl sections Siddharth Nayyar
  -- strict thread matches above, loose matches on Subject: below --
2026-03-05 16:55 [PATCH v4 0/8] scalable symbol flags with __kflagstab Siddharth Nayyar
2026-03-05 16:55 ` [PATCH v4 2/8] linker: add kflagstab section to vmlinux and modules Siddharth Nayyar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260305-kflagstab-v4-2-4fe6eea27e30@google.com \
    --to=sidnayyar@google.com \
    --cc=arnd@arndb.de \
    --cc=atomlin@atomlin.com \
    --cc=corbet@lwn.net \
    --cc=da.gomez@kernel.org \
    --cc=gprocida@google.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=maennich@google.com \
    --cc=mcgrof@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=petr.pavlu@suse.com \
    --cc=samitolvanen@google.com \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox