M A Young
2010-Jul-25 19:20 UTC
[Xen-devel] gcc 4.5 compile fixes for xen-4.0.1-rc4 for Fedora 14
I was trying to get xen-4.0.0 and xen-4.0.1-rc4 to build for Fedora 14 which is now using gcc 4.5 and found I needed the patches below Signed-off-by: Michael Young <m.a.young@durham.ac.uk> (though I don''t think the second patch (of netfront.c) is original enough for me to claim any credit) Linking of xen-4.0.1/xen/.xen-syms.0 fails for gcc 4.5 with the errors /builddir/build/BUILD/xen-4.0.1/xen/drivers/built_in.o: In function `pt_irq_time_out'': /builddir/build/BUILD/xen-4.0.1/xen/drivers/passthrough/io.c:83: undefined reference to `_Unwind_Resume'' /builddir/build/BUILD/xen-4.0.1/xen/drivers/passthrough/io.c:83: relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `_Unwind_Resume'' /builddir/build/BUILD/xen-4.0.1/xen/drivers/built_in.o:(.data.DW.ref.__gcc_personality_v0[DW.ref.__gcc_personality_v0]+0x0): undefined reference to `__gcc_personality_v0'' /builddir/build/BUILD/xen-4.0.1/xen/arch/x86/built_in.o: In function `paging_log_dirty_range'': /builddir/build/BUILD/xen-4.0.1/xen/arch/x86/mm/paging.c:603: undefined reference to `_Unwind_Resume'' /builddir/build/BUILD/xen-4.0.1/xen/arch/x86/mm/paging.c:603: relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `_Unwind_Resume'' /builddir/build/BUILD/xen-4.0.1/xen/arch/x86/built_in.o: In function `p2m_pod_zero_check'': /builddir/build/BUILD/xen-4.0.1/xen/arch/x86/mm/p2m.c:967: undefined reference to `_Unwind_Resume'' /builddir/build/BUILD/xen-4.0.1/xen/arch/x86/mm/p2m.c:967: relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `_Unwind_Resume'' if -fexceptions is set (in which case it is looking for functions from the libgcc_s library) so unset it --- xen-4.0.1/xen/Rules.mk.orig 2010-05-22 14:39:11.000000000 +0100 +++ xen-4.0.1/xen/Rules.mk 2010-07-24 14:14:01.000000000 +0100 @@ -71,6 +71,7 @@ DEPS = .*.d CFLAGS += $(CFLAGS-y) +CFLAGS += -fno-exceptions # Most CFLAGS are safe for assembly files: # -std=gnu{89,99} gets confused by #-prefixed end-of-line comments ------ Build of xen-4.0.1/stubdom/mini-os-x86_64-ioemu/netfront.o fails with the errors netfront.c:41:32: error: variably modified ''tx_freelist'' at file scope netfront.c:44:34: error: variably modified ''rx_buffers'' at file scope netfront.c:45:34: error: variably modified ''tx_buffers'' at file scope so use __CONST_RING_SIZE instead of __RING_SIZE The patch is based on http://xenbits.xen.org/linux-2.6.18-xen.hg?rev/efae51e0fa91 --- xen-4.0.1/extras/mini-os/netfront.c.orig 2010-05-22 14:39:10.000000000 +0100 +++ xen-4.0.1/extras/mini-os/netfront.c 2010-07-24 21:54:55.000000000 +0100 @@ -25,8 +25,8 @@ -#define NET_TX_RING_SIZE __RING_SIZE((struct netif_tx_sring *)0, PAGE_SIZE) -#define NET_RX_RING_SIZE __RING_SIZE((struct netif_rx_sring *)0, PAGE_SIZE) +#define NET_TX_RING_SIZE __CONST_RING_SIZE(netif_tx, PAGE_SIZE) +#define NET_RX_RING_SIZE __CONST_RING_SIZE(netif_rx, PAGE_SIZE) #define GRANT_INVALID_REF 0 ------ xen-4.0.1/extras/mini-os/lib/math.c generates the warning lib/math.c: In function ''__qdivrem'': lib/math.c:196:9: error: ''tmp.ul[1]'' may be used uninitialized in this function under gcc 4.5 though this looks incorrect so turn off the warning --- xen-4.0.1/extras/mini-os/minios.mk.orig 2010-02-02 20:43:00.000000000 +0000 +++ xen-4.0.1/extras/mini-os/minios.mk 2010-07-24 22:56:27.000000000 +0100 @@ -10,6 +10,7 @@ DEF_CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) DEF_CFLAGS += $(call cc-option,$(CC),-fgnu89-inline) DEF_CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline +DEF_CFLAGS += -Wno-uninitialized DEF_CPPFLAGS += -D__XEN_INTERFACE_VERSION__=$(XEN_INTERFACE_VERSION) DEF_ASFLAGS += -D__ASSEMBLY__ ------- building xen-4.0.1/stubdom/mini-os-x86_64-ioemu/arch/x86/mm.o gives the warning mm.c: In function ''set_readonly'': mm.c:321:46: error: taking address of expression of type ''void'' so make the definition of shared_info consistent with the definition in setup.c which doesn''t --- xen-4.0.1/extras/mini-os/arch/x86/mm.c.orig 2010-02-02 20:43:00.000000000 +0000 +++ xen-4.0.1/extras/mini-os/arch/x86/mm.c 2010-07-25 09:29:49.000000000 +0100 @@ -281,7 +281,7 @@ /* * Mark portion of the address space read only. */ -extern void shared_info; +extern char shared_info[PAGE_SIZE]; static void set_readonly(void *text, void *etext) { unsigned long start_address _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2010-Jul-25 21:25 UTC
Re: [Xen-devel] gcc 4.5 compile fixes for xen-4.0.1-rc4 for Fedora 14
On 25/07/2010 20:20, "M A Young" <m.a.young@durham.ac.uk> wrote:> --- xen-4.0.1/xen/Rules.mk.orig 2010-05-22 14:39:11.000000000 +0100 > +++ xen-4.0.1/xen/Rules.mk 2010-07-24 14:14:01.000000000 +0100 > @@ -71,6 +71,7 @@ > DEPS = .*.d > > CFLAGS += $(CFLAGS-y) > +CFLAGS += -fno-exceptions > > # Most CFLAGS are safe for assembly files: > # -std=gnu{89,99} gets confused by #-prefixed end-of-line commentsI checked in a more extensive variant of this as xen-unstable:21860 and xen-4.0-testing:21287. I guess it''s a good extra flag to have. For the rest of your patches, they need to be reviewed and applied by Stefano (cc''ed). He might not like blanket turning on of -Wno-uninitialized for example. They will come into xen-unstable via the xen-unstable-tools.hg tree, and from there be nominated (by Stefano) for backport to 4.0 branch. Thanks, Keir> ------ > Build of xen-4.0.1/stubdom/mini-os-x86_64-ioemu/netfront.o fails with the > errors > netfront.c:41:32: error: variably modified ''tx_freelist'' at file scope > netfront.c:44:34: error: variably modified ''rx_buffers'' at file scope > netfront.c:45:34: error: variably modified ''tx_buffers'' at file scope > so use __CONST_RING_SIZE instead of __RING_SIZE > The patch is based on > http://xenbits.xen.org/linux-2.6.18-xen.hg?rev/efae51e0fa91 > --- xen-4.0.1/extras/mini-os/netfront.c.orig 2010-05-22 14:39:10.000000000 > +0100 > +++ xen-4.0.1/extras/mini-os/netfront.c 2010-07-24 21:54:55.000000000 +0100 > @@ -25,8 +25,8 @@ > > > > -#define NET_TX_RING_SIZE __RING_SIZE((struct netif_tx_sring *)0, PAGE_SIZE) > -#define NET_RX_RING_SIZE __RING_SIZE((struct netif_rx_sring *)0, PAGE_SIZE) > +#define NET_TX_RING_SIZE __CONST_RING_SIZE(netif_tx, PAGE_SIZE) > +#define NET_RX_RING_SIZE __CONST_RING_SIZE(netif_rx, PAGE_SIZE) > #define GRANT_INVALID_REF 0 > > > > ------ > xen-4.0.1/extras/mini-os/lib/math.c generates the warning > lib/math.c: In function ''__qdivrem'': > lib/math.c:196:9: error: ''tmp.ul[1]'' may be used uninitialized in this > function > under gcc 4.5 though this looks incorrect so turn off the warning > --- xen-4.0.1/extras/mini-os/minios.mk.orig 2010-02-02 20:43:00.000000000 > +0000 > +++ xen-4.0.1/extras/mini-os/minios.mk 2010-07-24 22:56:27.000000000 +0100 > @@ -10,6 +10,7 @@ > DEF_CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) > DEF_CFLAGS += $(call cc-option,$(CC),-fgnu89-inline) > DEF_CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline > +DEF_CFLAGS += -Wno-uninitialized > DEF_CPPFLAGS += -D__XEN_INTERFACE_VERSION__=$(XEN_INTERFACE_VERSION) > > DEF_ASFLAGS += -D__ASSEMBLY__ > > ------- > building xen-4.0.1/stubdom/mini-os-x86_64-ioemu/arch/x86/mm.o gives the > warning > mm.c: In function ''set_readonly'': > mm.c:321:46: error: taking address of expression of type ''void'' > so make the definition of shared_info consistent with the definition in > setup.c which doesn''t > --- xen-4.0.1/extras/mini-os/arch/x86/mm.c.orig 2010-02-02 20:43:00.000000000 > +0000 > +++ xen-4.0.1/extras/mini-os/arch/x86/mm.c 2010-07-25 09:29:49.000000000 +0100 > @@ -281,7 +281,7 @@ > /* > * Mark portion of the address space read only. > */ > -extern void shared_info; > +extern char shared_info[PAGE_SIZE]; > static void set_readonly(void *text, void *etext) > { > unsigned long start_address > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel