From bf8b52ec3ad1e1e76818f6ff2b7b4f2a4c2dc53c Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 20 Jul 2018 12:10:12 +0200 Subject: [PATCH] Update LwIP to 2.1.0.rc1 This release candidate suppresses the remaining build warnings. Ref #2335 --- repos/libports/include/lwip/arch/cc.h | 42 +++++++++++++++---- repos/libports/include/lwip/lwipopts.h | 7 +++- repos/libports/lib/mk/lwip.mk | 10 ++--- repos/libports/ports/lwip.hash | 2 +- repos/libports/ports/lwip.port | 11 +++-- .../libports/recipes/src/vfs_lwip/content.mk | 2 +- repos/libports/src/lib/lwip/include/stdlib.h | 15 +++++++ repos/libports/src/lib/lwip/memmove.patch | 12 ++++++ .../src/lib/lwip/platform/sys_arch.cc | 10 ++--- 9 files changed, 83 insertions(+), 28 deletions(-) create mode 100644 repos/libports/src/lib/lwip/memmove.patch diff --git a/repos/libports/include/lwip/arch/cc.h b/repos/libports/include/lwip/arch/cc.h index 5ea8477dd..c43cdca2f 100644 --- a/repos/libports/include/lwip/arch/cc.h +++ b/repos/libports/include/lwip/arch/cc.h @@ -30,17 +30,31 @@ typedef unsigned long size_t; typedef long ptrdiff_t; #endif /* LWIP_NO_STDDEF_H */ - #ifndef LWIP_NO_STDINT_H #define LWIP_NO_STDINT_H 1 -typedef genode_uint8_t u8_t; -typedef genode_int8_t s8_t; -typedef genode_uint16_t u16_t; -typedef genode_int16_t s16_t; -typedef genode_uint32_t u32_t; -typedef genode_int32_t s32_t; +#define LWIP_HAVE_INT64 +typedef genode_uint8_t uint8_t; +typedef genode_int8_t int8_t; +typedef genode_uint16_t uint16_t; +typedef genode_int16_t int16_t; +typedef genode_uint32_t uint32_t; +typedef genode_int32_t int32_t; +typedef genode_uint64_t uint64_t; +typedef genode_int64_t int64_t; +typedef unsigned long uintptr_t; +typedef uint8_t u8_t; +typedef int8_t s8_t; +typedef uint16_t u16_t; +typedef int16_t s16_t; +typedef uint32_t u32_t; +typedef int32_t s32_t; +typedef uint64_t u64_t; +typedef int64_t s64_t; +typedef uintptr_t mem_ptr_t; -typedef unsigned long mem_ptr_t; +#ifndef NULL +#define NULL (uintptr_t)0 +#endif #endif /* LWIP_NO_STDINT_H */ @@ -78,6 +92,11 @@ void lwip_platform_assert(char const* msg, char const *file, int line); #endif +#ifndef LWIP_NO_CTYPE_H +#define LWIP_NO_CTYPE_H 1 +#endif + + #define LWIP_SKIP_PACKING_CHECK 1 #define PACK_STRUCT_FIELD(x) x #define PACK_STRUCT_STRUCT @@ -88,8 +107,13 @@ void lwip_platform_assert(char const* msg, char const *file, int line); #define BYTE_ORDER LITTLE_ENDIAN #endif /* BYTE_ORDER */ +/* + * XXX: Should these be inlined? + */ +void genode_memcpy( void *dst, const void *src, size_t len); +void *genode_memmove(void *dst, const void *src, size_t len); -void genode_free(void *ptr); +void genode_free(void *ptr); void *genode_malloc(unsigned long size); void *genode_calloc(unsigned long number, unsigned long size); diff --git a/repos/libports/include/lwip/lwipopts.h b/repos/libports/include/lwip/lwipopts.h index 91ff881d5..56035323e 100644 --- a/repos/libports/include/lwip/lwipopts.h +++ b/repos/libports/include/lwip/lwipopts.h @@ -73,8 +73,13 @@ extern "C" { #define MEMP_NUM_SYS_TIMEOUT 16 #define MEMP_NUM_TCP_PCB 128 -void genode_memcpy(void * dst, const void *src, unsigned long size); +#ifndef MEMCPY #define MEMCPY(dst,src,len) genode_memcpy(dst,src,len) +#endif + +#ifndef MEMMOVE +#define MEMMOVE(dst,src,len) genode_memmove(dst,src,len) +#endif /******************** ** Debug settings ** diff --git a/repos/libports/lib/mk/lwip.mk b/repos/libports/lib/mk/lwip.mk index adbab414d..3b3e6c7f7 100644 --- a/repos/libports/lib/mk/lwip.mk +++ b/repos/libports/lib/mk/lwip.mk @@ -5,7 +5,7 @@ # LWIP_PORT_DIR := $(call select_from_ports,lwip) -LWIPDIR := $(LWIP_PORT_DIR)/src/lib/lwip/lwip-2.0.3/src +LWIPDIR := $(LWIP_PORT_DIR)/src/lib/lwip/src -include $(LWIPDIR)/Filelists.mk @@ -33,9 +33,5 @@ INC_DIR += $(REP_DIR)/include/lwip \ $(REP_DIR)/src/lib/lwip/include vpath %.cc $(REP_DIR)/src/lib/lwip/platform -vpath %.c $(LWIPDIR)/core -vpath %.c $(LWIPDIR)/core/ipv4 -vpath %.c $(LWIPDIR)/core/ipv6 -vpath %.c $(LWIPDIR)/netif - -CC_CXX_WARN_STRICT = +vpath %.c $(sort $(dir \ + $(COREFILES) $(CORE4FILES) $(CORE6FILES) $(NETIFFILES))) diff --git a/repos/libports/ports/lwip.hash b/repos/libports/ports/lwip.hash index 57f98e23e..67c387e73 100644 --- a/repos/libports/ports/lwip.hash +++ b/repos/libports/ports/lwip.hash @@ -1 +1 @@ -1ac3301a29dcf5f4fc3981fb4338578c7d5d7fe5 +7b106db24a8a49b863999c90eb5943d472d325e1 diff --git a/repos/libports/ports/lwip.port b/repos/libports/ports/lwip.port index 5c8692c45..ee0ce2d56 100644 --- a/repos/libports/ports/lwip.port +++ b/repos/libports/ports/lwip.port @@ -1,12 +1,15 @@ LICENSE := BSD -VERSION := 2.0.3 +VERSION := 2_1_0_RC1 DOWNLOADS := lwip.archive -URL(lwip) := http://download.savannah.nongnu.org/releases/lwip/lwip-$(VERSION).zip -SHA(lwip) := 1488829ca48890cc7e5e86c5e76a74b32a1bc9ac8dc01b2177b3a937650e9730 +URL(lwip) := http://git.savannah.nongnu.org/cgit/lwip.git/snapshot/lwip-STABLE-$(VERSION).tar.gz +SHA(lwip) := 731c1bc74e9a73daebe9ef83b602ce35f878818eff06dc33785248e9de032666 DIR(lwip) := src/lib/lwip -UNPACKED_DIR := src/lib/lwip/lwip-$(VERSION) +UNPACKED_DIR := src/lib/lwip + +PATCHES := $(wildcard $(REP_DIR)/src/lib/lwip/*.patch) +PATCH_OPT := -p1 -d src/lib/lwip DIRS := \ include/lwip/lwip \ diff --git a/repos/libports/recipes/src/vfs_lwip/content.mk b/repos/libports/recipes/src/vfs_lwip/content.mk index 72b2a874a..5e716d70d 100644 --- a/repos/libports/recipes/src/vfs_lwip/content.mk +++ b/repos/libports/recipes/src/vfs_lwip/content.mk @@ -19,4 +19,4 @@ $(MIRROR_FROM_PORT_DIR): cp -r $(PORT_DIR)/$@ $@ LICENSE: - cp $(PORT_DIR)/src/lib/lwip/lwip-*/COPYING $@ + cp $(PORT_DIR)/src/lib/lwip/COPYING $@ diff --git a/repos/libports/src/lib/lwip/include/stdlib.h b/repos/libports/src/lib/lwip/include/stdlib.h index e69de29bb..2641481f4 100644 --- a/repos/libports/src/lib/lwip/include/stdlib.h +++ b/repos/libports/src/lib/lwip/include/stdlib.h @@ -0,0 +1,15 @@ +#ifndef _LWIP__INCLUDE__STDLIB_H_ +#define _LWIP__INCLUDE__STDLIB_H_ + +/** + * Simple atoi for LwIP purposes + */ +static inline int atoi(char const *s) +{ + int n = 0; + while ('0' <= *s && *s <= '9') + n = 10*n - (*s++ - '0'); + return n; +} + +#endif diff --git a/repos/libports/src/lib/lwip/memmove.patch b/repos/libports/src/lib/lwip/memmove.patch new file mode 100644 index 000000000..681805f15 --- /dev/null +++ b/repos/libports/src/lib/lwip/memmove.patch @@ -0,0 +1,12 @@ +diff --git a/src/core/def.c b/src/core/def.c +index 9da36fee..58edce6f 100644 +--- a/src/core/def.c ++++ b/src/core/def.c +@@ -235,6 +235,6 @@ lwip_itoa(char *result, size_t bufsize, int number) + return; + } + /* move from temporary buffer to output buffer (sign is not moved) */ +- memmove(res, tmp, (size_t)((result + bufsize) - tmp)); ++ MEMMOVE(res, tmp, (size_t)((result + bufsize) - tmp)); + } + #endif diff --git a/repos/libports/src/lib/lwip/platform/sys_arch.cc b/repos/libports/src/lib/lwip/platform/sys_arch.cc index b07d53deb..61e4c298c 100644 --- a/repos/libports/src/lib/lwip/platform/sys_arch.cc +++ b/repos/libports/src/lib/lwip/platform/sys_arch.cc @@ -34,9 +34,6 @@ namespace Lwip { static Genode::Allocator *_heap; - /** - * XXX: can this be replaced with an alarm? - */ struct Sys_timer { void check_timeouts(Genode::Duration) { @@ -98,8 +95,11 @@ extern "C" { u32_t sys_now(void) { return Lwip::_sys_timer->timer.curr_time().trunc_to_plain_ms().value; } - void genode_memcpy(void * dst, const void *src, unsigned long size) { - Genode::memcpy(dst, src, size); } + void genode_memcpy(void *dst, const void *src, size_t len) { + Genode::memcpy(dst, src, len); } + + void *genode_memmove(void *dst, const void *src, size_t len) { + return Genode::memmove(dst, src, len); } int memcmp(const void *b1, const void *b2, ::size_t len) { return Genode::memcmp(b1, b2, len); }