Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108615454
D34735.id105115.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D34735.id105115.diff
View Options
Index: contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
===================================================================
--- contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -2099,12 +2099,19 @@
*sp = ucontext->uc_mcontext.gregs[REG_UESP];
# endif
#elif defined(__powerpc__) || defined(__powerpc64__)
+# if SANITIZER_FREEBSD
+ ucontext_t *ucontext = (ucontext_t *)context;
+ *pc = ucontext->uc_mcontext.mc_srr0;
+ *sp = ucontext->uc_mcontext.mc_frame[1];
+ *bp = ucontext->uc_mcontext.mc_frame[31];
+# else
ucontext_t *ucontext = (ucontext_t*)context;
*pc = ucontext->uc_mcontext.regs->nip;
*sp = ucontext->uc_mcontext.regs->gpr[PT_R1];
// The powerpc{,64}-linux ABIs do not specify r31 as the frame
// pointer, but GCC always uses r31 when we need a frame pointer.
*bp = ucontext->uc_mcontext.regs->gpr[PT_R31];
+# endif
#elif defined(__sparc__)
#if defined(__arch64__) || defined(__sparcv9)
#define STACK_BIAS 2047
@@ -2188,17 +2195,6 @@
GetArgv()[0]);
Die();
}
-#elif SANITIZER_PPC64V2
- // Disable ASLR for Linux PPC64LE.
- int old_personality = personality(0xffffffff);
- if (old_personality != -1 && (old_personality & ADDR_NO_RANDOMIZE) == 0) {
- VReport(1, "WARNING: Program is being run with address space layout "
- "randomization (ASLR) enabled which prevents the thread and "
- "memory sanitizers from working on powerpc64le.\n"
- "ASLR will be disabled and the program re-executed.\n");
- CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
- ReExec();
- }
#elif SANITIZER_FREEBSD
int aslr_status;
if (UNLIKELY(procctl(P_PID, 0, PROC_ASLR_STATUS, &aslr_status) == -1)) {
@@ -2239,9 +2235,21 @@
Printf("This sanitizer is not compatible with enabled MPROTECT\n");
Die();
}
-#else
+# elif SANITIZER_PPC64V2
+ // Disable ASLR for Linux PPC64LE.
+ int old_personality = personality(0xffffffff);
+ if (old_personality != -1 && (old_personality & ADDR_NO_RANDOMIZE) == 0) {
+ VReport(1,
+ "WARNING: Program is being run with address space layout "
+ "randomization (ASLR) enabled which prevents the thread and "
+ "memory sanitizers from working on powerpc64le.\n"
+ "ASLR will be disabled and the program re-executed.\n");
+ CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
+ ReExec();
+ }
+# else
// Do nothing
-#endif
+# endif
}
void CheckNoDeepBind(const char *filename, int flag) {
Index: contrib/llvm-project/compiler-rt/lib/xray/xray_powerpc64.inc
===================================================================
--- contrib/llvm-project/compiler-rt/lib/xray/xray_powerpc64.inc
+++ contrib/llvm-project/compiler-rt/lib/xray/xray_powerpc64.inc
@@ -12,7 +12,22 @@
#include <cstdint>
#include <mutex>
+#ifdef __linux__
#include <sys/platform/ppc.h>
+#elif defined(__FreeBSD__)
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+#define __ppc_get_timebase __builtin_ppc_get_timebase
+
+uint64_t __ppc_get_timebase_freq (void)
+{
+ uint64_t tb_freq = 0;
+ size_t length = sizeof(tb_freq);
+ sysctlbyname("kern.timecounter.tc.timebase.frequency", &tb_freq, &length, nullptr, 0);
+ return tb_freq;
+}
+#endif
#include "xray_defs.h"
Index: lib/libclang_rt/Makefile
===================================================================
--- lib/libclang_rt/Makefile
+++ lib/libclang_rt/Makefile
@@ -31,10 +31,13 @@
.endif # amd64
.if ${MACHINE_CPUARCH} == "riscv"
+SUBDIR+= include
SUBDIR+= asan
SUBDIR+= asan-preinit
SUBDIR+= asan_cxx
SUBDIR+= asan_dynamic
+SUBDIR+= stats
+SUBDIR+= stats_client
SUBDIR+= ubsan_minimal
SUBDIR+= ubsan_standalone
SUBDIR+= ubsan_standalone_cxx
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 27, 9:53 PM (8 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16215532
Default Alt Text
D34735.id105115.diff (3 KB)
Attached To
Mode
D34735: riscv: also enable stats and stats_client in libclang_rt
Attached
Detach File
Event Timeline
Log In to Comment