[php-src] PR #13655: Remove DLSYM_NEEDS_UNDERSCORE

From: Date: Sun, 10 Mar 2024 05:56:48 +0000
Subject: [php-src] PR #13655: Remove DLSYM_NEEDS_UNDERSCORE
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-25346@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/13655 Author: petk Some non-ELF platforms in the past (BSD-based systems, OpenBSD, NetBSD, FreeBSD and Mac OS X ~10.3) required dlsym() to have symbol names prefixed with an underscore (_) character. This isn't relevant anymore on current systems. I'm targeting the master branch (PHP-8.4), otherwise this can also wait for PHP-9 if there's some concern for this to be removed too soon. <details><summary>The Libtool's check via Autoconf defines the DLSYM_NEEDS_UNDERSCORE symbol</summary> ```c #include <dlfcn.h> #include <stdio.h> #include <stdlib.h> #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may need to define LT_DLLAZY_OR_NOW on the command line if we discover that it does not work on some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i = 42; } int main(void) { void *self = dlopen(0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = 0; if (self) { if (dlsym(self, "fnord")) status = 1; else if (dlsym(self, "_fnord")) status = 2; /* dlclose(self); */ } else { puts(dlerror()); } return (status); } ``` </details>

« previous php.git-pulls (#25346) next »