This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Add -fno-split-stack
ClosedPublic

Authored by ChuanqiXu on Mar 24 2021, 1:57 AM.

Details

Summary

I found that clang has -fsplit-stack but doesn't support -fno-split-stack. So I think it is natural to support it.

Diff Detail

Event Timeline

ChuanqiXu created this revision.Mar 24 2021, 1:57 AM
ChuanqiXu requested review of this revision.Mar 24 2021, 1:57 AM

Adding the negative option to the driver makes sense to me. I think we could also simplify the option definitions, see my inline comment.

clang/include/clang/Driver/Options.td
2381

Typo.

I think it would also make sense to merge the option definitions for driver (fsplit_stack and fno_split_stack) and CC1 (split_stacks) into one. (We can rename the CC1 option from -split-stacks to -fsplit-stack.)

Other options already do this via BoolFOption, for example signed_char above. If you are not sure about how that works, take a look here.

ChuanqiXu added inline comments.Mar 24 2021, 2:35 AM
clang/include/clang/Driver/Options.td
2381

Thanks for reviewing.

For the renaming part, I worry about if it involves problems for compatibility.

If we mark fsplit_stack as BoolFOption, the user seems couldn't specify the opposite value by -fno-split-stack which seems to be one traditional usage style.

ChuanqiXu updated this revision to Diff 332906.Mar 24 2021, 2:36 AM
ChuanqiXu added a reviewer: jansvoboda11.

Edit as suggestion.

jansvoboda11 added inline comments.Mar 24 2021, 3:51 AM
clang/include/clang/Driver/Options.td
2381

Why not? BoolFOption would create both -fsplit-stack and -fno-split-stack in the driver. Marking the former with CC1Option would make it available to CC1 as well and we get the same result as with your current changes (but unifying the wording and tablegen definitions).

ChuanqiXu added inline comments.Mar 24 2021, 6:03 AM
clang/include/clang/Driver/Options.td
2381

Thanks for clarifying. I am not clear about the driver part. And I worry about if it is a problem if we rename the CC1 option from -split-stacks to -fsplit-stack.

jansvoboda11 added inline comments.Mar 24 2021, 6:14 AM
clang/include/clang/Driver/Options.td
2381

What are you not clear about on the driver part?

Renaming CC1 options is fine, as they are only intended to be used by Clang developers and we don't need to keep them backward compatible. Fixing potential build failures should be all there is to it.

ChuanqiXu updated this revision to Diff 333189.Mar 24 2021, 7:16 PM

Merge -fsplit-stack and -fno-split-stack into one in options.td. And rename -split-stacks into -fsplit-stack.

ChuanqiXu added inline comments.Mar 24 2021, 9:28 PM
clang/include/clang/Driver/Options.td
2381

Thanks for clarifying!

MaskRay accepted this revision.Mar 24 2021, 10:03 PM

If we want to improve test coverage, we can test -fno-split-stack -fsplit-stack passes -fsplit-stack. But doing this for every option may be excessive...
I have filed the libgcc morestack.S .init_array.0 feature request: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99759

clang/include/clang/Driver/Options.td
2383

s/Would use/Use/

This revision is now accepted and ready to land.Mar 24 2021, 10:03 PM

If we want to improve test coverage, we can test -fno-split-stack -fsplit-stack passes -fsplit-stack. But doing this for every option may be excessive...
I have filed the libgcc morestack.S .init_array.0 feature request: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99759

Thanks for reviewing! I would try to submit a patch to gcc if possible.

This revision was landed with ongoing or failed builds.Mar 24 2021, 11:19 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2021, 11:19 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript