[compiler-rt] r349994 - Add support for LLVM profile for NetBSD

Kamil Rytarowski via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 21 22:56:20 PST 2018


Author: kamil
Date: Fri Dec 21 22:56:19 2018
New Revision: 349994

URL: http://llvm.org/viewvc/llvm-project?rev=349994&view=rev
Log:
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

Modified:
    compiler-rt/trunk/cmake/config-ix.cmake
    compiler-rt/trunk/lib/profile/InstrProfilingPlatformLinux.c
    compiler-rt/trunk/lib/profile/InstrProfilingPlatformOther.c
    compiler-rt/trunk/test/profile/instrprof-dlopen-dlclose-gcov.test
    compiler-rt/trunk/test/profile/lit.cfg

Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=349994&r1=349993&r2=349994&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Fri Dec 21 22:56:19 2018
@@ -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)

Modified: compiler-rt/trunk/lib/profile/InstrProfilingPlatformLinux.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingPlatformLinux.c?rev=349994&r1=349993&r2=349994&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingPlatformLinux.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingPlatformLinux.c Fri Dec 21 22:56:19 2018
@@ -8,7 +8,7 @@
 \*===----------------------------------------------------------------------===*/
 
 #if defined(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
-    (defined(__sun__) && defined(__svr4__))
+    (defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__)
 
 #include <stdlib.h>
 

Modified: compiler-rt/trunk/lib/profile/InstrProfilingPlatformOther.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingPlatformOther.c?rev=349994&r1=349993&r2=349994&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingPlatformOther.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingPlatformOther.c Fri Dec 21 22:56:19 2018
@@ -8,7 +8,7 @@
 \*===----------------------------------------------------------------------===*/
 
 #if !defined(__APPLE__) && !defined(__linux__) && !defined(__FreeBSD__) && \
-    !(defined(__sun__) && defined(__svr4__))
+    !(defined(__sun__) && defined(__svr4__)) && !defined(__NetBSD__)
 
 #include <stdlib.h>
 

Modified: compiler-rt/trunk/test/profile/instrprof-dlopen-dlclose-gcov.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-dlopen-dlclose-gcov.test?rev=349994&r1=349993&r2=349994&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-dlopen-dlclose-gcov.test (original)
+++ compiler-rt/trunk/test/profile/instrprof-dlopen-dlclose-gcov.test Fri Dec 21 22:56:19 2018
@@ -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
 

Modified: compiler-rt/trunk/test/profile/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/lit.cfg?rev=349994&r1=349993&r2=349994&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/lit.cfg (original)
+++ compiler-rt/trunk/test/profile/lit.cfg Fri Dec 21 22:56:19 2018
@@ -67,7 +67,7 @@ config.substitutions.append( ("%clangxx_
 
 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']:




More information about the llvm-commits mailing list