[llvm-commits] Bug in "call __chkstak" on 64 bit OS
NAKAMURA Takumi
geek4civic at gmail.com
Tue Feb 21 18:36:30 PST 2012
Marina,
Please try my attached patch.
It seeks predefined symbols before DLLs.
IMO, tweaking only "chkstk" would be ad-hoc hack. I would be happier
if entire calls/jmps could be resolved as indirect.
Introducing large model is good thing, though! ;)
...Takumi
-------------- next part --------------
diff --git a/llvm/lib/Support/Windows/DynamicLibrary.inc b/llvm/lib/Support/Windows/DynamicLibrary.inc
index 83da82a..e858d74 100644
--- a/llvm/lib/Support/Windows/DynamicLibrary.inc
+++ b/llvm/lib/Support/Windows/DynamicLibrary.inc
@@ -124,17 +124,7 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
return i->second;
}
- // Now search the libraries.
- if (OpenedHandles) {
- for (DenseSet<HMODULE>::iterator I = OpenedHandles->begin(),
- E = OpenedHandles->end(); I != E; ++I) {
- FARPROC ptr = GetProcAddress((HMODULE)*I, symbolName);
- if (ptr) {
- return (void *)(intptr_t)ptr;
- }
- }
- }
-
+ // Next, search predefined explicit symbols.
#define EXPLICIT_SYMBOL(SYM) \
if (!strcmp(symbolName, #SYM)) return (void*)&SYM;
#define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \
@@ -147,6 +137,17 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
#undef EXPLICIT_SYMBOL
#undef EXPLICIT_SYMBOL2
+ // Now search the libraries.
+ if (OpenedHandles) {
+ for (DenseSet<HMODULE>::iterator I = OpenedHandles->begin(),
+ E = OpenedHandles->end(); I != E; ++I) {
+ FARPROC ptr = GetProcAddress((HMODULE)*I, symbolName);
+ if (ptr) {
+ return (void *)(intptr_t)ptr;
+ }
+ }
+ }
+
return 0;
}
More information about the llvm-commits
mailing list