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

Configure Feed

Select the types of activity you want to include in your feed.

serial: icom: 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 icom_startup(). For consistency, also rename its
shutdown() counterpart to icom_shutdown().

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/1aee9ef69f9d40405676712b34f0c397706e7023.1763669451.git.jpoimboe@kernel.org

authored by

Josh Poimboeuf and committed by
Peter Zijlstra
da620213 106f11d4

+4 -4
+4 -4
drivers/tty/serial/icom.c
··· 760 760 dma_free_coherent(&dev->dev, 4096, new_page, temp_pci); 761 761 } 762 762 763 - static int startup(struct icom_port *icom_port) 763 + static int icom_startup(struct icom_port *icom_port) 764 764 { 765 765 unsigned long temp; 766 766 unsigned char cable_id, raw_cable_id; ··· 832 832 return 0; 833 833 } 834 834 835 - static void shutdown(struct icom_port *icom_port) 835 + static void icom_shutdown(struct icom_port *icom_port) 836 836 { 837 837 unsigned long temp; 838 838 unsigned char cmdReg; ··· 1311 1311 int retval; 1312 1312 1313 1313 kref_get(&icom_port->adapter->kref); 1314 - retval = startup(icom_port); 1314 + retval = icom_startup(icom_port); 1315 1315 1316 1316 if (retval) { 1317 1317 kref_put(&icom_port->adapter->kref, icom_kref_release); ··· 1333 1333 cmdReg = readb(&icom_port->dram->CmdReg); 1334 1334 writeb(cmdReg & ~CMD_RCV_ENABLE, &icom_port->dram->CmdReg); 1335 1335 1336 - shutdown(icom_port); 1336 + icom_shutdown(icom_port); 1337 1337 1338 1338 kref_put(&icom_port->adapter->kref, icom_kref_release); 1339 1339 }