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

Respect ENABLE_LTO even for static build, but keep LTO default for static #4320

Merged
merged 2 commits into from
Jan 5, 2024

Conversation

vlstill
Copy link
Contributor

@vlstill vlstill commented Jan 5, 2024

Up until now, the ENABLE_LTO option was ignored for static builds. This can be quite confusing. With this change, the static now defaults to using LTO, but it is possible to override it explicitly.

Also, the check for GCC 8+ for LTO is no longer necessary as p4c supports only GCC 9+.

@vlstill vlstill added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label Jan 5, 2024
@vlstill vlstill self-assigned this Jan 5, 2024
Copy link
Contributor

@davidbolvansky davidbolvansky left a comment

Choose a reason for hiding this comment

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

Thanks

CMakeLists.txt Outdated
@@ -282,19 +289,15 @@ if (ENABLE_LTO AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(WARNING "LLD does not work with GCC's LTO object format, switching to Gold.")
set(BUILD_LINK_WITH_LLD OFF)
endif ()
add_cxx_compiler_option ("-flto")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to worry about as GCC 9 or newer is required by p4c anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, I may as well remove this check...

@vlstill vlstill merged commit b082745 into p4lang:main Jan 5, 2024
13 checks passed
@vlstill vlstill deleted the vlstill/fix-static-lto branch January 5, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Topics concerning the core segments of the compiler (frontend, midend, parser)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants