[compiler-rt] Pass the linker version to libfuzzer tests on darwin (PR #87719)

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 15:01:38 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Usama Hameed (usama54321)

<details>
<summary>Changes</summary>

The HOST_LINK_VERSION is a hardcoded string in Darwin clang that detects the linker version at configure time. The driver uses this information to build the correct set of arguments for the linker. This patch detects the linker version again during compiler-rt configuration and passes it to the libfuzzer tests. This allows a clang built on a machine with a new linker to run compiler-rt tests on a machine with an old linker.

rdar://125932376

---
Full diff: https://github.com/llvm/llvm-project/pull/87719.diff


1 Files Affected:

- (modified) compiler-rt/test/fuzzer/lit.cfg.py (+3) 


``````````diff
diff --git a/compiler-rt/test/fuzzer/lit.cfg.py b/compiler-rt/test/fuzzer/lit.cfg.py
index 4e203236b16708..9ecf162339f707 100644
--- a/compiler-rt/test/fuzzer/lit.cfg.py
+++ b/compiler-rt/test/fuzzer/lit.cfg.py
@@ -98,6 +98,9 @@ def generate_compiler_cmd(is_cpp=True, fuzzer_enabled=True, msan_enabled=False):
     if "windows" in config.available_features:
         extra_cmd = extra_cmd + " -D_DISABLE_VECTOR_ANNOTATION -D_DISABLE_STRING_ANNOTATION"
 
+    if "darwin" in config.available_features and getattr(config, "darwin_linker_version", None):
+        extra_cmd = extra_cmd + " -mlinker-version=" + config.darwin_linker_version
+
     return " ".join(
         [
             compiler_cmd,

``````````

</details>


https://github.com/llvm/llvm-project/pull/87719


More information about the llvm-commits mailing list