mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
value.h: reconstruct mrb_ro_data_p().
* use predefined `mrb_ro_data_p()` for user-mode Linux and macOS * define `MRB_LINK_TIME_RO_DATA_P` if predefined one is used * configure macro `MRB_USE_LINK_TIME_RO_DATA_P` is no longer used * contributions for new platforms are welcome
This commit is contained in:
@@ -408,17 +408,11 @@ mrb_undef_value(void)
|
||||
return v;
|
||||
}
|
||||
|
||||
#if defined(MRB_USE_ETEXT_EDATA) && !defined(MRB_USE_LINK_TIME_RO_DATA_P)
|
||||
# ifdef __GNUC__
|
||||
# warning MRB_USE_ETEXT_EDATA is deprecated. Define MRB_USE_LINK_TIME_RO_DATA_P instead.
|
||||
# endif
|
||||
# define MRB_USE_LINK_TIME_RO_DATA_P
|
||||
#endif
|
||||
|
||||
#if defined(MRB_USE_CUSTOM_RO_DATA_P)
|
||||
/* If you define `MRB_USE_CUSTOM_RO_DATA_P`, you must implement `mrb_ro_data_p()`. */
|
||||
mrb_bool mrb_ro_data_p(const char *p);
|
||||
#elif defined(MRB_USE_LINK_TIME_RO_DATA_P) || defined(__linux__)
|
||||
#elif (defined(__linux__) && !defined(__KERNEL__))
|
||||
#define MRB_LINK_TIME_RO_DATA_P
|
||||
extern char __ehdr_start[];
|
||||
extern char __init_array_start[];
|
||||
|
||||
@@ -428,6 +422,7 @@ mrb_ro_data_p(const char *p)
|
||||
return __ehdr_start < p && p < __init_array_start;
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
#define MRB_LINK_TIME_RO_DATA_P
|
||||
#include <mach-o/getsect.h>
|
||||
static inline mrb_bool
|
||||
mrb_ro_data_p(const char *p)
|
||||
|
||||
Reference in New Issue
Block a user