From nobody Tue Dec 2 02:04:09 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 DC61932FA11 for ; Thu, 20 Nov 2025 20:15:03 +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=1763669703; cv=none; b=NYvCaKpqWN3EYzL205nsFcgdMhEJMSubgNUu0dCJCYkrlQHQhi+P8ACipsdfbYMgsAsFx+tMcwLgobeLekZQSViZk0sZ7iGjaKExZIeEKaw/gWc1Kpynag8mHO45JP8TSIPUK9D9ZRJR0XiNq6YEQE5U1+FPHJE9PM7PTm8jhhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763669703; c=relaxed/simple; bh=iPe4wuZpLzda23MC4hWzxQHIeC44yhRipkTmvW8g5SQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EABsTNob/KvXLBBYBrImDcdx9fDdzFbQmJAtWOKl4s69kf6bIizPC/By7IF0OnY3gC/BXnriwgEZM9Za0HfhOmxzWG5wTLRo+XsxwumSNHbYzw5bQ9Z2bIbcvN5iHMPLwmOmoqFbZtaSB/RNz7N9MH3HwotJUBB7EmDQ+DCLt10= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nWILMF4q; 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="nWILMF4q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA4F0C19422; Thu, 20 Nov 2025 20:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763669703; bh=iPe4wuZpLzda23MC4hWzxQHIeC44yhRipkTmvW8g5SQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nWILMF4qKGTBnVeXM51tNEY5plP0KA7sczNNq1QxkSO7nrYjVHyXPfmmar9x+levX OHSOj3nhg3pIVChZ8gvvYIeU/Jf0QvRPc4EfHRWGkpPRtsHrSZMF2ailPh9Q7LTx0R rX/+fRSapSrFLFvz7mvCFyrvksQBT33dtnvcn9nh1bA6ajNnzcSVh3bF+ZlsKsAZQ7 3XEMPVFHFS9b4gmTA+sfEdtZzrbbSp+PHMQCKjl3MKxHJP/vhapmlfrHr1QyI9E6SY HEkZFM3YUJqKNWQ9H5M+W2zdCAOzxD4cYz9gTiZ1RjJZhjpbaMGPj06oM7pMqS80xz 7hXzzWYKRJr7Q== 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 1/6] serial: icom: Fix namespace collision and startup() section placement with -ffunction-sections Date: Thu, 20 Nov 2025 12:14:16 -0800 Message-ID: <1aee9ef69f9d40405676712b34f0c397706e7023.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 icom_startup(). For consistency, also rename its shutdown() counterpart to icom_shutdown(). Signed-off-by: Josh Poimboeuf Acked-by: Greg Kroah-Hartman --- drivers/tty/serial/icom.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c index 7fb995a8490e..d00903cfa841 100644 --- a/drivers/tty/serial/icom.c +++ b/drivers/tty/serial/icom.c @@ -760,7 +760,7 @@ static void load_code(struct icom_port *icom_port) dma_free_coherent(&dev->dev, 4096, new_page, temp_pci); } =20 -static int startup(struct icom_port *icom_port) +static int icom_startup(struct icom_port *icom_port) { unsigned long temp; unsigned char cable_id, raw_cable_id; @@ -832,7 +832,7 @@ static int startup(struct icom_port *icom_port) return 0; } =20 -static void shutdown(struct icom_port *icom_port) +static void icom_shutdown(struct icom_port *icom_port) { unsigned long temp; unsigned char cmdReg; @@ -1311,7 +1311,7 @@ static int icom_open(struct uart_port *port) int retval; =20 kref_get(&icom_port->adapter->kref); - retval =3D startup(icom_port); + retval =3D icom_startup(icom_port); =20 if (retval) { kref_put(&icom_port->adapter->kref, icom_kref_release); @@ -1333,7 +1333,7 @@ static void icom_close(struct uart_port *port) cmdReg =3D readb(&icom_port->dram->CmdReg); writeb(cmdReg & ~CMD_RCV_ENABLE, &icom_port->dram->CmdReg); =20 - shutdown(icom_port); + icom_shutdown(icom_port); =20 kref_put(&icom_port->adapter->kref, icom_kref_release); } --=20 2.51.1 From nobody Tue Dec 2 02:04:09 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 DC59732E756 for ; Thu, 20 Nov 2025 20:15:03 +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=1763669703; cv=none; b=l1G6YrNpzIlNF6qfxvndjvKtxAEsAagLOXNxnG4hHICZGitLd3nNI9zRZ6D6fId+k5Q5XenFlTc52kBRwSwJTe2ATRvenalNgVJLEXCJXIqzcWUk/qSwAN5b1qLBo+5E+MY69ZLx5H3GeeWVZN4g1ygyBXOT9PkvCLKyZ0EO5N0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763669703; c=relaxed/simple; bh=eh0WMvCd2FDOYh8f9GaU/M6QRLvRAv1R7RhYFfIBsCI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a4/Ixy+jEVQI8FYDkEN+/Mw5USbckbcdTXHp3b9iXHSv5kPPx5xSPg6QmKf3MUqVNEQVKow/UYGUgsQxYgCasGvfIOg/+iqhM8hWOgiMPMv0qsDdO9cW7ctN74e2N95g17AEkJuXYzWe3afAq4gteEkmzztj7e+gSgmJ5wjLCkY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kdGXEdpE; 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="kdGXEdpE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B080C16AAE; 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=1763669703; bh=eh0WMvCd2FDOYh8f9GaU/M6QRLvRAv1R7RhYFfIBsCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kdGXEdpEkF8ws5bKk5O0C1py8Q4++TsXxwVLCIACDT47wnb/m7uginaHc+XOlba3Q nj6s4rmh1AgYBsVCCbg5yj9PlsvG7snnCwOjfNbjzKn4plFSTOK+328q2Z8A1o2hMw Us8BB9vsi8hQfSqMXS1DC6P9ZD144bUMHAVnwFQ8nksIxhfUUisVBWq4Idocan/56c zWh7dh57k75W/gbp32TBjcNUUVMx8QI2zu2yQjVr4zX1NQ4q7iaf8MoF/V8vDMo/tu iWiBWJRpxnmqhWJltVgMKnWBIWI+4i6ihGuaovGumreFgG+2SeTIRgM1Urli8vq8uA Jlf4IQ0gD0RDQ== 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 2/6] media: atomisp: gc2235: Fix namespace collision and startup() section placement with -ffunction-sections Date: Thu, 20 Nov 2025 12:14:17 -0800 Message-ID: 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 gc2235_startup(). Signed-off-by: Josh Poimboeuf Acked-by: Greg Kroah-Hartman Reviewed-by: Hans de Goede --- drivers/staging/media/atomisp/i2c/atomisp-gc2235.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c b/drivers/s= taging/media/atomisp/i2c/atomisp-gc2235.c index 6fc39ab95e46..6050637a0def 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c @@ -491,7 +491,7 @@ static int gc2235_s_power(struct v4l2_subdev *sd, int o= n) return ret; } =20 -static int startup(struct v4l2_subdev *sd) +static int gc2235_startup(struct v4l2_subdev *sd) { struct gc2235_device *dev =3D to_gc2235_sensor(sd); struct i2c_client *client =3D v4l2_get_subdevdata(sd); @@ -556,7 +556,7 @@ static int gc2235_set_fmt(struct v4l2_subdev *sd, return 0; } =20 - ret =3D startup(sd); + ret =3D gc2235_startup(sd); if (ret) { dev_err(&client->dev, "gc2235 startup err\n"); goto err; --=20 2.51.1 From nobody Tue Dec 2 02:04:09 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 Acked-by: Greg Kroah-Hartman --- 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 From nobody Tue Dec 2 02:04:09 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 D61D6307491 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=W0R06YU7z6ga3LjB/gDazK4NRPoKt4R/zFv795KmguZRYgT5Njr2v/QudwbcXxM4OQ1fyaWtYE62MWM5U6uoZ1VpuSRg7RYOd/d69AeRnRZVdKLUqX4r2uP5ZcvLo5hij+Zm4P1tfq8J2lHhun63VPXQ5kJEJqHOWGItHuUIYqQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763669704; c=relaxed/simple; bh=sgi0YKniZ5UAMrG3Hm817p4oZ2+hI2zUnCoWIqMhEdc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DWmQ55X914NgyGMU9e1fI4Gdt97qj4o8QkaG8gKDPd3MENzxC6Fd0Xg4KNimg88l/T5bdCA1YW8GyaBD3uiHXg/lUSLdy+JNBFzrmqsTfDqhNMNf94GimJpPjFD7QRSwGuMTy+3WitidXx7hy0HKNdrPbMuw9t7YvnNdGo9/geU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JdHnRC5t; 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="JdHnRC5t" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24792C16AAE; Thu, 20 Nov 2025 20:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763669704; bh=sgi0YKniZ5UAMrG3Hm817p4oZ2+hI2zUnCoWIqMhEdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JdHnRC5tthFf28DfKjBjbXYUFrWSax0cDXzRgEpXWHrAlkGUfsIhVJXv3mPYgr62x sdSR1AJrJV+zPSvH0KnxXa6XjjMGq/27qblDj0+hrbF8dNTjsYy12GIh7uE8hQ5Nij 9kJf1WIEYe6UTM3DVZ18lUbTDgAiNiaFTb47zWd+vj822DKsLRWO8XiT8fM8gYCVmt FqyI8gwT26VMhwCkbtl2vzM+QPAMyawo7iW/oNT88S+iqjz7876QKmKfose666bRcB Xy11DiHNYDw0WpemCn7qSMFn+8O3kTsQeV9VN0XnKBK+t11mzfEjIpUWijVxkmzfBA RSHNvhB6jCJNg== 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 4/6] tty: synclink_gt: Fix namespace collision and startup() section placement with -ffunction-sections Date: Thu, 20 Nov 2025 12:14:19 -0800 Message-ID: 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 startup_hw(). For consistency, also rename its shutdown() counterpart to shutdown_hw(). Signed-off-by: Josh Poimboeuf Acked-by: Greg Kroah-Hartman --- drivers/tty/synclink_gt.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index 3865b10d2d43..9d591fb291fd 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c @@ -407,9 +407,9 @@ static void wr_reg32(struct slgt_info *info, unsigned = int addr, __u32 value); =20 static void msc_set_vcr(struct slgt_info *info); =20 -static int startup(struct slgt_info *info); +static int startup_hw(struct slgt_info *info); static int block_til_ready(struct tty_struct *tty, struct file * filp,str= uct slgt_info *info); -static void shutdown(struct slgt_info *info); +static void shutdown_hw(struct slgt_info *info); static void program_hw(struct slgt_info *info); static void change_params(struct slgt_info *info); =20 @@ -622,7 +622,7 @@ static int open(struct tty_struct *tty, struct file *fi= lp) =20 if (info->port.count =3D=3D 1) { /* 1st open on this device, init hardware */ - retval =3D startup(info); + retval =3D startup_hw(info); if (retval < 0) { mutex_unlock(&info->port.mutex); goto cleanup; @@ -666,7 +666,7 @@ static void close(struct tty_struct *tty, struct file *= filp) flush_buffer(tty); tty_ldisc_flush(tty); =20 - shutdown(info); + shutdown_hw(info); mutex_unlock(&info->port.mutex); =20 tty_port_close_end(&info->port, tty); @@ -687,7 +687,7 @@ static void hangup(struct tty_struct *tty) flush_buffer(tty); =20 mutex_lock(&info->port.mutex); - shutdown(info); + shutdown_hw(info); =20 spin_lock_irqsave(&info->port.lock, flags); info->port.count =3D 0; @@ -1445,7 +1445,7 @@ static int hdlcdev_open(struct net_device *dev) spin_unlock_irqrestore(&info->netlock, flags); =20 /* claim resources and init adapter */ - if ((rc =3D startup(info)) !=3D 0) { + if ((rc =3D startup_hw(info)) !=3D 0) { spin_lock_irqsave(&info->netlock, flags); info->netcount=3D0; spin_unlock_irqrestore(&info->netlock, flags); @@ -1455,7 +1455,7 @@ static int hdlcdev_open(struct net_device *dev) /* generic HDLC layer open processing */ rc =3D hdlc_open(dev); if (rc) { - shutdown(info); + shutdown_hw(info); spin_lock_irqsave(&info->netlock, flags); info->netcount =3D 0; spin_unlock_irqrestore(&info->netlock, flags); @@ -1499,7 +1499,7 @@ static int hdlcdev_close(struct net_device *dev) netif_stop_queue(dev); =20 /* shutdown adapter and release resources */ - shutdown(info); + shutdown_hw(info); =20 hdlc_close(dev); =20 @@ -2328,7 +2328,7 @@ static irqreturn_t slgt_interrupt(int dummy, void *de= v_id) return IRQ_HANDLED; } =20 -static int startup(struct slgt_info *info) +static int startup_hw(struct slgt_info *info) { DBGINFO(("%s startup\n", info->device_name)); =20 @@ -2361,7 +2361,7 @@ static int startup(struct slgt_info *info) /* * called by close() and hangup() to shutdown hardware */ -static void shutdown(struct slgt_info *info) +static void shutdown_hw(struct slgt_info *info) { unsigned long flags; =20 --=20 2.51.1 From nobody Tue Dec 2 02:04:09 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 0FC75347BB4 for ; Thu, 20 Nov 2025 20:15:05 +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=1763669705; cv=none; b=MfSbN6RdABWTMgtSSdIkF3gIXhP1ww040Xo9+3xEjvpMWTDI/q4+92fp9ZOadjBOfbswrCra3Blme70bQpeNAxP8iE35Z1WMZvPQk1uDstsrekAE8N5WGhnIi987ES4tprFHSXaXhSxRPf7YaTjr8stesTL97q36y61gHIWkOYc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763669705; c=relaxed/simple; bh=JB04Mjmoj1HHH7/cbsaMD0Jj5HOZq/GZTvrZ/wMeAEw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DDmCs9ybeX74+lzcs+rzFVoxWjPOUTsFoQmmZZ3KzH1DNKBPPH+rRI8LiHFXWq28PHbvpI5Xf9nl7GUaGA64B0aEOMlQgBJ8Lt52MlbARdxLb2P02rxv0ouEk90C5hwipoOuYNBz05oE9Nd3KociyOAKQ3YKnC18dTZCwYhUD7k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=h6nF6RuP; 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="h6nF6RuP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95B9BC4CEF1; Thu, 20 Nov 2025 20:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763669704; bh=JB04Mjmoj1HHH7/cbsaMD0Jj5HOZq/GZTvrZ/wMeAEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h6nF6RuP+ObzteGFIfTCYc53l8rgY5Qk1YRU9K79TisC+tTDsZey2hSvVpspl8Cwe kTzkoE+0E41tyFGc9bVjbboq+I/iE8jVKAzH/8pbAQpqAc89P46oRekFhBGFNO204E 2K8vakiOXE8WxspwV87RaJ3ZeLfPyqG1EmU5vAdfc/sA9E3/tmO5PbxxmrwlqvH6u1 1GyAem1LwobThJDEoJwyGFXUj+kfjN1PrsjwxK3A6pJvFeHjT48m8KFS6pAEuWyya/ Vk1sx/wZXy4L1di1m3OeIR68Jqu52z8/iOp25cx38uSCcid2l5/ojtTgA/zqYHXKgc HK2nY75+Wj1+Q== 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 5/6] kbuild: Check for functions with ambiguous -ffunction-sections section names Date: Thu, 20 Nov 2025 12:14:20 -0800 Message-ID: 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" Commit 9c7dc1dd897a ("objtool: Warn on functions with ambiguous -ffunction-sections section names") only works for drivers which are compiled on architectures supported by objtool. Make a script to perform the same check for all architectures. Signed-off-by: Josh Poimboeuf Acked-by: Greg Kroah-Hartman --- include/asm-generic/vmlinux.lds.h | 2 +- scripts/Makefile.vmlinux_o | 4 ++++ scripts/check-function-names.sh | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 scripts/check-function-names.sh diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index 5efe1de2209b..0cdae6f809b5 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -110,7 +110,7 @@ * .text.startup could be __attribute__((constructor)) code in a *non* * ffunction-sections object, which should be placed in .init.text; or it = could * be an actual function named startup() in an ffunction-sections object, = which - * should be placed in .text. Objtool will detect and complain about any = such + * should be placed in .text. The build will detect and complain about an= y such * ambiguously named functions. */ #define TEXT_MAIN \ diff --git a/scripts/Makefile.vmlinux_o b/scripts/Makefile.vmlinux_o index 20533cc0b1ee..527352c222ff 100644 --- a/scripts/Makefile.vmlinux_o +++ b/scripts/Makefile.vmlinux_o @@ -63,11 +63,15 @@ quiet_cmd_ld_vmlinux.o =3D LD $@ --start-group $(KBUILD_VMLINUX_LIBS) --end-group \ $(cmd_objtool) =20 +cmd_check_function_names =3D $(srctree)/scripts/check-function-names.sh $@ + define rule_ld_vmlinux.o $(call cmd_and_savecmd,ld_vmlinux.o) $(call cmd,gen_objtooldep) + $(call cmd,check_function_names) endef =20 + vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE $(call if_changed_rule,ld_vmlinux.o) =20 diff --git a/scripts/check-function-names.sh b/scripts/check-function-names= .sh new file mode 100755 index 000000000000..410042591cfc --- /dev/null +++ b/scripts/check-function-names.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# Certain function names are disallowed due to section name ambiguities +# introduced by -ffunction-sections. +# +# See the comment above TEXT_MAIN in include/asm-generic/vmlinux.lds.h. + +objfile=3D"$1" + +if [ ! -f "$objfile" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +bad_symbols=3D$(nm "$objfile" | awk '$2 ~ /^[TtWw]$/ {print $3}' | grep -E= '^(startup|exit|split|unlikely|hot|unknown)(\.|$)') + +if [ -n "$bad_symbols" ]; then + echo "$bad_symbols" | while read -r sym; do + echo "$objfile: error: $sym() function name creates ambiguity with -ffun= ction-sections" >&2 + done + exit 1 +fi + +exit 0 --=20 2.51.1 From nobody Tue Dec 2 02:04:09 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 E3477238C3B for ; Thu, 20 Nov 2025 20:15:05 +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=1763669707; cv=none; b=eqFwvM1d7LPJm7b1pWK+/2mKHMHkXfj1qzs5rfy9fO82s+a1QRovfIRCExcKqLJmQiBYMXFNHdIf8vk4jZKFwe3t/GgB+1au6TlM/BqWXsi2YTF//phb6aZNNUAqILPY8gOXDGKPVDTeu//BduX/4+Qi2vD5pmc9QYPAnjumgc0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763669707; c=relaxed/simple; bh=HhYG+rfbcnKWMpZZvL58X6/XVBb8jmjGxvV/Ge+TPJg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q5aQnH9M4i4ZWs/ZXNrHC3ZHiV95emKtncTm/vfIdv5vK9uUU5vG93fYQTJTd33dPK5tkiA+J4Q4uJbH4G5tz57JFSfyWG4cIC8D4xycdoYj5dmIo+SXaCzy+PqhIIMlfZlFPQB84o7kwynGMfRif+VBoi4hiGygMACAmtQnQiw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K3LUcofy; 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="K3LUcofy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19773C116C6; Thu, 20 Nov 2025 20:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763669705; bh=HhYG+rfbcnKWMpZZvL58X6/XVBb8jmjGxvV/Ge+TPJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K3LUcofyTze8M1eI0tOVc5Q+IUKjzD5CHk1Ehh5R3u6vOSOTGj6Zh3wi9waEsEE4A ApunHPmmLb+BkgKKriIO+1c3qkxsjej8sGqo3w19BIZE+FEEfSMxIzZhfZuzmkQkgk /J5mVrIOBxE8N5wvsl1b/JuMNC29CmYQpnoEwhdb1dsBk8D5901BoGkH8hrKn0WVCF LD340aX4cL8ao0bSi79w8PphTMapdbTYRPUknQz9x9pewS9NyPDouO9ifFNv7oPlVq hEBuUx1XgEmhRSxxui/xuzOOPy6FdC6s4iPDs+8aoupqAAtcj2X+rNXht+sIgY4iUc VgO9DlpmCzO6Q== 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 6/6] Revert "objtool: Warn on functions with ambiguous -ffunction-sections section names" Date: Thu, 20 Nov 2025 12:14:21 -0800 Message-ID: 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" This reverts commit 9c7dc1dd897a1cdcade9566ea4664b03fbabf4a4. The check-function-names.sh script now provides the function name checking functionality for all architectures, making the objtool check redundant. Signed-off-by: Josh Poimboeuf Acked-by: Greg Kroah-Hartman --- tools/objtool/Documentation/objtool.txt | 7 ------ tools/objtool/check.c | 33 ------------------------- 2 files changed, 40 deletions(-) diff --git a/tools/objtool/Documentation/objtool.txt b/tools/objtool/Docume= ntation/objtool.txt index f88f8d28513a..9e97fc25b2d8 100644 --- a/tools/objtool/Documentation/objtool.txt +++ b/tools/objtool/Documentation/objtool.txt @@ -456,13 +456,6 @@ the objtool maintainers. these special names and does not use module_init() / module_exit() macros to create them. =20 -13. file.o: warning: func() function name creates ambiguity with -ffunctio= ns-sections - - Functions named startup(), exit(), split(), unlikely(), hot(), and - unknown() are not allowed due to the ambiguity of their section - names when compiled with -ffunction-sections. For more information, - see the comment above TEXT_MAIN in include/asm-generic/vmlinux.lds.h. - =20 If the error doesn't seem to make sense, it could be a bug in objtool. Feel free to ask objtool maintainers for help. diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 72c7f6f03350..57fac6ce3454 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2663,37 +2663,6 @@ static int decode_sections(struct objtool_file *file) return 0; } =20 -/* - * Certain function names are disallowed due to section name ambiguities - * introduced by -ffunction-sections. - * - * See the comment above TEXT_MAIN in include/asm-generic/vmlinux.lds.h. - */ -static int validate_function_names(struct objtool_file *file) -{ - struct symbol *func; - int warnings =3D 0; - - for_each_sym(file->elf, func) { - if (!is_func_sym(func)) - continue; - - if (!strcmp(func->name, "startup") || strstarts(func->name, "startup.") = || - !strcmp(func->name, "exit") || strstarts(func->name, "exit.") || - !strcmp(func->name, "split") || strstarts(func->name, "split.") || - !strcmp(func->name, "unlikely") || strstarts(func->name, "unlikely."= ) || - !strcmp(func->name, "hot") || strstarts(func->name, "hot.") || - !strcmp(func->name, "unknown") || strstarts(func->name, "unknown."))= { - - WARN("%s() function name creates ambiguity with -ffunction-sections", - func->name); - warnings++; - } - } - - return warnings; -} - static bool is_special_call(struct instruction *insn) { if (insn->type =3D=3D INSN_CALL) { @@ -4963,8 +4932,6 @@ int check(struct objtool_file *file) if (!nr_insns) goto out; =20 - warnings +=3D validate_function_names(file); - if (opts.retpoline) warnings +=3D validate_retpoline(file); =20 --=20 2.51.1