aboutsummaryrefslogtreecommitdiff
path: root/Makefile (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Makefile: Fix building both static and shared library at the same timePali Rohár2019-08-221-18/+20
| | | | | | | | 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.
* Load Psapi.dll at runtime, this avoids linking caveatPali Rohár2019-05-061-5/+4
|
* Implement support for dlsym() with RTLD_DEFAULT and RTLD_NEXTPali Rohár2019-02-141-2/+5
| | | | | | | | | | | | | | | | | | | 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.
* Fix resolving global symbols when LoadLibrary() is called after dlopen()Pali Rohár2019-02-141-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 */
* configure: put test.{c,dll} to current directory (#26)Boris Nagaev2016-07-251-1/+5
| | | | | instead of /tmp/ to avoid races when building for multiple targets. Add test files to .gitignore and `make clean`.
* Add linked modules to a separate global listTimothy Gu2015-03-151-3/+4
| | | | Fixes #2.
* Define SHARED when building shared libraryTimothy Gu2015-03-151-0/+1
|
* Merge pull request #7 from xantares/patch-3Timothy Gu2015-03-111-2/+2
|\ | | | | | | | | only one rule to generate shared/export lib Fixes #1
| * only one rule to generate shared/export libxantares2015-03-101-2/+2
| | | | | | | | | | 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
* | add CFLAGSxantares2015-03-031-1/+2
|/
* Build sys additionsTimothy Gu2014-03-271-1/+1
| | | | | | * wine support for testing * License boilerplate * Reorder configure checks
* Makefile: cosmeticsTimothy Gu2014-02-071-8/+8
|
* Makefile: some rework with better dependency trackingTimothy Gu2014-02-071-18/+24
| | | | More to come later
* lowercase PREFIX variablesRamiro Polla2012-10-101-3/+3
|
* Move libcmd to configure.Ramiro Polla2009-01-111-3/+0
|
* Fix stripping when cross-compiling.Ramiro Polla2009-01-111-5/+0
|
* Allow cross-compilation with --cross-prefix.Ramiro Polla2009-01-111-2/+2
|
* Print all compiler warnings.Ramiro Polla2008-12-091-1/+1
|
* Add option to specify include and lib folderRamiro Polla2007-06-291-10/+10
| | | Patch by Víctor Paesa
* Cosmetics: white spaceRamiro Polla2007-06-291-1/+1
|
* Initial RevisionRamiro Polla2007-06-281-0/+77