objtool: More -ffunction-sections fixes
Subsystems (8)
Josh Poimboeuf
maintainercover objtool: More -ffunction-sections fixes
For tip/objtool/core.
- Patches 1-4: Rename functions
- Patches 5-6: Move the check out of objtool
Josh Poimboeuf (6):
serial: icom: Fix namespace collision and startup() section placement
with -ffunction-sections
media: atomisp: gc2235: Fix namespace collision and startup() section
placement with -ffunction-sections
tty: amiserial: Fix namespace collision and startup() section
placement with -ffunction-sections
tty: synclink_gt: Fix namespace collision and startup() section
placement with -ffunction-sections
kbuild: Check for functions with ambiguous -ffunction-sections section
names
Revert "objtool: Warn on functions with ambiguous -ffunction-sections
section names"
.../media/atomisp/i2c/atomisp-gc2235.c | 4 +-- drivers/tty/amiserial.c | 14 ++++---- drivers/tty/serial/icom.c | 8 ++--- drivers/tty/synclink_gt.c | 20 +++++------ include/asm-generic/vmlinux.lds.h | 2 +- scripts/Makefile.vmlinux_o | 4 +++ scripts/check-function-names.sh | 25 ++++++++++++++ tools/objtool/Documentation/objtool.txt | 7 ---- tools/objtool/check.c | 33 ------------------- 9 files changed, 53 insertions(+), 64 deletions(-) create mode 100755 scripts/check-function-names.sh
Signature · 1 line
2.51.1
Josh Poimboeuf
maintainerPATCH 1/6 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().
--- drivers/tty/serial/icom.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/icom.c +4 -4
@@ -760,7 +760,7 @@ static void load_code(struct icom_port *icom_port)dma_free_coherent (&dev->dev,4096 , new_page, temp_pci); } -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 ; } -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;kref_get (&icom_port->adapter->kref); - retval =startup (icom_port); + retval =icom_startup (icom_port);if (retval) {kref_put (&icom_port->adapter->kref, icom_kref_release);
@@ -1333,7 +1333,7 @@ static void icom_close(struct uart_port *port) cmdReg =readb (&icom_port->dram->CmdReg);writeb (cmdReg & ~CMD_RCV_ENABLE , &icom_port->dram->CmdReg); -shutdown (icom_port); +icom_shutdown (icom_port);kref_put (&icom_port->adapter->kref, icom_kref_release); }
Signature · 1 line
2.51.1
Josh Poimboeuf
maintainerPATCH 2/6 media: atomisp: gc2235: Fix namespace collision and startup() section placement with -ffunction-sections
In reply to Josh PoimboeufWhen 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().
--- drivers/staging/media/atomisp/i2c/atomisp-gc2235.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/i2c/atomisp-gc2235.c +2 -2
@@ -491,7 +491,7 @@ static int gc2235_s_power(struct v4l2_subdev *sd, int on)return ret; } -static int startup (struct v4l2_subdev *sd) +static int gc2235_startup (struct v4l2_subdev *sd) {struct gc2235_device *dev =to_gc2235_sensor (sd);struct i2c_client *client =v4l2_get_subdevdata (sd);
@@ -556,7 +556,7 @@ static int gc2235_set_fmt(struct v4l2_subdev *sd,return 0 ; } - ret =startup (sd); + ret =gc2235_startup (sd);if (ret) {dev_err (&client->dev,"gc2235 startup err\n" ); goto err;
Signature · 1 line
2.51.1
Josh Poimboeuf
maintainerPATCH 3/6 tty: amiserial: Fix namespace collision and startup() section placement with -ffunction-sections
In reply to Josh PoimboeufWhen 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().
--- drivers/tty/amiserial.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/tty/amiserial.c +7 -7
@@ -438,7 +438,7 @@ static irqreturn_t ser_tx_int(int irq, void *dev_id)* --------------------------------------------------------------- */ -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 = &info->tport;unsigned long flags;
@@ -513,7 +513,7 @@ static int startup(struct tty_struct *tty, struct serial_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;
@@ -975,7 +975,7 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)change_speed (tty, state,NULL ); } }else - retval =startup (tty, state); + retval =rs_startup (tty, state);tty_unlock (tty);return retval; }
@@ -1251,9 +1251,9 @@ static void rs_close(struct tty_struct *tty, struct file * filp)*/ rs_wait_until_sent (tty, state->timeout); } -shutdown (tty, state); +rs_shutdown (tty, state);rs_flush_buffer (tty); - +tty_ldisc_flush (tty); port->tty =NULL ;
@@ -1325,7 +1325,7 @@ static void rs_hangup(struct tty_struct *tty)struct serial_state *info = tty->driver_data;rs_flush_buffer (tty); -shutdown (tty, info); +rs_shutdown (tty, info); info->tport.count =0 ;tty_port_set_active (&info->tport, false); info->tport.tty =NULL ;
@@ -1349,7 +1349,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) port->tty = tty; tty->driver_data = info; - retval =startup (tty, info); + retval =rs_startup (tty, info);if (retval) {return retval; }
Signature · 1 line
2.51.1
Josh Poimboeuf
maintainerPATCH 4/6 tty: synclink_gt: Fix namespace collision and startup() section placement with -ffunction-sections
In reply to Josh PoimboeufWhen 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().
--- drivers/tty/synclink_gt.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/tty/synclink_gt.c +10 -10
@@ -407,9 +407,9 @@ static void wr_reg32(struct slgt_info *info, unsigned int addr, __u32 value);static void msc_set_vcr (struct slgt_info *info); -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,struct 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);
@@ -622,7 +622,7 @@ static int open(struct tty_struct *tty, struct file *filp)if (info->port.count ==1 ) {/* 1st open on this device, init hardware */ - retval =startup (info); + retval =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); -shutdown (info); +shutdown_hw (info);mutex_unlock (&info->port.mutex);tty_port_close_end (&info->port, tty);
@@ -687,7 +687,7 @@ static void hangup(struct tty_struct *tty)flush_buffer (tty);mutex_lock (&info->port.mutex); -shutdown (info); +shutdown_hw (info);spin_lock_irqsave (&info->port.lock, flags); info->port.count =0 ;
@@ -1445,7 +1445,7 @@ static int hdlcdev_open(struct net_device *dev)spin_unlock_irqrestore (&info->netlock, flags);/* claim resources and init adapter */ -if ((rc =startup (info)) !=0 ) { +if ((rc =startup_hw (info)) !=0 ) {spin_lock_irqsave (&info->netlock, flags); info->netcount=0 ;spin_unlock_irqrestore (&info->netlock, flags);
@@ -1455,7 +1455,7 @@ static int hdlcdev_open(struct net_device *dev)/* generic HDLC layer open processing */ rc =hdlc_open (dev);if (rc) { -shutdown (info); +shutdown_hw (info);spin_lock_irqsave (&info->netlock, flags); info->netcount =0 ;spin_unlock_irqrestore (&info->netlock, flags);
@@ -1499,7 +1499,7 @@ static int hdlcdev_close(struct net_device *dev)netif_stop_queue (dev);/* shutdown adapter and release resources */ -shutdown (info); +shutdown_hw (info);hdlc_close (dev);
@@ -2328,7 +2328,7 @@ static irqreturn_t slgt_interrupt(int dummy, void *dev_id)return IRQ_HANDLED ; } -static int startup (struct slgt_info *info) +static int startup_hw (struct slgt_info *info) {DBGINFO (("%s startup\n" , info->device_name));
@@ -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;
Signature · 1 line
2.51.1
Josh Poimboeuf
maintainerPATCH 5/6 kbuild: Check for functions with ambiguous -ffunction-sections section names
In reply to Josh PoimboeufCommit 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.
--- 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
include/asm-generic/vmlinux.lds.h +1 -1
@@ -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 any such * ambiguously named functions. */ #define TEXT_MAIN \
scripts/Makefile.vmlinux_o +4 -0
@@ -63,11 +63,15 @@ quiet_cmd_ld_vmlinux.o = LD $@ --start-group $(KBUILD_VMLINUX_LIBS) --end-group \ $(cmd_objtool) +cmd_check_function_names = $(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 + vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE $(call if_changed_rule,ld_vmlinux.o)
scripts/check-function-names.sh new file +25 -0
@@ -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="$1" + +if [ ! -f "$objfile" ]; then + echo "usage: $0 <file.o>" >&2 + exit 1 +fi + +bad_symbols=$(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 -ffunction-sections" >&2 + done + exit 1 +fi + +exit 0
Signature · 1 line
2.51.1
Josh Poimboeuf
maintainerPATCH 6/6 Revert "objtool: Warn on functions with ambiguous -ffunction-sections section names"
In reply to Josh PoimboeufThis reverts commit 9c7dc1dd897a1cdcade9566ea4664b03fbabf4a4.
The check-function-names.sh script now provides the function name checking functionality for all architectures, making the objtool check redundant.
--- tools/objtool/Documentation/objtool.txt | 7 ------ tools/objtool/check.c | 33 ------------------------- 2 files changed, 40 deletions(-)
tools/objtool/Documentation/objtool.txt +0 -7
@@ -456,13 +456,6 @@ the objtool maintainers. these special names and does not use module_init() / module_exit() macros to create them. -13. file.o: warning: func() function name creates ambiguity with -ffunctions-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. - If the error doesn't seem to make sense, it could be a bug in objtool. Feel free to ask objtool maintainers for help.
tools/objtool/check.c +0 -33
@@ -2663,37 +2663,6 @@ static int decode_sections(struct objtool_file *file)return 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. -*/ -static int validate_function_names (struct objtool_file *file) -{ -struct symbol *func; -int warnings =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 ==INSN_CALL ) {
@@ -4963,8 +4932,6 @@ int check(struct objtool_file *file)if (!nr_insns) goto out; - warnings +=validate_function_names (file); -if (opts.retpoline) warnings +=validate_retpoline (file);
Signature · 1 line
2.51.1
Quoted 6 lines · Josh Poimboeuf
For tip/objtool/core.
- Patches 1-4: Rename functions
- Patches 5-6: Move the check out of objtool
Quoted 13 lines
Josh Poimboeuf (6):
serial: icom: Fix namespace collision andstartup()section placement
with -ffunction-sections
media: atomisp: gc2235: Fix namespace collision andstartup()section
placement with -ffunction-sections
tty: amiserial: Fix namespace collision andstartup()section
placement with -ffunction-sections
tty:synclink_gt: Fix namespace collision andstartup()section
placement with -ffunction-sections
kbuild: Check for functions with ambiguous -ffunction-sections section
names
Revert "objtool: Warn on functions with ambiguous -ffunction-sections
section names"
For the tty changes:
[tip: objtool/core] kbuild: Check for functions with ambiguous -ffunction-sections section names
In reply to Josh PoimboeufThe following commit has been merged into the objtool/core branch of tip:
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 93863f3f859a626347ce2ec18947b11357b4ca14 Gitweb: https://git.kernel.org/tip/93863f3f859a626347ce2ec18947b11357b4ca14 Author: Josh Poimboeuf <[email protected]> AuthorDate: Thu, 20 Nov 2025 12:14:20 -08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 21 Nov 2025 10:04:10 +01:00
kbuild: Check for functions with ambiguous -ffunction-sections section names
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.
--- 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
include/asm-generic/vmlinux.lds.h +1 -1
@@ -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 any such * ambiguously named functions. */ #define TEXT_MAIN \
scripts/Makefile.vmlinux_o +4 -0
@@ -63,11 +63,15 @@ quiet_cmd_ld_vmlinux.o = LD $@ --start-group $(KBUILD_VMLINUX_LIBS) --end-group \ $(cmd_objtool) +cmd_check_function_names = $(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 + vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE $(call if_changed_rule,ld_vmlinux.o)
scripts/check-function-names.sh new file +25 -0
@@ -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="$1" + +if [ ! -f "$objfile" ]; then + echo "usage: $0 <file.o>" >&2 + exit 1 +fi + +bad_symbols=$(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 -ffunction-sections" >&2 + done + exit 1 +fi + +exit 0
[tip: objtool/core] Revert "objtool: Warn on functions with ambiguous -ffunction-sections section names"
In reply to Josh PoimboeufThe following commit has been merged into the objtool/core branch of tip:
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 11991999a20145b7f8af21202d0cac6b1f90a6e4 Gitweb: https://git.kernel.org/tip/11991999a20145b7f8af21202d0cac6b1f90a6e4 Author: Josh Poimboeuf <[email protected]> AuthorDate: Thu, 20 Nov 2025 12:14:21 -08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 21 Nov 2025 10:04:10 +01:00
Revert "objtool: Warn on functions with ambiguous -ffunction-sections section names"
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.
--- tools/objtool/Documentation/objtool.txt | 7 +----- tools/objtool/check.c | 33 +------------------------ 2 files changed, 40 deletions(-)
tools/objtool/Documentation/objtool.txt +0 -7
@@ -456,13 +456,6 @@ the objtool maintainers. these special names and does not use module_init() / module_exit() macros to create them. -13. file.o: warning: func() function name creates ambiguity with -ffunctions-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. - If the error doesn't seem to make sense, it could be a bug in objtool. Feel free to ask objtool maintainers for help.
tools/objtool/check.c +0 -33
@@ -2642,37 +2642,6 @@ static int decode_sections(struct objtool_file *file)return 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. -*/ -static int validate_function_names (struct objtool_file *file) -{ -struct symbol *func; -int warnings =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 ==INSN_CALL ) {
@@ -4942,8 +4911,6 @@ int check(struct objtool_file *file)if (!nr_insns) goto out; - warnings +=validate_function_names (file); -if (opts.retpoline) warnings +=validate_retpoline (file);
[tip: objtool/core] tty: synclink_gt: Fix namespace collision and startup() section placement with -ffunction-sections
In reply to Josh PoimboeufThe following commit has been merged into the objtool/core branch of tip:
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 31863337138a0482d614f1090727dac87c936959 Gitweb: https://git.kernel.org/tip/31863337138a0482d614f1090727dac87c936959 Author: Josh Poimboeuf <[email protected]> AuthorDate: Thu, 20 Nov 2025 12:14:19 -08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 21 Nov 2025 10:04:10 +01:00
tty: synclink_gt: 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 startup_hw(). For consistency, also rename its shutdown() counterpart to shutdown_hw().
--- drivers/tty/synclink_gt.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/tty/synclink_gt.c +10 -10
@@ -407,9 +407,9 @@ static void wr_reg32(struct slgt_info *info, unsigned int addr, __u32 value);static void msc_set_vcr (struct slgt_info *info); -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,struct 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);
@@ -622,7 +622,7 @@ static int open(struct tty_struct *tty, struct file *filp)if (info->port.count ==1 ) {/* 1st open on this device, init hardware */ - retval =startup (info); + retval =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); -shutdown (info); +shutdown_hw (info);mutex_unlock (&info->port.mutex);tty_port_close_end (&info->port, tty);
@@ -687,7 +687,7 @@ static void hangup(struct tty_struct *tty)flush_buffer (tty);mutex_lock (&info->port.mutex); -shutdown (info); +shutdown_hw (info);spin_lock_irqsave (&info->port.lock, flags); info->port.count =0 ;
@@ -1445,7 +1445,7 @@ static int hdlcdev_open(struct net_device *dev)spin_unlock_irqrestore (&info->netlock, flags);/* claim resources and init adapter */ -if ((rc =startup (info)) !=0 ) { +if ((rc =startup_hw (info)) !=0 ) {spin_lock_irqsave (&info->netlock, flags); info->netcount=0 ;spin_unlock_irqrestore (&info->netlock, flags);
@@ -1455,7 +1455,7 @@ static int hdlcdev_open(struct net_device *dev)/* generic HDLC layer open processing */ rc =hdlc_open (dev);if (rc) { -shutdown (info); +shutdown_hw (info);spin_lock_irqsave (&info->netlock, flags); info->netcount =0 ;spin_unlock_irqrestore (&info->netlock, flags);
@@ -1499,7 +1499,7 @@ static int hdlcdev_close(struct net_device *dev)netif_stop_queue (dev);/* shutdown adapter and release resources */ -shutdown (info); +shutdown_hw (info);hdlc_close (dev);
@@ -2328,7 +2328,7 @@ static irqreturn_t slgt_interrupt(int dummy, void *dev_id)return IRQ_HANDLED ; } -static int startup (struct slgt_info *info) +static int startup_hw (struct slgt_info *info) {DBGINFO (("%s startup\n" , info->device_name));
@@ -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;
[tip: objtool/core] tty: amiserial: Fix namespace collision and startup() section placement with -ffunction-sections
In reply to Josh PoimboeufThe following commit has been merged into the objtool/core branch of tip:
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 845c09e4744f111eae894ad3b67a369bb43d50fb Gitweb: https://git.kernel.org/tip/845c09e4744f111eae894ad3b67a369bb43d50fb Author: Josh Poimboeuf <[email protected]> AuthorDate: Thu, 20 Nov 2025 12:14:18 -08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 21 Nov 2025 10:04:09 +01:00
tty: amiserial: 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 rs_startup(). For consistency, also rename its shutdown() counterpart to rs_shutdown().
--- drivers/tty/amiserial.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/tty/amiserial.c +7 -7
@@ -438,7 +438,7 @@ static irqreturn_t ser_tx_int(int irq, void *dev_id)* --------------------------------------------------------------- */ -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 = &info->tport;unsigned long flags;
@@ -513,7 +513,7 @@ errout:* 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;
@@ -975,7 +975,7 @@ check_and_exit:change_speed (tty, state,NULL ); } }else - retval =startup (tty, state); + retval =rs_startup (tty, state);tty_unlock (tty);return retval; }
@@ -1251,9 +1251,9 @@ static void rs_close(struct tty_struct *tty, struct file * filp)*/ rs_wait_until_sent (tty, state->timeout); } -shutdown (tty, state); +rs_shutdown (tty, state);rs_flush_buffer (tty); - +tty_ldisc_flush (tty); port->tty =NULL ;
@@ -1325,7 +1325,7 @@ static void rs_hangup(struct tty_struct *tty)struct serial_state *info = tty->driver_data;rs_flush_buffer (tty); -shutdown (tty, info); +rs_shutdown (tty, info); info->tport.count =0 ;tty_port_set_active (&info->tport, false); info->tport.tty =NULL ;
@@ -1349,7 +1349,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) port->tty = tty; tty->driver_data = info; - retval =startup (tty, info); + retval =rs_startup (tty, info);if (retval) {return retval; }
[tip: objtool/core] media: atomisp: gc2235: Fix namespace collision and startup() section placement with -ffunction-sections
In reply to Josh PoimboeufThe following commit has been merged into the objtool/core branch of tip:
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 2c715c9de293b6c05bcdff1c22a7626f3bb42492 Gitweb: https://git.kernel.org/tip/2c715c9de293b6c05bcdff1c22a7626f3bb42492 Author: Josh Poimboeuf <[email protected]> AuthorDate: Thu, 20 Nov 2025 12:14:17 -08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 21 Nov 2025 10:04:09 +01:00
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().
--- drivers/staging/media/atomisp/i2c/atomisp-gc2235.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/i2c/atomisp-gc2235.c +2 -2
@@ -491,7 +491,7 @@ static int gc2235_s_power(struct v4l2_subdev *sd, int on)return ret; } -static int startup (struct v4l2_subdev *sd) +static int gc2235_startup (struct v4l2_subdev *sd) {struct gc2235_device *dev =to_gc2235_sensor (sd);struct i2c_client *client =v4l2_get_subdevdata (sd);
@@ -556,7 +556,7 @@ static int gc2235_set_fmt(struct v4l2_subdev *sd,return 0 ; } - ret =startup (sd); + ret =gc2235_startup (sd);if (ret) {dev_err (&client->dev,"gc2235 startup err\n" ); goto err;
[tip: objtool/core] serial: icom: Fix namespace collision and startup() section placement with -ffunction-sections
In reply to Josh PoimboeufThe following commit has been merged into the objtool/core branch of tip:
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: da6202139aef11c3c5881176e6e3184d88d8a0d9 Gitweb: https://git.kernel.org/tip/da6202139aef11c3c5881176e6e3184d88d8a0d9 Author: Josh Poimboeuf <[email protected]> AuthorDate: Thu, 20 Nov 2025 12:14:16 -08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 21 Nov 2025 10:04:09 +01:00
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().
--- drivers/tty/serial/icom.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/icom.c +4 -4
@@ -760,7 +760,7 @@ static void load_code(struct icom_port *icom_port)dma_free_coherent (&dev->dev,4096 , new_page, temp_pci); } -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 @@ unlock:return 0 ; } -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;kref_get (&icom_port->adapter->kref); - retval =startup (icom_port); + retval =icom_startup (icom_port);if (retval) {kref_put (&icom_port->adapter->kref, icom_kref_release);
@@ -1333,7 +1333,7 @@ static void icom_close(struct uart_port *port) cmdReg =readb (&icom_port->dram->CmdReg);writeb (cmdReg & ~CMD_RCV_ENABLE , &icom_port->dram->CmdReg); -shutdown (icom_port); +icom_shutdown (icom_port);kref_put (&icom_port->adapter->kref, icom_kref_release); }
Re: [PATCH 2/6] media: atomisp: gc2235: Fix namespace collision and startup() section placement with -ffunction-sections
In reply to Josh PoimboeufHi,
Quoted 17 lines · Josh Poimboeuf
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_SECTIONSor similar. This means that "startup" unfortunately needs to be prohibited as a function name.
Quoted 3 lines
Rename
startup()togc2235_startup().Signed-off-by Josh Poimboeuf <[email protected]>
Thanks, patch looks good to me:
Feel free to merge through the x86/tip tree together with the rest of the series.
Regards,
Hans
Quoted 26 lines
--- drivers/staging/media/atomisp/i2c/atomisp-gc2235.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/media/atomisp/i2c/atomisp-gc2235.c +2
-2@@ -491,7 +491,7 @@ static int gc2235_s_power(struct v4l2_subdev *sd, int on)return ret; } -static int startup (struct v4l2_subdev *sd) +static int gc2235_startup (struct v4l2_subdev *sd) {struct gc2235_device *dev =to_gc2235_sensor (sd);struct i2c_client *client =v4l2_get_subdevdata (sd);@@ -556,7 +556,7 @@ static int gc2235_set_fmt(struct v4l2_subdev *sd,return 0 ; } - ret =startup (sd); + ret =gc2235_startup (sd);if (ret) {dev_err (&client->dev,"gc2235 startup err\n" ); goto err;