From nobody Tue Dec 2 02:05:26 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D626833D6E6 for ; Thu, 20 Nov 2025 20:15:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763669704; cv=none; b=LhRhyczZlA2s4CmimDTyuUEqdWrU9dkgZjY8CmoJYIoGPH/gCOpiyTkFmA7gfQq6xo+GtugvfJkAiCa2+QD3Le16QB9b/NlkXqXIvrARTaBFEAZyioY0tyozFyE3IgrX+UnJnsAcp4cVjukgg0J7FHU6lvXAbTOB9XX9Wwp7tpg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763669704; c=relaxed/simple; bh=9r5vRaEP7TVeUP7Vi8XyqJdy3zgL96CSZMZqedSMopI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PBGDqMTQmNoRuIVz8LuhZYxc8QD2cFPylZddZn6+CaueHnebOXwAsNP4eWI0IG+LShvfoMtEK8rihm907iuJGgVTIDNe06BQaoQooRHMwCn6VTxYxAmRnPxF+mdaTeTwCnvCQUbe7+UKFh3nj2/f7L022D1r6nUt3mXKa4w6ja4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kUUvfIaD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kUUvfIaD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2690C19424; Thu, 20 Nov 2025 20:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763669704; bh=9r5vRaEP7TVeUP7Vi8XyqJdy3zgL96CSZMZqedSMopI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kUUvfIaDC52fXpNaDdVtLDiems7nt8UWQToRp8IlvtCkJLIHuPSE0QWniX+cWZ3j7 RGis0zL/srdfNBpc5H1/jAaZDwiC5uzGsf8CA3OK+hY+u2qctsIB3U50tNC9a494on bQOYdPOknQieOG0N88VHnejrPlSbjR2sGVpNigPJdMjJ3Tg/KWPfdXplz4+Cy9ePie Q4tUQAOO5qH27QQHYNhZuG+G0y1ss5C3DGRHOFXrUv53Z8fpSBIk67+RCrf9rq7zu3 wNEZzQqkIy9RjFZUDxEp2z+FollyKxcE0+BaufKG/KMVHLL92Ak5PAPLFiVg5dm8S6 EmCx8AsWjcW6g== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Greg Kroah-Hartman , Jiri Slaby , Mauro Carvalho Chehab , Hans de Goede Subject: [PATCH 3/6] tty: amiserial: Fix namespace collision and startup() section placement with -ffunction-sections Date: Thu, 20 Nov 2025 12:14:18 -0800 Message-ID: <9e56afff5268b0b12b99a8aa9bf244d6ebdcdf47.1763669451.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.51.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When compiled with -ffunction-sections (e.g., for LTO, livepatch, dead code elimination, AutoFDO, or Propeller), the startup() function gets compiled into the .text.startup section (or in some cases .text.startup.constprop.0 or .text.startup.isra.0). However, the .text.startup and .text.startup.* sections are also used 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. Some builds have a mix of objects, both with and without -ffunctions-sections, so it's not possible for the linker script to disambiguate with #ifdef CONFIG_FUNCTION_SECTIONS or similar. This means that "startup" unfortunately needs to be prohibited as a function name. Rename startup() to rs_startup(). For consistency, also rename its shutdown() counterpart to rs_shutdown(). Signed-off-by: Josh Poimboeuf --- drivers/tty/amiserial.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 5af46442a792..81eaca751541 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c @@ -438,7 +438,7 @@ static irqreturn_t ser_tx_int(int irq, void *dev_id) * --------------------------------------------------------------- */ =20 -static int startup(struct tty_struct *tty, struct serial_state *info) +static int rs_startup(struct tty_struct *tty, struct serial_state *info) { struct tty_port *port =3D &info->tport; unsigned long flags; @@ -513,7 +513,7 @@ static int startup(struct tty_struct *tty, struct seria= l_state *info) * This routine will shutdown a serial port; interrupts are disabled, and * DTR is dropped if the hangup on close termio flag is on. */ -static void shutdown(struct tty_struct *tty, struct serial_state *info) +static void rs_shutdown(struct tty_struct *tty, struct serial_state *info) { unsigned long flags; =20 @@ -975,7 +975,7 @@ static int set_serial_info(struct tty_struct *tty, stru= ct serial_struct *ss) change_speed(tty, state, NULL); } } else - retval =3D startup(tty, state); + retval =3D rs_startup(tty, state); tty_unlock(tty); return retval; } @@ -1251,9 +1251,9 @@ static void rs_close(struct tty_struct *tty, struct f= ile * filp) */ rs_wait_until_sent(tty, state->timeout); } - shutdown(tty, state); + rs_shutdown(tty, state); rs_flush_buffer(tty); - =09 + tty_ldisc_flush(tty); port->tty =3D NULL; =20 @@ -1325,7 +1325,7 @@ static void rs_hangup(struct tty_struct *tty) struct serial_state *info =3D tty->driver_data; =20 rs_flush_buffer(tty); - shutdown(tty, info); + rs_shutdown(tty, info); info->tport.count =3D 0; tty_port_set_active(&info->tport, false); info->tport.tty =3D NULL; @@ -1349,7 +1349,7 @@ static int rs_open(struct tty_struct *tty, struct fil= e * filp) port->tty =3D tty; tty->driver_data =3D info; =20 - retval =3D startup(tty, info); + retval =3D rs_startup(tty, info); if (retval) { return retval; } --=20 2.51.1