[llvm-bugs] [Bug 49535] New: Windows/DynamicLibrary: within a Win32/x86 exe, DynamicLibrary::HandleSet::DLSym looks a the wrong UCRT DLL

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 11 01:58:26 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49535

            Bug ID: 49535
           Summary: Windows/DynamicLibrary: within a Win32/x86 exe,
                    DynamicLibrary::HandleSet::DLSym looks a the wrong
                    UCRT DLL
           Product: libraries
           Version: 11.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: francis.andre.kampbell at orange.fr
                CC: llvm-bugs at lists.llvm.org

Created attachment 24622
  --> https://bugs.llvm.org/attachment.cgi?id=24622&action=edit
The source code

Hello

I am running a 32 bit lli.exe with a simple HelloWorld program as
#include <stdio.h>
int main() {
    printf("HelloWorld!\n");
    return 0;
}

and got this stack trace
Assertion failed: OffsetBytes <= AllocationSize && "Offset out of bounds!",
file
D:\projects\as400\rpg\llvm-project\llvm\lib\ExecutionEngine\RuntimeDyld\RuntimeDyldImpl.h,
line 90
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.      Program arguments:
D:\\projects\\as400\\rpg\\llvm-project\\build32\\Debug\\bin\\lli -debug
hw-m32.ll
 #0 0x01b9b709 HandleAbort
D:\projects\as400\rpg\llvm-project\llvm\lib\Support\Windows\Signals.inc:408:0
 #1 0x7a53fd98 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x9fd98)
 #2 0x7a5412e2 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa12e2)
 #3 0x7a5456d4 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa56d4)
 #4 0x7a543cca (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa3cca)
 #5 0x7a545c7a (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa5c7a)
 #6 0x01740f07 llvm::SectionEntry::getAddressWithOffset(unsigned int) const
D:\projects\as400\rpg\llvm-project\llvm\lib\ExecutionEngine\RuntimeDyld\RuntimeDyldImpl.h:90:0
 #7 0x01744c45 llvm::RuntimeDyldCOFFI386::resolveRelocation(class
llvm::RelocationEntry const &, unsigned __int64)
D:\projects\as400\rpg\llvm-project\llvm\lib\ExecutionEngine\RuntimeDyld\Targets\RuntimeDyldCOFFI386.h:144:0
 #8 0x01719e58 llvm::RuntimeDyldImpl::resolveRelocationList(class
llvm::SmallVector<class llvm::RelocationEntry, 64> const &, unsigned __int64)
D:\projects\as400\rpg\llvm-project\llvm\lib\ExecutionEngine\RuntimeDyld\RuntimeDyld.cpp:1082:0
 #9 0x0171d7c9 llvm::RuntimeDyldImpl::resolveLocalRelocations(void)
D:\projects\as400\rpg\llvm-project\llvm\lib\ExecutionEngine\RuntimeDyld\RuntimeDyld.cpp:153:0
#10 0x0171d5da llvm::RuntimeDyldImpl::resolveRelocations(void)
D:\projects\as400\rpg\llvm-project\llvm\lib\ExecutionEngine\RuntimeDyld\RuntimeDyld.cpp:139:0
#11 0x0171823d llvm::RuntimeDyld::resolveRelocations(void)
D:\projects\as400\rpg\llvm-project\llvm\lib\ExecutionEngine\RuntimeDyld\RuntimeDyld.cpp:1379:0
#12 0x0144bfa5 llvm::MCJIT::finalizeLoadedModules(void)
D:\projects\as400\rpg\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp:245:0
#13 0x0144bdb2 llvm::MCJIT::finalizeObject(void)
D:\projects\as400\rpg\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp:271:0
#14 0x006f080e main
D:\projects\as400\rpg\llvm-project\llvm\tools\lli\lli.cpp:631:0
#15 0x02d22013 invoke_main
d:\agent\_work\57\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78:0
#16 0x02d21e97 _scrt_common_main_seh
d:\agent\_work\57\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
#17 0x02d21d2d _scrt_common_main
d:\agent\_work\57\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331:0
#18 0x02d22098 mainCRTStartup
d:\agent\_work\57\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17:0
#19 0x75336359 (C:\WINDOWS\System32\KERNEL32.DLL+0x16359)
#20 0x774c8944 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x68944)
#21 0x774c8914 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x68914)

In fact, the failed assertion "Assertion failed: OffsetBytes <= AllocationSize
&& "Offset out of bounds!" is a side effect of a unresolved symbol
'___acrt_iob_func' that lli.exe is looking for thru the DynamicLibrary module.

The point is that this external unresolved symbol '___acrt_iob_func' is located
in the C:\Windows\SysWOW64\ucrtbased.dll and is absent from the
C:\Windows\system32\ucrtbased.dll.

Thus, this is an issue. DynalicLibrary should look for all unresolved symbols
in a 32 bit Win32/x86 module into the C:\Windows\SysWOW64 directory and not the
C:\Windows\system32.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210311/3f0df16e/attachment.html>


More information about the llvm-bugs mailing list