[patch 04/29] vmlinux.lds: move __attribute__((__cold__))functions back into final .text section

From: Greg KH
Date: Wed Jul 30 2008 - 19:33:36 EST


2.6.25-stable review patch. If anyone has any objections, please let us
know.

------------------
From: Jan Beulich <jbeulich@xxxxxxxxxx>

commit fb5e2b379732e1a6ea32392980bb42e0212db842 upstream

Due to the addition of __attribute__((__cold__)) to a few symbols
without adjusting the linker scripts, those symbols currently may end
up outside the [_stext,_etext) range, as they get placed in
.text.unlikely by (at least) gcc 4.3.0. This may confuse code not only
outside of the kernel, symbol_put_addr()'s BUG() could also trigger.
Hence we need to add .text.unlikely (and for future uses of
__attribute__((__hot__)) also .text.hot) to the TEXT_TEXT() macro.

Issue observed by Lukas Lipavsky.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
Tested-by: Lukas Lipavsky <llipavsky@xxxxxxx>
Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
include/asm-generic/vmlinux.lds.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -204,6 +204,7 @@
* during second ld run in second ld pass when generating System.map */
#define TEXT_TEXT \
ALIGN_FUNCTION(); \
+ *(.text.hot) \
*(.text) \
*(.ref.text) \
*(.text.init.refok) \
@@ -213,7 +214,8 @@
CPU_KEEP(init.text) \
CPU_KEEP(exit.text) \
MEM_KEEP(init.text) \
- MEM_KEEP(exit.text)
+ MEM_KEEP(exit.text) \
+ *(.text.unlikely)


/* sched.text is aling to function alignment to secure we have same

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/