value.h: add configuration macros around `mrb_ro_data_p()`; close
`MRB_USE_ETEXT_RO_DATA_P`: use `etext` and `edata`
`MRB_NO_DEFAULT_RO_DATA_P`: not use the default `mrb_ro_data_p()`
MODIFY
include/mrbconf.h
include/mrbconf.h
/* number of object per heap page */
//#define MRB_HEAP_PAGE_SIZE 1024
+/* define if your platform does not support etext, edata */
+//#define MRB_NO_DEFAULT_RO_DATA_P
+
+/* define if your platform supports etext, edata */
+//#define MRB_USE_RO_DATA_P_ETEXT
+/* use MRB_USE_ETEXT_RO_DATA_P by default on Linux */
+#if (defined(__linux__) && !defined(__KERNEL__))
+#define MRB_USE_ETEXT_RO_DATA_P
+#endif
+
/* you can provide and use mrb_ro_data_p() for your platform.
prototype is `mrb_bool mrb_ro_data_p(const char *ptr)` */
//#define MRB_USE_CUSTOM_RO_DATA_P

MODIFY
include/mruby/value.h
include/mruby/value.h
@@ -411,7 +411,8 @@ mrb_undef_value(void)
#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(__linux__) && !defined(__KERNEL__))
+#elif !defined(MRB_NO_DEFAULT_RO_DATA_P)
+#if defined(MRB_USE_ETEXT_RO_DATA_P)
#define MRB_LINK_TIME_RO_DATA_P
extern char etext, edata;
static inline mrb_bool
@@ -427,7 +428,9 @@ mrb_ro_data_p(const char *p)
{
return (char*)get_etext() < p && p < (char*)get_edata();
}
-#else
+#endif /* Linux or macOS */
+#endif /* MRB_NO_DEFAULT_RO_DATA_P */
+#ifndef MRB_LINK_TIME_RO_DATA_P
# define mrb_ro_data_p(p) FALSE
#endif

value.h: add configuration macros around `mrb_ro_data_p()`; close #5547

- `MRB_USE_ETEXT_RO_DATA_P`: use `etext` and `edata`
- `MRB_NO_DEFAULT_RO_DATA_P`: not use the default `mrb_ro_data_p()`