This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Make everything PIE by default
ClosedPublic

Authored by int3 on Apr 28 2021, 11:38 PM.

Details

Reviewers
thakis
MaskRay
Group Reviewers
Restricted Project
Commits
rG7e115da5df47: [lld-macho] Make everything PIE by default
Summary

Modern versions of macOS (>= 10.7) and in general all modern Mach-O
target archs want PIEs by default. ld64 defaults to PIE for iOS >= 4.3,
as well as for all versions of watchOS and simulators. Basically all the
platforms LLD is likely to target want PIE. So instead of cluttering LLD's
code with legacy version checks, I think it's simpler to just default to
PIE for everything.

Note that -no_pie still works, so users can still opt out of it.

Diff Detail

Event Timeline

int3 created this revision.Apr 28 2021, 11:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2021, 11:38 PM
Herald added a subscriber: dang. · View Herald Transcript
int3 requested review of this revision.Apr 28 2021, 11:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2021, 11:38 PM
thakis accepted this revision.Apr 29 2021, 8:31 AM
thakis added a subscriber: thakis.

Makes sense. Maybe explicitly say in commit message that this only affects the default and that -no_pie still works.

This revision is now accepted and ready to land.Apr 29 2021, 8:31 AM
MaskRay accepted this revision.Apr 29 2021, 8:50 AM
int3 edited the summary of this revision. (Show Details)Apr 29 2021, 12:05 PM
This revision was automatically updated to reflect the committed changes.
int3 added a comment.Apr 29 2021, 12:32 PM

Whoops, accidentally git-added the wrong file