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

Usama Hameed via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 14:47:51 PDT 2024


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

>From 93c2485798a8512d2e0df59ec4351ae12d9134e6 Mon Sep 17 00:00:00 2001
From: usama <u_hameed at apple.com>
Date: Fri, 5 Apr 2024 14:46:52 -0700
Subject: [PATCH] Pass the linker version to libfuzzer tests on darwin

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
---
 compiler-rt/test/fuzzer/lit.cfg.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compiler-rt/test/fuzzer/lit.cfg.py b/compiler-rt/test/fuzzer/lit.cfg.py
index 4e203236b16708..9084254b3b15cd 100644
--- a/compiler-rt/test/fuzzer/lit.cfg.py
+++ b/compiler-rt/test/fuzzer/lit.cfg.py
@@ -98,6 +98,11 @@ 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,



More information about the llvm-commits mailing list