[TSan] Adjust `TSAN_RTL_CFLAGS` before it gets copied

Add `COMPILER_RT_LIBDISPATCH_CFLAGS` to `TSAN_RTL_CFLAGS` before it gets
duplicated to `TSAN_RTL_DYNAMIC_CFLAGS` so both versions have the
necessary flags.

Reviewed By: wrotki, rsundahl

Differential Revision: https://reviews.llvm.org/D137183

GitOrigin-RevId: ea82ddd070b78bbdb94b3a2a3f0fdeb2738f1845
diff --git a/lib/tsan/rtl/CMakeLists.txt b/lib/tsan/rtl/CMakeLists.txt
index 0a12cb7..84747a5 100644
--- a/lib/tsan/rtl/CMakeLists.txt
+++ b/lib/tsan/rtl/CMakeLists.txt
@@ -6,6 +6,8 @@
                TSAN_RTL_CFLAGS)
 append_list_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors
                TSAN_RTL_CFLAGS)
+append_list_if(COMPILER_RT_INTERCEPT_LIBDISPATCH ${COMPILER_RT_LIBDISPATCH_CFLAGS}
+               TSAN_RTL_CFLAGS)
 
 set(TSAN_RTL_DYNAMIC_CFLAGS ${TSAN_RTL_CFLAGS})
 list(REMOVE_ITEM TSAN_RTL_DYNAMIC_CFLAGS -fPIE)
@@ -75,7 +77,6 @@
   list(APPEND TSAN_SOURCES
     tsan_interceptors_libdispatch.cpp
     )
-  list(APPEND TSAN_RTL_CFLAGS ${COMPILER_RT_LIBDISPATCH_CFLAGS})
 endif()
 
 set(TSAN_HEADERS