-
Notifications
You must be signed in to change notification settings - Fork 203
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
Support whole-program LTO #150
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to split the renaming of the math sources into a separate PR.
Also, it looks like a lot of the Makefile refactoring could be split out? I can't tell which parts of that relate to this change directly.
BTW, I'm working an wasm-ld fix that will allow compiler-to be part of LTO too: https://reviews.llvm.org/D71738 :) |
Done, in #151.
I've now split out the main code changes in #152 Assuming those land, when I rebase this PR over them this PR will be just a Makefile change. |
84baf06
to
041d027
Compare
Build and install an LTO version of libc.a and the startup files, alongside the non-LTO versions.
The dependencies for this PR all landed, and this PR is now rebased, so it's now just changes to the top-level Makefile to support LTO, and ready for review! |
@@ -9,13 +9,17 @@ SYSROOT ?= $(CURDIR)/sysroot | |||
# A directory to install to for "make install". | |||
INSTALL_DIR ?= /usr/local | |||
# single or posix | |||
THREAD_MODEL = single |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There still seem to be a lot of non-LTO related changes here? Some kind of re-base issue maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now filed #186 to pull out several refactorings.
@sunfishcode are you still interested in this? or may i (or someone) take it over? |
To avoid duplicate effort: you can apply https://gitlab.haskell.org/ghc/wasi-libc/-/commit/eecc0942af95a90447e6bad8c58d8c133ec82fa2 to Distributing different sysroots both with/without LTO is harder though. |
@yamt I'm not actively working on this, so you are welcome to take this over! |
# which runs after LLVM LTO, so LTO libraries don't satisfy them. They're | ||
# also relatively uninteresting to LTO, as LLVM recognizes most of them | ||
# even without seeing their definitions. | ||
override LIBC_NONLTO_SOURCES = \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sunfishcode
@sbc100
this exclusion is no longer necessary after https://reviews.llvm.org/D71738, right?
thank you. i guess i will look at full lto first though. as thin lto seems to have more obstacles. |
An old PR which I used as a base: WebAssembly#150 Co-Authored-by: Dan Gohman <[email protected]>
* Add LTO build option An old PR which I used as a base: #150 Co-Authored-by: Dan Gohman <[email protected]> * Exclude atexit.c from LTO This fixes a failure in wasi-sdk "make check". ("undefined symbol: __cxa_atexit" for ctors_dtors.c test) * avoid specifying multiple lto flags for LIBC_NONLTO_OBJS --------- Co-authored-by: Dan Gohman <[email protected]>
Build and install an LTO version of libc.a and the startup files,
alongside the non-LTO versions.
This also adds support for the proposed
__main_argc_argv
convention,supporting compilers both with and without that change.
This doesn't depend on https://reviews.llvm.org/D70700, but contains code that anticipates it.
This does depend on WebAssembly/wasi-sdk#89.