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.

vmlinux.lds: Fix TEXT_MAIN to include .text.start and friends

Since:

6568f14cb5ae ("vmlinux.lds: Exclude .text.startup and .text.exit from TEXT_MAIN")

the TEXT_MAIN macro uses a series of patterns to prevent the
.text.startup[.*] and .text.exit[.*] sections from getting
linked into the vmlinux runtime .text.

That commit is a tad too aggressive: it also inadvertently filters out
valid runtime text sections like .text.start and
.text.start.constprop.0, which can be generated for a function named
start() when -ffunction-sections is enabled.

As a result, those sections become orphans when building with
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION for arm:

arm-linux-gnueabi-ld: warning: orphan section `.text.start.constprop.0' from `drivers/usb/host/sl811-hcd.o' being placed in section `.text.start.constprop.0'
arm-linux-gnueabi-ld: warning: orphan section `.text.start.constprop.0' from `drivers/media/dvb-frontends/drxk_hard.o' being placed in section `.text.start.constprop.0'
arm-linux-gnueabi-ld: warning: orphan section `.text.start' from `drivers/media/dvb-frontends/stv0910.o' being placed in section `.text.start'
arm-linux-gnueabi-ld: warning: orphan section `.text.start.constprop.0' from `drivers/media/pci/ddbridge/ddbridge-sx8.o' being placed in section `.text.start.constprop.0'

Fix that by explicitly adding the partial "substring" sections (.text.s,
.text.st, .text.sta, etc) and their cloned derivatives.

While this unfortunately means that TEXT_MAIN continues to grow,
these changes are ultimately necessary for proper support of
-ffunction-sections.

Fixes: 6568f14cb5ae ("vmlinux.lds: Exclude .text.startup and .text.exit from TEXT_MAIN")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: live-patching@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://patch.msgid.link/cd588144e63df901a656b06b566855019c4a931d.1762991150.git.jpoimboe@kernel.org
Closes: https://lore.kernel.org/oe-kbuild-all/202511040812.DFGedJiy-lkp@intel.com/

authored by

Josh Poimboeuf and committed by
Ingo Molnar
f6a8919d d851f2b2

+12 -11
+12 -11
include/asm-generic/vmlinux.lds.h
··· 90 90 * Support -ffunction-sections by matching .text and .text.*, 91 91 * but exclude '.text..*', .text.startup[.*], and .text.exit[.*]. 92 92 * 93 - * .text.startup and .text.startup.* are matched later by INIT_TEXT. 94 - * .text.exit and .text.exit.* are matched later by EXIT_TEXT. 93 + * .text.startup and .text.startup.* are matched later by INIT_TEXT, and 94 + * .text.exit and .text.exit.* are matched later by EXIT_TEXT, so they must be 95 + * explicitly excluded here. 95 96 * 96 97 * Other .text.* sections that are typically grouped separately, such as 97 98 * .text.unlikely or .text.hot, must be matched explicitly before using ··· 101 100 #define TEXT_MAIN \ 102 101 .text \ 103 102 .text.[_0-9A-Za-df-rt-z]* \ 104 - .text.s[_0-9A-Za-su-z]* \ 105 - .text.st[_0-9A-Zb-z]* \ 106 - .text.sta[_0-9A-Za-qs-z]* \ 107 - .text.star[_0-9A-Za-su-z]* \ 108 - .text.start[_0-9A-Za-tv-z]* \ 109 - .text.startu[_0-9A-Za-oq-z]* \ 103 + .text.s[_0-9A-Za-su-z]* .text.s .text.s.* \ 104 + .text.st[_0-9A-Zb-z]* .text.st .text.st.* \ 105 + .text.sta[_0-9A-Za-qs-z]* .text.sta .text.sta.* \ 106 + .text.star[_0-9A-Za-su-z]* .text.star .text.star.* \ 107 + .text.start[_0-9A-Za-tv-z]* .text.start .text.start.* \ 108 + .text.startu[_0-9A-Za-oq-z]* .text.startu .text.startu.* \ 110 109 .text.startup[_0-9A-Za-z]* \ 111 - .text.e[_0-9A-Za-wy-z]* \ 112 - .text.ex[_0-9A-Za-hj-z]* \ 113 - .text.exi[_0-9A-Za-su-z]* \ 110 + .text.e[_0-9A-Za-wy-z]* .text.e .text.e.* \ 111 + .text.ex[_0-9A-Za-hj-z]* .text.ex .text.ex.* \ 112 + .text.exi[_0-9A-Za-su-z]* .text.exi .text.exi.* \ 114 113 .text.exit[_0-9A-Za-z]* 115 114 116 115 /*