[compiler-rt] [TSan] Add interceptor for os_unfair_lock_lock_with_flags (PR #153815)
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 18 18:51:31 PDT 2025
================
@@ -23,6 +36,28 @@ int main() {
pthread_join(t1, NULL);
pthread_join(t2, NULL);
fprintf(stderr, "global_variable = %ld\n", global_variable);
+
+ // CHECK: global_variable = 2
+
+ void *(*func)(void *) = Thread;
+ char flags_available = 0;
+#if defined(__MAC_15_0)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wunguarded-availability-new"
+ if (&os_unfair_lock_lock_with_flags) {
+# pragma clang diagnostic pop
+ func = ThreadWithFlags;
+ flags_available = 1;
+ }
+#endif
----------------
yln wrote:
I think if we use `__builtin_available()` inside `ThreadWithFlags()` then this dance with `func` and `flags_available` will become unnecessary.
There reason for the complication here is so we pass the 2nd `CHECK: global_variable = 4`, right?
https://github.com/llvm/llvm-project/pull/153815
More information about the llvm-commits
mailing list