public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] serial: icom: Fix namespace collision and startup() section placement with -ffunction-sections
Date: Wed, 19 Nov 2025 09:43:15 +0100	[thread overview]
Message-ID: <20251119084315.GI4067720@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <23f084ab-7b1a-485e-be1e-e639906fd5b3@kernel.org>

On Wed, Nov 19, 2025 at 07:58:05AM +0100, Jiri Slaby wrote:
> On 19. 11. 25, 7:27, Josh Poimboeuf wrote:
> > When compiling the kernel with -ffunction-sections (e.g., for LTO,
> > livepatch, dead code elimination, AutoFDO, or Propeller), the startup()
> > function gets compiled into the .text.startup section.  In some cases it
> > can even be cloned into .text.startup.constprop.0 or
> > .text.startup.isra.0.
> > 
> > However, the .text.startup and .text.startup.* section names are already
> > reserved for use by the compiler for __attribute__((constructor)) code.
> > 
> > This naming conflict causes the vmlinux linker script to wrongly place
> > startup() function code in .init.text, which gets freed during boot.
> 
> This sounds rather error-prone. What are the patterns supposed to match
> actually? Can't *those* real victims™ be renamed to something less common
> instead?

Yeah, this is a terrible mess. The problem is that when linking objects
build with and without -ffunction-sections you can no longer uniquely
identify what's what :-(

As long as its consistently one or the other it works, but if you mix
them constructors and normal function like this get mixed up.

In another thread I've suggested this might be a toolchain bug, but even
if they agree and fix it, we still stuck with the old compilers. And I'm
not sure the toolchain people are agreeing there's anything wrong here
-- the argument is that you shouldn't be mixing this or somesuch.

Anyway, objtool has a warning for this, so new occurrences should be
flagged before they get introduced. But yes, we need to make the tree
clean first.

  reply	other threads:[~2025-11-19  8:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19  6:27 [PATCH] serial: icom: Fix namespace collision and startup() section placement with -ffunction-sections Josh Poimboeuf
2025-11-19  6:58 ` Jiri Slaby
2025-11-19  8:43   ` Peter Zijlstra [this message]
2025-11-19  8:44     ` Peter Zijlstra
2025-11-19 17:04       ` Josh Poimboeuf

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=20251119084315.GI4067720@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=x86@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