|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2015-10-16 07:47 UTC] for-bugs at hnw dot jp
 Description: ------------ I built and ran PHP 7.0.0RC5 on Mac OS X 10.10. Then "Symbol not found" error occurred. On the same machine, 7.0.0RC2 runs correctly. The correct binary can be built by "./configure --disable-huge-code-pages". On Mac OS X, "HAVE_HUGE_CODE_PAGES" should be undefined. Test script: --------------- <?php echo 1; Expected result: ---------------- 1 Actual result: -------------- dyld: lazy symbol binding failed: Symbol not found: _accel_move_code_to_huge_pages Referenced from: /Users/hnw/.phpenv/versions/7.0.0RC5/lib/php/extensions/no-debug-non-zts-20151012/opcache.so Expected in: flat namespace dyld: Symbol not found: _accel_move_code_to_huge_pages Referenced from: /Users/hnw/.phpenv/versions/7.0.0RC5/lib/php/extensions/no-debug-non-zts-20151012/opcache.so Expected in: flat namespace Trace/BPT trap: 5 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 01:00:01 2025 UTC | 
could you please verify this patch? diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index e6d7005..c4b66ea 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -2517,13 +2517,13 @@ static int accel_remap_huge_pages(void *start, size_t size, const char *name, si } memcpy(mem, start, size); -#ifdef MAP_HUGETLB +# ifdef MAP_HUGETLB ret = mmap(start, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED | MAP_HUGETLB, -1, 0); -#endif -#ifdef MADV_HUGEPAGE +# endif +# ifdef MADV_HUGEPAGE if (ret == MAP_FAILED) { ret = mmap(start, size, PROT_READ | PROT_WRITE | PROT_EXEC, @@ -2531,7 +2531,7 @@ static int accel_remap_huge_pages(void *start, size_t size, const char *name, si -1, 0); madvise(start, size, MADV_HUGEPAGE); } -#endif +# endif if (ret == start) { memcpy(start, mem, size); mprotect(start, size, PROT_READ | PROT_EXEC); @@ -2565,7 +2565,12 @@ static void accel_move_code_to_huge_pages(void) fclose(f); } } -# endif +# else +static void accel_move_code_to_huge_pages(void) +{ + return; +} +# endif /* defined(MAP_HUGETLB) || defined(MADV_HUGEPAGE) */ #endif /* HAVE_HUGE_CODE_PAGES */ static int accel_startup(zend_extension *extension) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index bd53f6e..0d87e46 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -242,7 +242,6 @@ static ZEND_INI_MH(OnEnable) } #ifdef HAVE_OPCACHE_FILE_CACHE - static ZEND_INI_MH(OnUpdateFileCache) { if (new_value) { @@ -269,6 +268,18 @@ static ZEND_INI_MH(OnUpdateFileCache) } #endif +#ifdef HAVE_HUGE_CODE_PAGES +static ZEND_INI_MH(OnUpdateHugeCodePages) +{ +# if defined(MAP_HUGETLB) || defined(MADV_HUGEPAGE) + OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); +# else + zend_accel_error(ACCEL_LOG_WARNING, "opcache.huge_code_pages has no affect as huge page is not avaliable\n"); +# endif + return SUCCESS; +} +#endif + ZEND_INI_BEGIN() STD_PHP_INI_BOOLEAN("opcache.enable" , "1", PHP_INI_ALL, OnEnable, enabled , zend_accel_globals, accel_globals) STD_PHP_INI_BOOLEAN("opcache.use_cwd" , "1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.use_cwd , zend_accel_globals, accel_globals) @@ -313,7 +324,7 @@ ZEND_INI_BEGIN() STD_PHP_INI_ENTRY("opcache.file_cache_fallback" , "1" , PHP_INI_SYSTEM, OnUpdateBool, accel_directives.file_cache_fallback, zend_accel_globals, accel_globals) #endif #ifdef HAVE_HUGE_CODE_PAGES - STD_PHP_INI_BOOLEAN("opcache.huge_code_pages" , "0" , PHP_INI_SYSTEM, OnUpdateBool, accel_directives.huge_code_pages, zend_accel_globals, accel_globals) + STD_PHP_INI_BOOLEAN("opcache.huge_code_pages" , "0" , PHP_INI_SYSTEM, OnUpdateHugeCodePages, accel_directives.huge_code_pages, zend_accel_globals, accel_globals) #endif ZEND_INI_END() thanks