-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[compiler-rt][profile] Add support for LLVM profile for Haiku #107575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Haiku uses typical UNIX interfaces. All tests pass except instrprof-error.c Posix/gcov-dlopen.c Posix/gcov-destructor.c Posix/instrprof-dlopen-norpath.test
@llvm/pr-subscribers-pgo Author: Jérôme Duval (korli) ChangesHaiku uses typical UNIX interfaces. All tests pass except Full diff: https://github.com/llvm/llvm-project/pull/107575.diff 12 Files Affected:
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 97204177cde9a4..35c59922a8ebb8 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -37,7 +37,11 @@ check_c_compiler_flag(-nodefaultlibs C_SUPPORTS_NODEFAULTLIBS_FLAG)
if (C_SUPPORTS_NODEFAULTLIBS_FLAG)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
if (COMPILER_RT_HAS_LIBC)
- list(APPEND CMAKE_REQUIRED_LIBRARIES c)
+ if (HAIKU)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES root)
+ else ()
+ list(APPEND CMAKE_REQUIRED_LIBRARIES c)
+ endif ()
endif ()
if (COMPILER_RT_USE_BUILTINS_LIBRARY)
# TODO: remote this check once we address PR51389.
@@ -815,7 +819,7 @@ else()
endif()
if (PROFILE_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|AIX")
+ OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|AIX|Haiku")
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 b766436497b741..e8df5343af1411 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(__NetBSD__) || \
- defined(_AIX)
+ defined(_AIX) || defined(__HAIKU__)
#if !defined(_AIX)
#include <elf.h>
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
index aa79a5641ceca6..1d10f0bff800e2 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(__Fuchsia__) && !(defined(__sun__) && defined(__svr4__)) && \
- !defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX)
+ !defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX) && !defined(__HAIKU__)
#include <stdlib.h>
#include <stdio.h>
diff --git a/compiler-rt/test/builtins/Unit/ctor_dtor.c b/compiler-rt/test/builtins/Unit/ctor_dtor.c
index 47560722a9f750..58dffba5338eaa 100644
--- a/compiler-rt/test/builtins/Unit/ctor_dtor.c
+++ b/compiler-rt/test/builtins/Unit/ctor_dtor.c
@@ -1,7 +1,7 @@
// REQUIRES: crt
// RUN: %clang -fno-use-init-array -g -c %s -o %t.o
-// RUN: %clang -o %t -no-pie -nostdlib %crt1 %crti %crtbegin %t.o -lc %libgcc %crtend %crtn
+// RUN: %clang -o %t -no-pie -nostdlib %crt1 %crti %crtbegin %t.o %libc %libgcc %crtend %crtn
// RUN: %run %t 2>&1 | FileCheck %s
#include <stdio.h>
diff --git a/compiler-rt/test/builtins/Unit/dso_handle.cpp b/compiler-rt/test/builtins/Unit/dso_handle.cpp
index 796746992af949..183e29b8ac31ae 100644
--- a/compiler-rt/test/builtins/Unit/dso_handle.cpp
+++ b/compiler-rt/test/builtins/Unit/dso_handle.cpp
@@ -2,8 +2,8 @@
// RUN: %clangxx -g -fno-exceptions -DCRT_SHARED -c %s -fPIC -o %tshared.o
// RUN: %clangxx -g -fno-exceptions -c %s -fPIC -o %t.o
-// RUN: %clangxx -g -shared -o %t.so -nostdlib %crti %crtbegin %tshared.o %libstdcxx -lc -lm %libgcc %crtend %crtn
-// RUN: %clangxx -g -o %t -fno-pic -no-pie -nostdlib %crt1 %crti %crtbegin %t.o %libstdcxx -lc -lm %libgcc %t.so %crtend %crtn
+// RUN: %clangxx -g -shared -o %t.so -nostdlib %crti %crtbegin %tshared.o %libstdcxx %libc -lm %libgcc %crtend %crtn
+// RUN: %clangxx -g -o %t -fno-pic -no-pie -nostdlib %crt1 %crti %crtbegin %t.o %libstdcxx %libc -lm %libgcc %t.so %crtend %crtn
// RUN: %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: target={{(arm|aarch64).*}}
diff --git a/compiler-rt/test/builtins/Unit/lit.cfg.py b/compiler-rt/test/builtins/Unit/lit.cfg.py
index f63d15919888ef..f1f63dfae35a52 100644
--- a/compiler-rt/test/builtins/Unit/lit.cfg.py
+++ b/compiler-rt/test/builtins/Unit/lit.cfg.py
@@ -104,7 +104,10 @@ def get_libgcc_file_name():
if sys.platform in ["win32"] and execute_external:
# Don't pass dosish path separator to msys bash.exe.
base_lib = base_lib.replace("\\", "/")
- config.substitutions.append(("%librt ", base_lib + " -lc -lm "))
+ if config.host_os == "Haiku":
+ config.substitutions.append(("%librt ", base_lib + " -lroot "))
+ else:
+ config.substitutions.append(("%librt ", base_lib + " -lc -lm "))
builtins_build_crt = get_required_attr(config, "builtins_build_crt")
if builtins_build_crt:
@@ -123,6 +126,7 @@ def get_libgcc_file_name():
config.substitutions.append(("%crtn", get_library_path("crtn.o")))
config.substitutions.append(("%libgcc", get_libgcc_file_name()))
+ config.substitutions.append(("%libc", "-lroot" if sys.platform.startswith("haiku") else "-lc"))
config.substitutions.append(
("%libstdcxx", "-l" + config.sanitizer_cxx_lib.lstrip("lib"))
diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index 0690c3a18efdbc..16893a7cab5c98 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -82,6 +82,8 @@ def push_dynamic_library_lookup_path(config, new_path):
dynamic_library_lookup_var = "PATH"
elif platform.system() == "Darwin":
dynamic_library_lookup_var = "DYLD_LIBRARY_PATH"
+ elif platform.system() == "Haiku":
+ dynamic_library_lookup_var = "LIBRARY_PATH"
else:
dynamic_library_lookup_var = "LD_LIBRARY_PATH"
@@ -264,7 +266,6 @@ def push_dynamic_library_lookup_path(config, new_path):
"COMPILER_PATH",
"RC_DEBUG_OPTIONS",
"CINDEXTEST_PREAMBLE_FILE",
- "LIBRARY_PATH",
"CPATH",
"C_INCLUDE_PATH",
"CPLUS_INCLUDE_PATH",
diff --git a/compiler-rt/test/profile/Posix/gcov-destructor.c b/compiler-rt/test/profile/Posix/gcov-destructor.c
index bd1e0d2dde079b..1f9412f095a0fd 100644
--- a/compiler-rt/test/profile/Posix/gcov-destructor.c
+++ b/compiler-rt/test/profile/Posix/gcov-destructor.c
@@ -1,4 +1,5 @@
/// Test that destructors and destructors whose priorities are greater than 100 are tracked.
+// XFAIL: target={{.*haiku.*}}
// RUN: mkdir -p %t.dir && cd %t.dir
// RUN: %clang --coverage %s -o %t -dumpdir ./
// RUN: rm -f gcov-destructor.gcda && %run %t
diff --git a/compiler-rt/test/profile/Posix/gcov-dlopen.c b/compiler-rt/test/profile/Posix/gcov-dlopen.c
index ceac6ac355ee6a..72f11186e084cb 100644
--- a/compiler-rt/test/profile/Posix/gcov-dlopen.c
+++ b/compiler-rt/test/profile/Posix/gcov-dlopen.c
@@ -1,5 +1,6 @@
/// atexit(3) not supported in dlopen(3)ed+dlclose(3)d DSO
// XFAIL: target={{.*netbsd.*}}
+// XFAIL: target={{.*haiku.*}}
// RUN: mkdir -p %t.d && cd %t.d
diff --git a/compiler-rt/test/profile/Posix/instrprof-dlopen-norpath.test b/compiler-rt/test/profile/Posix/instrprof-dlopen-norpath.test
index ba42433f98c296..b7f8141d879ba9 100644
--- a/compiler-rt/test/profile/Posix/instrprof-dlopen-norpath.test
+++ b/compiler-rt/test/profile/Posix/instrprof-dlopen-norpath.test
@@ -1,3 +1,4 @@
+XFAIL: target={{.*haiku.*}}
RUN: rm -rf %t && split-file %s %t && cd %t
RUN: %clang_pgogen -fPIC foo.c -c -Xclang -fprofile-instrument-path="default_foo_%m.profraw"
RUN: %clang_pgogen -fPIC foo2.c -c -Xclang -fprofile-instrument-path="default_foo2_%m.profraw"
diff --git a/compiler-rt/test/profile/instrprof-error.c b/compiler-rt/test/profile/instrprof-error.c
index 3297c9d8840ae8..a49d238edf8fc3 100644
--- a/compiler-rt/test/profile/instrprof-error.c
+++ b/compiler-rt/test/profile/instrprof-error.c
@@ -1,3 +1,4 @@
+// XFAIL: target={{.*haiku.*}}
// RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t/ %run %t 1 2>&1 | FileCheck %s
diff --git a/compiler-rt/test/profile/lit.cfg.py b/compiler-rt/test/profile/lit.cfg.py
index d3ba115731c5dc..c9a272e23db013 100644
--- a/compiler-rt/test/profile/lit.cfg.py
+++ b/compiler-rt/test/profile/lit.cfg.py
@@ -166,6 +166,7 @@ def exclude_unsupported_files_for_aix(dirname):
"NetBSD",
"SunOS",
"AIX",
+ "Haiku",
]:
config.unsupported = True
|
✅ With the latest revision this PR passed the Python code formatter. |
✅ With the latest revision this PR passed the C/C++ code formatter. |
cc @MaskRay |
Co-authored-by: Petr Hosek <[email protected]>
@korli Please rebase. |
Done |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/186/builds/3762 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/42/builds/1774 Here is the relevant piece of the build log for the reference
|
…07575) Haiku uses typical UNIX interfaces. All tests pass except instrprof-error.c Posix/gcov-dlopen.c Posix/gcov-destructor.c Posix/instrprof-dlopen-norpath.test --------- Co-authored-by: Petr Hosek <[email protected]>
Haiku uses typical UNIX interfaces.
All tests pass except
instrprof-error.c
Posix/gcov-dlopen.c
Posix/gcov-destructor.c
Posix/instrprof-dlopen-norpath.test