Page MenuHomePhabricator

[Gnu Driver] Let -static-pie win if it is specified along with -pie or -static.
ClosedPublic

Authored by sivachandra on Mar 26 2019, 1:35 PM.

Diff Detail

Repository
rC Clang

Event Timeline

sivachandra created this revision.Mar 26 2019, 1:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 26 2019, 1:35 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sivachandra retitled this revision from [Gnu Driver] Is -pie and -static-pie are both passed, let -static-pie win. to [Gnu Driver] If -pie and -static-pie are both passed, let -static-pie win..Mar 26 2019, 1:38 PM
saugustine added inline comments.Mar 26 2019, 2:06 PM
clang/lib/Driver/ToolChains/Gnu.cpp
311 ↗(On Diff #192342)

It's not clear to me that the command line -static-pie -no-pie should result in static-pie, given the way the rest of that function is coded.

I might make it a ternary enum: "nothing" "pie" "static-pie" with the last one winning. That method seems more consistent with current behavior.

This would allow anyone checking the state of pie to use a single function and just check the result.

Let -static-pie win if specified along with -pie or -static.

Also, treat specifying -nopie/-no-pie along with -static-pie as an error.

sivachandra retitled this revision from [Gnu Driver] If -pie and -static-pie are both passed, let -static-pie win. to [Gnu Driver] Let -static-pie win if it is specified along with -pie or -static..May 21 2019, 1:15 PM
sivachandra edited the summary of this revision. (Show Details)
sivachandra marked an inline comment as done.May 21 2019, 1:16 PM

PTAL

clang/lib/Driver/ToolChains/Gnu.cpp
311 ↗(On Diff #192342)

static-pie is now handled in its own separate function below.

saugustine accepted this revision.May 21 2019, 1:34 PM
This revision is now accepted and ready to land.May 21 2019, 1:34 PM
This revision was automatically updated to reflect the committed changes.