dwarf: add explicit_fde_offset to support more optimal __unwind_info dwarf lookups

This commit is contained in:
kcbanner
2023-07-16 22:07:20 -04:00
parent bdb0a6fa77
commit 774dc2fdb7
3 changed files with 77 additions and 19 deletions

View File

@@ -8,6 +8,14 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
// Unwinding pure zig code, with a frame pointer
//
// getcontext version: zig std
//
// Unwind info type:
// - ELF: DWARF .debug_frame
// - MachO: __unwind_info encodings:
// - x86_64: RBP_FRAME
// - aarch64: FRAME, DWARF
{
const exe = b.addExecutable(.{
.name = "zig_unwind_fp",
@@ -23,7 +31,15 @@ pub fn build(b: *std.Build) void {
test_step.dependOn(&run_cmd.step);
}
// Unwinding pure zig code, without a frame pointer
// Unwinding pure zig code, without a frame pointer.
//
// getcontext version: zig std
//
// Unwind info type:
// - ELF: DWARF .eh_frame_hdr + .eh_frame
// - MachO: __unwind_info encodings:
// - x86_64: STACK_IMMD, STACK_IND
// - aarch64: FRAMELESS, DWARF
{
const exe = b.addExecutable(.{
.name = "zig_unwind_nofp",
@@ -34,12 +50,21 @@ pub fn build(b: *std.Build) void {
if (target.isDarwin()) exe.unwind_tables = true;
exe.omit_frame_pointer = true;
exe.unwind_tables = true;
const run_cmd = b.addRunArtifact(exe);
test_step.dependOn(&run_cmd.step);
}
// Unwinding through a C shared library without a frame pointer (libc)
//
// getcontext version: libc
//
// Unwind info type:
// - ELF: DWARF .eh_frame + .debug_frame
// - MachO: __unwind_info encodings:
// - x86_64: STACK_IMMD, STACK_IND
// - aarch64: FRAMELESS, DWARF
{
const c_shared_lib = b.addSharedLibrary(.{
.name = "c_shared_lib",