Re: [PATCH] serial: icom: Fix namespace collision and startup() section placement with -ffunction-sections
From: Jiri Slaby
Date: Wed Nov 19 2025 - 01:58:09 EST
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?
Fix that by renaming startup() to icom_startup(). For consistency, also
rename its shutdown() counterpart to icom_shutdown().
I see also:
drivers/staging/media/atomisp/i2c/atomisp-gc2235.c:static int startup(struct v4l2_subdev *sd)
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:static int startup(struct v4l2_subdev *sd)
drivers/tty/amiserial.c:static int startup(struct tty_struct *tty, struct serial_state *info)
drivers/tty/synclink_gt.c:static int startup(struct slgt_info *info)
thanks,
--
js
suse labs