[llvm] 4a63d62 - [gn] attempt to port 53a81d4d26f0 (win/asan dynamic runtime)

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 06:11:43 PDT 2024


Author: Nico Weber
Date: 2024-09-10T09:11:35-04:00
New Revision: 4a63d62f686546f5d7329a5e48def09ba817e42a

URL: https://github.com/llvm/llvm-project/commit/4a63d62f686546f5d7329a5e48def09ba817e42a
DIFF: https://github.com/llvm/llvm-project/commit/4a63d62f686546f5d7329a5e48def09ba817e42a.diff

LOG: [gn] attempt to port 53a81d4d26f0 (win/asan dynamic runtime)

Based on the output of llvm/utils/gn/build/sync_source_lists_from_cmake.py
and reading the diff, but not actually tested on Windows.

Added: 
    

Modified: 
    llvm/utils/gn/secondary/compiler-rt/lib/asan/BUILD.gn
    llvm/utils/gn/secondary/compiler-rt/lib/sanitizer_common/BUILD.gn
    llvm/utils/gn/secondary/compiler-rt/lib/ubsan/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/utils/gn/secondary/compiler-rt/lib/asan/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/asan/BUILD.gn
index 2bd940581913e6..c4d7c2f08e6353 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/asan/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/asan/BUILD.gn
@@ -154,13 +154,6 @@ if (current_toolchain == host_toolchain) {
     sources = [ "asan_preinit.cpp" ]
   }
 
