aboutsummaryrefslogtreecommitdiff
path: root/lib/std/elf.zig
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2023-05-01 00:46:28 -0400
committerkcbanner <kcbanner@gmail.com>2023-07-20 22:58:12 -0400
commitea9917d9bd921f9fc14028a8dbf9e3f0f2579120 (patch)
tree5128a49e9c364c4b72b11c6d4afb14c35dcbcc6b /lib/std/elf.zig
parent8a18abfd60392a3adcfc4e6cfa712f63ecf2bf67 (diff)
downloadzig-ea9917d9bd921f9fc14028a8dbf9e3f0f2579120.tar.gz
zig-ea9917d9bd921f9fc14028a8dbf9e3f0f2579120.zip
debug: support loading elf debug info from external files
Some distributions (ie. Ubuntu) have their libc debug info in separate files. This change allows the stack walking code to read that debug info. - add support for reading compressed ELF sections - support reading the build-id from the elf headers in order to lookup external debug info - support reading the .gnu_debuglink section to look up external debug info
Diffstat (limited to 'lib/std/elf.zig')
-rw-r--r--lib/std/elf.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/std/elf.zig b/lib/std/elf.zig
index 3ea136fabe..004e508960 100644
--- a/lib/std/elf.zig
+++ b/lib/std/elf.zig
@@ -371,6 +371,9 @@ pub const SHT_LOUSER = 0x80000000;
/// End of application-specific
pub const SHT_HIUSER = 0xffffffff;
+// Note type for .note.gnu.build_id
+pub const NT_GNU_BUILD_ID = 3;
+
/// Local symbol
pub const STB_LOCAL = 0;
/// Global symbol
@@ -1055,6 +1058,11 @@ pub const Shdr = switch (@sizeOf(usize)) {
8 => Elf64_Shdr,
else => @compileError("expected pointer size of 32 or 64"),
};
+pub const Chdr = switch (@sizeOf(usize)) {
+ 4 => Elf32_Chdr,
+ 8 => Elf64_Chdr,
+ else => @compileError("expected pointer size of 32 or 64"),
+};
pub const Sym = switch (@sizeOf(usize)) {
4 => Elf32_Sym,
8 => Elf64_Sym,