s2 fails to build on OS X 10.10 and earlier:
https://trac.macports.org/ticket/67784
absl/debugging/internal/examine_stack.cc:58:34: error: use of undeclared identifier 'MAP_ANONYMOUS'
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
^
1 error generated.
MAP_ANONYMOUS is equivalent to MAP_ANON which is available on older systems.
There are several places where you already have code to address this:
|
// MAP_ANONYMOUS |
|
#if defined(__APPLE__) |
|
// For mmap, Linux defines both MAP_ANONYMOUS and MAP_ANON and says MAP_ANON is |
|
// deprecated. In Darwin, MAP_ANON is all there is. |
|
#if !defined MAP_ANONYMOUS |
|
#define MAP_ANONYMOUS MAP_ANON |
|
#endif // !MAP_ANONYMOUS |
|
#endif // __APPLE__ |
|
#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS) |
|
#define MAP_ANONYMOUS MAP_ANON |
|
#endif |
|
// MAP_ANONYMOUS |
|
#if defined(__APPLE__) |
|
// For mmap, Linux defines both MAP_ANONYMOUS and MAP_ANON and says MAP_ANON is |
|
// deprecated. In Darwin, MAP_ANON is all there is. |
|
#if !defined MAP_ANONYMOUS |
|
#define MAP_ANONYMOUS MAP_ANON |
|
#endif // !MAP_ANONYMOUS |
|
#endif // __APPLE__ |
Note that the comment is outdated: MAP_ANONYMOUS does exist on Darwin in OS X 10.11 (released 2015) and later.
There are two places where similar code needs to be added, or it needs to be moved into a more central include file:
|
void* p = ::mmap(nullptr, num_bytes, PROT_READ | PROT_WRITE, |
|
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); |
|
void* altstack = mmap(nullptr, kAlternateStackSize, PROT_READ | PROT_WRITE, |
|
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); |
I see no reason to limit the fix to systems where __APPLE__ is defined.
s2 fails to build on OS X 10.10 and earlier:
https://trac.macports.org/ticket/67784
MAP_ANONYMOUSis equivalent toMAP_ANONwhich is available on older systems.There are several places where you already have code to address this:
s2/src/absl/base/internal/low_level_alloc.cc
Lines 56 to 63 in 4fe0c97
s2/src/absl/debugging/failure_signal_handler.cc
Lines 154 to 156 in 4fe0c97
s2/src/s2/base/port.h
Lines 574 to 581 in 4fe0c97
Note that the comment is outdated:
MAP_ANONYMOUSdoes exist on Darwin in OS X 10.11 (released 2015) and later.There are two places where similar code needs to be added, or it needs to be moved into a more central include file:
s2/src/absl/debugging/internal/examine_stack.cc
Lines 57 to 58 in 4fe0c97
s2/src/absl/debugging/internal/stack_consumption.cc
Lines 113 to 114 in 4fe0c97
I see no reason to limit the fix to systems where
__APPLE__is defined.