http://llvm.org/bugs/show_bug.cgi?id=21896

            Bug ID: 21896
           Summary: clang-cl: Implement /Gs compiler switch
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

The /Gs compiler switch is ignored by clang-cl:

1>clang-cl.exe : warning : argument unused during compilation: '/Gs0x7fffffff'
1>...
1>main.obj : error LNK2019: unresolved external symbol __chkstk referenced in
function "int __cdecl mainCRTStartup(void)" (?mainCRTStartup@@YAHXZ)

The /Gs compiler switch is needed to suppress calls to __chkstk (the stack
probing function used by MSVC), e.g. when one carefully uses stack memory so
that all necessary stack probes are initiated, or when compiling with
/NODEFAULTLIB (as __chkstk would then be undefined). 

One workaround could be to forward /Gs0x7fffffff or /Gs2147483647 (the maximum
value for /Gs, which is the recommended way to suppress all __chkstk() calls)
to -mno-stack-arg-probe. Currently a /Gs value of 4096 seems to be hardcoded in
LLVM:

http://llvm.org/klaus/llvm/blob/master/lib/Target/X86/X86FrameLowering.cpp#L-709

Specifying -mno-stack-arg-probe will probably set UseStackProbe to false.

Reference:
http://msdn.microsoft.com/en-us/library/9598wk25

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to