-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
There are a couple of object sections I'd like to be able to use when creating applications/libraries in zig.
- support in zig stdlib backtrace generation and other introspection code (Related: add a builtin for comptime source information #2029)
- compiler option to emit relevant sections
- support in zig build system
.gnu_debuglink
From https://sourceware.org/binutils/docs/binutils/objcopy.html:
Part of the process of adding the
.gnu_debuglinksection involves embedding a checksum of the contents of the debug info file into the section.
From https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files
A debug link is a special section of the executable file named
.gnu_debuglink. The section must contain:
- A filename, with any leading directory components removed, followed by a zero byte,
- zero to three bytes of padding, as needed to reach the next four-byte boundary within the section, and
- a four-byte CRC checksum, stored in the same endianness used for the executable file itself. The checksum is computed on the debugging information file’s full contents by the function given below, passing zero as the crc argument.
Any executable file format can carry a debug link, as long as it can contain a section named
.gnu_debuglinkwith the contents described above.
.gnu_debugdata
From https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html:
.gnu_debugdatasection. This feature is called MiniDebugInfo. This section holds an LZMA-compressed object and is used to supply extra symbols for backtraces.
Related to #2851