ziglang/zig
263
5.9k
Fork
You've already forked zig
759

SIGSEGV running Elf2 binaries #35367

Closed
opened 2026年05月20日 11:03:55 +02:00 by mlugg · 5 comments
Owner
Copy link

Zig Version

0.17.0-dev.313+27be3b069

Steps to Reproduce and Observed Behavior

This issue is split out from #35307 (this comment and this comment), because it is a separate issue to the original problem. Latest example by @1off reproduced below.


Checkout https://github.com/zigtools/zls at commit f0bb3d2780, then try to build with zig build check -fincremental --watch.

ziglang.org tarball:

$ ~/Downloads/zig-x86_64-linux-0.17.0-dev.313+27be3b069/zig build check -fincremental --watch
check
└─ compile exe zls Debug native
 └─ run exe zls_gen (version_data.zig) failure
error: process terminated with signal SEGV
failed command: ./.zig-cache/o/1210fa2b6befa8aa5da96122c5c098fb/zls_gen --langref-version master --langref-path /home/rad/lab/zls/src/tools/langref.html.in --generate-version-data /home/rad/lab/zls/.zig-cache/o/68195cf24a3bbf340fba20d215786b02/version_data.zig
check
└─ compile exe zls Debug native
 └─ run exe lsp-codegen (lsp_types.zig) failure
error: process terminated with signal SEGV
failed command: ./.zig-cache/o/fd92e7de8b7a4d575e9d368603cfb389/lsp-codegen /home/rad/lab/zls/.zig-cache/o/04088ba3fd4930bdce1aea303f62da1b/lsp_types.zig
Build Summary: 5/9 steps succeeded (2 failed)

Debug build of Zig:

$ ~/lab/zig/build/stage5/bin/zig version
0.17.0-dev.313+27be3b069
$ ~/lab/zig/build/stage5/bin/zig build check -fincremental --watch
check
└─ compile exe zls Debug native
 └─ run exe zls_gen (version_data.zig) failure
error: process terminated with signal SEGV
failed command: ./.zig-cache/o/3e11733faaeb9b7c0b4eb90fa7d53a1b/zls_gen --langref-version master --langref-path /home/rad/lab/zls/src/tools/langref.html.in --generate-version-data /home/rad/lab/zls/.zig-cache/o/3086aff2e0e1b7b0019665717ba92792/version_data.zig
check
└─ compile exe zls Debug native
 └─ run exe lsp-codegen (lsp_types.zig) failure
error: process terminated with signal SEGV
failed command: ./.zig-cache/o/ecb09c1acd0b1c324bd267980a2bb2e9/lsp-codegen /home/rad/lab/zls/.zig-cache/o/4dbbfbbc2ebf7274fc938e687737597d/lsp_types.zig
Build Summary: 5/9 steps succeeded (2 failed)

Debugging the crashing binaries:

$ lldb ./.zig-cache/o/3e11733faaeb9b7c0b4eb90fa7d53a1b/zls_gen
(lldb) target create "./.zig-cache/o/3e11733faaeb9b7c0b4eb90fa7d53a1b/zls_gen"
Current executable set to '/home/rad/lab/zls/.zig-cache/o/3e11733faaeb9b7c0b4eb90fa7d53a1b/zls_gen' (x86_64).
(lldb) run
warning: failed to set breakpoint site at 0x918f50 for breakpoint -2.1: error: 9 sending the breakpoint request
warning: failed to set breakpoint site at 0x918f50 for breakpoint -2.1: error: 9 sending the breakpoint request
Process 167463 launched: '/home/rad/lab/zls/.zig-cache/o/3e11733faaeb9b7c0b4eb90fa7d53a1b/zls_gen' (x86_64)
Process 167463 stopped
* thread #1, name = 'zls_gen', stop reason = signal SIGSEGV: address not mapped to object (fault address=0x918f50)
 frame #0: 0x0000000000918f50 zls_gen`_start
zls_gen`_start:
-> 0x918f50 <+0>: xorl %ebp, %ebp
 0x918f52 <+2>: movq %rsp, %rdi
 0x918f55 <+5>: andq $-0x10, %rsp
 0x918f59 <+9>: movq 0ドルx940620, %rax ; imm = 0x940620
$ lldb ./.zig-cache/o/ecb09c1acd0b1c324bd267980a2bb2e9/lsp-codegen
(lldb) target create "./.zig-cache/o/ecb09c1acd0b1c324bd267980a2bb2e9/lsp-codegen"
Current executable set to '/home/rad/lab/zls/.zig-cache/o/ecb09c1acd0b1c324bd267980a2bb2e9/lsp-codegen' (x86_64).
(lldb) run
warning: failed to set breakpoint site at 0x919050 for breakpoint -2.1: error: 9 sending the breakpoint request
warning: failed to set breakpoint site at 0x919050 for breakpoint -2.1: error: 9 sending the breakpoint request
Process 167498 launched: '/home/rad/lab/zls/.zig-cache/o/ecb09c1acd0b1c324bd267980a2bb2e9/lsp-codegen' (x86_64)
Process 167498 stopped
* thread #1, name = 'lsp-codegen', stop reason = signal SIGSEGV: address not mapped to object (fault address=0x919050)
 frame #0: 0x0000000000919050 lsp-codegen`_start
lsp-codegen`_start:
-> 0x919050 <+0>: xorl %ebp, %ebp
 0x919052 <+2>: movq %rsp, %rdi
 0x919055 <+5>: andq $-0x10, %rsp
 0x919059 <+9>: movq 0ドルx91e620, %rax ; imm = 0x91E620

Expected Behavior

The zls_gen and lsp-codegen binaries should not segfault.

zls_gen binary
lsp-codegen binary

### Zig Version 0.17.0-dev.313+27be3b069 ### Steps to Reproduce and Observed Behavior This issue is split out from #35307 ([this comment](https://codeberg.org/ziglang/zig/issues/35307#issuecomment-15206691) and [this comment](https://codeberg.org/ziglang/zig/issues/35307#issuecomment-15400001)), because it is a separate issue to the original problem. Latest example by @1off reproduced below. --- Checkout `https://github.com/zigtools/zls` at commit `f0bb3d2780`, then try to build with `zig build check -fincremental --watch`. ziglang.org tarball: ```console $ ~/Downloads/zig-x86_64-linux-0.17.0-dev.313+27be3b069/zig build check -fincremental --watch check └─ compile exe zls Debug native └─ run exe zls_gen (version_data.zig) failure error: process terminated with signal SEGV failed command: ./.zig-cache/o/1210fa2b6befa8aa5da96122c5c098fb/zls_gen --langref-version master --langref-path /home/rad/lab/zls/src/tools/langref.html.in --generate-version-data /home/rad/lab/zls/.zig-cache/o/68195cf24a3bbf340fba20d215786b02/version_data.zig check └─ compile exe zls Debug native └─ run exe lsp-codegen (lsp_types.zig) failure error: process terminated with signal SEGV failed command: ./.zig-cache/o/fd92e7de8b7a4d575e9d368603cfb389/lsp-codegen /home/rad/lab/zls/.zig-cache/o/04088ba3fd4930bdce1aea303f62da1b/lsp_types.zig Build Summary: 5/9 steps succeeded (2 failed) ``` Debug build of Zig: ```console $ ~/lab/zig/build/stage5/bin/zig version 0.17.0-dev.313+27be3b069 $ ~/lab/zig/build/stage5/bin/zig build check -fincremental --watch check └─ compile exe zls Debug native └─ run exe zls_gen (version_data.zig) failure error: process terminated with signal SEGV failed command: ./.zig-cache/o/3e11733faaeb9b7c0b4eb90fa7d53a1b/zls_gen --langref-version master --langref-path /home/rad/lab/zls/src/tools/langref.html.in --generate-version-data /home/rad/lab/zls/.zig-cache/o/3086aff2e0e1b7b0019665717ba92792/version_data.zig check └─ compile exe zls Debug native └─ run exe lsp-codegen (lsp_types.zig) failure error: process terminated with signal SEGV failed command: ./.zig-cache/o/ecb09c1acd0b1c324bd267980a2bb2e9/lsp-codegen /home/rad/lab/zls/.zig-cache/o/4dbbfbbc2ebf7274fc938e687737597d/lsp_types.zig Build Summary: 5/9 steps succeeded (2 failed) ``` Debugging the crashing binaries: ```console $ lldb ./.zig-cache/o/3e11733faaeb9b7c0b4eb90fa7d53a1b/zls_gen (lldb) target create "./.zig-cache/o/3e11733faaeb9b7c0b4eb90fa7d53a1b/zls_gen" Current executable set to '/home/rad/lab/zls/.zig-cache/o/3e11733faaeb9b7c0b4eb90fa7d53a1b/zls_gen' (x86_64). (lldb) run warning: failed to set breakpoint site at 0x918f50 for breakpoint -2.1: error: 9 sending the breakpoint request warning: failed to set breakpoint site at 0x918f50 for breakpoint -2.1: error: 9 sending the breakpoint request Process 167463 launched: '/home/rad/lab/zls/.zig-cache/o/3e11733faaeb9b7c0b4eb90fa7d53a1b/zls_gen' (x86_64) Process 167463 stopped * thread #1, name = 'zls_gen', stop reason = signal SIGSEGV: address not mapped to object (fault address=0x918f50) frame #0: 0x0000000000918f50 zls_gen`_start zls_gen`_start: -> 0x918f50 <+0>: xorl %ebp, %ebp 0x918f52 <+2>: movq %rsp, %rdi 0x918f55 <+5>: andq $-0x10, %rsp 0x918f59 <+9>: movq 0ドルx940620, %rax ; imm = 0x940620 $ lldb ./.zig-cache/o/ecb09c1acd0b1c324bd267980a2bb2e9/lsp-codegen (lldb) target create "./.zig-cache/o/ecb09c1acd0b1c324bd267980a2bb2e9/lsp-codegen" Current executable set to '/home/rad/lab/zls/.zig-cache/o/ecb09c1acd0b1c324bd267980a2bb2e9/lsp-codegen' (x86_64). (lldb) run warning: failed to set breakpoint site at 0x919050 for breakpoint -2.1: error: 9 sending the breakpoint request warning: failed to set breakpoint site at 0x919050 for breakpoint -2.1: error: 9 sending the breakpoint request Process 167498 launched: '/home/rad/lab/zls/.zig-cache/o/ecb09c1acd0b1c324bd267980a2bb2e9/lsp-codegen' (x86_64) Process 167498 stopped * thread #1, name = 'lsp-codegen', stop reason = signal SIGSEGV: address not mapped to object (fault address=0x919050) frame #0: 0x0000000000919050 lsp-codegen`_start lsp-codegen`_start: -> 0x919050 <+0>: xorl %ebp, %ebp 0x919052 <+2>: movq %rsp, %rdi 0x919055 <+5>: andq $-0x10, %rsp 0x919059 <+9>: movq 0ドルx91e620, %rax ; imm = 0x91E620 ``` ### Expected Behavior The `zls_gen` and `lsp-codegen` binaries should not segfault. [zls_gen binary](https://codeberg.org/attachments/16073e5c-c696-4661-91ce-71dc5e36210f) [lsp-codegen binary](https://codeberg.org/attachments/918f5591-d5d1-4f5e-901e-d2a68306d72e)
mlugg added this to the 0.17.0 milestone 2026年05月20日 11:03:55 +02:00
Author
Owner
Copy link

