emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/beardbolt 246377bbff 173/323: Add dummy panic handler t


From: ELPA Syncer
Subject: [elpa] externals/beardbolt 246377bbff 173/323: Add dummy panic handler to reduce size of zig diassembly
Date: Thu, 9 Mar 2023 10:58:28 -0500 (EST)

branch: externals/beardbolt
commit 246377bbff99734f30daedf2c47c03283c97e7c5
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>

    Add dummy panic handler to reduce size of zig diassembly
    
    Follow up from discussion in !7
---
 doc/rmsbolt.org      | 11 +++++++++++
 doc/rmsbolt.texi     | 11 +++++++++++
 starters/rmsbolt.zig |  7 +++++++
 3 files changed, 29 insertions(+)

diff --git a/doc/rmsbolt.org b/doc/rmsbolt.org
index d27a4be23a..0dd8963fe4 100644
--- a/doc/rmsbolt.org
+++ b/doc/rmsbolt.org
@@ -175,6 +175,17 @@ supported at the moment, with ~sbcl~ giving much better 
results.
 Assembly is generated through the ~zig~ compiler. Due to large binary sizes,
 disassembly is discouraged.
 
+Zig embeds a panic handler which inflates the size of binaries. In order to
+reduce this to a manageable level, you can add the following snippet to your
+file:
+
+#+BEGIN_SRC zig
+  pub fn panic(msg: []const u8, error_return_trace: 
?*@import("builtin").StackTrace) noreturn {
+      while (true) {
+      }
+  }
+#+END_SRC
+
 * Integrations
 This section covers integrations that RMSbolt provides, which make it easier to
 use RMSbolt with complex projects with many dependencies.
diff --git a/doc/rmsbolt.texi b/doc/rmsbolt.texi
index c552495350..9727b03396 100644
--- a/doc/rmsbolt.texi
+++ b/doc/rmsbolt.texi
@@ -290,6 +290,17 @@ supported at the moment, with @code{sbcl} giving much 
better results.
 Assembly is generated through the @code{zig} compiler. Due to large binary 
sizes,
 disassembly is discouraged.
 
+Zig embeds a panic handler which inflates the size of binaries. In order to
+reduce this to a manageable level, you can add the following snippet to your
+file:
+
+@example
+pub fn panic(msg: []const u8, error_return_trace: 
?*@@import("builtin").StackTrace) noreturn @{
+    while (true) @{
+    @}
+@}
+@end example
+
 @node Integrations
 @chapter Integrations
 
diff --git a/starters/rmsbolt.zig b/starters/rmsbolt.zig
index 1cfa66bd54..60527742ee 100644
--- a/starters/rmsbolt.zig
+++ b/starters/rmsbolt.zig
@@ -22,3 +22,10 @@ pub fn main() void {
         std.debug.warn("{c}\n", a);
     }
 }
+
+// Zig embeds a panic handler that prints stack traces, causing a disassembly 
much larger than normal.
+// You can optionally place this function in files you disassemble to make 
them easier to digest.
+pub fn panic(msg: []const u8, error_return_trace: 
?*@import("builtin").StackTrace) noreturn {
+    while (true) {
+    }
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]