Revert "mm: don't use _{g, m}fn for defining INVALID_{G, M}FN"
PATCH 1/2 Revert "mm: don't use _{g, m}fn for defining INVALID_{G, M}FN"
This reverts commit 725039d39ef10c6e3c59ba4a2511188281133b19. The change was intended to solve compilation when using INVALID_{G,M}FN for global variables.
However, due to a compiler bug this will not work for GCC up to 5.0 (see [1]).
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856
--- xen/include/xen/mm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
xen/include/xen/mm.h +2 -2
@@ -56,7 +56,7 @@ TYPE_SAFE(unsigned long, mfn);#define PRI_mfn "05lx" -#define INVALID_MFN ((const mfn_t){ ~0UL }) +#define INVALID_MFN _mfn(~0UL)#ifndef mfn_t#define mfn_t/* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */
@@ -89,7 +89,7 @@ static inline bool_t mfn_eq(mfn_t x, mfn_t y) TYPE_SAFE(unsigned long, gfn);#define PRI_gfn "05lx" -#define INVALID_GFN ((const gfn_t){ ~0UL }) +#define INVALID_GFN _gfn(~0UL)#ifndef gfn_t#define gfn_t/* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 2/2 xen/mm: Introduce {G, M}FN_INVALID_INITIALIZER
The current implementation of {G,M}FN_INVALID cannot be used to initialize global variable because the initializer element is not a constant.
Due to a bug in GCC 4.9 and older ([1]), it is not easy to find a common value to initialize a variable and directly passed as an argument.
Introduce 2 news define {G,M}FN_INVALID_INITIALIZER to be used for initializing a variable.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856
---
Build tested it with:
* ARM: GCC 4.9.4, 5.1, 4.3, 6.1.1, 7.1.0
* x86: Clang 3.5.0, 3.6.0, 3.6.2, 3.8.0, 3.9.0, 4.0.0
With introducing a dummy global variable common/mm.c:
mfn_t foo = INVALID_MFN_INITIALIZER
--- xen/include/xen/mm.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
xen/include/xen/mm.h +10 -0
@@ -57,6 +57,11 @@ TYPE_SAFE(unsigned long, mfn);#define PRI_mfn "05lx"#define INVALID_MFN _mfn(~0UL) +/* +* To be used for global variable initialization. This workaround a bug +* in GCC < 5.0. +*/ +#define INVALID_MFN_INITIALIZER {~0UL}#ifndef mfn_t#define mfn_t/* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */
@@ -90,6 +95,11 @@ static inline bool_t mfn_eq(mfn_t x, mfn_t y) TYPE_SAFE(unsigned long, gfn);#define PRI_gfn "05lx"#define INVALID_GFN _gfn(~0UL) +/* +* To be used for global variable initialization. This workaround a bug +* in GCC < 5.0 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856 +*/ +#define INVALID_GFN_INITIALIZER { ~0UL }#ifndef gfn_t#define gfn_t/* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 2/2] xen/mm: Introduce {G, M}FN_INVALID_INITIALIZER
Quoted 7 lines · Julien Grall
The current implementation of {G,M}FN_INVALID cannot be used to initialize global variable because the initializer element is not a constant.
Due to a bug in GCC 4.9 and older ([1]), it is not easy to find a common value to initialize a variable and directly passed as an argument.
Quoted 6 lines
Introduce 2 news define {G,M}FN_INVALID_INITIALIZER to be used for initializing a variable.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856
Signed-off-by Julien Grall <[email protected]>
but please choose either { ~0UL } or {~0UL} and use it for both.
Quoted 43 lines
---
Build tested it with:
* ARM: GCC 4.9.4, 5.1, 4.3, 6.1.1, 7.1.0
* x86: Clang 3.5.0, 3.6.0, 3.6.2, 3.8.0, 3.9.0, 4.0.0With introducing a dummy global variable
common/mm.c:
mfn_tfoo =INVALID_MFN_INITIALIZER--- xen/include/xen/mm.h | 10 ++++++++++ 1 file changed, 10 insertions(+)xen/include/xen/mm.h +10
-0@@ -57,6 +57,11 @@ TYPE_SAFE(unsigned long, mfn);#define PRI_mfn "05lx"#define INVALID_MFN _mfn(~0UL) +/* +* To be used for global variable initialization. This workaround a bug +* in GCC < 5.0. +*/ +#define INVALID_MFN_INITIALIZER {~0UL}#ifndef mfn_t#define mfn_t/* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */ @@ -90,6 +95,11 @@ static inline bool_t mfn_eq(mfn_t x, mfn_t y) TYPE_SAFE(unsigned long, gfn);#define PRI_gfn "05lx"#define INVALID_GFN _gfn(~0UL) +/* +* To be used for global variable initialization. This workaround a bug +* in GCC < 5.0 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856 +*/ +#define INVALID_GFN_INITIALIZER { ~0UL }#ifndef gfn_t#define gfn_t/* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */ Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 2/2] xen/mm: Introduce {G, M}FN_INVALID_INITIALIZER
Quoted 11 lines · Tim Deegan
Quoted 10 lines · Julien Grall
The current implementation of {G,M}FN_INVALID cannot be used to initialize global variable because the initializer element is not a constant.
Due to a bug in GCC 4.9 and older ([1]), it is not easy to find a common value to initialize a variable and directly passed as an argument.
Introduce 2 news define {G,M}FN_INVALID_INITIALIZER to be used for initializing a variable.
Quoted 6 lines
Quoted 3 lines
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856
Signed-off-by Julien Grall <[email protected]>but please choose either { ~0UL } or {~0UL} and use it for both.
Whoops. Sorry for that. I will stick to {~0UL} unless someone prefer the { ~0UL }.
Cheers,
Quoted 44 lines
Quoted 44 lines
---
Build tested it with:
* ARM: GCC 4.9.4, 5.1, 4.3, 6.1.1, 7.1.0
* x86: Clang 3.5.0, 3.6.0, 3.6.2, 3.8.0, 3.9.0, 4.0.0With introducing a dummy global variable
common/mm.c:
mfn_tfoo =INVALID_MFN_INITIALIZER--- xen/include/xen/mm.h | 10 ++++++++++ 1 file changed, 10 insertions(+)xen/include/xen/mm.h +10
-1@@ -57,6 +57,11 @@ TYPE_SAFE(unsigned long, mfn);#define PRI_mfn "05lx"#define INVALID_MFN _mfn(~0UL) +/* +* To be used for global variable initialization. This workaround a bug +* in GCC < 5.0. +*/ +#define INVALID_MFN_INITIALIZER {~0UL}#ifndef mfn_t#define mfn_t/* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */ @@ -90,6 +95,11 @@ static inline bool_t mfn_eq(mfn_t x, mfn_t y) TYPE_SAFE(unsigned long, gfn);#define PRI_gfn "05lx"#define INVALID_GFN _gfn(~0UL) +/* +* To be used for global variable initialization. This workaround a bug +* in GCC < 5.0 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856 +*/ +#define INVALID_GFN_INITIALIZER { ~0UL }#ifndef gfn_t#define gfn_t/* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */ --2.11.0
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 2/2] xen/mm: Introduce {G, M}FN_INVALID_INITIALIZER
Hi,
Quoted 14 lines · Julien Grall
Quoted 11 lines · Tim Deegan
Quoted 10 lines · Julien Grall
The current implementation of {G,M}FN_INVALID cannot be used to initialize global variable because the initializer element is not a constant.
Due to a bug in GCC 4.9 and older ([1]), it is not easy to find a common value to initialize a variable and directly passed as an argument.
Introduce 2 news define {G,M}FN_INVALID_INITIALIZER to be used for initializing a variable.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856
Signed-off-by Julien Grall <[email protected]>but please choose either { ~0UL } or {~0UL} and use it for both.
Whoops. Sorry for that. I will stick to {~0UL} unless someone prefer the { ~0UL }.
Also, shall I resent a patch with this change? Or will it get taken care on commit? (assuming there are no other changes).
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 2/2] xen/mm: Introduce {G, M}FN_INVALID_INITIALIZER
Quoted 22 lines · Julien Grall
Hi,
Quoted 19 lines · Julien Grall
Quoted 16 lines · Tim Deegan
Quoted 14 lines · Julien Grall
The current implementation of {G,M}FN_INVALID cannot be used to initialize global variable because the initializer element is not a constant.
Due to a bug in GCC 4.9 and older ([1]), it is not easy to find a common
value to initialize a variable and directly passed as an argument.Introduce 2 news define {G,M}FN_INVALID_INITIALIZER to be used for initializing a variable.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856
Signed-off-by Julien Grall <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
but please choose either { ~0UL } or {~0UL} and use it for both.
Whoops. Sorry for that. I will stick to {~0UL} unless someone prefer the { ~0UL }.
Also, shall I resent a patch with this change? Or will it get taken care on commit? (assuming there are no other changes).
I'll sort it out on commit, when I do my next sweep (if someone doesn't beat me to it).
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel