Skip to content

Commit

Permalink
Add macOS support to mrb_ro_data_p
Browse files Browse the repository at this point in the history
This adds macOS support to mrb_ro_data_p, fixes #3636
  • Loading branch information
Asmod4n authored Apr 25, 2017
1 parent cef523c commit 9057a3f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/mruby/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,14 @@ mrb_undef_value(void)
}

#ifdef MRB_USE_ETEXT_EDATA
#if (defined(__APPLE__) && defined(__MACH__))
#include <mach-o/getsect.h>
static inline mrb_bool
mrb_ro_data_p(const char *p)
{
return (const char*)get_etext() < p && p < (const char*)get_edata();
}
#else
extern char _etext[];
#ifdef MRB_NO_INIT_ARRAY_START
extern char _edata[];
Expand All @@ -284,6 +292,7 @@ mrb_ro_data_p(const char *p)
return _etext < p && p < (char*)&__init_array_start;
}
#endif
#endif
#else
# define mrb_ro_data_p(p) FALSE
#endif
Expand Down

0 comments on commit 9057a3f

Please sign in to comment.