[PATCH] Bug 18582 - Offset overflow on calling __chkstk and __alloca on x64

Benoit Belley benoit.belley at autodesk.com
Thu Jan 29 08:48:03 PST 2015

majnemer wrote:

> I'm a little confused here.

Me also! :-)

> The symbols __alloca and __chkstk come from a DLL which means that referring to them goes to a thunk which will then dereference __imp__chkstk and __imp__alloca. The thunks are built by the linker which means that they must be accessible to your EXE or DLL regardless how far away you are from the C runtime's DLL.

Probably... I'll have to investigate.

> I guess my first question would be, how does the symbol for __chkstk work out when running on the JIT? Do we literally find out where the CRT's __chkstk function is in memory and use that address?

Yes, that's what the problem is...

> If so, how about we say that these calls should be indirect if we are using CodeModel::Large ?

I'm ok about the indirection. But, I really don't understand why going through that __imp__chkstk indirection wouldn't be necessary in the CodeModel::Small and CodeModel::Medium also. AFAIU, this is an X86_64 specific issue, not a large model issue...




More information about the llvm-commits mailing list