Define MAP_ANONYMOUS if not defined #1500
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Building abseil on OS X 10.10 and earlier fails:
The fix for this issue is to define
MAP_ANONYMOUS
to be equal to the olderMAP_ANON
if it is not already defined.There are other places in the abseil code where this was already being done (see #120), just not everywhere.
In failure_signal_handler.cc, the fix was embedded in the middle of a function. It seems cleaner to have it near the top of the file, as it is in low_level_alloc.cc, so I added it to the top in the new files and moved it to the top in failure_signal_handler.cc.
In low_level_alloc.cc, the fix was restricted only to Apple platforms, and this had to be expanded to a second platform recently (see be85b34):
abseil-cpp/absl/base/internal/low_level_alloc.cc
Lines 60 to 67 in be85b34
There's no reason to restrict it by platform at all; just define it if it's not defined, on any platform. The comment about
MAP_ANONYMOUS
not existing on Darwin is also outdated; it does exist in Darwin on OS X 10.11 (released 2015) and later. So I've also removed these comments and restrictions and made this block the same as the others.Maybe there is some central header where this could be addressed once instead of being copied into each file that uses
MAP_ANONYMOUS
but I don't know the abseil code well enough to determine that.Feel free to edit the code or commit message as required for your standards.