All of lore.kernel.org
 help / color / mirror / Atom feed
* xen/x86: unable to build with gcc5
@ 2015-03-13 12:00 Ian Campbell
  2015-03-13 12:10 ` Jan Beulich
  2015-03-13 13:25 ` Jan Beulich
  0 siblings, 2 replies; 9+ messages in thread
From: Ian Campbell @ 2015-03-13 12:00 UTC (permalink / raw)
  To: Jan Beulich, Keir Fraser; +Cc: xen-devel

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: xen/x86: unable to build with gcc5
  2015-03-13 12:00 xen/x86: unable to build with gcc5 Ian Campbell
@ 2015-03-13 12:10 ` Jan Beulich
  2015-03-13 12:25   ` Ian Campbell
  2015-03-13 13:25 ` Jan Beulich
  1 sibling, 1 reply; 9+ messages in thread
From: Jan Beulich @ 2015-03-13 12:10 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Keir Fraser, xen-devel

>>> On 13.03.15 at 13:00, <ian.campbell@citrix.com> 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_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

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?

> 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 []?

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: xen/x86: unable to build with gcc5
  2015-03-13 12:10 ` Jan Beulich
@ 2015-03-13 12:25   ` Ian Campbell
  2015-03-13 12:58     ` Jan Beulich
  2015-03-13 13:32     ` M A Young
  0 siblings, 2 replies; 9+ messages in thread
From: Ian Campbell @ 2015-03-13 12:25 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Keir Fraser, xen-devel

[-- Attachment #1: Type: text/plain, Size: 1990 bytes --]

On Fri, 2015-03-13 at 12:10 +0000, Jan Beulich wrote:
[...]
> 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.

> > 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 []?
> 
> 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<-------------

>From fbe732e5be6352afe2d9302f5d56439b9b9b6dee Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@citrix.com>
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]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 xen/common/symbols.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index bc2fde6..fc7c9e7 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -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[];
-- 
2.1.4




[-- Attachment #2: boot.o --]
[-- Type: application/x-object, Size: 231648 bytes --]

[-- Attachment #3: dmi_scan.o --]
[-- Type: application/x-object, Size: 75560 bytes --]

[-- Attachment #4: unxz.o --]
[-- Type: application/x-object, Size: 152144 bytes --]

[-- Attachment #5: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: xen/x86: unable to build with gcc5
  2015-03-13 12:25   ` Ian Campbell
@ 2015-03-13 12:58     ` Jan Beulich
  2015-03-20 12:28       ` Ian Campbell
  2015-03-13 13:32     ` M A Young
  1 sibling, 1 reply; 9+ messages in thread
From: Jan Beulich @ 2015-03-13 12:58 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Keir Fraser, xen-devel

>>> On 13.03.15 at 13:25, <ian.campbell@citrix.com> wrote:
> From: Ian Campbell <ian.campbell@citrix.com>
> 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]
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

> ---
>  xen/common/symbols.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/common/symbols.c b/xen/common/symbols.c
> index bc2fde6..fc7c9e7 100644
> --- a/xen/common/symbols.c
> +++ b/xen/common/symbols.c
> @@ -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[];
> -- 
> 2.1.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: xen/x86: unable to build with gcc5
  2015-03-13 12:00 xen/x86: unable to build with gcc5 Ian Campbell
  2015-03-13 12:10 ` Jan Beulich
@ 2015-03-13 13:25 ` Jan Beulich
  2015-03-13 13:35   ` Ian Campbell
  1 sibling, 1 reply; 9+ messages in thread
From: Jan Beulich @ 2015-03-13 13:25 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Keir Fraser, xen-devel

>>> On 13.03.15 at 13:00, <ian.campbell@citrix.com> 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_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

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: xen/x86: unable to build with gcc5
  2015-03-13 12:25   ` Ian Campbell
  2015-03-13 12:58     ` Jan Beulich
@ 2015-03-13 13:32     ` M A Young
  2015-03-13 14:20       ` Ian Campbell
  1 sibling, 1 reply; 9+ messages in thread
From: M A Young @ 2015-03-13 13:32 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Keir Fraser, Jan Beulich, xen-devel

On Fri, 13 Mar 2015, Ian Campbell wrote:

> On Fri, 2015-03-13 at 12:10 +0000, Jan Beulich wrote:
> [...]
> > 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: xen/x86: unable to build with gcc5
  2015-03-13 13:25 ` Jan Beulich
@ 2015-03-13 13:35   ` Ian Campbell
  0 siblings, 0 replies; 9+ messages in thread
From: Ian Campbell @ 2015-03-13 13:35 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Keir Fraser, xen-devel

On Fri, 2015-03-13 at 13:25 +0000, Jan Beulich wrote:
> >>> On 13.03.15 at 13:00, <ian.campbell@citrix.com> 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_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
> 
> 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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: xen/x86: unable to build with gcc5
  2015-03-13 13:32     ` M A Young
@ 2015-03-13 14:20       ` Ian Campbell
  0 siblings, 0 replies; 9+ messages in thread
From: Ian Campbell @ 2015-03-13 14:20 UTC (permalink / raw)
  To: M A Young; +Cc: Keir Fraser, Jan Beulich, xen-devel

On Fri, 2015-03-13 at 13:32 +0000, M A Young wrote:
> On Fri, 13 Mar 2015, Ian Campbell wrote:
> 
> > On Fri, 2015-03-13 at 12:10 +0000, Jan Beulich wrote:
> > [...]
> > > 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

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: xen/x86: unable to build with gcc5
  2015-03-13 12:58     ` Jan Beulich
@ 2015-03-20 12:28       ` Ian Campbell
  0 siblings, 0 replies; 9+ messages in thread
From: Ian Campbell @ 2015-03-20 12:28 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Keir Fraser, xen-devel

On Fri, 2015-03-13 at 12:58 +0000, Jan Beulich wrote:
> >>> On 13.03.15 at 13:25, <ian.campbell@citrix.com> wrote:
> > From: Ian Campbell <ian.campbell@citrix.com>
> > 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]
> > 
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-03-20 12:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13 12:00 xen/x86: unable to build with gcc5 Ian Campbell
2015-03-13 12:10 ` Jan Beulich
2015-03-13 12:25   ` Ian Campbell
2015-03-13 12:58     ` Jan Beulich
2015-03-20 12:28       ` Ian Campbell
2015-03-13 13:32     ` M A Young
2015-03-13 14:20       ` Ian Campbell
2015-03-13 13:25 ` Jan Beulich
2015-03-13 13:35   ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.