summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-12-29 01:01:13 +0100
committerIngo Molnar <mingo@elte.hu>2008-12-29 12:15:49 +0100
commit43a256322ac1fc105c181b3cade3b9bfc0b63ca1 (patch)
tree6f4b6fc286451598d20222af8b511fe0a3fcdcfc
parentsparseirq: work around __weak alias bug (diff)
downloadlinux-43a256322ac1fc105c181b3cade3b9bfc0b63ca1.tar.xz
linux-43a256322ac1fc105c181b3cade3b9bfc0b63ca1.zip
sparseirq: move __weak symbols into separate compilation unit
GCC has a bug with __weak alias functions: if the functions are in the same compilation unit as their call site, GCC can decide to inline them - and thus rob the linker of the opportunity to override the weak alias with the real thing. So move all the IRQ handling related __weak symbols to kernel/irq/chip.c. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--include/linux/interrupt.h6
-rw-r--r--include/linux/irq.h3
-rw-r--r--init/main.c10
-rw-r--r--kernel/irq/manage.c9
-rw-r--r--kernel/softirq.c20
5 files changed, 26 insertions, 22 deletions
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 777f89e00b4a..d9a370325ae2 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -467,4 +467,10 @@ static inline void init_irq_proc(void)
int show_interrupts(struct seq_file *p, void *v);
+struct irq_desc;
+
+extern int early_irq_init(void);
+extern int arch_early_irq_init(void);
+extern int arch_init_chip_data(struct irq_desc *desc, int cpu);
+
#endif
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 0e40af4bac40..d64a6d49bdef 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -193,9 +193,6 @@ struct irq_desc {
const char *name;
} ____cacheline_internodealigned_in_smp;
-extern int early_irq_init(void);
-extern int arch_early_irq_init(void);
-extern int arch_init_chip_data(struct irq_desc *desc, int cpu);
extern void arch_init_copy_chip_data(struct irq_desc *old_desc,
struct irq_desc *desc, int cpu);
extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc);
diff --git a/init/main.c b/init/main.c
index c314aa15370e..2c183abbf61c 100644
--- a/init/main.c
+++ b/init/main.c
@@ -539,16 +539,6 @@ void __init __weak thread_info_cache_init(void)
{
}
-int __init __weak arch_early_irq_init(void)
-{
- return 0;
-}
-
-int __init __weak early_irq_init(void)
-{
- return arch_early_irq_init();
-}
-
asmlinkage void __init start_kernel(void)
{
char * command_line;
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index c2741b02ad38..46953a06f4a8 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -261,15 +261,6 @@ void enable_irq(unsigned int irq)
}
EXPORT_SYMBOL(enable_irq);
-/*
- * [ Not in kernel/irq/handle.c, so that GCC does not
- * inline the __weak alias: ]
- */
-int __weak arch_init_chip_data(struct irq_desc *desc, int cpu)
-{
- return 0;
-}
-
static int set_irq_wake_real(unsigned int irq, unsigned int on)
{
struct irq_desc *desc = irq_to_desc(irq);
diff --git a/kernel/softirq.c b/kernel/softirq.c
index e7c69a720d69..daf46358d2dd 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -797,3 +797,23 @@ int on_each_cpu(void (*func) (void *info), void *info, int wait)
}
EXPORT_SYMBOL(on_each_cpu);
#endif
+
+/*
+ * [ These __weak aliases are kept in a separate compilation unit, so that
+ * GCC does not inline them incorrectly. ]
+ */
+
+int __init __weak early_irq_init(void)
+{
+ return 0;
+}
+
+int __init __weak arch_early_irq_init(void)
+{
+ return 0;
+}
+
+int __weak arch_init_chip_data(struct irq_desc *desc, int cpu)
+{
+ return 0;
+}