-
Notifications
You must be signed in to change notification settings - Fork 14k
[BOLT] Fix LLVM_APPEND_VC_REV support #142410
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
[BOLT] Fix LLVM_APPEND_VC_REV support #142410
Conversation
The CMake flag LLVM_APPEND_VC_REV can be passed when building BOLT a BOLT to prevent including a VC Revision. This patch enables this functionality. Usage: `-DLLVM_APPEND_VC_REV=OFF` when running CMake.
@llvm/pr-subscribers-bolt Author: Paschalis Mpeis (paschalis-mpeis) ChangesThe CMake flag LLVM_APPEND_VC_REV can be passed when building BOLT a BOLT to prevent including a VC Revision. This patch enables this functionality. Usage: Full diff: https://github.com/llvm/llvm-project/pull/142410.diff 1 Files Affected:
diff --git a/bolt/lib/Utils/CMakeLists.txt b/bolt/lib/Utils/CMakeLists.txt
index efba6d54449d3..812c199846080 100644
--- a/bolt/lib/Utils/CMakeLists.txt
+++ b/bolt/lib/Utils/CMakeLists.txt
@@ -6,12 +6,25 @@ set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
+if(llvm_vc AND LLVM_APPEND_VC_REV)
+ set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
+endif()
+if (LLVM_VC_REPOSITORY AND LLVM_VC_REVISION)
+ set(llvm_source_dir ${LLVM_SOURCE_DIR})
+ set(llvm_vc_repository ${LLVM_VC_REPOSITORY})
+ set(llvm_vc_revision ${LLVM_VC_REVISION})
+endif()
+if(bolt_vc AND LLVM_APPEND_VC_REV)
+ set(bolt_source_dir ${BOLT_SOURCE_DIR})
+endif()
+
# Create custom target to generate the VC revision include.
add_custom_command(OUTPUT "${version_inc}"
DEPENDS "${llvm_vc}" "${bolt_vc}" "${generate_vcs_version_script}"
COMMAND ${CMAKE_COMMAND} "-DNAMES=BOLT"
+ "-DLLVM_SOURCE_DIR=${llvm_source_dir}"
+ "-DBOLT_SOURCE_DIR=${bolt_source_dir}"
"-DHEADER_FILE=${version_inc}"
- "-DBOLT_SOURCE_DIR=${BOLT_SOURCE_DIR}"
"-DLLVM_VC_REPOSITORY=${llvm_vc_repository}"
"-DLLVM_VC_REVISION=${llvm_vc_revision}"
"-DLLVM_FORCE_VC_REVISION=${LLVM_FORCE_VC_REVISION}"
|
Details regarding the NFC checks (llvm-zorg):One of the nfc-test issues is due to a BOLT SHA mismatch. The problem isn't actually in the # section not present
$ llvm-objdump -s -j .note.bolt_info build/bin/llvm-bolt
llvm-objdump: warning: .. not found in any input file However, there is a mismatch , in a @aaupov, in the coming days I'll publish more patches, adjusting both bolt and llvm-zorg. |
We're supposed to set this flag on NFC builder: At a time of enabling, I verified that if the changes are not affecting BOLT, it's not rebuilt (which ensures that NFC checks are not triggered). Perhaps it was broken at some point, causing changes in the bolt binary. |
Hey Amir,
Yes, thanks a lot! That's what brought me to this patch.
I believe this is what happened too. At some point there was a broader CMake change (the one that introduced lowercase Could you consider accepting this PR? Below I list some commands to help with reviewing: gh pr checkout 142410 # get this patch Before this patch: git checkout HEAD~2
# emits sha (correct)
cmake -DLLVM_APPEND_VC_REV=ON ..
bolt --version | grep revision
BOLT revision b71255705bab3bba231c045a9fd101df438a7a72
# emits sha (wrong)
cmake -DLLVM_APPEND_VC_REV=OFF ..
bolt --version | grep revision
BOLT revision b71255705bab3bba231c045a9fd101df438a7a72 With this path: git checkout 8c0ef06a044b9aa9e7c8c79d9331dc2a0a4fe37a
# emits sha (correct)
cmake -DLLVM_APPEND_VC_REV=ON ..
bolt --version | grep revision
BOLT revision 8c0ef06a044b9aa9e7c8c79d9331dc2a0a4fe37a
# emits unknown (correct)
cmake -DLLVM_APPEND_VC_REV=OFF ..
bolt --version | grep revision
BOLT revision <unknown> |
This appears to have happened around #97130. Shortly before, around commit b037d0f this flag was respected. There is no reliable way to check this within LLVM itself, but I will add a validation step on the buildbot to track whether the NFC comparisons are working as expected (ie the commit SHA as well the GNU IDs). |
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.
Approving to unblock. Please wait a couple of days if folks more familiar with VC_REV functionality want to chime in: @RossComputerGuy, @h-vetinari, @nico, @kwk
Did you intend to ping me? I'm not familiar with that. 👀 In fact, I first completely misinterpreted this as refering to VC the MSVC toolchain (and wondering whether bolt started supporting windows), but it seems VC is version control: llvm-project/llvm/cmake/modules/AddLLVM.cmake Lines 2593 to 2600 in 6c1091e
|
Thanks Amir. Sure, I'll give it a couple of more days before merging in case there are any further comments. |
@h-vetinari did you intend to ping me? |
I didn't ping you @kwk; I'm in the same boat as you (i.e. I don't know why I was pinged, see my comment above) |
Hey folks, Let's wait for @aaupov to clear up the confusion. That PR brought some extra CMake configuration but inadvertently broke the EDIT: I see that @h-vetinari participated in the discussion of the above PR, so probably that is the reason why. |
Right, I've included the reviewers of #97130 |
Any objections to this PR?
Also, this is implemented by: |
I believe it's good to go since there were no objections in a week. |
The CMake flag LLVM_APPEND_VC_REV can be passed when building BOLT a BOLT to prevent including a VC Revision. This patch enables this functionality.
Usage:
-DLLVM_APPEND_VC_REV=OFF
when running CMake.