diff options
author | Ivan Kokshaysky <ink@jurassic.park.msu.ru> | 2008-06-20 19:26:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-06-20 19:46:10 -0400 |
commit | ede426923b25414f5ec9c00fefe6727d9721dd13 (patch) | |
tree | 201a873e852807d0b5a02503eecd39a45338be94 /arch/alpha/Makefile | |
parent | 9267b4b3880d00dc2dab90f1d817c856939114f7 (diff) |
alpha: link failure fix
With built-in scsi disk driver, the final link fails with a following
error:
`.exit.text' referenced in section `.rodata' of drivers/built-in.o:
defined in discarded section `.exit.text' of drivers/built-in.o
This happens with -Os (CONFIG_CC_OPTIMIZE_FOR_SIZE=y) with all gcc-4
versions, and also with -O2 and gcc-4.3.
The problem is in sd.c:sd_major() being inlined into __exit function
exit_sd(), and the compiler generating a jump table in .rodata section
for the 'switch' statement in sd_major(). So we have references to
discarded section.
Fixed with a big hammer in the form of -fno-jump-tables.
Note that jump tables vs. discarded sections is a generic problem,
other architectures are just lucky not to suffer from it. But with
a slightly more complex switch/case statement it can be reproduced
on x86 as well. So maybe at some point we should consider
-fno-jump-tables as a generic compile option...
Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/alpha/Makefile')
-rw-r--r-- | arch/alpha/Makefile | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile index 4e1a8e2c4541..4759fe751aa1 100644 --- a/arch/alpha/Makefile +++ b/arch/alpha/Makefile | |||
@@ -13,6 +13,7 @@ NM := $(NM) -B | |||
13 | LDFLAGS_vmlinux := -static -N #-relax | 13 | LDFLAGS_vmlinux := -static -N #-relax |
14 | CHECKFLAGS += -D__alpha__ -m64 | 14 | CHECKFLAGS += -D__alpha__ -m64 |
15 | cflags-y := -pipe -mno-fp-regs -ffixed-8 -msmall-data | 15 | cflags-y := -pipe -mno-fp-regs -ffixed-8 -msmall-data |
16 | cflags-y += $(call cc-option, -fno-jump-tables) | ||
16 | 17 | ||
17 | cpuflags-$(CONFIG_ALPHA_EV4) := -mcpu=ev4 | 18 | cpuflags-$(CONFIG_ALPHA_EV4) := -mcpu=ev4 |
18 | cpuflags-$(CONFIG_ALPHA_EV5) := -mcpu=ev5 | 19 | cpuflags-$(CONFIG_ALPHA_EV5) := -mcpu=ev5 |