Makefile


Log

Author Commit Date CI Message
Ralf Habacker faa2ff80 2020-09-14T12:21:55 Makefile: Adjust paths of source files, which are now located in subdirectories
Pali Rohár 2b342400 2019-08-22T23:36:22 Makefile: Fix building both static and shared library at the same time Static library libdl.a must be build without -DSHARED flag for obvious reason. So -DSHARED cannot be in global CFLAGS. Define also two separate test targets: test.exe for shared library and test-static.exe for static library.
Pali Rohár f3da31d7 2019-05-06T21:47:33 Load Psapi.dll at runtime, this avoids linking caveat
Pali Rohár 63d7bda4 2019-01-29T22:57:04 Implement support for dlsym() with RTLD_DEFAULT and RTLD_NEXT dlsym() with RTLD_DEFAULT handle behaves in same way like with global handle returned by dlopen() with NULL file name. dlsym() with RTLD_NEXT handle search for next loaded module which provides specified symbol. "Next" means module which in EnumProcessModules() result after the module which called dlsym(). To get caller function of dlsym() use _ReturnAddress() intrinsic. To get module where is caller function use the fact that HMODULE is the same value as the module's base address. When compiling under gcc, defines _ReturnAddress() macro via gcc's builtin as it does not provide MSC's specific _ReturnAddress() intrinsic. Added tests demonstrate that both RTLD_DEFAULT and RTLD_NEXT are working as expected.
Pali Rohár 29c46a54 2019-01-29T22:38:42 Fix resolving global symbols when LoadLibrary() is called after dlopen() Usage of first_automatic_object cache is wrong. This cache is filled by all loaded DLL files (either implicitly or explicitly with LoadLibrary() call) by EnumProcessModules() call at first usage of dlopen(). So dlsym() can resolve global symbols only if they were loaded prior to dlopen() call. Any future usage of LoadLibrary() does not include newly loaded DLLs into first_automatic_object cache. To fix this problem, first_automatic_object cache is fully removed and EnumProcessModules() call is issued directly in dlsym() call. As EnumProcessModules() returns all DLLs, included those which were loaded by dlopen() with RTLD_LOCAL, it may break RTLD_LOCAL support. To address this problem switch linked-list of all loaded DLLs with RTLD_GLOBAL to linked-list of all loaded DLLs with RTLD_LOCAL flag. And then skip modules from EnumProcessModules() which are in linked-list. Also in WinAPI all DLLs loaded by LoadLibrary() behaves like RTLD_GLOBAL. So above change is compatible with this behavior. There may be another problem. Before retrieving HMODULE for DLL filename (which is done by LoadLibrary()), it is not possible to detect if DLL was already loaded by RTLD_LOCAL or not. And after calling LoadLibrary() it is not possible to know if DLL was loaded either by dlsym() with RTLD_LOCAL or by LoadLibrary() (which is equivalent to RTLD_GLOBAL). To address this problem, compare number of loaded modules (counted by EnumProcessModules()) before and after LoadLibrary() called from dlsym(). If number does not change it means that DLL was already loaded. So based on this result either add or remove HMODULE from linked-list of RTLD_LOCAL modules. Added test demonstrate usage of: global = dlopen(NULL, RTLD_GLOBAL); /* global handle */ LoadLibrary("library.dll"); /* this provides function */ function = dlsym(global, "function"); /* resolve function from library.dll */
Boris Nagaev e19bf076 2016-07-25T13:49:13 configure: put test.{c,dll} to current directory (#26) instead of /tmp/ to avoid races when building for multiple targets. Add test files to .gitignore and `make clean`.
Timothy Gu dd4254a3 2014-10-08T15:50:21 Add linked modules to a separate global list Fixes #2.
Timothy Gu 5ea707ad 2015-03-15T16:35:22 Define SHARED when building shared library
Timothy Gu 9e5c2eb2 2015-03-11T17:15:03 Merge pull request #7 from xantares/patch-3 only one rule to generate shared/export lib Fixes #1
xantares cb7a22d4 2015-03-10T10:49:17 only one rule to generate shared/export lib or else the rule is applied to libdl.dll AND libdl.dll.a: x86_64-w64-mingw32-gcc -Wl,--out-implib,libdl.dll.a -shared -o libdl.dll dlfcn.o x86_64-w64-mingw32-gcc -Wl,--out-implib,libdl.dll.a -shared -o libdl.dll.a dlfcn.o
xantares f869380a 2015-03-03T08:49:31 add CFLAGS
Timothy Gu 665499d0 2014-03-27T02:58:02 Build sys additions * wine support for testing * License boilerplate * Reorder configure checks
Timothy Gu 2ef1b924 2014-02-07T05:14:53 Makefile: cosmetics
Timothy Gu 39829878 2014-02-07T05:14:03 Makefile: some rework with better dependency tracking More to come later
Ramiro Polla f290240c 2012-10-10T22:14:56 lowercase PREFIX variables
Ramiro Polla 5da418e9 2009-01-11T21:31:27 Move libcmd to configure.
Ramiro Polla 3cacb13d 2009-01-11T21:28:05 Fix stripping when cross-compiling.
Ramiro Polla 0122e850 2009-01-11T21:02:36 Allow cross-compilation with --cross-prefix.
Ramiro Polla f27c0727 2008-12-09T21:02:30 Print all compiler warnings.
Ramiro Polla e2c8fc0f 2007-06-29T20:50:05 Add option to specify include and lib folder Patch by Víctor Paesa
Ramiro Polla 85d184f7 2007-06-29T20:36:07 Cosmetics: white space
Ramiro Polla 4c4b268c 2007-06-28T05:50:08 Initial Revision