[PATCH] D155013: [compiler-rt][xray] Fix alignment of XRayFileHeader
Leandro Lupori via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 11 13:29:45 PDT 2023
luporl created this revision.
Herald added subscribers: Enna1, kristof.beyls, dberris.
Herald added a project: All.
luporl added reviewers: MaskRay, DavidSpickett.
luporl added a subscriber: llvm-commits.
luporl published this revision for review.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155013
Files:
compiler-rt/lib/xray/xray_fdr_logging.cpp
Index: compiler-rt/lib/xray/xray_fdr_logging.cpp
===================================================================
--- compiler-rt/lib/xray/xray_fdr_logging.cpp
+++ compiler-rt/lib/xray/xray_fdr_logging.cpp
@@ -140,7 +140,8 @@
}
static XRayFileHeader &fdrCommonHeaderInfo() {
- static std::aligned_storage<sizeof(XRayFileHeader)>::type HStorage;
+ static std::aligned_storage<sizeof(XRayFileHeader),
+ alignof(XRayFileHeader)>::type HStorage;
static pthread_once_t OnceInit = PTHREAD_ONCE_INIT;
static bool TSCSupported = true;
static uint64_t CycleFrequency = NanosecondsPerSecond;
@@ -204,7 +205,8 @@
// 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;
+ static std::aligned_storage<sizeof(XRayFileHeader),
+ alignof(XRayFileHeader)>::type HeaderStorage;
static pthread_once_t HeaderOnce = PTHREAD_ONCE_INIT;
pthread_once(
&HeaderOnce, +[] {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155013.539269.patch
Type: text/x-patch
Size: 1142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230711/7be2d924/attachment.bin>
More information about the llvm-commits
mailing list