Re: FFI symbol resolution problems on Windows

  • From: Konstantin Olkhovskiy <lupus@xxxxxxxxxx>
  • To: luajit <luajit@xxxxxxxxxxxxx>
  • Date: Mon, 22 Dec 2014 23:48:43 +0400

2014-12-22 6:14 GMT+03:00 malkia <malkia@xxxxxxxxx>:

> Try running it through Dependency Walker http://www.dependencywalker.com/
>
press F7 and select everything
>

I did not know it could do that, thanks for a hint! Here is somewhat
relevant excerpt
from the log:

--------------------------------------------------------------------------------
Starting profile on 12/22/2014 at 10:34:20 PM

Operating System: Microsoft Windows NT/2000/XP/2003/Vista based Enterprise
(64-bit), version 6.01.7601 Service Pack 1
Program Executable: e:\LUAJIT.EXE
Program Arguments: test.lua
Starting Directory: E:\
Search Path:
E:\ActivePerl-5.8.8.819-MSWin32-x86-267479\perl\bin\;C:\MinGW\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\

Options Selected:
     Simulate ShellExecute by inserting any App Paths directories into the
PATH environment variable.
     Log DllMain calls for process attach and process detach messages.
     Log DllMain calls for all other messages, including thread attach and
thread detach.
     Hook the process to gather more detailed dependency information.
     Log LoadLibrary function calls.
     Log GetProcAddress function calls.
     Log thread information.
     Use simple thread numbers instead of actual thread IDs.
     Log first chance exceptions.
     Log debug output messages.
     Use full paths when logging file names.
     Log a time stamp with each line of log.
     Automatically open and profile child processes.
--------------------------------------------------------------------------------

00:00:00.000: Started "e:\LUAJIT.EXE" (process 0x2BE4) at address
0x00400000 by thread 1.  Successfully hooked module.
<...>
00:00:00.828: DllMain(0x67EC0000, DLL_PROCESS_ATTACH, 0x00000000) in
"e:\LIBAPR-1-0.DLL" called by thread 1.
00:00:00.844: GetProcAddress(0x6E940000 [c:\mingw\bin\LIBGCC_S_DW2-1.DLL],
"__register_frame_info") called from "e:\LIBAPR-1-0.DLL" at address
0x67EC11EE and returned 0x6E954510 by thread 1.
00:00:00.844: DllMain(0x67EC0000, DLL_PROCESS_ATTACH, 0x00000000) in
"e:\LIBAPR-1-0.DLL" returned 1 (0x1) by thread 1.
00:00:00.844: LoadLibraryA("./libapr-1-0.dll") returned 0x67EC0000 by
thread 1.
00:00:12.453: GetProcAddress(0x67EC0000 [e:\LIBAPR-1-0.DLL], "apr_env_get")
called from "e:\LUAJIT.EXE" at address 0x0044DC89 and returned NULL by
thread 1. Error: The specified procedure could not be found (127).
00:00:12.453: GetProcAddress(0x67EC0000 [e:\LIBAPR-1-0.DLL],
"_apr_env_get@12") called from "e:\LUAJIT.EXE" at address 0x0044DC89 and
returned NULL by thread 1. Error: The specified procedure could not be
found (127).
00:00:12.469: GetProcAddress(0x6E940000 [c:\mingw\bin\LIBGCC_S_DW2-1.DLL],
"__deregister_frame_info") called from "e:\LUAJIT.EXE" at address
0x0040139E and returned 0x6E954900 by thread 1.
<...>
00:00:12.500: DllMain(0x67EC0000, DLL_PROCESS_DETACH, 0x00000001) in
"e:\LIBAPR-1-0.DLL" called by thread 1.
00:00:12.500: GetProcAddress(0x6E940000 [c:\mingw\bin\LIBGCC_S_DW2-1.DLL],
"__deregister_frame_info") called from "e:\LIBAPR-1-0.DLL" at address
0x67EC127E and returned 0x6E954900 by thread 1.
00:00:12.500: DllMain(0x67EC0000, DLL_PROCESS_DETACH, 0x00000001) in
"e:\LIBAPR-1-0.DLL" returned 1 (0x1) by thread 1.
00:00:12.500: DllMain(0x6E940000, DLL_PROCESS_DETACH, 0x00000001) in
"c:\mingw\bin\LIBGCC_S_DW2-1.DLL" called by thread 1.
00:00:12.500: GetProcAddress(0x6E940000 [c:\mingw\bin\LIBGCC_S_DW2-1.DLL],
"__deregister_frame_info") called from "c:\mingw\bin\LIBGCC_S_DW2-1.DLL" at
address 0x6E94125E and returned 0x6E954900 by thread 1.
00:00:12.516: DllMain(0x6E940000, DLL_PROCESS_DETACH, 0x00000001) in
"c:\mingw\bin\LIBGCC_S_DW2-1.DLL" returned 1 (0x1) by thread 1.
<...>
00:00:12.609: Exited "e:\LUAJIT.EXE" (process 0x2BE4) with code 3 (0x3) by
thread 1.

Looks like LuaJIT is trying "apr_env_get", and then "_apr_env_get@12",
which looks
identical to the one, listed by objdump.

-- 
Regards,
Konstantin

Other related posts: