From fc6f6cbc684652a72e1077c48988a00243503fff Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 20 Dec 2018 11:34:12 +0300 Subject: [PATCH] Allow to force executable pages allocation in gctest Pass -D TEST_PAGES_EXECUTABLE to CFLAGS to enable the executable pages allocation in gctest even if the collector is compiled with NO_EXECUTE_PERMISSION. * tests/test.c (INIT_PAGES_EXECUTABLE): New macro (calls GC_set_pages_executable(1) if TEST_PAGES_EXECUTABLE). * tests/test.c (GC_COND_INIT): Call INIT_PAGES_EXECUTABLE (before GC_OPT_INIT). * tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK] (main): Remove UNTESTED(GC_set_pages_executable). --- tests/test.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test.c b/tests/test.c index 69be479e..321425f3 100644 --- a/tests/test.c +++ b/tests/test.c @@ -156,6 +156,12 @@ # define INIT_MANUAL_VDB_ALLOWED /* empty */ #endif +#ifdef TEST_PAGES_EXECUTABLE +# define INIT_PAGES_EXECUTABLE GC_set_pages_executable(1) +#else +# define INIT_PAGES_EXECUTABLE (void)0 +#endif + #define CHECK_GCLIB_VERSION \ if (GC_get_version() != ((GC_VERSION_MAJOR<<16) \ | (GC_VERSION_MINOR<<8) \ @@ -185,7 +191,7 @@ #endif #define GC_COND_INIT() \ - INIT_FORK_SUPPORT; INIT_MANUAL_VDB_ALLOWED; \ + INIT_FORK_SUPPORT; INIT_MANUAL_VDB_ALLOWED; INIT_PAGES_EXECUTABLE; \ GC_OPT_INIT; CHECK_GCLIB_VERSION; \ INIT_PRINT_STATS; INIT_FIND_LEAK; INIT_PERF_MEASUREMENT @@ -1971,7 +1977,6 @@ void GC_CALLBACK warn_proc(char *msg, GC_word p) UNTESTED(GC_set_on_collection_event); UNTESTED(GC_set_on_heap_resize); UNTESTED(GC_set_oom_fn); - UNTESTED(GC_set_pages_executable); UNTESTED(GC_set_push_other_roots); UNTESTED(GC_set_start_callback); UNTESTED(GC_set_stop_func); -- 2.40.0