Closed
Description
Zig Version
0.15.0-dev.621+a63f7875f
Steps to Reproduce and Observed Behavior
pub fn main() void {
@extern(*const fn () callconv(.c) void, .{
.library_name = "foo",
.name = "bar",
})();
}
zig build-exe foo.lib repro.zig -target x86_64-windows-gnu
# -or-
zig build-exe repro.zig -target x86_64-windows-gnu
Results in random compiler segfaults and errors. Here's a few:
error: unable to generate DLL import .lib file for +7╥: InvalidWtf8
error(link): DLL import library for -lbI not found
error: failed to link with LLD: DllImportLibraryNotFound
error: unable to generate DLL import .lib file for ☺D#: Unexpected
error: unable to generate DLL import .lib file for ☻
You get the same behavior regardless of whether or not you pass an implib on the command line.
This is probably caused by some kind of UAF. Sema.handleExternLibName()
seems like a good place to start investigating.
Expected Behavior
No segfault.