diff mbox

[V1,02/29] xen: Introduce __initconst to store initial const data

Message ID 1377701263-3319-3-git-send-email-julien.grall@linaro.org
State Accepted, archived
Headers show

Commit Message

Julien Grall Aug. 28, 2013, 2:47 p.m. UTC
It's possible to have 2 type (const and non-const) of data in the same
compilation unit. Using only __initdata will result to a compilation error:

    error: $variablename causes as section tupe conflict with $variablename2

because a section containing const variables is marked read only and so cannot
contain non-const variables.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Cambell <ian.campbell@citrix.com>
CC: Jan Beulich <JBeulich@suse.com>
CC: Keir Fraser <keir@xen.org>
---
 xen/include/xen/init.h |    1 +
 1 file changed, 1 insertion(+)

Comments

Ian Campbell Sept. 10, 2013, 10:50 a.m. UTC | #1
On Wed, 2013-08-28 at 15:47 +0100, Julien Grall wrote:
> It's possible to have 2 type (const and non-const) of data in the same
> compilation unit. Using only __initdata will result to a compilation error:
> 
>     error: $variablename causes as section tupe conflict with $variablename2
> 
> because a section containing const variables is marked read only and so cannot
> contain non-const variables.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Acked-by: Ian Cambell <ian.campbell@citrix.com>
> CC: Jan Beulich <JBeulich@suse.com>

Jan said he "didn't mind" this change, so although I've not taken that
as an Ack I have applied this patch.

> CC: Keir Fraser <keir@xen.org>
> ---
>  xen/include/xen/init.h |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/xen/include/xen/init.h b/xen/include/xen/init.h
> index b602577..9d481b3 100644
> --- a/xen/include/xen/init.h
> +++ b/xen/include/xen/init.h
> @@ -10,6 +10,7 @@
>  #define __init            __text_section(".init.text")
>  #define __exit            __text_section(".exit.text")
>  #define __initdata        __section(".init.data")
> +#define __initconst       __section(".init.rodata")
>  #define __exitdata        __used_section(".exit.data")
>  #define __initsetup       __used_section(".init.setup")
>  #define __init_call(lvl)  __used_section(".initcall" lvl ".init")
diff mbox

Patch

diff --git a/xen/include/xen/init.h b/xen/include/xen/init.h
index b602577..9d481b3 100644
--- a/xen/include/xen/init.h
+++ b/xen/include/xen/init.h
@@ -10,6 +10,7 @@ 
 #define __init            __text_section(".init.text")
 #define __exit            __text_section(".exit.text")
 #define __initdata        __section(".init.data")
+#define __initconst       __section(".init.rodata")
 #define __exitdata        __used_section(".exit.data")
 #define __initsetup       __used_section(".init.setup")
 #define __init_call(lvl)  __used_section(".initcall" lvl ".init")