ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
34.93k stars 2.55k forks source link

external and compressed debug info #2300

Open daurnimator opened 5 years ago

daurnimator commented 5 years ago

There are a couple of object sections I'd like to be able to use when creating applications/libraries in zig.

.gnu_debuglink

From https://sourceware.org/binutils/docs/binutils/objcopy.html:

Part of the process of adding the .gnu_debuglink section 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_debuglink with the contents described above.

.gnu_debugdata

From https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html:

.gnu_debugdata section. This feature is called MiniDebugInfo. This section holds an LZMA-compressed object and is used to supply extra symbols for backtraces.

Related to #2851

andrewrk commented 5 years ago

Thanks for the filing the issue. Do you know if clang supports these?

daurnimator commented 5 years ago

Do you know if clang supports these?

clang doesn't need to, it's a feature of: