aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/gperftools/gperftools/0001-src-mmap_hook.cc-Fix-build-for-32bit-machine.patch
blob: 1142df0be918521e6c70d39f2eff5d51b33b7f63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From d675808d300278a9e7143428cfecf3fda61cc9a2 Mon Sep 17 00:00:00 2001
From: Robert Yang <liezhi.yang@windriver.com>
Date: Thu, 21 Mar 2024 10:59:29 +0000
Subject: [PATCH] src/mmap_hook.cc: Fix build for 32bit machine

Fixed build error on 32bit machine:

../git/src/mmap_hook.cc:309:31: error: static assertion failed
 309 | static_assert(sizeof(int32_t) == sizeof(off_t), "");

This is because oe's off_t is 64bit on both 32 and 64bit system, which is the
default value of glibc, so the assertion would be failed on 32bit system, and
remove mmap() and mmap64() to fix the redefined error.

Upstream-Status: Inappropriate [OE-Specific]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 src/mmap_hook.cc | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/src/mmap_hook.cc b/src/mmap_hook.cc
index 0a0f62f..27425e4 100644
--- a/src/mmap_hook.cc
+++ b/src/mmap_hook.cc
@@ -302,30 +302,8 @@ void* mmap(void* start, size_t length, int prot, int flags, int fd, off_t off) _
 
 #define HOOKED_MMAP
 
-#elif defined(DEFINED_DO_MMAP) && defined(__linux__) && !GOOD_LINUX_SYSTEM
-// Linuxes with 32-bit off_t. We're being careful with mmap64 being
-// 64-bit and mmap being 32-bit.
-
-static_assert(sizeof(int32_t) == sizeof(off_t), "");
-
-extern "C" void* mmap64(void* start, size_t length, int prot, int flags, int fd, int64_t off)
-  __THROW ATTRIBUTE_SECTION(malloc_hook);
-extern "C" void* mmap(void* start, size_t length, int prot, int flags, int fd, off_t off)
-  __THROW ATTRIBUTE_SECTION(malloc_hook);
-
-void* mmap(void *start, size_t length, int prot, int flags, int fd, off_t off) __THROW {
-  return do_mmap_with_hooks(start, length, prot, flags, fd, off);
-}
-
-void* mmap64(void *start, size_t length, int prot, int flags, int fd, int64_t off) __THROW {
-  return do_mmap_with_hooks(start, length, prot, flags, fd, off);
-}
-
-#define HOOKED_MMAP
-
 #endif  // Linux/32-bit off_t case
 
-
 #ifdef HOOKED_MMAP
 
 extern "C" int munmap(void* start, size_t length) __THROW ATTRIBUTE_SECTION(malloc_hook);
-- 
2.35.5