It seems like the program headers are not being written correctly:

$ readelf -Wl ~/Downloads/zls_gen
Elf file type is EXEC (Executable file)
Entry point 0x918f50
There are 5 program headers, starting at offset 1224704
Program Headers:
 Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0
 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0
 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0
 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0
 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0
 Section to Segment mapping:
 Segment Sections...
 00
 01
 02
 03
 04
$ readelf -Wl ~/Downloads/lsp-codegen
Elf file type is EXEC (Executable file)
Entry point 0x919050
There are 5 program headers, starting at offset 1224704
Program Headers:
 Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0
 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0
 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0
 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0
 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0
 Section to Segment mapping:
 Segment Sections...
 00
 01
 02
 03
 04

This seems very similar to #32123. Presumably there's some kind of MappedFile bug which leads to parts of the memory-mapped file not being flushed correctly in some cases?

Unlabeling as "regression" since the similarity between these issues suggests to me that these are the same bug, and that it just happens to be triggered a bit more often now than it used to be.

It seems like the program headers are not being written correctly: ```console $ readelf -Wl ~/Downloads/zls_gen Elf file type is EXEC (Executable file) Entry point 0x918f50 There are 5 program headers, starting at offset 1224704 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0 Section to Segment mapping: Segment Sections... 00 01 02 03 04 $ readelf -Wl ~/Downloads/lsp-codegen Elf file type is EXEC (Executable file) Entry point 0x919050 There are 5 program headers, starting at offset 1224704 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0 NULL 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0 Section to Segment mapping: Segment Sections... 00 01 02 03 04 ``` This seems very similar to https://codeberg.org/ziglang/zig/issues/32123. Presumably there's some kind of `MappedFile` bug which leads to parts of the memory-mapped file not being flushed correctly in some cases? Unlabeling as "regression" since the similarity between these issues suggests to me that these are the same bug, and that it just happens to be triggered a bit more often now than it used to be.
mlugg modified the milestone from 0.17.0 to Urgent 2026年05月20日 11:09:27 +02:00
mlugg removed their assignment 2026年05月20日 11:09:32 +02:00
Contributor
Copy link

btrfs ☑️

Moved project and verified that it does NOT manifest on XFS ☑️

I've subscribed to the linked issue.

Thank You

btrfs ☑️ Moved project and verified that it does NOT manifest on XFS ☑️ I've subscribed to the linked issue. Thank You
Author
Owner
Copy link

@1off, sorry for yet another ping, but I might have just figured out what's going on, and since the issue doesn't reproduce for me I'll need you to test the fix for me. Could you apply this patch against master and see if it solves your issue?

