Index: compiler-rt/trunk/lib/profile/CMakeLists.txt =================================================================== --- compiler-rt/trunk/lib/profile/CMakeLists.txt +++ compiler-rt/trunk/lib/profile/CMakeLists.txt @@ -64,7 +64,8 @@ InstrProfilingPlatformOther.c InstrProfilingPlatformWindows.c InstrProfilingRuntime.cc - InstrProfilingUtil.c) + InstrProfilingUtil.c + ) set(PROFILE_HEADERS InstrProfData.inc @@ -72,10 +73,13 @@ InstrProfilingInternal.h InstrProfilingPort.h InstrProfilingUtil.h - WindowsMMap.h) + WindowsMMap.h + ) if(WIN32) - list(APPEND PROFILE_SOURCES WindowsMMap.c) + list(APPEND PROFILE_SOURCES + WindowsMMap.c + ) endif() if(FUCHSIA OR UNIX) Index: llvm/trunk/utils/gn/secondary/compiler-rt/lib/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/compiler-rt/lib/BUILD.gn +++ llvm/trunk/utils/gn/secondary/compiler-rt/lib/BUILD.gn @@ -1,5 +1,6 @@ group("lib") { deps = [ "//compiler-rt/lib/builtins", + "//compiler-rt/lib/profile", ] } Index: llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn +++ llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn @@ -16,7 +16,10 @@ } 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 @@ cflags += [ "-fomit-frame-pointer" ] } cflags_c = [ "-std=c11" ] - configs -= [ "//llvm/utils/gn/build:thin_archive" ] sources = [ "absvdi2.c", Index: llvm/trunk/utils/gn/secondary/compiler-rt/lib/profile/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/compiler-rt/lib/profile/BUILD.gn +++ llvm/trunk/utils/gn/secondary/compiler-rt/lib/profile/BUILD.gn @@ -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", + ] + } +}