Skip to contentSkip to conversation

kbuild: Fix .text.unlikely placement

PATCH In review Andi Kleen 2 participants 2 messages Jul 20, 2015 – Aug 20, 2015

Subsystems (2)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 kbuild: Fix .text.unlikely placement

From: Andi Kleen <[email protected]>

When building a kernel with .text.unlikely text the unlikely text for each translation unit was put next to the main .text code in the final vmlinux.

The problem is that the linker doesn't allow more specific submatches of a section name in a different linker script statement after the main match.

So we need to move them all into one line. With that change .text.unlikely is at the end of everything again.

I also moved .text.hot into the same statement though, even though that's not strictly needed.

---
 include/asm-generic/vmlinux.lds.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
include/asm-generic/vmlinux.lds.h +1 -3
index 8bd374d..1781e54 100644
@@ -412,12 +412,10 @@
  * during second ld run in second ld pass when generating System.map */
 #define TEXT_TEXT							\
 		ALIGN_FUNCTION();					\
-		*(.text.hot)						\
-		*(.text .text.fixup)					\
+		*(.text.hot .text .text.fixup .text.unlikely)		\
 		*(.ref.text)						\
 	MEM_KEEP(init.text)						\
 	MEM_KEEP(exit.text)						\
-		*(.text.unlikely)
 
 
 /* sched.text is aling to function alignment to secure we have same
Signature · 1 line
2.4.5
#1 lore raw
Quoted 10 lines · Andi Kleen

From: Andi Kleen <[email protected]>

When building a kernel with .text.unlikely text the unlikely text for each translation unit was put next to the main .text code in the final vmlinux.

The problem is that the linker doesn't allow more specific submatches of a section name in a different linker script statement after the main match.

Quoted 7 lines

So we need to move them all into one line. With that change .text.unlikely is at the end of everything again.

I also moved .text.hot into the same statement though, even though that's not strictly needed.

Applied to kbuild.git#kbuild.

Michal