Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn off LTO by default on OSX #2284

Merged
merged 1 commit into from
Oct 17, 2017
Merged

Turn off LTO by default on OSX #2284

merged 1 commit into from
Oct 17, 2017

Conversation

SeanTAllen
Copy link
Member

This turns off LTO by default on MacOS. This will have performance
implications for default installs, however, turning on LTO by default
can lead users to have broken installs via "spookey action at a
distance".

Here's the scenario. For LTO to work, you need to be using the same
bitcode for the linker in both the Pony runtime and the currently
installed linker. Ways that having LTO can lead to a broken install:

  1. install Pony
  2. upgrade XCode such that the linker bitcode version changes

In that scenario, you no longer can compile programs.

Another scenerio (which can happen via homebrew).

  1. build pony and its runtime on a machine that has XCode version X
  2. install onto a machine that has an older version of XCode

The pony will fail to build programs and fail with a fairly inscrutable
error.

At one point in the past LTO off was and I advocated for turning it on
for MacOS where we felt it was safe to do. "Safe" meant, "won't bork
your programs". The issue we were looking at is, LTO is still
experimental in GCC but not clang. So, OSX where we use clang's linker,
we felt good about making the change.

What we didn't think about at the time was that this can lead to broken
installs for unknowing users. With this commit, we are turning off LTO
by default. Additionally...

This commit adds more details about turning on LTO to the README and
gives specific information about how it can break MacOS installs if you
change your XCode version. This should have it safe for more experienced
"build from source" MacOS users to turn on LTO and understand the
consequences. No more "spooky breakage at a distance" problem. Further,
when reviewing the "performance cheatsheet" on the Pony website, I
realized LTO wasn't mentioned. I'll be adding information about building
with LTO to the performance cheatsheet with the appropriate caveats.

README.md Outdated
@@ -70,7 +70,7 @@ If you're using `docker-machine` instead of native docker, make sure you aren't

Pull the latest image as above.

```bash
```bas
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The h in bash seems to have been cut off here

This turns off LTO by default on MacOS. This will have performance
implications for default installs, however, turning on LTO by default
can lead users to have broken installs via "spookey action at a
distance".

Here's the scenario. For LTO to work, you need to be using the same
bitcode for the linker in both the Pony runtime and the currently
installed linker. Ways that having LTO can lead to a broken install:

1) install Pony
2) upgrade XCode such that the linker bitcode version changes

In that scenario, you no longer can compile programs.

Another scenerio (which can happen via homebrew).

1) build pony and its runtime on a machine that has XCode version X
2) install onto a machine that has an older version of XCode

The pony will fail to build programs and fail with a fairly inscrutable
error.

At one point in the past LTO off was and I advocated for turning it on
for MacOS where we felt it was safe to do. "Safe" meant, "won't bork
your programs". The issue we were looking at is, LTO is still
experimental in GCC but not clang. So, OSX where we use clang's linker,
we felt good about making the change.

What we didn't think about at the time was that this can lead to broken
installs for unknowing users. With this commit, we are turning off LTO
by default. Additionally...

This commit adds more details about turning on LTO to the README and
gives specific information about how it can break MacOS installs if you
change your XCode version. This should have it safe for more experienced
"build from source" MacOS users to turn on LTO and understand the
consequences. No more "spooky breakage at a distance" problem. Further,
when reviewing the "performance cheatsheet" on the Pony website, I
realized LTO wasn't mentioned. I'll be adding information about building
with LTO to the performance cheatsheet with the appropriate caveats.
@SeanTAllen
Copy link
Member Author

nice catch @Theodus

i forced pushed a fix.

@SeanTAllen SeanTAllen added the changelog - changed Automatically add "Changed" CHANGELOG entry on merge label Oct 17, 2017
@SeanTAllen SeanTAllen merged commit 1e3e896 into master Oct 17, 2017
@SeanTAllen SeanTAllen deleted the no-osx-lto branch October 17, 2017 16:02
ponylang-main added a commit that referenced this pull request Oct 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - changed Automatically add "Changed" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants