From: Tejun Heo Date: Fri, 3 Jul 2009 22:13:18 +0000 (+0900) Subject: Merge branch 'master' into for-next X-Git-Tag: upstream/snapshot3+hdmi~17644^2^2~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c43768cbb7655ea5ff782ae250f6e2ef4297cf98;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git Merge branch 'master' into for-next Pull linus#master to merge PER_CPU_DEF_ATTRIBUTES and alpha build fix changes. As alpha in percpu tree uses 'weak' attribute instead of inline assembly, there's no need for __used attribute. Conflicts: arch/alpha/include/asm/percpu.h arch/mn10300/kernel/vmlinux.lds.S include/linux/percpu-defs.h --- c43768cbb7655ea5ff782ae250f6e2ef4297cf98 diff --cc arch/arm/kernel/vmlinux.lds.S index e256c57,6937102..5cc4812 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@@ -82,9 -83,16 +83,17 @@@ SECTION EXIT_TEXT EXIT_DATA *(.exitcall.exit) + *(.discard) *(.ARM.exidx.exit.text) *(.ARM.extab.exit.text) + #ifndef CONFIG_HOTPLUG_CPU + *(.ARM.exidx.cpuexit.text) + *(.ARM.extab.cpuexit.text) + #endif + #ifndef CONFIG_HOTPLUG + *(.ARM.exidx.devexit.text) + *(.ARM.extab.devexit.text) + #endif #ifndef CONFIG_MMU *(.fixup) *(__ex_table) diff --cc arch/mn10300/kernel/vmlinux.lds.S index 5d9f2f9,bcebcef..5609d49 --- a/arch/mn10300/kernel/vmlinux.lds.S +++ b/arch/mn10300/kernel/vmlinux.lds.S @@@ -145,8 -117,7 +117,8 @@@ SECTION /* Sections to be discarded */ /DISCARD/ : { - *(.exitcall.exit) + EXIT_CALL + *(.discard) } STABS_DEBUG diff --cc include/asm-generic/vmlinux.lds.h index a19120c,dccdbed..c5c18ac --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@@ -625,17 -626,9 +626,17 @@@ *(.init.ramfs) \ VMLINUX_SYMBOL(__initramfs_end) = .; #else - #define INITRAMFS + #define INIT_RAM_FS #endif +#define DISCARDS \ + /DISCARD/ : { \ + EXIT_TEXT \ + EXIT_DATA \ + *(.exitcall.exit) \ + *(.discard) \ + } + /** * PERCPU_VADDR - define output section for percpu area * @vaddr: explicit base address (optional) diff --cc include/linux/percpu-defs.h index 9b7a53c,68438e1..aefc2f1 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h @@@ -17,61 -17,15 +17,63 @@@ * linkage errors occur due the compiler generating the wrong code to access * that section. */ -#define DECLARE_PER_CPU_SECTION(type, name, section) \ - extern \ - __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ - PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name - -#define DEFINE_PER_CPU_SECTION(type, name, section) \ - __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ - PER_CPU_ATTRIBUTES PER_CPU_DEF_ATTRIBUTES \ +#define __PCPU_ATTRS(sec) \ + __attribute__((section(PER_CPU_BASE_SECTION sec))) \ + PER_CPU_ATTRIBUTES + +#define __PCPU_DUMMY_ATTRS \ + __attribute__((section(".discard"), unused)) + +/* + * s390 and alpha modules require percpu variables to be defined as + * weak to force the compiler to generate GOT based external + * references for them. This is necessary because percpu sections + * will be located outside of the usually addressable area. + * + * This definition puts the following two extra restrictions when + * defining percpu variables. + * + * 1. The symbol must be globally unique, even the static ones. + * 2. Static percpu variables cannot be defined inside a function. + * + * Archs which need weak percpu definitions should define + * ARCH_NEEDS_WEAK_PER_CPU in asm/percpu.h when necessary. + * + * To ensure that the generic code observes the above two + * restrictions, if CONFIG_DEBUG_FORCE_WEAK_PER_CPU is set weak + * definition is used for all cases. + */ +#if defined(ARCH_NEEDS_WEAK_PER_CPU) || defined(CONFIG_DEBUG_FORCE_WEAK_PER_CPU) +/* + * __pcpu_scope_* dummy variable is used to enforce scope. It + * receives the static modifier when it's used in front of + * DEFINE_PER_CPU() and will trigger build failure if + * DECLARE_PER_CPU() is used for the same variable. + * + * __pcpu_unique_* dummy variable is used to enforce symbol uniqueness + * such that hidden weak symbol collision, which will cause unrelated + * variables to share the same address, can be detected during build. + */ +#define DECLARE_PER_CPU_SECTION(type, name, sec) \ + extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ + extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name + +#define DEFINE_PER_CPU_SECTION(type, name, sec) \ + __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ + __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ - __PCPU_ATTRS(sec) __weak __typeof__(type) per_cpu__##name ++ __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ ++ __typeof__(type) per_cpu__##name +#else +/* + * Normal declaration and definition macros. + */ +#define DECLARE_PER_CPU_SECTION(type, name, sec) \ + extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name + +#define DEFINE_PER_CPU_SECTION(type, name, sec) \ - __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name ++ __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \ + __typeof__(type) per_cpu__##name +#endif /* * Variant on the per-CPU variable declaration/definition theme used for