Skip to content

Commit

Permalink
gn build: Add build files for compiler-rt/lib/profile
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D65518

llvm-svn: 367450
  • Loading branch information
nico committed Jul 31, 2019
1 parent f301498 commit b206c3e
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 4 deletions.
10 changes: 7 additions & 3 deletions compiler-rt/lib/profile/CMakeLists.txt
Expand Up @@ -64,18 +64,22 @@ set(PROFILE_SOURCES
InstrProfilingPlatformOther.c
InstrProfilingPlatformWindows.c
InstrProfilingRuntime.cc
InstrProfilingUtil.c)
InstrProfilingUtil.c
)

set(PROFILE_HEADERS
InstrProfData.inc
InstrProfiling.h
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)
Expand Down
1 change: 1 addition & 0 deletions llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
@@ -1,5 +1,6 @@
group("lib") {
deps = [
"//compiler-rt/lib/builtins",
"//compiler-rt/lib/profile",
]
}
4 changes: 3 additions & 1 deletion llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
64 changes: 64 additions & 0 deletions llvm/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",
]
}
}

0 comments on commit b206c3e

Please sign in to comment.