Re: linux-next: build failure after merge of the xen tree

Jeremy Fitzhardinge
2010-07-23T05:56:19Z

On 07/22/2010 09:01 PM, Stephen Rothwell wrote:
> After merging the xen tree, today's linux-next build (86_64 allmodconfig)
> failed like this:
>
> arch/x86/xen/enlighten.c:71: error: __pcpu_scope_xen_vcpu causes a section type conflict
> arch/x86/xen/enlighten.c:72: error: __pcpu_scope_xen_vcpu_info causes a section type conflict
> arch/x86/xen/enlighten.c:71: error: __pcpu_unique_xen_vcpu causes a section type conflict
> arch/x86/xen/enlighten.c:72: error: __pcpu_unique_xen_vcpu_info causes a section type conflict
> arch/x86/xen/enlighten.c:558: error: __pcpu_unique_idt_desc causes a section type conflict
> arch/x86/xen/enlighten.c:760: error: __pcpu_unique_xen_cr0_value causes a section type conflict
>
> Not sure what has caused this. I have dropped the xen tree for today.
>
> gcc version 4.4.4 binutils version 2.20.1.
>

I can reproduce this.

I bisected it down to change bee6ab53e652a414af20392899879b58cd80d033.

Ah! That change uses RESERVE_BRK(), which creates a dummy function and
puts it into the .discard section. Presumably that makes gcc think that
.discard is for code, and so when the percpu stuff starts putting data
into .discard, gcc (now) complains. If we add more .discard.* sections
then everyone is happy:

diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 86b1506..ef292c7 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -82,7 +82,7 @@ void *extend_brk(size_t size, size_t align);
* executable.)
*/
#define RESERVE_BRK(name,sz) \
- static void __section(.discard) __used \
+ static void __section(.discard.text) __used \
__brk_reservation_fn_##name##__(void) { \
asm volatile ( \
".pushsection .brk_reservation,\"aw\",@nobits;" \
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 48c5299..ae6b88e 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -643,6 +643,7 @@
EXIT_DATA \
EXIT_CALL \
*(.discard) \
+ *(.discard.*) \
}

/**

I'll write up a proper patch.

Thanks,
J