Skip to content

Conversation

@bfredl
Copy link
Contributor

@bfredl bfredl commented Jan 8, 2026

On master attempting to build -Dlang=luajit on macos (at least for arm64) hits an assert in Zig's MachO linker:

 thread 73187 panic: unexpected pointer encoding
   /home/bfredl/dev/zig/src/link/MachO/eh_frame.zig:33:21: 0x772f808 in parse (main.zig)
                       @panic("unexpected pointer encoding"); // TODO error
                       ^
   /home/bfredl/dev/zig/src/link/MachO/Object.zig:1125:22: 0x7732c1d in initEhFrameRecords (main.zig)
           try cie.parse(macho_file);
                        ^
   /home/bfredl/dev/zig/src/link/MachO/Object.zig:255:36: 0x7743887 in parse (main.zig)
           try self.initEhFrameRecords(gpa, index, handle, macho_file);
                                      ^
   /home/bfredl/dev/zig/src/link/MachO/file.zig:336:35: 0x7745bd3 in parse (main.zig)
               .object => |x| x.parse(macho_file),
                                     ^

with some debugging this turns out to be the __eh_frame section which is generated in lj_vm.S. This debug info can be disabled at compile time using LJ_NO_UNWIND.

Ideally this should be handled better upstream by omitting debug frames it does not understand instead of crashing the compiler, but for now this allows luajit to be used on macos at all.

On master attempting to build -Dlang=luajit on macos (at least for
arm64) hits an assert in Zig's MachO linker:

     thread 73187 panic: unexpected pointer encoding
       /home/bfredl/dev/zig/src/link/MachO/eh_frame.zig:33:21: 0x772f808 in parse (main.zig)
                           @Panic("unexpected pointer encoding"); // TODO error
                           ^
       /home/bfredl/dev/zig/src/link/MachO/Object.zig:1125:22: 0x7732c1d in initEhFrameRecords (main.zig)
               try cie.parse(macho_file);
                            ^
       /home/bfredl/dev/zig/src/link/MachO/Object.zig:255:36: 0x7743887 in parse (main.zig)
               try self.initEhFrameRecords(gpa, index, handle, macho_file);
                                          ^
       /home/bfredl/dev/zig/src/link/MachO/file.zig:336:35: 0x7745bd3 in parse (main.zig)
                   .object => |x| x.parse(macho_file),
                                         ^
with some debugging this turns out to be the __eh_frame section which
is generated in lj_vm.S. This debug info can be disabled at compile time
using LJ_NO_UNWIND.

Ideally this should be handled better upstream by omiting debug frames
it does not understand instead of crashing the compiler, but for now
this allows luajit to be used on macos at all.
@robbielyman
Copy link
Collaborator

appreciate this! is there an issue filed with Zig I can point to in a comment? it would be useful to leave a little "todo, remove when blahblahblah" in the build file.

@bfredl
Copy link
Contributor Author

bfredl commented Jan 9, 2026

I found this https://codeberg.org/ziglang/zig/issues/30669 :)

@robbielyman robbielyman merged commit 188ba36 into natecraddock:main Jan 9, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants