xen/x86: unable to build with gcc5
This was originally reported against Xen 4.4 in
http://bugs.debian.org/778181 but I have reproduced with current staging using debug=n. Compiler I used is:
$ gcc --version
gcc (Debian 5-20150205-1) 5.0.0 20150205 (experimental) [trunk revision 220455]Error: size of boot.o:.text is 0x026c /build/gcc5/xen.git/xen/Rules.mk:180: recipe for target 'boot.init.o' failed
$ objdump -t ./xen/arch/x86/efi/boot.o | grep -P '[^t]\.text[^\.]' 0000000000000000 l d .text 0000000000000000 .text 0000000000000000 l F .text 00000000000000e9 pre_parse.constprop.9 00000000000000f0 l F .text 0000000000000123 get_value.constprop.10 0000000000000220 l F .text 000000000000004c set_color.part.4.constprop.11
pre_parse, get_value and set_color are all annotated with __init, but I guess this is something else. Any idea what to do? Possibly a gcc bug?
Building with -k -s I also see:
Error: size of unxz.o:.text is 0x06b
->
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l F .text 000000000000006b dec_vli.isra.1
Error: size of dmi_scan.o:.text is 0x018f
->
grep -P '[^t]\.text\b'
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l F .text 000000000000018f _dmi_iterate.constprop.6
And:
symbols.c: In function 'symbols_lookup':
symbols.c:128:359: error: array subscript is above array bounds [-Werror=array-bounds] symbols.c:136:176: error: array subscript is above array bounds [-Werror=array-bounds]
from common/symbols.c. I suppose because of
extern const unsigned int symbols_offsets[1]
#define symbols_address(n) (SYMBOLS_ORIGIN + symbols_offsets[n])
I'm not sure why that needs to be a singleton array instead of []?
Ian.
Quoted 27 lines
Quoted 1 line
Quoted 1 line · On 13.03.15 at 13:00, <[email protected]> wrote:
This was originally reported against Xen 4.4 in
http://bugs.debian.org/778181 but I have reproduced with current staging using debug=n. Compiler I used is:$ gcc --version gcc (Debian 5-20150205-1) 5.0.0 20150205 (experimental) [trunk revision 220455]Error: size of boot.o:.text is
0x026c/build/gcc5/xen.git/xen/Rules.mk:180: recipe for target 'boot.init.o' failed$ objdump -t ./xen/arch/x86/efi/boot.o | grep -P '[^t]\.text[^\.]' 0000000000000000 l d .text 0000000000000000 .text 0000000000000000 l F .text 00000000000000e9 pre_parse.constprop.9 00000000000000f0 l F .text 0000000000000123 get_value.constprop.10 0000000000000220 l F .text 000000000000004c set_color.part.4.constprop.11
pre_parse,get_valueandset_colorare all annotated with__init, but I guess this is something else. Any idea what to do? Possibly a gcc bug?Building with -k -s I also see:
Error: size of unxz.o:.text is
0x06b
->
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l F .text000000000000006bdec_vli.isra.1
Quoted 5 lines
Error: size of dmi_scan.o:.text is
0x018f
->
grep -P '[^t]\.text\b'
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l F .text000000000000018f_dmi_iterate.constprop.6
For all of the above, at a first glance I'd say compiler bug. But to be sure, could you send the three .o-s?
Quoted 8 lines
And:
symbols.c: In function 'symbols_lookup':
symbols.c:128:359: error: array subscript is above array bounds [-Werror=array-bounds]
symbols.c:136:176: error: array subscript is above array bounds [-Werror=array-bounds]
Quoted 5 lines
from
common/symbols.c. I suppose because of
extern const unsigned int symbols_offsets[1]
#definesymbols_address(n)(SYMBOLS_ORIGIN+ symbols_offsets[n])I'm not sure why that needs to be a singleton array instead of []?
I don't see a reason other than someone having wanted to be standard C compliant (which we don't need to be here).
Jan
On Fri, 2015-03-13 at 12:10 +0000, Jan Beulich wrote:
[...]
Quoted 2 lines
For all of the above, at a first glance I'd say compiler bug. But to be sure, could you send the three .o-s?
Attached.
Quoted 6 lines
Quoted 6 lines
symbols.c: In function 'symbols_lookup':
symbols.c:128:359: error: array subscript is above array bounds [-Werror=array-bounds]
symbols.c:136:176: error: array subscript is above array bounds [-Werror=array-bounds]
Quoted 8 lines
Quoted 5 lines
from
common/symbols.c. I suppose because of
extern const unsigned int symbols_offsets[1]
#definesymbols_address(n)(SYMBOLS_ORIGIN+ symbols_offsets[n])I'm not sure why that needs to be a singleton array instead of []?
I don't see a reason other than someone having wanted to be standard C compliant (which we don't need to be here).
I've switched to Keir's current address in case he has a comment, but the following fixes it for me:
8<-------------
Quoted 1 line
From
fbe732e5be6352afe2d9302f5d56439b9b9b6deeMon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Fri, 13 Mar 2015 12:22:25 +0000
Subject: [PATCH] xen: common: Use unbounded array for symbols_offset.
Using a singleton array causes gcc5 to report:symbols.c: In function 'symbols_lookup':
symbols.c:128:359: error: array subscript is above array bounds [-Werror=array-bounds] symbols.c:136:176: error: array subscript is above array bounds [-Werror=array-bounds]
--- xen/common/symbols.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/symbols.c +1 -1
@@ -19,7 +19,7 @@#include <xen/spinlock.h> #ifdef SYMBOLS_ORIGIN -extern const unsigned int symbols_offsets[1 ]; +extern const unsigned int symbols_offsets[];#define symbols_address (n) (SYMBOLS_ORIGIN + symbols_offsets[n])#else extern const unsigned long symbols_addresses[];
Signature · 1 line
2.1.4
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Jan Beulich
Acked-byQuoted 5 lines
Quoted 1 line
Quoted 1 line · On 13.03.15 at 13:25, <[email protected]> wrote:
From: Ian Campbell <[email protected]>
Date: Fri, 13 Mar 2015 12:22:25 +0000
Subject: [PATCH] xen: common: Use unbounded array forsymbols_offset.
Quoted 8 lines
Using a singleton array causes gcc5 to report:
symbols.c: In function 'symbols_lookup':
symbols.c:128:359: error: array subscript is above array bounds [-Werror=array-bounds]
symbols.c:136:176: error: array subscript is above array bounds [-Werror=array-bounds]Signed-off-by Ian Campbell <[email protected]>
Quoted 19 lines
--- xen/common/symbols.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/common/symbols.c +1
-1@@ -19,7 +19,7 @@#include <xen/spinlock.h> #ifdef SYMBOLS_ORIGIN -extern const unsigned int symbols_offsets[1 ]; +extern const unsigned int symbols_offsets[];#define symbols_address (n) (SYMBOLS_ORIGIN + symbols_offsets[n])#else extern const unsigned long symbols_addresses[];Signature · 1 line
2.1.4
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 13.03.15 at 13:00, <[email protected]> wrote:
Error: size of boot.o:.text is
0x026c/build/gcc5/xen.git/xen/Rules.mk:180: recipe for target 'boot.init.o' failed$ objdump -t ./xen/arch/x86/efi/boot.o | grep -P '[^t]\.text[^\.]' 0000000000000000 l d .text 0000000000000000 .text 0000000000000000 l F .text 00000000000000e9 pre_parse.constprop.9 00000000000000f0 l F .text 0000000000000123 get_value.constprop.10 0000000000000220 l F .text 000000000000004c set_color.part.4.constprop.11
pre_parse,get_valueandset_colorare all annotated with__init, but I guess this is something else. Any idea what to do? Possibly a gcc bug?Building with -k -s I also see:
Error: size of unxz.o:.text is
0x06b
->
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l F .text000000000000006bdec_vli.isra.1
Quoted 5 lines
Error: size of dmi_scan.o:.text is
0x018f
->
grep -P '[^t]\.text\b'
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l F .text000000000000018f_dmi_iterate.constprop.6
The same with these other two cases too - they're properly annotated. I.e. the compiler forgets to propagate the section attribute when generating variants of the functions (e.g. after having detected that it always gets called with some argument set to some specific value). Do you want to report this as a bug (assuming there isn't one already; I for one can't find any) from the Debian side, or should I open one?
Jan
Quoted 4 lines · Ian Campbell
On Fri, 2015-03-13 at 12:10 +0000, Jan Beulich wrote:
[...]Quoted 2 lines
For all of the above, at a first glance I'd say compiler bug. But to be sure, could you send the three .o-s?
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64963
Michael Young
Quoted 26 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 13.03.15 at 13:00, <[email protected]> wrote:
Error: size of boot.o:.text is
0x026c/build/gcc5/xen.git/xen/Rules.mk:180: recipe for target 'boot.init.o' failed$ objdump -t ./xen/arch/x86/efi/boot.o | grep -P '[^t]\.text[^\.]' 0000000000000000 l d .text 0000000000000000 .text 0000000000000000 l F .text 00000000000000e9 pre_parse.constprop.9 00000000000000f0 l F .text 0000000000000123 get_value.constprop.10 0000000000000220 l F .text 000000000000004c set_color.part.4.constprop.11
pre_parse,get_valueandset_colorare all annotated with__init, but I guess this is something else. Any idea what to do? Possibly a gcc bug?Building with -k -s I also see:
Error: size of unxz.o:.text is
0x06b
->
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l F .text000000000000006bdec_vli.isra.1Quoted 5 lines
Error: size of dmi_scan.o:.text is
0x018f
->
grep -P '[^t]\.text\b'
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l F .text000000000000018f_dmi_iterate.constprop.6
Quoted 7 lines
The same with these other two cases too - they're properly annotated. I.e. the compiler forgets to propagate the section attribute when generating variants of the functions (e.g. after having detected that it always gets called with some argument set to some specific value). Do you want to report this as a bug (assuming there isn't one already; I for one can't find any) from the Debian side, or should I open one?
I'll bounce the Debian Xen bug back to the Debian gcc package with your comments and I suppose the maintainer will then take it upstream.
Ian.
Quoted 8 lines · M A Young
Quoted 4 lines · Ian Campbell
On Fri, 2015-03-13 at 12:10 +0000, Jan Beulich wrote:
[...]Quoted 2 lines
For all of the above, at a first glance I'd say compiler bug. But to be sure, could you send the three .o-s?
Indeed, it turns out I was using an old gcc-5 snapshot (5-20150205-1). I've just updated to 5-20150307-1 and the issue is already fixed as indicated in that bug report. The symbols.c patch is still needed.
Sorry for the noise.
Ian.
Ian Campbell
AppliedQuoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 13.03.15 at 13:25, <[email protected]> wrote:
From: Ian Campbell <[email protected]>
Date: Fri, 13 Mar 2015 12:22:25 +0000
Subject: [PATCH] xen: common: Use unbounded array forsymbols_offset.Using a singleton array causes gcc5 to report:
symbols.c: In function 'symbols_lookup':
symbols.c:128:359: error: array subscript is above array bounds [-Werror=array-bounds]
symbols.c:136:176: error: array subscript is above array bounds [-Werror=array-bounds]
Quoted 3 lines
Quoted 1 line
Signed-off-by Ian Campbell <[email protected]>Acked-by Jan Beulich <[email protected]>
Applied, thanks.