[LLVMbugs] [Bug 21896] New: clang-cl: Implement /Gs compiler switch

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Dec 12 08:14:10 PST 2014


            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: unassignedclangbugs at nondot.org
          Reporter: clangbugs.10.mdwxzxkl at spamgourmet.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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

1>clang-cl.exe : warning : argument unused during compilation: '/Gs0x7fffffff'
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


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


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/20141212/8229e0eb/attachment.html>

More information about the llvm-bugs mailing list