[llvm] [BinaryFormat] Add "SFrame" structures and constants (PR #147264)

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 01:57:31 PDT 2025


================
@@ -0,0 +1,165 @@
+//===-- llvm/BinaryFormat/SFrame.h ---SFrame Data Structures ----*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+/// \file
+/// This file contains data-structure definitions and constants to support
+/// unwinding based on .sframe sections.  This only supports SFRAME_VERSION_2
+/// as described at https://sourceware.org/binutils/docs/sframe-spec.html
+///
+/// Naming conventions follow the spec document. #defines converted to constants
+/// and enums for better C++ compatibility.
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_BINARYFORMAT_SFRAME_H
+#define LLVM_BINARYFORMAT_SFRAME_H
+
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/DataTypes.h"
+
+namespace llvm {
+
+namespace sframe {
+
+constexpr uint16_t SFRAME_MAGIC = 0xDEE2;
+
+enum : uint8_t {
+  SFRAME_VERSION_1 = 1,
+  SFRAME_VERSION_2 = 2,
+};
+
+/// sframe_preable.sfp_flags flags.
----------------
labath wrote:

That's cool. Thanks for letting me know. I've added the new constant to this PR, and I've also update my (WIP) parser/dumper to account for this change.

https://github.com/llvm/llvm-project/pull/147264


More information about the llvm-commits mailing list