From nobody Thu Apr 9 23:23:13 2026 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (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 ACCE13E120F for ; Thu, 5 Mar 2026 16:55:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729729; cv=none; b=rMegAO8QCoLRO+eZRb9cGi5184K77l66IM0Pr+V+C0RZiVVxq2RVCb3c/iOXejBM/40y7+wGnA6icQgGSgBQsij/OJDJm1YcV5DRa+RbSzELd9OePmqXrjKWeV6+oUHQwupd1T38ICNvHZlu8ssWfVFQQ2liIUI/tw3IuH8XrDI= 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.73 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-f73.google.com with SMTP id 5b1f17b1804b1-48071615686so65061935e9.1 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=tMTD3JYlCNHRYHLso4j1HSqsi13QkJI/aJnCP8/KqywNh1eKQIYKmB0PNqcIbnvvro srORPlM0CI3hqwoYVSArQB+3AwcwtdK00Tb9gkrRTFADq5Twqg0wPHQ6Noi+RDXG1pmP HxemZ1dNsqDDRoPnnd2MTqA/2BvG9w9qV4QocoYyZtgldO38L6sYOdcDcRslQthxbnSY dh7LaAsLIxBYLggE2EwCE3UTlz8h8kBjo5sMupttfBn2T3kYLXIVHUZ6TIbSUmu1hg+P rQ0U8x+gTczzr5tvsRQz9ckRIQy0neKnY1PzgbXEtmtEtD8UEC1Ear3x6eqX0GftfKcn hIaQ== X-Forwarded-Encrypted: i=1; AJvYcCV/7USzDNZxqCkfx5CYP3XFr/K1yU7BW3vuIPMNotAPfk4xZF4EzOkV/+JcPrtVKJweWTEB0LjKPKB6hSk=@vger.kernel.org X-Gm-Message-State: AOJu0YwHD1j4ytNbjwJEISIvIJNTis0f0sTKTNBMnSydjXSWrXElLIoR aIUsfNUE6kfCL7CuZ6/taJud19+mTo6xsJdv2sqyQOQzlJWqxDuWDu/HiQQSDkpYvE8pJS/gBoT vKe4Lrw0nLMjKikERwg== 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-kernel@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" Content-Transfer-Encoding: quoted-printable 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-interna= l.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 =20 -#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) =20 -#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" \ + ) =20 #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; =20 - 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); =20 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); =20 - 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); } } =20 --=20 2.53.0.473.g4a7958ca14-goog