-
Notifications
You must be signed in to change notification settings - Fork 280
enable -flto for unix systems #3407
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
Conversation
Different build setups require different tools for the archive step. Hence, we make the ar command a variable, so that the correct tool can be specified for each environment. Signed-off-by: Norbert Manthey <[email protected]>
Link time optimization allows inlining functions that would be located in other building blocks otherwise. This might result in better performance, but also in more compile time errors. To be able to use flto objects in archives, instead of ar the tool gcc-ar has to be used. Hence, when adding flto to CXX_FLAGS, also change AR from ar to gcc-ar. Signed-off-by: Norbert Manthey <[email protected]>
@peterschrammel: I wonder whether -flto is useful to be included for the binary that'll be submitted to SVCOMP. If you have resources for another test, that would be helpful. |
@@ -35,6 +35,9 @@ endif | |||
CFLAGS ?= -Wall -O2 | |||
CP_CFLAGS = -MMD -MP | |||
CXXFLAGS ?= -Wall -O2 | |||
CXXFLAGS += -flto | |||
LINKFLAGS += -flto | |||
AR = gcc-ar |
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 guess CI will probably tell us this, but will this work with clang builds?
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 this feature supposed to be stable in g++-5 ?
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.
afaict, yes.
I wonder whether the bug in CI is an flto stability error, or an actual problem in the code base that's now uncovered. |
Closing as (as discussed in #6011 ) this may not be stable/suitable. |
These changes might improve the performance of CBMC, as well as allow to spot compilation problems earlier.