diff --git a/src/link/Elf2.zig b/src/link/Elf2.zig
index 194da884e8..46a5106046 100644
--- a/src/link/Elf2.zig
+++ b/src/link/Elf2.zig
@@ -4273,10 +4273,13 @@ fn flushFileOffset(elf: *Elf, ni: MappedFile.Node.Index) !void {
 },
 .segment => |phndx| {
 switch (elf.phdrSlice()) {
- inline else => |phdr| elf.targetStore(
- &phdr[phndx].offset,
- @intCast(ni.fileLocation(&elf.mf, false).offset),
- ),
+ inline else => |phdr, class| {
+ const ph = &phdr[phndx];
+ elf.targetStore(&ph.offset, @intCast(ni.fileLocation(&elf.mf, false).offset));
+ if (elf.targetLoad(&ph.type) == .PHDR) {
+ @field(elf.ehdrPtr(), @tagName(class)).phoff = ph.offset;
+ }
+ },
 }
 var child_it = ni.children(&elf.mf);
 while (child_it.next()) |child_ni| try elf.flushFileOffset(child_ni);
@@ -4296,14 +4299,18 @@ fn flushMoved(elf: *Elf, ni: MappedFile.Node.Index) !void {
 .segment => |phndx| {
 try elf.flushFileOffset(ni);
 switch (elf.phdrSlice()) {
- inline else => |phdr, class| {
+ inline else => |phdr| {
 const ph = &phdr[phndx];
 switch (elf.targetLoad(&ph.type)) {
 else => unreachable,
 .NULL, .LOAD => return,
- .DYNAMIC, .INTERP => {},
- .PHDR => @field(elf.ehdrPtr(), @tagName(class)).phoff = ph.offset,
- .TLS, std.elf.PT.GNU_RELRO => {},
+
+ .DYNAMIC,
+ .INTERP,
+ .PHDR,
+ .TLS,
+ .GNU_RELRO,
+ => {},
 }
 elf.targetStore(&ph.vaddr, @intCast(elf.computeNodeVAddr(ni)));
 ph.paddr = ph.vaddr;
@1off, sorry for yet another ping, but I might have just figured out what's going on, and since the issue doesn't reproduce for me I'll need you to test the fix for me. Could you apply this patch against master and see if it solves your issue? ```diff diff --git a/src/link/Elf2.zig b/src/link/Elf2.zig index 194da884e8..46a5106046 100644 --- a/src/link/Elf2.zig +++ b/src/link/Elf2.zig @@ -4273,10 +4273,13 @@ fn flushFileOffset(elf: *Elf, ni: MappedFile.Node.Index) !void { }, .segment => |phndx| { switch (elf.phdrSlice()) { - inline else => |phdr| elf.targetStore( - &phdr[phndx].offset, - @intCast(ni.fileLocation(&elf.mf, false).offset), - ), + inline else => |phdr, class| { + const ph = &phdr[phndx]; + elf.targetStore(&ph.offset, @intCast(ni.fileLocation(&elf.mf, false).offset)); + if (elf.targetLoad(&ph.type) == .PHDR) { + @field(elf.ehdrPtr(), @tagName(class)).phoff = ph.offset; + } + }, } var child_it = ni.children(&elf.mf); while (child_it.next()) |child_ni| try elf.flushFileOffset(child_ni); @@ -4296,14 +4299,18 @@ fn flushMoved(elf: *Elf, ni: MappedFile.Node.Index) !void { .segment => |phndx| { try elf.flushFileOffset(ni); switch (elf.phdrSlice()) { - inline else => |phdr, class| { + inline else => |phdr| { const ph = &phdr[phndx]; switch (elf.targetLoad(&ph.type)) { else => unreachable, .NULL, .LOAD => return, - .DYNAMIC, .INTERP => {}, - .PHDR => @field(elf.ehdrPtr(), @tagName(class)).phoff = ph.offset, - .TLS, std.elf.PT.GNU_RELRO => {}, + + .DYNAMIC, + .INTERP, + .PHDR, + .TLS, + .GNU_RELRO, + => {}, } elf.targetStore(&ph.vaddr, @intCast(elf.computeNodeVAddr(ni))); ph.paddr = ph.vaddr; ```
Contributor
Copy link

Applied and (clean) rebuilt stage5

~/lab/zls master
❯ rm -rf ./.zig-cache/
~/lab/zls master
❯ ~/lab/zig/build/stage5/bin/zig build check -Duse-llvm -fincremental --watch --verbose
git -C /home/rad/lab/zls --git-dir .git describe --match "*.*.*" --tags
/home/rad/lab/zig/build/stage5/bin/zig build-exe -fsingle-threaded --dep meta-model -Mroot=/home/rad/lab/zls/zig-pkg/lsp_kit-0.1.0-bi_PL3IyDACfp1xdTnkiOHEok2YpPCCCJHuuOcNzjl1D/src/codegen/codegen.zig -Mmeta-model=/home/rad/lab/zls/zig-pkg/lsp_kit-0.1.0-bi_PL3IyDACfp1xdTnkiOHEok2YpPCCCJHuuOcNzjl1D/metaModel.json --cache-dir .zig-cache --global-cache-dir /home/rad/.cache/zig --name lsp-codegen --zig-lib-dir /home/rad/lab/zig/lib/ -fincremental --listen=-
/home/rad/lab/zig/build/stage5/bin/zig build-exe -fsingle-threaded -Mroot=/home/rad/lab/zls/src/tools/config_gen.zig --cache-dir .zig-cache --global-cache-dir /home/rad/.cache/zig --name zls_gen --zig-lib-dir /home/rad/lab/zig/lib/ -fincremental --listen=-
./.zig-cache/o/73b124d55d7918daa41f3f02b3320041/zls_gen --langref-version master --langref-path /home/rad/lab/zls/src/tools/langref.html.in --generate-version-data /home/rad/lab/zls/.zig-cache/o/1b6dacb5d3ac1f611add7e0e1fe7acf6/version_data.zig
./.zig-cache/o/6467fcfef8ccef5df3c70d46fef4320e/lsp-codegen /home/rad/lab/zls/.zig-cache/o/caf8edc9195d0f629e06722d36af61cb/lsp_types.zig
/home/rad/lab/zig/build/stage5/bin/zig build-exe -ODebug --dep exe_options --dep known-folders --dep tracy --dep zls -Mroot=/home/rad/lab/zls/src/main.zig -Mexe_options=.zig-cache/c/5ff422ac537d4f2273535d71e4e50037/options.zig -ODebug -Mknown-folders=/home/rad/lab/zls/zig-pkg/known_folders-0.0.0-Fy-PJsbKAACbDh9bBxR0MMThxZSS6A9RH4apWphNHY70/known-folders.zig -fno-sanitize-c -ODebug --dep options -Mtracy=/home/rad/lab/zls/src/tracy.zig -ODebug --dep diffz --dep lsp --dep tracy --dep build_options --dep version_data -Mzls=/home/rad/lab/zls/src/zls.zig -Moptions=.zig-cache/c/f87b3e6c38d28a627fb9eb3a80ec9a43/options.zig -ODebug -Mdiffz=/home/rad/lab/zls/zig-pkg/diffz-0.0.1-G2tlIfLNAQCc06RFk0tFGj2M-X-id4WHFkMVw2JoMILR/DiffMatchPatch.zig -ODebug --dep parser --dep types -Mlsp=/home/rad/lab/zls/zig-pkg/lsp_kit-0.1.0-bi_PL3IyDACfp1xdTnkiOHEok2YpPCCCJHuuOcNzjl1D/src/lsp.zig -Mbuild_options=.zig-cache/c/fda864d4d755ba4c393d3338147b3eaa/options.zig -Mversion_data=.zig-cache/o/1b6dacb5d3ac1f611add7e0e1fe7acf6/version_data.zig -ODebug -Mparser=/home/rad/lab/zls/zig-pkg/lsp_kit-0.1.0-bi_PL3IyDACfp1xdTnkiOHEok2YpPCCCJHuuOcNzjl1D/src/parser.zig -ODebug --dep parser -Mtypes=.zig-cache/o/caf8edc9195d0f629e06722d36af61cb/lsp_types.zig -fno-emit-bin --cache-dir .zig-cache --global-cache-dir /home/rad/.cache/zig --name zls --zig-lib-dir /home/rad/lab/zig/lib/ -fincremental --listen=-
Build Summary: 9/9 steps succeeded
^C⏎ 
~/lab/zls master
❯ readelf -Wl ./.zig-cache/o/73b124d55d7918daa41f3f02b3320041/zls_gen
Elf file type is EXEC (Executable file)
Entry point 0x918f50
There are 5 program headers, starting at offset 13443072
Program Headers:
 Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
 PHDR 0xcd2000 0x0000000000621000 0x0000000000621000 0x000118 0x000118 R 0x8
 LOAD 0x1499000 0x0000000000209000 0x0000000000209000 0x0f0000 0x198000 RW 0x1000
 LOAD 0xcd2000 0x0000000000621000 0x0000000000621000 0x009000 0x00c000 R 0x1000
 LOAD 0xd78000 0x000000000062d000 0x000000000062d000 0x721000 0x1240000 R E 0x1000
 GNU_RELRO 0x1499000 0x0000000000209000 0x0000000000209000 0x001000 0x001000 R 0x1000
 Section to Segment mapping:
 Segment Sections...
 00 
 01 .data .data.rel.ro .got .got.plt 
 02 .rodata 
 03 .text .plt .plt.sec 
 04 .data.rel.ro .got .got.plt 
~/lab/zls master
❯ readelf -Wl ./.zig-cache/o/6467fcfef8ccef5df3c70d46fef4320e/lsp-codegen
Elf file type is EXEC (Executable file)
Entry point 0x918ed0
There are 5 program headers, starting at offset 14921728
Program Headers:
 Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
 PHDR 0xe3b000 0x0000000000621000 0x0000000000621000 0x000118 0x000118 R 0x8
 LOAD 0xe3b000 0x0000000000621000 0x0000000000621000 0x009000 0x00c000 R 0x1000
 LOAD 0xe7b000 0x000000000062d000 0x000000000062d000 0x721000 0x1240000 R E 0x1000
 LOAD 0x15e6000 0x000000000186d000 0x000000000186d000 0x2e3000 0x760000 RW 0x1000
 GNU_RELRO 0x15e6000 0x000000000186d000 0x000000000186d000 0x001000 0x001000 R 0x1000
 Section to Segment mapping:
 Segment Sections...
 00 
 01 .rodata 
 02 .text .plt .plt.sec 
 03 .data .data.rel.ro .got .got.plt 
 04 .data.rel.ro .got .got.plt 
Applied and (clean) rebuilt stage5 ``` ~/lab/zls master ❯ rm -rf ./.zig-cache/ ~/lab/zls master ❯ ~/lab/zig/build/stage5/bin/zig build check -Duse-llvm -fincremental --watch --verbose git -C /home/rad/lab/zls --git-dir .git describe --match "*.*.*" --tags /home/rad/lab/zig/build/stage5/bin/zig build-exe -fsingle-threaded --dep meta-model -Mroot=/home/rad/lab/zls/zig-pkg/lsp_kit-0.1.0-bi_PL3IyDACfp1xdTnkiOHEok2YpPCCCJHuuOcNzjl1D/src/codegen/codegen.zig -Mmeta-model=/home/rad/lab/zls/zig-pkg/lsp_kit-0.1.0-bi_PL3IyDACfp1xdTnkiOHEok2YpPCCCJHuuOcNzjl1D/metaModel.json --cache-dir .zig-cache --global-cache-dir /home/rad/.cache/zig --name lsp-codegen --zig-lib-dir /home/rad/lab/zig/lib/ -fincremental --listen=- /home/rad/lab/zig/build/stage5/bin/zig build-exe -fsingle-threaded -Mroot=/home/rad/lab/zls/src/tools/config_gen.zig --cache-dir .zig-cache --global-cache-dir /home/rad/.cache/zig --name zls_gen --zig-lib-dir /home/rad/lab/zig/lib/ -fincremental --listen=- ./.zig-cache/o/73b124d55d7918daa41f3f02b3320041/zls_gen --langref-version master --langref-path /home/rad/lab/zls/src/tools/langref.html.in --generate-version-data /home/rad/lab/zls/.zig-cache/o/1b6dacb5d3ac1f611add7e0e1fe7acf6/version_data.zig ./.zig-cache/o/6467fcfef8ccef5df3c70d46fef4320e/lsp-codegen /home/rad/lab/zls/.zig-cache/o/caf8edc9195d0f629e06722d36af61cb/lsp_types.zig /home/rad/lab/zig/build/stage5/bin/zig build-exe -ODebug --dep exe_options --dep known-folders --dep tracy --dep zls -Mroot=/home/rad/lab/zls/src/main.zig -Mexe_options=.zig-cache/c/5ff422ac537d4f2273535d71e4e50037/options.zig -ODebug -Mknown-folders=/home/rad/lab/zls/zig-pkg/known_folders-0.0.0-Fy-PJsbKAACbDh9bBxR0MMThxZSS6A9RH4apWphNHY70/known-folders.zig -fno-sanitize-c -ODebug --dep options -Mtracy=/home/rad/lab/zls/src/tracy.zig -ODebug --dep diffz --dep lsp --dep tracy --dep build_options --dep version_data -Mzls=/home/rad/lab/zls/src/zls.zig -Moptions=.zig-cache/c/f87b3e6c38d28a627fb9eb3a80ec9a43/options.zig -ODebug -Mdiffz=/home/rad/lab/zls/zig-pkg/diffz-0.0.1-G2tlIfLNAQCc06RFk0tFGj2M-X-id4WHFkMVw2JoMILR/DiffMatchPatch.zig -ODebug --dep parser --dep types -Mlsp=/home/rad/lab/zls/zig-pkg/lsp_kit-0.1.0-bi_PL3IyDACfp1xdTnkiOHEok2YpPCCCJHuuOcNzjl1D/src/lsp.zig -Mbuild_options=.zig-cache/c/fda864d4d755ba4c393d3338147b3eaa/options.zig -Mversion_data=.zig-cache/o/1b6dacb5d3ac1f611add7e0e1fe7acf6/version_data.zig -ODebug -Mparser=/home/rad/lab/zls/zig-pkg/lsp_kit-0.1.0-bi_PL3IyDACfp1xdTnkiOHEok2YpPCCCJHuuOcNzjl1D/src/parser.zig -ODebug --dep parser -Mtypes=.zig-cache/o/caf8edc9195d0f629e06722d36af61cb/lsp_types.zig -fno-emit-bin --cache-dir .zig-cache --global-cache-dir /home/rad/.cache/zig --name zls --zig-lib-dir /home/rad/lab/zig/lib/ -fincremental --listen=- Build Summary: 9/9 steps succeeded ^C⏎ ~/lab/zls master ❯ readelf -Wl ./.zig-cache/o/73b124d55d7918daa41f3f02b3320041/zls_gen Elf file type is EXEC (Executable file) Entry point 0x918f50 There are 5 program headers, starting at offset 13443072 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0xcd2000 0x0000000000621000 0x0000000000621000 0x000118 0x000118 R 0x8 LOAD 0x1499000 0x0000000000209000 0x0000000000209000 0x0f0000 0x198000 RW 0x1000 LOAD 0xcd2000 0x0000000000621000 0x0000000000621000 0x009000 0x00c000 R 0x1000 LOAD 0xd78000 0x000000000062d000 0x000000000062d000 0x721000 0x1240000 R E 0x1000 GNU_RELRO 0x1499000 0x0000000000209000 0x0000000000209000 0x001000 0x001000 R 0x1000 Section to Segment mapping: Segment Sections... 00 01 .data .data.rel.ro .got .got.plt 02 .rodata 03 .text .plt .plt.sec 04 .data.rel.ro .got .got.plt ~/lab/zls master ❯ readelf -Wl ./.zig-cache/o/6467fcfef8ccef5df3c70d46fef4320e/lsp-codegen Elf file type is EXEC (Executable file) Entry point 0x918ed0 There are 5 program headers, starting at offset 14921728 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0xe3b000 0x0000000000621000 0x0000000000621000 0x000118 0x000118 R 0x8 LOAD 0xe3b000 0x0000000000621000 0x0000000000621000 0x009000 0x00c000 R 0x1000 LOAD 0xe7b000 0x000000000062d000 0x000000000062d000 0x721000 0x1240000 R E 0x1000 LOAD 0x15e6000 0x000000000186d000 0x000000000186d000 0x2e3000 0x760000 RW 0x1000 GNU_RELRO 0x15e6000 0x000000000186d000 0x000000000186d000 0x001000 0x001000 R 0x1000 Section to Segment mapping: Segment Sections... 00 01 .rodata 02 .text .plt .plt.sec 03 .data .data.rel.ro .got .got.plt 04 .data.rel.ro .got .got.plt ```
Author
Owner
Copy link

Great, thank you! I'll get a PR up in a moment.

Great, thank you! I'll get a PR up in a moment.
alexrp modified the milestone from Urgent to 0.17.0 2026年06月27日 03:24:51 +02:00
Sign in to join this conversation.
No Branch/Tag specified
master
elfv2
spork8
restricted
0.16.x
panic-rewrite
parking-futex-lockfree
windows-Io-cleanup
Io-watch
ParseCommandLineOptions
windows-async-files
poll-ring
debug-file-leaks-differently
debug-file-leaks
ProcessPrng
elfv2-dyn
jobserver
threadtheft
io-threaded-no-queue
0.15.x
Io.net
comptime-allocator
restricted-function-pointers
cli
wasm-linker-writer
wrangle-writer-buffering
sha1-stream
async-await-demo
fixes
0.14.x
ast-node-methods
macos-debug-info
make-vs-configure
fuzz-macos
sans-aro
ArrayList-reserve
incr-bug
llvm-ir-nosanitize-metadata
ci-tarballs
ci-scripts
threadpool
0.12.x
new-pkg-hash
json-diagnostics
more-doctests
rework-comptime-mutation
0.11.x
ci-perf-comment
stage2-async
0.10.x
autofix
0.9.x
aro
hcs
0.8.x
0.7.x
0.16.0
0.15.2
0.15.1
0.15.0
0.14.1
0.14.0
0.12.1
0.13.0
0.12.0
0.11.0
0.10.1
0.10.0
0.9.1
0.9.0
0.8.1
0.8.0
0.7.1
0.7.0
0.6.0
0.5.0
0.4.0
0.3.0
0.2.0
0.1.1
0.1.0
Labels
Clear labels
abi/f32
abi/ilp32
abi/sf
accepted
This proposal is planned.
arch/21k
arch/6502
arch/aarch64
arch/alpha
arch/amdgcn
arch/arc
arch/arc32
arch/arc64
arch/arm
arch/avr
arch/bfin
arch/bpf
arch/colossus
arch/cris
arch/csky
arch/dlx
arch/epiphany
arch/fr30
arch/frv
arch/hexagon
arch/hppa
arch/hppa64
arch/ia64
arch/kalimba
arch/kvx
arch/lanai
arch/lm32
arch/loongarch32
arch/loongarch64
arch/m32r
arch/m68k
arch/m88k
arch/mcore
arch/microblaze
arch/mips
arch/mips64
arch/mmix
arch/moxie
arch/mrisc32
arch/msp430
arch/nds32
arch/ns32k
arch/nvptx
arch/or1k
arch/powerpc
arch/powerpc64
arch/propeller
arch/riscv32
arch/riscv64
arch/rl78
arch/rx
arch/s390x
arch/sh
arch/sparc
arch/sparc64
arch/spirv
arch/spu
arch/tricore
arch/v850
arch/vax
arch/vc4
arch/ve
arch/wasm
arch/x86
arch/x86_64
arch/xcore
arch/xtensa
autodoc
The web application for interactive documentation and generation of its assets.
backend/c
The C backend outputs C source code.
backend/llvm
The LLVM backend outputs an LLVM bitcode module.
backend/self-hosted
The self-hosted backends produce machine code directly.
binutils
Zig's included binary utilities: zig ar, zig dlltool, zig lib, zig ranlib, zig objcopy, and zig rc.
breaking
Implementing this issue could cause existing code to no longer compile or have different behavior.
build system
The Zig build system - zig build, std.Build, the build runner, and package management.
debug info
An issue related to debug information (e.g. DWARF) produced by the Zig compiler.
docs
An issue with documentation, e.g. the language reference or standard library doc comments.
error message
This issue points out an error message that is unhelpful and should be improved.
frontend
Tokenization, parsing, AstGen, ZonGen, Sema, Legalize, and Liveness.
fuzzing
An issue related to Zig's integrated fuzz testing.
incremental
Reuse of internal compiler state for faster compilation.
lib/c
This issue relates to Zig's libc implementation and/or vendored libcs.
lib/compiler-rt
This issue relates to Zig's compiler-rt library.
lib/cxx
This issue relates to Zig's vendored libc++ and/or libc++abi.
lib/std
This issue relates to Zig's standard library.
lib/tsan
This issue relates to Zig's vendored libtsan.
lib/ubsan-rt
This issue relates to Zig's ubsan-rt library.
lib/unwind
This issue relates to Zig's vendored libunwind.
linking
Zig's integrated object file and incremental linker.
miscompilation
The compiler reports success but produces semantically incorrect code.
os/android
os/contiki
os/dragonfly
os/driverkit
os/emscripten
os/freebsd
os/fuchsia
os/haiku
os/hermit
os/hurd
os/illumos
os/ios
os/linux
os/maccatalyst
os/macos
os/managarm
os/netbsd
os/ohos
os/openbsd
os/plan9
os/redox
os/rtems
os/serenity
os/tvos
os/uefi
os/visionos
os/wasi
os/watchos
os/windows
proposal
This issue suggests language modifications. If it also has the "accepted" label then it is planned.
release notes
This issue or pull request should be mentioned in the release notes.
testing
This issue is related to testing the compiler, standard library, or other parts of Zig.
zig cc
Zig as a drop-in C-family compiler.
zig fmt
The Zig source code formatter.
zig reduce
The Zig source code reduction tool.
bounty
https://ziglang.org/news/announcing-donor-bounties
bug
Observed behavior contradicts documented or intended behavior.
contributor-friendly
This issue is limited in scope and/or knowledge of project internals.
downstream
An issue with a third-party project that uses this project.
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
infra
An issue related to project infrastructure, e.g. continuous integration.
optimization
A task to improve performance and/or resource usage.
question
No questions on the issue tracker; use a community space instead.
regression
Something that used to work in a previous version stopped working
upstream
An issue with a third-party project that this project uses.
use case
Describes a real use case that is difficult or impossible, but does not propose a solution.
No labels
abi/f32
abi/ilp32
abi/sf
accepted
arch/21k
arch/6502
arch/aarch64
arch/alpha
arch/amdgcn
arch/arc
arch/arc32
arch/arc64
arch/arm
arch/avr
arch/bfin
arch/bpf
arch/colossus
arch/cris
arch/csky
arch/dlx
arch/epiphany
arch/fr30
arch/frv
arch/hexagon
arch/hppa
arch/hppa64
arch/ia64
arch/kalimba
arch/kvx
arch/lanai
arch/lm32
arch/loongarch32
arch/loongarch64
arch/m32r
arch/m68k
arch/m88k
arch/mcore
arch/microblaze
arch/mips
arch/mips64
arch/mmix
arch/moxie
arch/mrisc32
arch/msp430
arch/nds32
arch/ns32k
arch/nvptx
arch/or1k
arch/powerpc
arch/powerpc64
arch/propeller
arch/riscv32
arch/riscv64
arch/rl78
arch/rx
arch/s390x
arch/sh
arch/sparc
arch/sparc64
arch/spirv
arch/spu
arch/tricore
arch/v850
arch/vax
arch/vc4
arch/ve
arch/wasm
arch/x86
arch/x86_64
arch/xcore
arch/xtensa
autodoc
backend/c
backend/llvm
backend/self-hosted
binutils
breaking
build system
debug info
docs
error message
frontend
fuzzing
incremental
lib/c
lib/compiler-rt
lib/cxx
lib/std
lib/tsan
lib/ubsan-rt
lib/unwind
linking
miscompilation
os/android
os/contiki
os/dragonfly
os/driverkit
os/emscripten
os/freebsd
os/fuchsia
os/haiku
os/hermit
os/hurd
os/illumos
os/ios
os/linux
os/maccatalyst
os/macos
os/managarm
os/netbsd
os/ohos
os/openbsd
os/plan9
os/redox
os/rtems
os/serenity
os/tvos
os/uefi
os/visionos
os/wasi
os/watchos
os/windows
proposal
release notes
testing
zig cc
zig fmt
zig reduce
bounty
bug
contributor-friendly
downstream
enhancement
infra
optimization
question
regression
upstream
use case
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ziglang/zig#35367
Reference in a new issue
ziglang/zig
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?