From 3316e82af3542e83665c24eb727ce24e047e3fb2 Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Wed, 16 Jul 2025 11:01:13 -0700 Subject: [PATCH 1/3] FreeBSD: Disable SIMDParameterPassing The SIMD module is not available on FreeBSD, disabling it. --- validation-test/stdlib/SIMDParameterPassing.swift.gyb | 1 + 1 file changed, 1 insertion(+) diff --git a/validation-test/stdlib/SIMDParameterPassing.swift.gyb b/validation-test/stdlib/SIMDParameterPassing.swift.gyb index 41ed886313b9b..462870709e7fb 100644 --- a/validation-test/stdlib/SIMDParameterPassing.swift.gyb +++ b/validation-test/stdlib/SIMDParameterPassing.swift.gyb @@ -19,6 +19,7 @@ // REQUIRES: executable_test // REQUIRES: long_test // XFAIL: OS=linux-gnu, OS=linux-android +// UNSUPPORTED: OS=freebsd import StdlibUnittest import simd From 79f7b638eb25aca60bc5eccc969e592fb80fb5df Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Wed, 16 Jul 2025 11:15:30 -0700 Subject: [PATCH 2/3] FreeBSD: Testing: pthread handling Fixing pthread usage in tsan and tsan-inout tests. pthreads are imported as opaque pointers on FreeBDS, and thus need to be kept in an optional pthread_t, like on Apple platforms. Unlike on macOS, pthread_join is not annotated with nullability annotations and thus takes an optional opaque pointer, so we don't need to unwrap it. --- test/Sanitizers/tsan/tsan.swift | 4 ++-- validation-test/Sanitizers/tsan-inout.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Sanitizers/tsan/tsan.swift b/test/Sanitizers/tsan/tsan.swift index 45894a33970af..ad002741d7f9e 100644 --- a/test/Sanitizers/tsan/tsan.swift +++ b/test/Sanitizers/tsan/tsan.swift @@ -50,7 +50,7 @@ var racey_x: Int; // TSan %deflake as part of the test. for _ in 1...5 { -#if os(macOS) || os(iOS) +#if os(macOS) || os(iOS) || os(FreeBSD) var t : pthread_t? #else var t : pthread_t = 0 @@ -61,7 +61,7 @@ for _ in 1...5 { return nil }, nil) -#if os(macOS) || os(iOS) +#if os(macOS) || os(iOS) || os(FreeBSD) threads.append(t!) #else threads.append(t) diff --git a/validation-test/Sanitizers/tsan-inout.swift b/validation-test/Sanitizers/tsan-inout.swift index 94b886da31236..1aa636fb3b6b9 100644 --- a/validation-test/Sanitizers/tsan-inout.swift +++ b/validation-test/Sanitizers/tsan-inout.swift @@ -27,7 +27,7 @@ var gInThread2: () -> () = { } // Spawn two threads, run the two passed in closures simultaneously, and // join them. func testRace(name: String, thread inThread1: @escaping () -> (), thread inThread2: @escaping () -> ()) { -#if canImport(Darwin) +#if canImport(Darwin) || os(FreeBSD) var thread1: pthread_t? var thread2: pthread_t? #else From 6b0f814187d75928583f3c50f22dd5d8d3edd524 Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Wed, 16 Jul 2025 11:19:40 -0700 Subject: [PATCH 3/3] lld: Keep unused function section Newer versions of lld are keeping the unused function section for func2, causing this test to fail. --- test/LinkerSections/function_sections.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/test/LinkerSections/function_sections.swift b/test/LinkerSections/function_sections.swift index f7e9df726c05a..f70e3743b97aa 100644 --- a/test/LinkerSections/function_sections.swift +++ b/test/LinkerSections/function_sections.swift @@ -11,4 +11,3 @@ // GOLD: .text.$s16FunctionSections5func1yyF // LLD: .text.$s16FunctionSections5func1yyF -// LLD-NOT: .text.$s16FunctionSections5func2yyF