-  source_set("weak_interception") {
-    configs -= [ "//llvm/utils/gn/build:llvm_code" ]
-    configs += [ "//llvm/utils/gn/build:crt_code" ]
-    sources = [ "asan_win_weak_interception.cpp" ]
-    defines = [ "SANITIZER_DYNAMIC" ]
-  }
-
   shared_library("asan_shared_library") {
     output_dir = crt_current_out_dir
     if (current_os == "mac") {
@@ -242,22 +235,25 @@ if (current_toolchain == host_toolchain) {
     }
   }
   if (current_os == "win") {
-    static_library("asan_dll_thunk") {
+    static_library("asan_static_runtime_thunk") {
       output_dir = crt_current_out_dir
-      output_name = "clang_rt.asan_dll_thunk$crt_current_target_suffix"
+      output_name = "clang_rt.asan_static_runtime_thunk$crt_current_target_suffix"
       configs -= [ "//llvm/utils/gn/build:llvm_code" ]
       configs += [ "//llvm/utils/gn/build:crt_code" ]
       complete_static_lib = true
       configs -= [ "//llvm/utils/gn/build:thin_archive" ]
       sources = [
         "asan_globals_win.cpp",
-        "asan_win_dll_thunk.cpp",
+        "asan_malloc_win_thunk.cpp",
+        "asan_win_common_runtime_thunk.cpp",
+        "asan_win_static_runtime_thunk.cpp",
       ]
-      defines = [ "SANITIZER_DLL_THUNK" ]
+      defines = [ "SANITIZER_STATIC_RUNTIME_THUNK" ]
       deps = [
         "//compiler-rt/lib/interception:sources",
-        "//compiler-rt/lib/sanitizer_common:dll_thunk",
-        "//compiler-rt/lib/ubsan:dll_thunk",
+        "//compiler-rt/lib/sanitizer_common:runtime_thunk",
+        "//compiler-rt/lib/sanitizer_common:sancov_runtime_thunk",
+        "//compiler-rt/lib/ubsan:runtime_thunk",
       ]
     }
     static_library("asan_dynamic_runtime_thunk") {
@@ -270,12 +266,14 @@ if (current_toolchain == host_toolchain) {
       configs -= [ "//llvm/utils/gn/build:thin_archive" ]
       sources = [
         "asan_globals_win.cpp",
+        "asan_win_common_runtime_thunk.cpp",
         "asan_win_dynamic_runtime_thunk.cpp",
       ]
       defines = [ "SANITIZER_DYNAMIC_RUNTIME_THUNK" ]
       deps = [
-        "//compiler-rt/lib/sanitizer_common:dynamic_runtime_thunk",
-        "//compiler-rt/lib/ubsan:dynamic_runtime_thunk",
+        "//compiler-rt/lib/sanitizer_common:runtime_thunk",
+        "//compiler-rt/lib/sanitizer_common:sancov_runtime_thunk",
+        "//compiler-rt/lib/ubsan:runtime_thunk",
       ]
       cflags = [ "-Zl" ]
     }
@@ -284,7 +282,7 @@ if (current_toolchain == host_toolchain) {
     deps = [ ":asan_shared_library" ]
     if (current_os == "win") {
       deps += [
-        ":asan_dll_thunk",
+        ":asan_static_runtime_thunk",
         ":asan_dynamic_runtime_thunk",
       ]
     }

diff  --git a/llvm/utils/gn/secondary/compiler-rt/lib/sanitizer_common/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/sanitizer_common/BUILD.gn
index f7f1fce10bf5f5..450c419d25fe88 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/sanitizer_common/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/sanitizer_common/BUILD.gn
@@ -167,42 +167,38 @@ source_set("sources") {
     "sanitizer_vector.h",
     "sanitizer_win.cpp",
     "sanitizer_win.h",
+    "sanitizer_win_interception.cpp",
+    "sanitizer_win_interception.h",
     "sanitizer_win_defs.h",
-    "sanitizer_win_dll_thunk.h",
-    "sanitizer_win_weak_interception.h",
+    "sanitizer_win_thunk_interception.h",
   ]
 }
 
-source_set("weak_interception") {
+source_set("runtime_thunk") {
   configs -= [ "//llvm/utils/gn/build:llvm_code" ]
   configs += [ "//llvm/utils/gn/build:crt_code" ]
-  sources = [
-    "sanitizer_coverage_win_weak_interception.cpp",
-    "sanitizer_win_weak_interception.cpp",
+  sources = [ "sanitizer_win_thunk_interception.cpp" ]
+  defines = [
+    "SANITIZER_DYNAMIC_RUNTIME_THUNK",
+    "SANITIZER_STATIC_RUNTIME_THUNK",
   ]
-  defines = [ "SANITIZER_DYNAMIC" ]
+  cflags = []
+  if (current_os == "win") {
+    cflags += [ "-Zl" ]
+  }
 }
 
-source_set("dll_thunk") {
+source_set("sancov_runtime_thunk") {
   configs -= [ "//llvm/utils/gn/build:llvm_code" ]
   configs += [ "//llvm/utils/gn/build:crt_code" ]
   sources = [
-    "sanitizer_coverage_win_dll_thunk.cpp",
+    "sanitizer_coverage_win_runtime_thunk.cpp",
     "sanitizer_coverage_win_sections.cpp",
-    "sanitizer_win_dll_thunk.cpp",
   ]
-  defines = [ "SANITIZER_DLL_THUNK" ]
-}
-
-source_set("dynamic_runtime_thunk") {
-  configs -= [ "//llvm/utils/gn/build:llvm_code" ]
-  configs += [ "//llvm/utils/gn/build:crt_code" ]
-  sources = [
-    "sanitizer_coverage_win_dynamic_runtime_thunk.cpp",
-    "sanitizer_coverage_win_sections.cpp",
-    "sanitizer_win_dynamic_runtime_thunk.cpp",
+  defines = [
+    "SANITIZER_DYNAMIC_RUNTIME_THUNK",
+    "SANITIZER_STATIC_RUNTIME_THUNK",
   ]
-  defines = [ "SANITIZER_DYNAMIC_RUNTIME_THUNK" ]
   cflags = []
   if (current_os == "win") {
     cflags += [ "-Zl" ]

diff  --git a/llvm/utils/gn/secondary/compiler-rt/lib/ubsan/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/ubsan/BUILD.gn
index 230de4750d4f95..d3b4a406f8b50d 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/ubsan/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/ubsan/BUILD.gn
@@ -51,25 +51,14 @@ source_set("sources") {
   ]
 }
 
-source_set("weak_interception") {
+source_set("runtime_thunk") {
   configs -= [ "//llvm/utils/gn/build:llvm_code" ]
   configs += [ "//llvm/utils/gn/build:crt_code" ]
-  sources = [ "ubsan_win_weak_interception.cpp" ]
-  defines = [ "SANITIZER_DYNAMIC" ]
-}
-
-source_set("dll_thunk") {
-  configs -= [ "//llvm/utils/gn/build:llvm_code" ]
-  configs += [ "//llvm/utils/gn/build:crt_code" ]
-  sources = [ "ubsan_win_dll_thunk.cpp" ]
-  defines = [ "SANITIZER_DLL_THUNK" ]
-}
-
-source_set("dynamic_runtime_thunk") {
-  configs -= [ "//llvm/utils/gn/build:llvm_code" ]
-  configs += [ "//llvm/utils/gn/build:crt_code" ]
-  defines = [ "SANITIZER_DYNAMIC_RUNTIME_THUNK" ]
-  sources = [ "ubsan_win_dynamic_runtime_thunk.cpp" ]
+  sources = [ "ubsan_win_runtime_thunk.cpp" ]
+  defines = [
+    "SANITIZER_DYNAMIC_RUNTIME_THUNK",
+    "SANITIZER_STATIC_RUNTIME_THUNK",
+  ]
 }
 
 source_set("standalone_sources") {


        


More information about the llvm-commits mailing list