[llvm] [gcov] Set current_working_directory to . for GCC>=9 (PR #121420)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 31 17:48:27 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Fangrui Song (MaskRay)
<details>
<summary>Changes</summary>
GCC 9 changed the gcov format to set current_working_directory to be
used by gcov --json-format
(https://github.com/linux-test-project/lcov/issues/38).
This change breaks local determinism, which we value more than strict
GCC compatibility. Just write "." to appease GCC's gcov.
Fix #<!-- -->121368
---
Full diff: https://github.com/llvm/llvm-project/pull/121420.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+3-1)
``````````diff
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index f9be7f933d31e4..dc3307a212817a 100644
--- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -973,8 +973,10 @@ bool GCOVProfiler::emitProfileNotes(
out.write(Tmp, 4);
}
write(Stamp);
+ // getcwd() breaks local determinism and is not easy to adjust with
+ // -ffile-prefix-map. Just write "." to appease GCC's gcov.
if (Version >= 90)
- writeString(""); // unuseful current_working_directory
+ writeString(".");
if (Version >= 80)
write(0); // unuseful has_unexecuted_blocks
``````````
</details>
https://github.com/llvm/llvm-project/pull/121420
More information about the llvm-commits
mailing list