Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: atomisp: gc2235: Fix namespace collision and startup() section placement with -ffunction-sections

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 <jpoimboe@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/d28103a6edf7beceb5e3c6fa24e49dbad1350389.1763669451.git.jpoimboe@kernel.org

authored by

Josh Poimboeuf and committed by
Peter Zijlstra
2c715c9d da620213

+2 -2
+2 -2
drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
··· 491 491 return ret; 492 492 } 493 493 494 - static int startup(struct v4l2_subdev *sd) 494 + static int gc2235_startup(struct v4l2_subdev *sd) 495 495 { 496 496 struct gc2235_device *dev = to_gc2235_sensor(sd); 497 497 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 556 556 return 0; 557 557 } 558 558 559 - ret = startup(sd); 559 + ret = gc2235_startup(sd); 560 560 if (ret) { 561 561 dev_err(&client->dev, "gc2235 startup err\n"); 562 562 goto err;