1From d675808d300278a9e7143428cfecf3fda61cc9a2 Mon Sep 17 00:00:00 2001 2From: Robert Yang <liezhi.yang@windriver.com> 3Date: Thu, 21 Mar 2024 10:59:29 +0000 4Subject: [PATCH] src/mmap_hook.cc: Fix build for 32bit machine 5 6Fixed build error on 32bit machine: 7 8../git/src/mmap_hook.cc:309:31: error: static assertion failed 9 309 | static_assert(sizeof(int32_t) == sizeof(off_t), ""); 10 11This is because oe's off_t is 64bit on both 32 and 64bit system, which is the 12default value of glibc, so the assertion would be failed on 32bit system, and 13remove mmap() and mmap64() to fix the redefined error. 14 15Upstream-Status: Inappropriate [OE-Specific] 16 17Signed-off-by: Robert Yang <liezhi.yang@windriver.com> 18--- 19 src/mmap_hook.cc | 22 ---------------------- 20 1 file changed, 22 deletions(-) 21 22diff --git a/src/mmap_hook.cc b/src/mmap_hook.cc 23index 0a0f62f..27425e4 100644 24--- a/src/mmap_hook.cc 25+++ b/src/mmap_hook.cc 26@@ -302,30 +302,8 @@ void* mmap(void* start, size_t length, int prot, int flags, int fd, off_t off) _ 27 28 #define HOOKED_MMAP 29 30-#elif defined(DEFINED_DO_MMAP) && defined(__linux__) && !GOOD_LINUX_SYSTEM 31-// Linuxes with 32-bit off_t. We're being careful with mmap64 being 32-// 64-bit and mmap being 32-bit. 33- 34-static_assert(sizeof(int32_t) == sizeof(off_t), ""); 35- 36-extern "C" void* mmap64(void* start, size_t length, int prot, int flags, int fd, int64_t off) 37- __THROW ATTRIBUTE_SECTION(malloc_hook); 38-extern "C" void* mmap(void* start, size_t length, int prot, int flags, int fd, off_t off) 39- __THROW ATTRIBUTE_SECTION(malloc_hook); 40- 41-void* mmap(void *start, size_t length, int prot, int flags, int fd, off_t off) __THROW { 42- return do_mmap_with_hooks(start, length, prot, flags, fd, off); 43-} 44- 45-void* mmap64(void *start, size_t length, int prot, int flags, int fd, int64_t off) __THROW { 46- return do_mmap_with_hooks(start, length, prot, flags, fd, off); 47-} 48- 49-#define HOOKED_MMAP 50- 51 #endif // Linux/32-bit off_t case 52 53- 54 #ifdef HOOKED_MMAP 55 56 extern "C" int munmap(void* start, size_t length) __THROW ATTRIBUTE_SECTION(malloc_hook); 57-- 582.35.5 59 60