This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Properly handle -pie and -nopie on Fuchsia
Needs ReviewPublic

Authored by phosek on May 23 2023, 12:55 AM.

Details

Reviewers
abrachet
mcgrathr
Summary

Prior to this patch we would ignore -pie and -nopie options but that
could lead to issues when compiling code that uses either of these
flags.

Diff Detail

Event Timeline

phosek created this revision.May 23 2023, 12:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2023, 12:55 AM
Herald added a subscriber: abrachet. · View Herald Transcript
phosek requested review of this revision.May 23 2023, 12:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2023, 12:55 AM
phosek edited reviewers, added: abrachet, mcgrathr; removed: phosek.May 23 2023, 12:55 AM
phosek updated this revision to Diff 524599.May 23 2023, 1:08 AM
phosek updated this revision to Diff 524601.
phosek updated this revision to Diff 524602.

In GCC the spelling is -no-pie. -nopie is not documented as an alias, and I don't think it works.

I suspect that OpenBSD uses -nopie, but this is never adopted by other OSes / GCC. And Clang should not add a new alias that has no significant uses.

That alias is already recognized by the GNU driver. I'm sharing the implementation between the two drivers. Would you prefer to reject -nopie when targeting Fuchsia?

That alias is already recognized by the GNU driver. I'm sharing the implementation between the two drivers. Would you prefer to reject -nopie when targeting Fuchsia?

Hmm, handling OPT_nopie in clang/lib/Driver/ToolChains/Gnu.cpp looks like a mistake. We should reject it for Gnu.cpp...

That alias is already recognized by the GNU driver. I'm sharing the implementation between the two drivers. Would you prefer to reject -nopie when targeting Fuchsia?

Hmm, handling OPT_nopie in clang/lib/Driver/ToolChains/Gnu.cpp looks like a mistake. We should reject it for Gnu.cpp...

I can send a separate change for that.