From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.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 BC6E13E121B for ; Thu, 5 Mar 2026 16:55:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729729; cv=none; b=jTDO0L3b8UWHkXN0SgmT7kXuv05tZU7T5xXCjHoXJ6L3PsX6Y5UUKRHBrM6QtCSAJ7S/D/yCYivJC+jWfivcf6JMEwJq7AnJaac81LDVlQuYob4+YGPtyPsXs0K6bMa0vbY9Qw3f8AEP+0oEQV2fjVEvkXEvVXzOewp/NqRRaUo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729729; c=relaxed/simple; bh=8wThas+yx6VNeitZlqkk+kXKQX1pW5KK15IT5W2pzHQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=rGeLgPsR7Q88RDTLrEbC9V7pmz1MlO4dAtikZiSmDD2hTEpHgJs6kvTJ9WDK1folBt2HrbAKDCGsRimSEJDakgBZOJ2rG3YwLBBJOk41aqst82WjIuAreMo6sU2bcJJ79iFjbmAtQUI++xmCG8T8zmoCdknM4kSv/Jp5pqKzY6M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sidnayyar.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=3o52q5sr; arc=none smtp.client-ip=209.85.128.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--sidnayyar.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3o52q5sr" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-483a2db68caso67751935e9.0 for ; Thu, 05 Mar 2026 08:55:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729726; x=1773334526; 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=SFGOKKmdozaG9322AXfBKix4rJQP+3sKTD6zVfi8C3I=; b=3o52q5sr4EK4amOyH0A7gv8Hfes5Llms2e/Ocp1fGyxk1Kl1KgHGLeoKZpfkjC4qjM 3orEpcZAtdlA1+vWjcStEPCFEUOA3cBUUxOH8bsjSd2yG/TsK/gV44cHH+RAU4UMOFcw PvwjqQiLdaVnDcKAa20HmAWbgldPb3f9YMX6OjVOvFOV6rUoJC41sJeBqIp5nHfgW4nd HHMwiVlexdxv59MQcH6PGAOdHF46Wo2V2r1fWNyzdt5zjCD7qVc+Hb5FKf3p7+3aWf2U uDcHCcWnGL9XkJ6rBsEqVntcK0e3sDI/O8Ryr7W5FTc/WAz0kxSIxwVXTMyjStbkXviy Ue1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729726; x=1773334526; 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=SFGOKKmdozaG9322AXfBKix4rJQP+3sKTD6zVfi8C3I=; b=HPn0V7iL7MqrZR/N4E9JlOLLRDrLozrfgpoxaBrO9Jb84Rfq0njzRTfrZhgaqc+8+d gMAw/q1AplCpxfPsV3sNWxJEtZh2TiFrfqIHjP1G4hWwSA+JHVojAOrKiWWtFjG+Tw2z 6IMI1BKcNRNQK2U24i2IdIaP4GxqTaq0tTz3WT8csoibuQQIrkuIjcxb3KrprPM3bkVX iMrW2LbFjUCyzbezrVe/ND5cfhWUTC9GUtHy5aqB1CwIE7XkXRRLQS/atGQwrQxA38Qx s0Bf97gZrf7SJlxZIQXhvYxEL6hAyEje3UZcKaJ+8cbPGCgnFU3qIm70NUjfBHkzDepk P/kg== X-Gm-Message-State: AOJu0Yxy2I/gNH7272IuN4OIWwJQgK17u/wQWIKk1PwKZsYBV62omlpz 5nALqfl+EWRx2MLpa9VF7PCbj63pYA0LQD4RelxHzzbmF3JbqCmdRXdXOmdypDqIVhiQUSqlZgC Rct5A0i2OSxtuwuLaaQ== X-Received: from wmbbd15.prod.google.com ([2002:a05:600c:1f0f:b0:483:acd9:bd08]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:c87:b0:483:8e43:6def with SMTP id 5b1f17b1804b1-485235f9a7amr2224385e9.28.1772729726133; Thu, 05 Mar 2026 08:55:26 -0800 (PST) Date: Thu, 05 Mar 2026 16:55:21 +0000 In-Reply-To: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> Precedence: bulk X-Mailing-List: linux-modules@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-5-6a76bf8b83c7@google.com> Subject: [PATCH v4 5/8] modpost: remove fragmentation of ksymtab and kcrctab sections From: Siddharth Nayyar To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Arnd Bergmann , Nathan Chancellor , Nicolas Schier , Jonathan Corbet , Shuah Khan 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 , maennich@google.com, gprocida@google.com Content-Type: text/plain; charset="utf-8" Since the modules loader determines whether an exported symbol is GPL only from data in the kflagstab section, modpost can put all symbols in the regular ksymtab and stop using the *_gpl versions of the ksymtab and kcrctab. Signed-off-by: Siddharth Nayyar --- include/linux/export-internal.h | 21 +++++++++++---------- scripts/mod/modpost.c | 8 ++++---- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/linux/export-internal.h b/include/linux/export-internal.h index 4123c7592404..726054614752 100644 --- a/include/linux/export-internal.h +++ b/include/linux/export-internal.h @@ -37,14 +37,14 @@ * section flag requires it. Use '%progbits' instead of '@progbits' since the * former apparently works on all arches according to the binutils source. */ -#define __KSYMTAB(name, sym, sec, ns) \ +#define __KSYMTAB(name, sym, ns) \ asm(" .section \"__ksymtab_strings\",\"aMS\",%progbits,1" "\n" \ "__kstrtab_" #name ":" "\n" \ " .asciz \"" #name "\"" "\n" \ "__kstrtabns_" #name ":" "\n" \ " .asciz \"" ns "\"" "\n" \ " .previous" "\n" \ - " .section \"___ksymtab" sec "+" #name "\", \"a\"" "\n" \ + " .section \"___ksymtab+" #name "\", \"a\"" "\n" \ __KSYM_ALIGN "\n" \ "__ksymtab_" #name ":" "\n" \ __KSYM_REF(sym) "\n" \ @@ -59,15 +59,16 @@ #define KSYM_FUNC(name) name #endif -#define KSYMTAB_FUNC(name, sec, ns) __KSYMTAB(name, KSYM_FUNC(name), sec, ns) -#define KSYMTAB_DATA(name, sec, ns) __KSYMTAB(name, name, sec, ns) +#define KSYMTAB_FUNC(name, ns) __KSYMTAB(name, KSYM_FUNC(name), ns) +#define KSYMTAB_DATA(name, ns) __KSYMTAB(name, name, ns) -#define SYMBOL_CRC(sym, crc, sec) \ - asm(".section \"___kcrctab" sec "+" #sym "\",\"a\"" "\n" \ - ".balign 4" "\n" \ - "__crc_" #sym ":" "\n" \ - ".long " #crc "\n" \ - ".previous" "\n") +#define SYMBOL_CRC(sym, crc) \ + asm(" .section \"___kcrctab+" #sym "\",\"a\"" "\n" \ + " .balign 4" "\n" \ + "__crc_" #sym ":" "\n" \ + " .long " #crc "\n" \ + " .previous" "\n" \ + ) #define SYMBOL_FLAGS(sym, flags) \ asm(" .section \"___kflagstab+" #sym "\",\"a\"" "\n" \ diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 1d721fe67caf..9d96acce60a8 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1876,9 +1876,9 @@ static void add_exported_symbols(struct buffer *buf, struct module *mod) if (trim_unused_exports && !sym->used) continue; - buf_printf(buf, "KSYMTAB_%s(%s, \"%s\", \"%s\");\n", + buf_printf(buf, "KSYMTAB_%s(%s, \"%s\");\n", sym->is_func ? "FUNC" : "DATA", sym->name, - sym->is_gpl_only ? "_gpl" : "", sym->namespace); + sym->namespace); buf_printf(buf, "SYMBOL_FLAGS(%s, 0x%02x);\n", sym->name, get_symbol_flags(sym)); @@ -1899,8 +1899,8 @@ static void add_exported_symbols(struct buffer *buf, struct module *mod) sym->name, mod->name, mod->is_vmlinux ? "" : ".ko", sym->name); - buf_printf(buf, "SYMBOL_CRC(%s, 0x%08x, \"%s\");\n", - sym->name, sym->crc, sym->is_gpl_only ? "_gpl" : ""); + buf_printf(buf, "SYMBOL_CRC(%s, 0x%08x);\n", + sym->name, sym->crc); } } -- 2.53.0.473.g4a7958ca14-goog