Page MenuHomePhabricator

[Driver] Add -static= to unify -static-{libgcc,libstdc++}
Needs ReviewPublic

Authored by MaskRay on Oct 12 2018, 7:15 PM.

Details

Summary

We have lots of -static-* options now. Add -static= (OPT_static_EQ) so
that people can specify -static=foo,bar instead of -static-foo and
-static-bar. This saves us a bunch of OPT_static_foo, OPT_static_bar,
etc, which may be added in the future.

Diff Detail

Event Timeline

MaskRay created this revision.Oct 12 2018, 7:15 PM
MaskRay updated this revision to Diff 169538.Oct 12 2018, 7:48 PM

Rename local variables

Greeting from a dev meeting attendee :)

Seems like a better solution than what I had in D37726.
I'm not sully sure on the naming so I think someone else should also sign off on this.

Also, Sorry for the long time to reply, I don't LLVM often enough :)

Seems like a better solution than what I had in D37726.
I'm not sully sure on the naming so I think someone else should also sign off on this.

This is still not good enough. --static=rtlib,stdlib may be better. I'll also find some time to improve this one :)

tomgrc added a subscriber: tomgrc.Tue, Aug 20, 12:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptTue, Aug 20, 12:09 PM
hhb added a subscriber: hhb.Fri, Aug 23, 11:31 AM
MaskRay updated this revision to Diff 219025.Thu, Sep 5, 8:50 PM
MaskRay retitled this revision from [Driver] Add -static-{rtlib,stdlib} and make -static-{libgcc,libstdc++} their aliases to [Driver] Add -static= to unify -static-{libgcc,libstdc++}.
MaskRay edited the summary of this revision. (Show Details)
MaskRay added reviewers: phosek, pirama, rnk, srhines.
MaskRay removed a subscriber: rnk.

Repurpose the patch. Add -static= instead

pirama added a comment.EditedThu, Sep 5, 9:49 PM

Does this regress from existing behavior for unused argument warnings? Currently, -static-libstdc++ -nostdlib issues an unused argument warning for -static-libstdc++, while AFAICT -static=c++stdlib -nostdlib doesn't.

I'm not exactly sure how/where to issue this warning, though.

Does this regress from existing behavior for unused argument warnings? Currently, -static-libstdc++ -nostdlib issues an unused argument warning for -static-libstdc++, while AFAICT -static=c++stdlib -nostdlib doesn't.

I'm not exactly sure how/where to issue this warning, though.

This change will suppress some unused argument warnings but I'll not call that "regression":)

Various toolchains already do things like:

Args.ClaimAllArgs(options::OPT_g_Group);
Args.ClaimAllArgs(options::OPT_emit_llvm);
Args.ClaimAllArgs(options::OPT_w);

Hexagon and Myriad even do Args.ClaimAllArgs(options::OPT_static_libgcc); This diagnostic IMO has very low value.