summaryrefslogtreecommitdiff
path: root/main/compiler-rt
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2021-12-18 00:16:22 +0100
committerJakub Jirutka <jakub@jirutka.cz>2021-12-18 01:09:51 +0100
commit06b03f70fb94972286c0c9f6278df89e53903833 (patch)
tree1a9e7e0a30e42aaec34ab1cbda16359b49fdff92 /main/compiler-rt
parent80a75e546c569812f35b29b62ff5b4d1dbe6f59e (diff)
downloadaports-06b03f70fb94972286c0c9f6278df89e53903833.zip
main/compiler-rt: build with XRay
Diffstat (limited to 'main/compiler-rt')
-rw-r--r--main/compiler-rt/APKBUILD4
-rw-r--r--main/compiler-rt/xray-ppc64-musl.patch63
2 files changed, 66 insertions, 1 deletions
diff --git a/main/compiler-rt/APKBUILD b/main/compiler-rt/APKBUILD
index 2290665c4eb..5f271e633f9 100644
--- a/main/compiler-rt/APKBUILD
+++ b/main/compiler-rt/APKBUILD
@@ -28,6 +28,7 @@ source="https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/c
https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/llvm-$pkgver.src.tar.xz
fuzzer-size_t-musl.patch
fix-arch-detection-for-ppc64le.patch
+ xray-ppc64-musl.patch
sanitizer-supported-arch.patch
aarch64-ucontext.patch
@@ -67,7 +68,7 @@ build() {
-DCMAKE_INSTALL_PREFIX=/usr \
-DCOMPILER_RT_INCLUDE_TESTS=ON \
-DCOMPILER_RT_BUILD_SANITIZERS=$_build_sanitizers \
- -DCOMPILER_RT_BUILD_XRAY=OFF \
+ -DCOMPILER_RT_BUILD_XRAY=ON \
-DCOMPILER_RT_INSTALL_PATH="/usr/lib/clang/$pkgver" \
-DLLVM_EXTERNAL_LIT="/usr/bin/lit" \
-DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src" \
@@ -94,6 +95,7 @@ sha512sums="
ff674afb4c8eea699a4756f1bb463f15098a7fa354c733de83c024f8f0cf238cd5f19ae3ec446831c7109235e293e2bf31d8562567ede163c8ec53af7306ba0f llvm-12.0.1.src.tar.xz
1770e3c641dd7e6787471183ea2ace4543e2d4cf51df9612a28966d7414ef7f73b16fd46cec07a347c56a0c68c715659e554841aedf003b53c0997b2b6872936 fuzzer-size_t-musl.patch
6b1b9b3f7bc2dc70f64f7e096b4b7b657f788271161721c4a49a7a7a86aeff5787b8bd3239666d7d1efa686429e1246588e6d4bac1c765f305d38349965c169a fix-arch-detection-for-ppc64le.patch
+8ed6746474f135ebf77a0888957126ef3a5ded97551632198cf15659104d792487920324b74569dfc46140d26f0a268e2378d6f8878c1c9013b8e6f199eeb3b7 xray-ppc64-musl.patch
014951fa69792814f41cc5b3b412c2d3dcd9d1396d98a2b44eb304b13f238246fad94eb7ecd7c159788b7d3e4a1119f25a4dc2c33bc9330dd8800c6e1a586b43 sanitizer-supported-arch.patch
cc109c684f30842043a2e4991ef0bea626bd0ea8108bbe41cd3fc8610fec70e2ae0b17763a7ba1868c97fe2b1d32d6042ed19a833a3444908d601f0c26cedb67 aarch64-ucontext.patch
48d30e4f726949dbb5f3d3deb9b91dc1a73ab88f71534728233219327e1973619648690abd6e2f5fad041790dfc4d1db9aa9a58fa8f4c22160db80a6dd2a204e sanitizer-x86_64-execinfo.patch
diff --git a/main/compiler-rt/xray-ppc64-musl.patch b/main/compiler-rt/xray-ppc64-musl.patch
new file mode 100644
index 00000000000..d1c55ba1957
--- /dev/null
+++ b/main/compiler-rt/xray-ppc64-musl.patch
@@ -0,0 +1,63 @@
+Patch-Source: https://github.com/void-linux/void-packages/blob/c907a54de30ad0b19fbf9f37d5b67cabe5c7744d/srcpkgs/llvm12/patches/compiler-rt-xray-ppc64-musl.patch
+--- a/lib/xray/xray_powerpc64.inc
++++ b/lib/xray/xray_powerpc64.inc
+@@ -12,7 +12,13 @@
+
+ #include <cstdint>
+ #include <mutex>
++#ifdef __GLIBC__
+ #include <sys/platform/ppc.h>
++#else
++#include <cctype>
++#include <cstring>
++#include <cstdlib>
++#endif
+
+ #include "xray_defs.h"
+
+@@ -20,13 +26,45 @@ namespace __xray {
+
+ ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
+ CPU = 0;
++#ifdef __GLIBC__
+ return __ppc_get_timebase();
++#else
++ return __builtin_ppc_get_timebase();
++#endif
+ }
+
+ inline uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
+ static std::mutex M;
+ std::lock_guard<std::mutex> Guard(M);
++#ifdef __GLIBC__
+ return __ppc_get_timebase_freq();
++#else
++ /* FIXME: a less dirty implementation? */
++ static uint64_t base;
++ if (!base) {
++ FILE *f = fopen("/proc/cpuinfo", "rb");
++ if (f) {
++ ssize_t nr;
++ /* virtually always big enough to hold the line */
++ char buf[512];
++ while (fgets(buf, sizeof(buf), f)) {
++ char *ret = strstr(buf, "timebase");
++ if (!ret) {
++ continue;
++ }
++ ret += sizeof("timebase") - 1;
++ ret = strchr(ret, ':');
++ if (!ret) {
++ continue;
++ }
++ base = strtoul(ret + 1, nullptr, 10);
++ break;
++ }
++ fclose(f);
++ }
++ }
++ return base;
++#endif
+ }
+
+ inline bool probeRequiredCPUFeatures() XRAY_NEVER_INSTRUMENT {