]> granicus.if.org Git - llvm/commitdiff
gn build: Add build files for compiler-rt/lib/profile
authorNico Weber <nicolasweber@gmx.de>
Wed, 31 Jul 2019 17:15:32 +0000 (17:15 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 31 Jul 2019 17:15:32 +0000 (17:15 +0000)
Differential Revision: https://reviews.llvm.org/D65518

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367450 91177308-0d34-0410-b5e6-96231b3b80d8

utils/gn/secondary/compiler-rt/lib/BUILD.gn
utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
utils/gn/secondary/compiler-rt/lib/profile/BUILD.gn [new file with mode: 0644]

index 16aa0ec3f58a5ec44fad8dad001f84c17f7eb755..bc3664e242c5f77ec3d3e9a522dc3f443d308b15 100644 (file)
@@ -1,5 +1,6 @@
 group("lib") {
   deps = [
     "//compiler-rt/lib/builtins",
+    "//compiler-rt/lib/profile",
   ]
 }
index c1fbf08834fd31de661f41be666a96d35ef4fb52..3d8f5deabb97c0acb185537b9b9f7d5fc5c8d7e6 100644 (file)
@@ -16,7 +16,10 @@ static_library("builtins") {
   } else {
     output_name = "clang_rt.builtins$crt_current_target_suffix"
   }
+
   complete_static_lib = true
+  configs -= [ "//llvm/utils/gn/build:thin_archive" ]
+
   cflags = [
     "-fPIC",
     "-fno-builtin",
@@ -28,7 +31,6 @@ static_library("builtins") {
     cflags += [ "-fomit-frame-pointer" ]
   }
   cflags_c = [ "-std=c11" ]
-  configs -= [ "//llvm/utils/gn/build:thin_archive" ]
 
   sources = [
     "absvdi2.c",
diff --git a/utils/gn/secondary/compiler-rt/lib/profile/BUILD.gn b/utils/gn/secondary/compiler-rt/lib/profile/BUILD.gn
new file mode 100644 (file)
index 0000000..136d3c2
--- /dev/null
@@ -0,0 +1,64 @@
+import("//compiler-rt/target.gni")
+
+static_library("profile") {
+  output_dir = crt_current_out_dir
+  if (current_os == "mac") {
+    output_name = "clang_rt.profile_osx"
+  } else {
+    output_name = "clang_rt.profile$crt_current_target_suffix"
+  }
+
+  complete_static_lib = true
+  configs -= [ "//llvm/utils/gn/build:thin_archive" ]
+
+  cflags = []
+  if (target_os != "win") {
+    cflags = [
+      "-fPIC",
+      "-Wno-pedantic",
+    ]
+  } else {
+    # This appears to be a C-only warning banning the use of locals in
+    # aggregate initializers. All other compilers accept this, though.
+    #     nonstandard extension used : 'identifier' :
+    #     cannot be initialized using address of automatic variable
+    cflags += [ "/wd4221" ]
+  }
+
+  sources = [
+    "GCDAProfiling.c",
+    "InstrProfiling.c",
+    "InstrProfiling.h",
+    "InstrProfilingBuffer.c",
+    "InstrProfilingFile.c",
+    "InstrProfilingInternal.h",
+    "InstrProfilingMerge.c",
+    "InstrProfilingMergeFile.c",
+    "InstrProfilingNameVar.c",
+    "InstrProfilingPlatformDarwin.c",
+    "InstrProfilingPlatformFuchsia.c",
+    "InstrProfilingPlatformLinux.c",
+    "InstrProfilingPlatformOther.c",
+    "InstrProfilingPlatformWindows.c",
+    "InstrProfilingPort.h",
+    "InstrProfilingRuntime.cc",
+    "InstrProfilingUtil.c",
+    "InstrProfilingUtil.h",
+    "InstrProfilingValue.c",
+    "InstrProfilingWriter.c",
+  ]
+  if (target_os == "win") {
+    sources += [
+      "WindowsMMap.c",
+      "WindowsMMap.h",
+    ]
+  }
+
+  if (target_os != "win") {
+    defines = [
+      "COMPILER_RT_TARGET_HAS_ATOMICS",
+      "COMPILER_RT_TARGET_HAS_FCNTL_LCK",
+      "COMPILER_RT_TARGET_HAS_UNAME",
+    ]
+  }
+}