]> git.baikalelectronics.ru Git - kernel.git/commit
[MIPS] Discard .exit.text and .exit.data at runtime.
authorRalf Baechle <ralf@linux-mips.org>
Mon, 11 Dec 2006 11:54:52 +0000 (11:54 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 12 Dec 2006 01:46:24 +0000 (01:46 +0000)
commit428504d39d5ea6ac933768ca813d86250359f04e
treeaf5c5dcb2a6880cef1f8bfcd2b7b3586efc4bd66
parent601971b5b351701bb11dd7389fc8e78d01d6c858
[MIPS] Discard .exit.text and .exit.data at runtime.

While the recent cset 1c00235fe4aaba4bcaa1b7eef574f2d4affad0a1 did improve
things it didn't resolve all the problems.  So bite the bullet and discard
.exit.text and .exit.data at runtime.  Which of course sucks because it
bloats binaries with code that will never ever be used but it's the only
thing that will work reliable as demonstrated by the function sd_major() in
drivers/scsi/sd.c.

Gcc may compile sd_major() using a jump table which it will put into
.rodata.  If it also inlines sd_major's function body into exit_sd() which
gcc > 3.4.x does.  If CONFIG_BLK_DEV_SD has been set to y we would like ld
to discard exit_sd's code at link time.  However sd_major happens to
contain a switch statement which gcc will compile using a jump table in
.rodata on the architectures I checked.  So, when ld later discards
.exit.text only the jump table in .rodata with its stale references to
the discard .exit.text will be left which any no antique ld will honor
with a link error.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/vmlinux.lds.S