Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb+git@google.com>
To: llvm@lists.linux.dev
Cc: Ard Biesheuvel <ardb@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nsc@kernel.org>,
	 Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	 Justin Stitt <justinstitt@google.com>,
	linux-kbuild@vger.kernel.org
Subject: [PATCH] kallsyms: Omit unnamed local symbols from System.map and kallsyms
Date: Thu, 26 Nov 2026 17:57:40 +0100	[thread overview]
Message-ID: <20261126165739.2453269-2-ardb+git@google.com> (raw)

From: Ard Biesheuvel <ardb@kernel.org>

Since LLVM PR #223686 [1] ("[LLD][ELF] AArch64 Errata patch use
STT_NOTYPE for symbols"), ld.lld --fix-cortex-a53-843419 (enabled on
arm64 by CONFIG_ARM64_ERRATUM_843419, which defaults to y) synthesizes
an unnamed (st_name == 0, "") STT_NOTYPE local symbol for every
executable InputSection that lacks an STT_SECTION symbol in its input
object, such as empty .text sections in data-only or .init.text
translation units, or per-function sections under -ffunction-sections.

elf_symbol_type() classifies these unnamed STT_NOTYPE local symbols in
executable sections as 't' (matching GNU nm and llvm-nm), and
sysmap_omits() does not filter empty names. As a result, nameless 't'
entries are emitted into System.map and compressed into the kernel's
kallsyms tables.

Beyond bloating the kallsyms tables with useless nameless entries, this
causes CONFIG_KALLSYMS_SELFTEST to fail at boot ("Test for Nth symbol
failed: ()"), because kallsyms_lookup_name("") explicitly rejects empty
strings and returns 0.

Omit symbols with an empty name in sysmap_omits() so they are excluded
from both System.map and kallsyms.

[1] https://github.com/llvm/llvm-project/commit/5da7779afdf3

Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicolas Schier <nsc@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Justin Stitt <justinstitt@google.com>
Cc: linux-kbuild@vger.kernel.org
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 scripts/kallsyms-sysmap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/kallsyms-sysmap.c b/scripts/kallsyms-sysmap.c
index a482968eba51..1cb3b1775157 100644
--- a/scripts/kallsyms-sysmap.c
+++ b/scripts/kallsyms-sysmap.c
@@ -96,6 +96,10 @@ static bool sysmap_omits(const char *name, char type)
 {
 	size_t i;
 
+	/* Unnamed symbols (st_name == 0). */
+	if (!*name)
+		return true;
+
 	/* Absolute, undefined and debugging symbols. */
 	if (type == 'a' || type == 'N' || type == 'U' || type == 'w')
 		return true;
-- 
2.56.1.839.g22a8290db9-goog


                 reply	other threads:[~2026-11-26 16:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261126165739.2453269-2-ardb+git@google.com \
    --to=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=justinstitt@google.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nsc@kernel.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