This code adds the -mstack-probe-size command line option and implements the /Gs compiler switch for clang-cl.
This should fix http://llvm.org/bugs/show_bug.cgi?id=21896
Differential D6685
Implement command line options for stack probe space AndrewH on Dec 16 2014, 11:20 AM. Authored by
Details This code adds the -mstack-probe-size command line option and implements the /Gs compiler switch for clang-cl. This should fix http://llvm.org/bugs/show_bug.cgi?id=21896
Diff Detail
Event TimelineComment Actions Like the bug this bug depends on: I took the liberty to add some reviewers based on the commit history. Is anything blocking this? I would be happy to help. Comment Actions Thanks! I think this looks good. Please also add a test for the /Gs alias in test/Driver/cl-options.c, and remove it from the "Unsupported but parsed" section. Comment Actions Added some management code to make the special case -mstack-probe-size=0 work. Current behavior is that when -mstack-probe-size is omitted, the X86 target will choose the default stack probe size (which is currently 4096 bytes, but I did not want to expose such internal technicalities to the driver). When -mstack-probe-size=n is used, the X86 target will use a stack probing size of n bytes. Note that in contrast to the stack alignment parameter, n=0 is a valid value for the stack probing size. Added the test cases to cl-options.c.
Comment Actions
I could see the problem that this would expose a (somewhat) magic constant to the frontend, whereas only the backend knows what sane default size should be used. StackAlignment has the same problem, but it can use 0 to indicate the usage of the default value, thus it does not need an Is...Overridden code gen option. So the question is whether we should duplicate that magic value of 4096 for both frontend and backend. You can make that decision; I have no preference and I am very pragmatic on that issue.
Please be aware that WinX86_32TargetCodeGenInfo inherits from X86_32TargetCodeGenInfo (which in turn inherits from TargetCodeGenInfo), whereas WinX86_64TargetCodeGenInfo directly inherits from TargetCodeGenInfo. Thus I have added a call to TargetCodeGenInfo::SetTargetAttributes. Comment Actions And this is the version without IsStackProbeSizeOverridden but with 4096 as a somewhat magic number in clang. Comment Actions The two revisions that can be considered for submission are: Could please some look over these revisions and decide which one could be applied to the trunk? Comment Actions LGTM with nits fixed.
Comment Actions To majnemer or hans: Could you push the last revision to trunk? I do not have any commit rights. Thanks! |