L4Linux: no linux-kernel memcpy in cxx (fix #446)

Certain symbols from the libgcc_eh library in cxx that is linked with the
L4Linux kernel were resolved by using kernel internal implementations.
This lead to errors because the complete Linux kernel is built regparm=3.
This patch prefixes the appropriate symbols in the Linux Kernel and its
modules. Moreover, it fixes some warnings introduced by the latest update
to gcc 4.7.
This commit is contained in:
Stefan Kalkowski 2012-11-02 11:54:29 +01:00 committed by Norman Feske
parent 20ddd1bcdc
commit 518cbc5a5f
4 changed files with 68 additions and 15 deletions

View File

@ -887,20 +887,22 @@ Index: arch/l4/Makefile
=================================================================== ===================================================================
--- arch/l4/Makefile (revision 25) --- arch/l4/Makefile (revision 25)
+++ arch/l4/Makefile (working copy) +++ arch/l4/Makefile (working copy)
@@ -163,6 +163,12 @@ @@ -163,6 +163,14 @@
KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
KBUILD_CFLAGS += $(call cc-option,-mno-avx,) KBUILD_CFLAGS += $(call cc-option,-mno-avx,)
+# +#
+# Prevent the gcc from linking Linux memmove into compiler-generated +# Prevent the gcc from linking Linux functions into compiler-generated
+# Genode stuff. +# Genode stuff.
+# +#
+KBUILD_CFLAGS += -Dmemmove=lx_memmove +KBUILD_CFLAGS += -Dmemmove=lx_memmove -Dmemset=lx_memset -Dmemcpy=lx_memcpy
+KBUILD_CFLAGS += -Dstrlen=lx_strlen -Dabort=lx_abort
+
+ +
endif endif
ifeq ($(BASEARCH),arm) ifeq ($(BASEARCH),arm)
@@ -243,6 +249,8 @@ @@ -243,6 +251,8 @@
endif endif
@ -909,7 +911,7 @@ Index: arch/l4/Makefile
# ----------------------------------------------- # -----------------------------------------------
@@ -265,14 +273,15 @@ @@ -265,14 +275,15 @@
L4LX_E_L-$(CONFIG_L4_TCG_STPM) += stpm-client L4LX_E_L-$(CONFIG_L4_TCG_STPM) += stpm-client
L4LX_E_L-$(CONFIG_L4_FERRET) += ferret L4LX_E_L-$(CONFIG_L4_FERRET) += ferret
@ -930,7 +932,7 @@ Index: arch/l4/Makefile
arch/l4/l4lxlib/generic/ \ arch/l4/l4lxlib/generic/ \
arch/l4/l4lxlib/$(BASEENV)/ arch/l4/l4lxlib/$(BASEENV)/
@@ -291,7 +300,7 @@ @@ -291,7 +302,7 @@
core-y += arch/l4/ core-y += arch/l4/
@ -939,7 +941,7 @@ Index: arch/l4/Makefile
L4_REQUIRED_MODS := libc_be_minimal_log_io \ L4_REQUIRED_MODS := libc_be_minimal_log_io \
libc_minimal libc_minimal_l4re \ libc_minimal libc_minimal_l4re \
@@ -307,15 +316,17 @@ @@ -307,15 +318,17 @@
$(error Aborting.) $(error Aborting.)
endif endif
@ -961,7 +963,7 @@ Index: arch/l4/Makefile
-Iarch/$(LINSRCARCH)/include/generated \ -Iarch/$(LINSRCARCH)/include/generated \
$(if $(PLATFORMNAME),-I$(src)/arch/l4/include/asm/mach-$(LINSRCARCH)/$(PLATFORMNAME)) \ $(if $(PLATFORMNAME),-I$(src)/arch/l4/include/asm/mach-$(LINSRCARCH)/$(PLATFORMNAME)) \
$(if $(PLATFORMNAME),-I$(src)/arch/l4/include/asm/plat-$(LINSRCARCH)/$(PLATFORMNAME)) \ $(if $(PLATFORMNAME),-I$(src)/arch/l4/include/asm/plat-$(LINSRCARCH)/$(PLATFORMNAME)) \
@@ -337,6 +348,8 @@ @@ -337,6 +350,8 @@
KBUILD_CPPFLAGS += -DTEXT_OFFSET=0x01000000 KBUILD_CPPFLAGS += -DTEXT_OFFSET=0x01000000
endif endif
@ -970,7 +972,7 @@ Index: arch/l4/Makefile
all: lImage all: lImage
boot := arch/l4/boot boot := arch/l4/boot
@@ -345,11 +358,11 @@ @@ -345,11 +360,11 @@
$(Q)$(MAKE) $(build)=$(boot) $@ $(Q)$(MAKE) $(build)=$(boot) $@
check_for_l4defs: check_for_l4defs:
@ -987,6 +989,54 @@ Index: arch/l4/Makefile
server: server:
$(Q)$(MAKE) $(build)=arch/l4/server $(Q)$(MAKE) $(build)=arch/l4/server
Index: arch/x86/lib/memcpy_32.c
===================================================================
--- arch/x86/lib/memcpy_32.c (revision 25)
+++ arch/x86/lib/memcpy_32.c (working copy)
@@ -1,8 +1,13 @@
#include <linux/string.h>
#include <linux/module.h>
+#ifdef NOT_GENODE
#undef memcpy
#undef memset
+#else
+#undef lx_memcpy
+#undef lx_memset
+#endif /* NOT_GENODE */
void *memcpy(void *to, const void *from, size_t n)
{
Index: arch/x86/include/asm/string_32.h
===================================================================
--- arch/x86/include/asm/string_32.h (revision 25)
+++ arch/x86/include/asm/string_32.h (working copy)
@@ -179,8 +179,12 @@
#ifndef CONFIG_KMEMCHECK
#if (__GNUC__ >= 4)
+#ifdef NOT_GENODE
#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
#else
+#define lx_memcpy(t, f, n) __memcpy(t, f, n)
+#endif
+#else
#define memcpy(t, f, n) \
(__builtin_constant_p((n)) \
? __constant_memcpy((t), (f), (n)) \
@@ -322,8 +326,12 @@
#define __HAVE_ARCH_MEMSET
#if (__GNUC__ >= 4)
+#ifdef NOT_GENODE
#define memset(s, c, count) __builtin_memset(s, c, count)
#else
+#define lx_memset(s, c, count) __memset(s, c, count)
+#endif
+#else
#define memset(s, c, count) \
(__builtin_constant_p(c) \
? __constant_c_x_memset((s), (0x01010101UL * (unsigned char)(c)), \
Index: drivers/tty/serial/l4ser.c Index: drivers/tty/serial/l4ser.c
=================================================================== ===================================================================
--- drivers/tty/serial/l4ser.c (revision 25) --- drivers/tty/serial/l4ser.c (revision 25)

View File

@ -129,8 +129,9 @@ static void genode_blk_request(struct request_queue *q)
} }
static void genode_end_request(void *request, short write, static void FASTCALL
void *buf, unsigned long sz) { genode_end_request(void *request, short write,
void *buf, unsigned long sz) {
struct request *req = (struct request*) request; struct request *req = (struct request*) request;
struct genode_blk_device *dev = req->rq_disk->private_data; struct genode_blk_device *dev = req->rq_disk->private_data;
char *ptr = (char*) buf; char *ptr = (char*) buf;

View File

@ -240,8 +240,9 @@ static struct fb_ops genodefb_ops = {
** Input callbacks ** ** Input callbacks **
***********************/ ***********************/
void input_event_callback (void *dev, unsigned int type, void FASTCALL
unsigned int code, int value) input_event_callback (void *dev, unsigned int type,
unsigned int code, int value)
{ {
struct input_dev *input_dev = (struct input_dev*) dev; struct input_dev *input_dev = (struct input_dev*) dev;

View File

@ -29,8 +29,9 @@
static struct net_device *net_dev; static struct net_device *net_dev;
static void genode_net_receive_packet(void* dev_addr, void *addr, static void FASTCALL
unsigned long size) genode_net_receive_packet(void* dev_addr, void *addr,
unsigned long size)
{ {
struct net_device *dev = (struct net_device *) dev_addr; struct net_device *dev = (struct net_device *) dev_addr;
struct net_device_stats *stats = (struct net_device_stats*) netdev_priv(dev); struct net_device_stats *stats = (struct net_device_stats*) netdev_priv(dev);