[llvm] [BinaryFormat] Add "SFrame" structures and constants (PR #147264)
Pavel Labath via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 9 02:23:56 PDT 2025
================
@@ -0,0 +1,98 @@
+//===- SFrameTest.cpp -----------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/BinaryFormat/SFrame.h"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+using namespace llvm::sframe;
+
+namespace {
+// Test structure sizes and triviality.
+static_assert(std::is_trivial_v<sframe_preamble>);
+static_assert(sizeof(sframe_preamble) == 4);
----------------
labath wrote:
@Sterling-Augustine, @dwblaikie, any thoughts on this? I'm particularly interested in whether you have plans to reuse the parsing code in the linker. My plan was to provide an iterator-based api to access the FDEs. In this setup, it would all of the FDE data in order to extract it and swap it.
I'm pretty sure that's fine for dumping (which is accessing everything anyway, and is not performance critical), and for LLDB (which only accesses one FDE at a time), but maybe it's not okay for the linker which might only need to access the offset field of the FDE (to sort it) and the rest could be `memcpy`ed into the output buffer?
https://github.com/llvm/llvm-project/pull/147264
More information about the llvm-commits
mailing list