aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt
diff options
context:
space:
mode:
authorLeandro Lupori <leandro.lupori@linaro.org>2023-07-11 20:08:13 +0000
committerLeandro Lupori <leandro.lupori@linaro.org>2023-07-17 10:51:27 -0300
commit33acdc1e2fbf9775f73d12a0964f1866ae828052 (patch)
tree06329b4ac296c14d2ca1601c9b2e15a6fe49b908 /compiler-rt
parent63d6659a045d2e014d53ae890eec8b3cd96e5805 (diff)
downloadllvm-33acdc1e2fbf9775f73d12a0964f1866ae828052.zip
llvm-33acdc1e2fbf9775f73d12a0964f1866ae828052.tar.gz
llvm-33acdc1e2fbf9775f73d12a0964f1866ae828052.tar.bz2
[compiler-rt][xray] Fix alignment of XRayFileHeader
XRayFileHeader storage was obtained from std::aligned_storage using its default alignment and not the struct's alignment requirement. This was causing a bus error on AArch32, on armv8 machines, where vld1.64/vst1.64 instructions with 128-bit alignment requirement were being used to copy XRayFileHeader. There is still another issue with fdr-single-thread.cpp test on armv7. Now it runs until completion and produces a valid log file, but for some reason the function name appears as _end in it, instead of the expected mangled fn name. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D155013
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/xray/xray_fdr_logging.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler-rt/lib/xray/xray_fdr_logging.cpp b/compiler-rt/lib/xray/xray_fdr_logging.cpp
index 6056f81..378a8c0f 100644
--- a/compiler-rt/lib/xray/xray_fdr_logging.cpp
+++ b/compiler-rt/lib/xray/xray_fdr_logging.cpp
@@ -15,6 +15,7 @@
//===----------------------------------------------------------------------===//
#include "xray_fdr_logging.h"
#include <cassert>
+#include <cstddef>
#include <errno.h>
#include <limits>
#include <memory>
@@ -140,7 +141,7 @@ static ThreadLocalData &getThreadLocalData() {
}
static XRayFileHeader &fdrCommonHeaderInfo() {
- static std::aligned_storage<sizeof(XRayFileHeader)>::type HStorage;
+ alignas(XRayFileHeader) static std::byte HStorage[sizeof(XRayFileHeader)];
static pthread_once_t OnceInit = PTHREAD_ONCE_INIT;
static bool TSCSupported = true;
static uint64_t CycleFrequency = NanosecondsPerSecond;
@@ -204,7 +205,8 @@ XRayBuffer fdrIterator(const XRayBuffer B) {
// initialized the first time this function is called. We'll update one part
// of this information with some relevant data (in particular the number of
// buffers to expect).
- static std::aligned_storage<sizeof(XRayFileHeader)>::type HeaderStorage;
+ alignas(
+ XRayFileHeader) static std::byte HeaderStorage[sizeof(XRayFileHeader)];
static pthread_once_t HeaderOnce = PTHREAD_ONCE_INIT;
pthread_once(
&HeaderOnce, +[] {