diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake index fb2aee8e42ee2..d658b7009e859 100644 --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -162,7 +162,6 @@ endmacro() # OBJECT_LIBS # PARENT_TARGET # ADDITIONAL_HEADERS
-# EXTENSIONS # C_STANDARD # CXX_STANDARD ) function(add_compiler_rt_runtime name type) @@ -174,7 +173,7 @@ function(add_compiler_rt_runtime name type) cmake_parse_arguments(LIB "" "PARENT_TARGET;C_STANDARD;CXX_STANDARD" - "OS;ARCHS;SOURCES;CFLAGS;LINK_FLAGS;DEFS;DEPS;LINK_LIBS;OBJECT_LIBS;ADDITIONAL_HEADERS;EXTENSIONS" + "OS;ARCHS;SOURCES;CFLAGS;LINK_FLAGS;DEFS;DEPS;LINK_LIBS;OBJECT_LIBS;ADDITIONAL_HEADERS" ${ARGN}) set(libnames) # Until we support this some other way, build compiler-rt runtime without LTO @@ -445,10 +444,6 @@ function(add_compiler_rt_runtime name type) if(type STREQUAL "SHARED") rt_externalize_debuginfo(${libname}) endif() - - if(DEFINED LIB_EXTENSIONS) - set_target_properties(${libname} PROPERTIES C_EXTENSIONS ${LIB_EXTENSIONS}) - endif() endforeach() if(LIB_PARENT_TARGET) add_dependencies(${LIB_PARENT_TARGET} ${libnames}) diff --git a/compiler-rt/lib/profile/CMakeLists.txt b/compiler-rt/lib/profile/CMakeLists.txt index ac1451c8ceed1..a6402f80b890a 100644 --- a/compiler-rt/lib/profile/CMakeLists.txt +++ b/compiler-rt/lib/profile/CMakeLists.txt @@ -162,8 +162,7 @@ if(APPLE) CFLAGS ${EXTRA_FLAGS} SOURCES ${PROFILE_SOURCES} ADDITIONAL_HEADERS ${PROFILE_HEADERS} - PARENT_TARGET profile - EXTENSIONS ON) + PARENT_TARGET profile) else() add_compiler_rt_runtime(clang_rt.profile STATIC @@ -171,6 +170,5 @@ else() CFLAGS ${EXTRA_FLAGS} SOURCES ${PROFILE_SOURCES} ADDITIONAL_HEADERS ${PROFILE_HEADERS} - PARENT_TARGET profile - EXTENSIONS ON) + PARENT_TARGET profile) endif() diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c index ac01805e70adc..523ade5eafc15 100644 --- a/compiler-rt/lib/profile/GCDAProfiling.c +++ b/compiler-rt/lib/profile/GCDAProfiling.c @@ -21,6 +21,11 @@ #if !defined(__Fuchsia__) +#if defined(__linux__) +// For fdopen() +#define _DEFAULT_SOURCE +#endif + #include #include #include diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c index 354f21b786151..71127b05aafb8 100644 --- a/compiler-rt/lib/profile/InstrProfilingFile.c +++ b/compiler-rt/lib/profile/InstrProfilingFile.c @@ -8,6 +8,11 @@ #if !defined(__Fuchsia__) +#if defined(__linux__) +// For fileno(), ftruncate(), getpagesize(), setenv() +#define _DEFAULT_SOURCE +#endif + #include #include #include diff --git a/compiler-rt/lib/profile/InstrProfilingUtil.c b/compiler-rt/lib/profile/InstrProfilingUtil.c index 0fae91cfb8950..a9d9df813764b 100644 --- a/compiler-rt/lib/profile/InstrProfilingUtil.c +++ b/compiler-rt/lib/profile/InstrProfilingUtil.c @@ -12,6 +12,11 @@ #include #include "WindowsMMap.h" #else +#if defined(__linux__) +// For fdopen(), fileno(), getpagesize(), madvise() +#define _DEFAULT_SOURCE +#endif + #include #include #include