summaryrefslogtreecommitdiff
path: root/compiler-rt
diff options
context:
space:
mode:
authorKamil Rytarowski <n54@gmx.com>2018-12-22 06:56:19 +0000
committerKamil Rytarowski <n54@gmx.com>2018-12-22 06:56:19 +0000
commitf82ba720fa7312af08e14c2a78b0926689934362 (patch)
tree44edb909ae30cbf451105ad8481485133197bd91 /compiler-rt
parent4c75719b8c96cc1a8e4eeed746cc8c339adc4d44 (diff)
Add support for LLVM profile for NetBSD
Summary: NetBSD uses typical UNIX interfaces. All tests pass except instrprof-dlopen-dlclose-gcov.test, as there is not supported semantics of atexit(3) in dlopen(3)ed+dlclose(3)d DSO. NetBSD also ships an older version of LLVM profile (ABI v.2 predating ABI v.4 in upstream version) inside libc. That copy has been manually removed during the porting and testing process of the upstream version to NetBSD. Otherwise there were conflicts between them two. Reviewers: joerg, vitalybuka, vsk Subscribers: srhines, fedor.sergeev, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55997
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/cmake/config-ix.cmake2
-rw-r--r--compiler-rt/lib/profile/InstrProfilingPlatformLinux.c2
-rw-r--r--compiler-rt/lib/profile/InstrProfilingPlatformOther.c2
-rw-r--r--compiler-rt/test/profile/instrprof-dlopen-dlclose-gcov.test3
-rw-r--r--compiler-rt/test/profile/lit.cfg2
5 files changed, 7 insertions, 4 deletions
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 7e9ad63556a..db5c4645dc0 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -586,7 +586,7 @@ else()
endif()
if (PROFILE_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS")
+ OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD")
set(COMPILER_RT_HAS_PROFILE TRUE)
else()
set(COMPILER_RT_HAS_PROFILE FALSE)
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
index a517821a2fb..3764df1d807 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
@@ -8,7 +8,7 @@
\*===----------------------------------------------------------------------===*/
#if defined(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
- (defined(__sun__) && defined(__svr4__))
+ (defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__)
#include <stdlib.h>
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
index a339abc7f88..7c2f14cfce1 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
@@ -8,7 +8,7 @@
\*===----------------------------------------------------------------------===*/
#if !defined(__APPLE__) && !defined(__linux__) && !defined(__FreeBSD__) && \
- !(defined(__sun__) && defined(__svr4__))
+ !(defined(__sun__) && defined(__svr4__)) && !defined(__NetBSD__)
#include <stdlib.h>
diff --git a/compiler-rt/test/profile/instrprof-dlopen-dlclose-gcov.test b/compiler-rt/test/profile/instrprof-dlopen-dlclose-gcov.test
index 8b1b2e29474..36b5dbd262d 100644
--- a/compiler-rt/test/profile/instrprof-dlopen-dlclose-gcov.test
+++ b/compiler-rt/test/profile/instrprof-dlopen-dlclose-gcov.test
@@ -1,3 +1,6 @@
+# atexit(3) not supported in dlopen(3)ed+dlclose(3)d DSO
+XFAIL: netbsd
+
RUN: mkdir -p %t.d
RUN: cd %t.d
diff --git a/compiler-rt/test/profile/lit.cfg b/compiler-rt/test/profile/lit.cfg
index 1cd2509672f..7449650a623 100644
--- a/compiler-rt/test/profile/lit.cfg
+++ b/compiler-rt/test/profile/lit.cfg
@@ -67,7 +67,7 @@ config.substitutions.append( ("%clangxx_profuse=", build_invocation(clang_cxxfla
config.substitutions.append( ("%clang_lto_profgen=", build_invocation(clang_cflags, True) + " -fprofile-instr-generate=") )
-if config.host_os not in ['Darwin', 'FreeBSD', 'Linux', 'SunOS']:
+if config.host_os not in ['Darwin', 'FreeBSD', 'Linux', 'NetBSD', 'SunOS']:
config.unsupported = True
if config.target_arch in ['armv7l']: