FRV: Fix the section attribute on UP DECLARE_PER_CPU()
authorDavid Howells <dhowells@redhat.com>
Tue, 21 Apr 2009 22:00:24 +0000 (23:00 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Apr 2009 02:39:59 +0000 (19:39 -0700)
commit9b8de7479d0dbab1ed98b5b015d44232c9d3d08e
tree1b138996efe642f03699a7737af109dfa72ef830
parentccc5ff94c66e628d3c501b26ace5d4339667715d
FRV: Fix the section attribute on UP DECLARE_PER_CPU()

In non-SMP mode, the variable section attribute specified by DECLARE_PER_CPU()
does not agree with that specified by DEFINE_PER_CPU().  This means that
architectures that have a small data section references relative to a base
register may throw up linkage errors due to too great a displacement between
where the base register points and the per-CPU variable.

On FRV, the .h declaration says that the variable is in the .sdata section, but
the .c definition says it's actually in the .data section.  The linker throws
up the following errors:

kernel/built-in.o: In function `release_task':
kernel/exit.c:78: relocation truncated to fit: R_FRV_GPREL12 against symbol `per_cpu__process_counts' defined in .data section in kernel/built-in.o
kernel/exit.c:78: relocation truncated to fit: R_FRV_GPREL12 against symbol `per_cpu__process_counts' defined in .data section in kernel/built-in.o

To fix this, DECLARE_PER_CPU() should simply apply the same section attribute
as does DEFINE_PER_CPU().  However, this is made slightly more complex by
virtue of the fact that there are several variants on DEFINE, so these need to
be matched by variants on DECLARE.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/alpha/include/asm/percpu.h
arch/ia64/include/asm/smp.h
arch/x86/include/asm/desc.h
arch/x86/include/asm/hardirq.h
arch/x86/include/asm/processor.h
arch/x86/include/asm/tlbflush.h
include/asm-generic/percpu.h
include/linux/percpu.h
net/rds/rds.h