* [PATCH] scripts/sorttable: Mark long_size as __maybe_unused
@ 2026-09-01 1:46 Nathan Chancellor
2026-09-04 19:34 ` Nicolas Schier
2026-09-09 6:11 ` Nicolas Schier
0 siblings, 2 replies; 4+ messages in thread
From: Nathan Chancellor @ 2026-09-01 1:46 UTC (permalink / raw)
To: Steven Rostedt, Nicolas Schier
Cc: Nick Desaulniers, Bill Wendling, Justin Stitt, linux-kernel,
linux-kbuild, llvm, stable, Nathan Chancellor
When building in a kernel tree prior to commit b055f4c431e3 ("sorttable:
Move ELF parsing into scripts/elf-parse.[ch]") with clang-23 or newer,
which implements a new warning under -Wunused-but-set-variable for
static global variable, there is a warning from sorttable because
long_size is unused when MCOUNT_SORT_ENABLED is not set:
scripts/sorttable.c:452:12: error: variable 'long_size' set but not used [-Werror,-Wunused-but-set-global]
452 | static int long_size;
| ^
Mark long_size as __maybe_unused to avoid inserting more ugly #ifdef
directives while insuring the warning does not reappear, as the
aforementioned change does not alter the uses of long_size, so it
appears to be coincidence that the warning disappears after this
refactoring.
Cc: stable@vger.kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
This is breaking our builds on stable:
https://github.com/ClangBuiltLinux/continuous-integration2/actions/runs/33143924291
There was a previous patch sent for this issue
https://lore.kernel.org/20260603191708.27241-1-beakthoven@gmail.com/
but it was marked as stable only. I think this should be taken via
mainline and backported the normal way, as it appears to be coincidence
that the warning is not present in mainline. It does not look like
scripts/sorttable.c has a formal owner according to MAINTAINERS so this
could either go through one of Steve's trees or the kbuild tree.
---
scripts/sorttable.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/sorttable.c b/scripts/sorttable.c
index d8dc2a1b7c31..d7b50581c732 100644
--- a/scripts/sorttable.c
+++ b/scripts/sorttable.c
@@ -116,7 +116,7 @@ static inline void *get_index(void *start, int entsize, int index)
}
static int extable_ent_size;
-static int long_size;
+static int long_size __maybe_unused;
#define ERRSTR_MAXSZ 256
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260831-sorttable-long_size-unused-but-set-global-262c0873a1a9
Best regards,
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] scripts/sorttable: Mark long_size as __maybe_unused
2026-09-01 1:46 [PATCH] scripts/sorttable: Mark long_size as __maybe_unused Nathan Chancellor
@ 2026-09-04 19:34 ` Nicolas Schier
2026-09-08 23:37 ` Nathan Chancellor
2026-09-09 6:11 ` Nicolas Schier
1 sibling, 1 reply; 4+ messages in thread
From: Nicolas Schier @ 2026-09-04 19:34 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Steven Rostedt, Nick Desaulniers, Bill Wendling, Justin Stitt,
linux-kernel, linux-kbuild, llvm, stable
On Mon, Aug 31, 2026 at 06:46:31PM -0700, Nathan Chancellor wrote:
> When building in a kernel tree prior to commit b055f4c431e3 ("sorttable:
> Move ELF parsing into scripts/elf-parse.[ch]") with clang-23 or newer,
> which implements a new warning under -Wunused-but-set-variable for
> static global variable, there is a warning from sorttable because
> long_size is unused when MCOUNT_SORT_ENABLED is not set:
>
> scripts/sorttable.c:452:12: error: variable 'long_size' set but not used [-Werror,-Wunused-but-set-global]
> 452 | static int long_size;
> | ^
>
> Mark long_size as __maybe_unused to avoid inserting more ugly #ifdef
> directives while insuring the warning does not reappear, as the
> aforementioned change does not alter the uses of long_size, so it
> appears to be coincidence that the warning disappears after this
> refactoring.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> This is breaking our builds on stable:
>
> https://github.com/ClangBuiltLinux/continuous-integration2/actions/runs/33143924291
>
> There was a previous patch sent for this issue
>
> https://lore.kernel.org/20260603191708.27241-1-beakthoven@gmail.com/
>
> but it was marked as stable only. I think this should be taken via
> mainline and backported the normal way, as it appears to be coincidence
> that the warning is not present in mainline. It does not look like
> scripts/sorttable.c has a formal owner according to MAINTAINERS so this
> could either go through one of Steve's trees or the kbuild tree.
> ---
> scripts/sorttable.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Thanks!
Tested-by: Nicolas Schier <n.schier@fritz.com>
--
Nicolas
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] scripts/sorttable: Mark long_size as __maybe_unused
2026-09-04 19:34 ` Nicolas Schier
@ 2026-09-08 23:37 ` Nathan Chancellor
0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2026-09-08 23:37 UTC (permalink / raw)
To: Nicolas Schier
Cc: Steven Rostedt, Nick Desaulniers, Bill Wendling, Justin Stitt,
linux-kernel, linux-kbuild, llvm, stable
On Fri, Sep 04, 2026 at 09:34:10PM +0200, Nicolas Schier wrote:
> On Mon, Aug 31, 2026 at 06:46:31PM -0700, Nathan Chancellor wrote:
> > When building in a kernel tree prior to commit b055f4c431e3 ("sorttable:
> > Move ELF parsing into scripts/elf-parse.[ch]") with clang-23 or newer,
> > which implements a new warning under -Wunused-but-set-variable for
> > static global variable, there is a warning from sorttable because
> > long_size is unused when MCOUNT_SORT_ENABLED is not set:
> >
> > scripts/sorttable.c:452:12: error: variable 'long_size' set but not used [-Werror,-Wunused-but-set-global]
> > 452 | static int long_size;
> > | ^
> >
> > Mark long_size as __maybe_unused to avoid inserting more ugly #ifdef
> > directives while insuring the warning does not reappear, as the
> > aforementioned change does not alter the uses of long_size, so it
> > appears to be coincidence that the warning disappears after this
> > refactoring.
> >
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > This is breaking our builds on stable:
> >
> > https://github.com/ClangBuiltLinux/continuous-integration2/actions/runs/33143924291
> >
> > There was a previous patch sent for this issue
> >
> > https://lore.kernel.org/20260603191708.27241-1-beakthoven@gmail.com/
> >
> > but it was marked as stable only. I think this should be taken via
> > mainline and backported the normal way, as it appears to be coincidence
> > that the warning is not present in mainline. It does not look like
> > scripts/sorttable.c has a formal owner according to MAINTAINERS so this
> > could either go through one of Steve's trees or the kbuild tree.
> > ---
> > scripts/sorttable.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
>
> Thanks!
>
> Tested-by: Nicolas Schier <n.schier@fritz.com>
Thanks. Given how trivial this is and since it needs to go to stable,
could you take this via kbuild-fixes?
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scripts/sorttable: Mark long_size as __maybe_unused
2026-09-01 1:46 [PATCH] scripts/sorttable: Mark long_size as __maybe_unused Nathan Chancellor
2026-09-04 19:34 ` Nicolas Schier
@ 2026-09-09 6:11 ` Nicolas Schier
1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Schier @ 2026-09-09 6:11 UTC (permalink / raw)
To: Steven Rostedt, Nathan Chancellor
Cc: Nick Desaulniers, Bill Wendling, Justin Stitt, linux-kernel,
linux-kbuild, llvm, stable
On Mon, 31 Aug 2026 18:46:31 -0700, Nathan Chancellor wrote:
> scripts/sorttable: Mark long_size as __maybe_unused
Applied to kbuild/linux.git (kbuild-fixes-unstable), thanks!
[1/1] scripts/sorttable: Mark long_size as __maybe_unused
https://git.kernel.org/kbuild/c/d9e2ba9f
Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped,
reverted or modified (e.g. trailers).
Patches applied to the kbuild-fixes-unstable branch are accepted pending
wider testing in linux-next and any post-commit review; they will
generally be moved to the kbuild-fixes branch within about a week if
no issues are found.
Best regards,
--
Nicolas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-09 6:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-01 1:46 [PATCH] scripts/sorttable: Mark long_size as __maybe_unused Nathan Chancellor
2026-09-04 19:34 ` Nicolas Schier
2026-09-08 23:37 ` Nathan Chancellor
2026-09-09 6:11 ` Nicolas Schier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®