Skip to contentSkip to conversation

Fix section type conflict in arch/ia64/xen/xen_pv_ops.c

PATCH In review Takashi Iwai 4 participants 13 messages Nov 6, 2008 – Nov 12, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix section type conflict in arch/ia64/xen/xen_pv_ops.c

__initdata and const cannot be always a happy pair, as gcc-4.3.3 gives the compile errors like:

arch/ia64/xen/xen_pv_ops.c:156: error: xen_init_ops causes a section type conflict arch/ia64/xen/xen_pv_ops.c:340: error: xen_iosapic_ops causes a section type conflict

This patch simply removes const from data with __initdata.

---

arch/ia64/xen/xen_pv_ops.c +3 -3
index 04cd123..5d491d9 100644
@@ -153,7 +153,7 @@ xen_post_smp_prepare_boot_cpu(void)
 	xen_setup_vcpu_info_placement();
 }
 
-static const struct pv_init_ops xen_init_ops __initdata = {
+static struct pv_init_ops xen_init_ops __initdata = {
 	.banner = xen_banner,
 
 	.reserve_memory = xen_reserve_memory,
@@ -260,7 +260,7 @@ xen_intrin_local_irq_restore(unsigned long mask)
 		xen_rsm_i();
 }
 
-static const struct pv_cpu_ops xen_cpu_ops __initdata = {
+static struct pv_cpu_ops xen_cpu_ops __initdata = {
 	.fc		= xen_fc,
 	.thash		= xen_thash,
 	.get_cpuid	= xen_get_cpuid,
@@ -337,7 +337,7 @@ xen_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
 	HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
 }
 
-static const struct pv_iosapic_ops xen_iosapic_ops __initdata = {
+static struct pv_iosapic_ops xen_iosapic_ops __initdata = {
 	.pcat_compat_init = xen_pcat_compat_init,
 	.__get_irq_chip = xen_iosapic_get_irq_chip,
 
#1 lore raw
Quoted 8 lines · Takashi Iwai

__initdata and const cannot be always a happy pair, as gcc-4.3.3 gives the compile errors like:

arch/ia64/xen/xen_pv_ops.c:156: error: xen_init_ops causes a section type conflict arch/ia64/xen/xen_pv_ops.c:340: error: xen_iosapic_ops causes a section type conflict

This patch simply removes const from data with __initdata.

Yeah, I've seen these sort of messages before, but I don't see why there's an inherent problem with having const __initdata.

Sam?

J

Quoted 35 lines

---

arch/ia64/xen/xen_pv_ops.c +3 -3
index 04cd123..5d491d9 100644
@@ -153,7 +153,7 @@ xen_post_smp_prepare_boot_cpu(void)
 	xen_setup_vcpu_info_placement();
 }
 
-static const struct pv_init_ops xen_init_ops __initdata = {
+static struct pv_init_ops xen_init_ops __initdata = {
 	.banner = xen_banner,
 
 	.reserve_memory = xen_reserve_memory,
@@ -260,7 +260,7 @@ xen_intrin_local_irq_restore(unsigned long mask)
 		xen_rsm_i();
 }
 
-static const struct pv_cpu_ops xen_cpu_ops __initdata = {
+static struct pv_cpu_ops xen_cpu_ops __initdata = {
 	.fc		= xen_fc,
 	.thash		= xen_thash,
 	.get_cpuid	= xen_get_cpuid,
@@ -337,7 +337,7 @@ xen_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
 	HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
 }
 
-static const struct pv_iosapic_ops xen_iosapic_ops __initdata = {
+static struct pv_iosapic_ops xen_iosapic_ops __initdata = {
 	.pcat_compat_init = xen_pcat_compat_init,
 	.__get_irq_chip = xen_iosapic_get_irq_chip,
 
#2 lore raw

At Thu, 06 Nov 2008 10:57:21 -0800,

Quoted 5 lines · Jeremy Fitzhardinge
Quoted 3 lines · Takashi Iwai

__initdata and const cannot be always a happy pair, as gcc-4.3.3 gives the compile errors like:

Quoted 8 lines
Quoted 5 lines

arch/ia64/xen/xen_pv_ops.c:156: error: xen_init_ops causes a section type conflict arch/ia64/xen/xen_pv_ops.c:340: error: xen_iosapic_ops causes a section type conflict

This patch simply removes const from data with __initdata.

Yeah, I've seen these sort of messages before, but I don't see why there's an inherent problem with having const __initdata.

Oh, wait; just looking through linux/init.h, I see we have now __initconst. Maybe this is the right choice?

This would be better documented somewhere in Documentation/*...

thanks,

Takashi

Quoted 41 lines

Sam?

J

Quoted 35 lines

---

arch/ia64/xen/xen_pv_ops.c +3 -3
index 04cd123..5d491d9 100644
@@ -153,7 +153,7 @@ xen_post_smp_prepare_boot_cpu(void)
 	xen_setup_vcpu_info_placement();
 }
 
-static const struct pv_init_ops xen_init_ops __initdata = {
+static struct pv_init_ops xen_init_ops __initdata = {
 	.banner = xen_banner,
 
 	.reserve_memory = xen_reserve_memory,
@@ -260,7 +260,7 @@ xen_intrin_local_irq_restore(unsigned long mask)
 		xen_rsm_i();
 }
 
-static const struct pv_cpu_ops xen_cpu_ops __initdata = {
+static struct pv_cpu_ops xen_cpu_ops __initdata = {
 	.fc		= xen_fc,
 	.thash		= xen_thash,
 	.get_cpuid	= xen_get_cpuid,
@@ -337,7 +337,7 @@ xen_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
 	HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
 }
 
-static const struct pv_iosapic_ops xen_iosapic_ops __initdata = {
+static struct pv_iosapic_ops xen_iosapic_ops __initdata = {
 	.pcat_compat_init = xen_pcat_compat_init,
 	.__get_irq_chip = xen_iosapic_get_irq_chip,
 
#3 lore raw
In reply to Jeremy Fitzhardinge
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 8 lines · Takashi Iwai

__initdata and const cannot be always a happy pair, as gcc-4.3.3 gives the compile errors like:

arch/ia64/xen/xen_pv_ops.c:156: error: xen_init_ops causes a section type conflict
arch/ia64/xen/xen_pv_ops.c:340: error: xen_iosapic_ops causes a section type conflict

Quoted 7 lines
Quoted 2 lines

This patch simply removes const from data with __initdata.

Yeah, I've seen these sort of messages before, but I don't see why there's an inherent problem with having const __initdata.

Sam?

The root problem here is that in some cases gcc will stuff this into a section marked CONST and in other cases not.
So when we manually specify the section we better not mix const and non-const stuff in the same section.
The problem is that it is very gcc dependent. I have with powerpc seen that the same code was not put in CONST with a 32 bit build, but with the 64 bit build it was.
The only cure was to remove the const and use initdata. You can try to play with initconst - and it may work.
But you need to have pretty good build coverage to be sure.

Sam

#4 lore raw

At Thu, 6 Nov 2008 22:48:48 +0100,

Quoted 19 lines · Sam Ravnborg
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 8 lines · Takashi Iwai

__initdata and const cannot be always a happy pair, as gcc-4.3.3 gives the compile errors like:

arch/ia64/xen/xen_pv_ops.c:156: error: xen_init_ops causes a section type conflict
arch/ia64/xen/xen_pv_ops.c:340: error: xen_iosapic_ops causes a section type conflict

Quoted 7 lines
Quoted 2 lines

This patch simply removes const from data with __initdata.

Yeah, I've seen these sort of messages before, but I don't see why there's an inherent problem with having const __initdata.

Sam?

Quoted 10 lines

The root problem here is that in some cases gcc will stuff this into a section marked CONST and in other cases not.
So when we manually specify the section we better not mix const and non-const stuff in the same section.
The problem is that it is very gcc dependent. I have with powerpc seen that the same code was not put in CONST with a 32 bit build, but with the 64 bit build it was.
The only cure was to remove the const and use initdata. You can try to play with initconst - and it may work.
But you need to have pretty good build coverage to be sure.

OK, then my original patch should do right :)
Do you guys see any problems with it?

Right now 2.6.28-rc kernel doesn't build, thus this is basically a regression.

thanks,

Takashi

#5 lore raw
Quoted 32 lines · Takashi Iwai

At Thu, 6 Nov 2008 22:48:48 +0100,

Quoted 19 lines · Sam Ravnborg
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 8 lines · Takashi Iwai

__initdata and const cannot be always a happy pair, as gcc-4.3.3 gives the compile errors like:

arch/ia64/xen/xen_pv_ops.c:156: error: xen_init_ops causes a section type conflict
arch/ia64/xen/xen_pv_ops.c:340: error: xen_iosapic_ops causes a section type conflict

Quoted 7 lines
Quoted 2 lines

This patch simply removes const from data with __initdata.

Yeah, I've seen these sort of messages before, but I don't see why there's an inherent problem with having const __initdata.

Sam?

Quoted 10 lines

The root problem here is that in some cases gcc will stuff this into a section marked CONST and in other cases not.
So when we manually specify the section we better not mix const and non-const stuff in the same section.
The problem is that it is very gcc dependent. I have with powerpc seen that the same code was not put in CONST with a 32 bit build, but with the 64 bit build it was.
The only cure was to remove the const and use initdata. You can try to play with initconst - and it may work.
But you need to have pretty good build coverage to be sure.

Quoted 5 lines

OK, then my original patch should do right :)
Do you guys see any problems with it?

Right now 2.6.28-rc kernel doesn't build, thus this is basically a regression.

I'm fine with the patch.

The above sounds x86 xen potentially has the same issue, though.

linux-2.6/arch/x86/xen $ grep __initdata *
enlighten.c:static const struct pv_info xen_info __initdata = { enlighten.c:static const struct pv_init_ops xen_init_ops __initdata = { enlighten.c:static const struct pv_time_ops xen_time_ops __initdata = { enlighten.c:static const struct pv_cpu_ops xen_cpu_ops __initdata = { enlighten.c:static const struct pv_apic_ops xen_apic_ops __initdata = { enlighten.c:static const struct pv_mmu_ops xen_mmu_ops __initdata = { enlighten.c:static const struct machine_ops __initdata xen_machine_ops = { irq.c:static const struct pv_irq_ops xen_irq_ops __initdata = { smp.c:static const struct smp_ops xen_smp_ops __initdata = {

thanks,

Signature · 1 line
yamahata
#6 lore raw

At Tue, 11 Nov 2008 17:15:52 +0900,

Quoted 44 lines · Isaku Yamahata
Quoted 32 lines · Takashi Iwai

At Thu, 6 Nov 2008 22:48:48 +0100,

Quoted 19 lines · Sam Ravnborg
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 8 lines · Takashi Iwai

__initdata and const cannot be always a happy pair, as gcc-4.3.3 gives the compile errors like:

arch/ia64/xen/xen_pv_ops.c:156: error: xen_init_ops causes a section type conflict
arch/ia64/xen/xen_pv_ops.c:340: error: xen_iosapic_ops causes a section type conflict

Quoted 7 lines
Quoted 2 lines

This patch simply removes const from data with __initdata.

Yeah, I've seen these sort of messages before, but I don't see why there's an inherent problem with having const __initdata.

Sam?

Quoted 10 lines

The root problem here is that in some cases gcc will stuff this into a section marked CONST and in other cases not.
So when we manually specify the section we better not mix const and non-const stuff in the same section.
The problem is that it is very gcc dependent. I have with powerpc seen that the same code was not put in CONST with a 32 bit build, but with the 64 bit build it was.
The only cure was to remove the const and use initdata. You can try to play with initconst - and it may work.
But you need to have pretty good build coverage to be sure.

Quoted 5 lines

OK, then my original patch should do right :)
Do you guys see any problems with it?

Right now 2.6.28-rc kernel doesn't build, thus this is basically a regression.

I'm fine with the patch.

The above sounds x86 xen potentially has the same issue, though.

Quoted 10 lines

linux-2.6/arch/x86/xen $ grep __initdata *
enlighten.c:static const struct pv_info xen_info __initdata = { enlighten.c:static const struct pv_init_ops xen_init_ops __initdata = { enlighten.c:static const struct pv_time_ops xen_time_ops __initdata = { enlighten.c:static const struct pv_cpu_ops xen_cpu_ops __initdata = { enlighten.c:static const struct pv_apic_ops xen_apic_ops __initdata = { enlighten.c:static const struct pv_mmu_ops xen_mmu_ops __initdata = { enlighten.c:static const struct machine_ops __initdata xen_machine_ops = { irq.c:static const struct pv_irq_ops xen_irq_ops __initdata = { smp.c:static const struct smp_ops xen_smp_ops __initdata = {

Oh, care to create a patch?

thanks,

Takashi

#7 lore raw
Quoted 57 lines · Takashi Iwai

At Tue, 11 Nov 2008 17:15:52 +0900,

Quoted 44 lines · Isaku Yamahata
Quoted 32 lines · Takashi Iwai

At Thu, 6 Nov 2008 22:48:48 +0100,

Quoted 19 lines · Sam Ravnborg
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 8 lines · Takashi Iwai

__initdata and const cannot be always a happy pair, as gcc-4.3.3 gives the compile errors like:

arch/ia64/xen/xen_pv_ops.c:156: error: xen_init_ops causes a section type conflict
arch/ia64/xen/xen_pv_ops.c:340: error: xen_iosapic_ops causes a section type conflict

Quoted 7 lines
Quoted 2 lines

This patch simply removes const from data with __initdata.

Yeah, I've seen these sort of messages before, but I don't see why there's an inherent problem with having const __initdata.

Sam?

Quoted 10 lines

The root problem here is that in some cases gcc will stuff this into a section marked CONST and in other cases not.
So when we manually specify the section we better not mix const and non-const stuff in the same section.
The problem is that it is very gcc dependent. I have with powerpc seen that the same code was not put in CONST with a 32 bit build, but with the 64 bit build it was.
The only cure was to remove the const and use initdata. You can try to play with initconst - and it may work.
But you need to have pretty good build coverage to be sure.

Quoted 5 lines

OK, then my original patch should do right :)
Do you guys see any problems with it?

Right now 2.6.28-rc kernel doesn't build, thus this is basically a regression.

I'm fine with the patch.

The above sounds x86 xen potentially has the same issue, though.

Quoted 10 lines

linux-2.6/arch/x86/xen $ grep __initdata *
enlighten.c:static const struct pv_info xen_info __initdata = { enlighten.c:static const struct pv_init_ops xen_init_ops __initdata = { enlighten.c:static const struct pv_time_ops xen_time_ops __initdata = { enlighten.c:static const struct pv_cpu_ops xen_cpu_ops __initdata = { enlighten.c:static const struct pv_apic_ops xen_apic_ops __initdata = { enlighten.c:static const struct pv_mmu_ops xen_mmu_ops __initdata = { enlighten.c:static const struct machine_ops __initdata xen_machine_ops = { irq.c:static const struct pv_irq_ops xen_irq_ops __initdata = { smp.c:static const struct smp_ops xen_smp_ops __initdata = {

Quoted 1 line

Oh, care to create a patch?

Here is.

__initdata and const cannot be always a happy pair and x86 xen has the potential issue.
This patch simply removes const from data with __initdata under arch/x86/xen/.

arch/x86/xen/enlighten.c +7 -7
index 0013a72..19f758c 100644
@@ -1173,14 +1173,14 @@ static void xen_set_fixmap(unsigned idx, unsigned long phys, pgprot_t prot)
 #endif
 }
 
-static const struct pv_info xen_info __initdata = {
+static struct pv_info xen_info __initdata = {
 	.paravirt_enabled = 1,
 	.shared_kernel_pmd = 0,
 
 	.name = "Xen",
 };
 
-static const struct pv_init_ops xen_init_ops __initdata = {
+static struct pv_init_ops xen_init_ops __initdata = {
 	.patch = xen_patch,
 
 	.banner = xen_banner,
@@ -1189,7 +1189,7 @@ static const struct pv_init_ops xen_init_ops __initdata = {
 	.post_allocator_init = xen_post_allocator_init,
 };
 
-static const struct pv_time_ops xen_time_ops __initdata = {
+static struct pv_time_ops xen_time_ops __initdata = {
 	.time_init = xen_time_init,
 
 	.set_wallclock = xen_set_wallclock,
@@ -1198,7 +1198,7 @@ static const struct pv_time_ops xen_time_ops __initdata = {
 	.sched_clock = xen_sched_clock,
 };
 
-static const struct pv_cpu_ops xen_cpu_ops __initdata = {
+static struct pv_cpu_ops xen_cpu_ops __initdata = {
 	.cpuid = xen_cpuid,
 
 	.set_debugreg = xen_set_debugreg,
@@ -1260,7 +1260,7 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
 	},
 };
 
-static const struct pv_apic_ops xen_apic_ops __initdata = {
+static struct pv_apic_ops xen_apic_ops __initdata = {
 #ifdef CONFIG_X86_LOCAL_APIC
 	.setup_boot_clock = paravirt_nop,
 	.setup_secondary_clock = paravirt_nop,
@@ -1268,7 +1268,7 @@ static const struct pv_apic_ops xen_apic_ops __initdata = {
 #endif
 };
 
-static const struct pv_mmu_ops xen_mmu_ops __initdata = {
+static struct pv_mmu_ops xen_mmu_ops __initdata = {
 	.pagetable_setup_start = xen_pagetable_setup_start,
 	.pagetable_setup_done = xen_pagetable_setup_done,
 
@@ -1381,7 +1381,7 @@ static void xen_crash_shutdown(struct pt_regs *regs)
 	xen_reboot(SHUTDOWN_crash);
 }
 
-static const struct machine_ops __initdata xen_machine_ops = {
+static struct machine_ops __initdata xen_machine_ops = {
 	.restart = xen_restart,
 	.halt = xen_machine_halt,
 	.power_off = xen_machine_halt,
arch/x86/xen/irq.c +1 -1
index 28b85ab..ffadf3a 100644
@@ -124,7 +124,7 @@ static void xen_halt(void)
 		xen_safe_halt();
 }
 
-static const struct pv_irq_ops xen_irq_ops __initdata = {
+static struct pv_irq_ops xen_irq_ops __initdata = {
 	.init_IRQ = __xen_init_IRQ,
 	.save_fl = xen_save_fl,
 	.restore_fl = xen_restore_fl,
arch/x86/xen/smp.c +1 -1
index d77da61..f0a1ea3 100644
@@ -466,7 +466,7 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static const struct smp_ops xen_smp_ops __initdata = {
+static struct smp_ops xen_smp_ops __initdata = {
 	.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
 	.smp_prepare_cpus = xen_smp_prepare_cpus,
 	.smp_cpus_done = xen_smp_cpus_done,
Signature · 1 line
yamahata
#8 lore raw
Quoted 7 lines · Isaku Yamahata

Here is.

__initdata and const cannot be always a happy pair and x86 xen has the potential issue.
This patch simply removes const from data with __initdata under arch/x86/xen/.

No, I think the proper fix is to use __initconst.

J

#9 lore raw

At Tue, 11 Nov 2008 09:43:27 -0800,

Quoted 11 lines · Jeremy Fitzhardinge
Quoted 7 lines · Isaku Yamahata

Here is.

__initdata and const cannot be always a happy pair and x86 xen has the potential issue.
This patch simply removes const from data with __initdata under arch/x86/xen/.

No, I think the proper fix is to use __initconst.

The problem is that it depends on gcc version which section it goes. Thus __initconst could break some gcc versions as well.

Takashi

#10 lore raw
Quoted 13 lines · Takashi Iwai

At Tue, 11 Nov 2008 09:43:27 -0800,

Quoted 10 lines · Jeremy Fitzhardinge
Quoted 8 lines · Isaku Yamahata

Here is.

__initdata and const cannot be always a happy pair and x86 xen has the potential issue.
This patch simply removes const from data with __initdata under arch/x86/xen/.

Quoted 6 lines
Quoted 2 lines

No, I think the proper fix is to use __initconst.

The problem is that it depends on gcc version which section it goes. Thus __initconst could break some gcc versions as well.

Why? __initconst explicitly puts it in .init.rodata.

J

#11 lore raw

At Tue, 11 Nov 2008 10:47:24 -0800,

Quoted 15 lines · Jeremy Fitzhardinge
Quoted 13 lines · Takashi Iwai

At Tue, 11 Nov 2008 09:43:27 -0800,

Quoted 10 lines · Jeremy Fitzhardinge
Quoted 8 lines · Isaku Yamahata

Here is.

__initdata and const cannot be always a happy pair and x86 xen has the potential issue.
This patch simply removes const from data with __initdata under arch/x86/xen/.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

No, I think the proper fix is to use __initconst.

The problem is that it depends on gcc version which section it goes. Thus __initconst could break some gcc versions as well.

Why? __initconst explicitly puts it in .init.rodata.

Hrm, right, that's what __initconst does. Just confused. Then I'm wondering in which case __initconst can be broken... Sam? Do you have any particular reports?

Takashi

#12 lore raw
Quoted 24 lines · Takashi Iwai

At Tue, 11 Nov 2008 10:47:24 -0800,

Quoted 22 lines · Jeremy Fitzhardinge
Quoted 19 lines · Takashi Iwai

At Tue, 11 Nov 2008 09:43:27 -0800,

Quoted 4 lines · Jeremy Fitzhardinge
Quoted 2 lines · Isaku Yamahata

Here is.

Quoted 8 lines
Quoted 6 lines

__initdata and const cannot be always a happy pair and x86 xen has the potential issue.
This patch simply removes const from data with __initdata under arch/x86/xen/.

No, I think the proper fix is to use __initconst.

The problem is that it depends on gcc version which section it goes. Thus __initconst could break some gcc versions as well.

Quoted 5 lines
Quoted 1 line

Why? __initconst explicitly puts it in .init.rodata.

Hrm, right, that's what __initconst does. Just confused. Then I'm wondering in which case __initconst can be broken... Sam? Do you have any particular reports?

I have only got reports that __initconst causes gcc build failure on powerpc 64 bit.
So for x86 it should be safe to use __initconst.

Sam