-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release fast doesn't work in complex project: ld.lld: error: Invalid value reference from metadata
Global is external, but doesn't have external or weak linkage!
#13349
Comments
As a workaround, you might try disabling LTO. |
It compiles. I managed to find the relevant code. It appears to be the same piece of code as in #13348, so it's likely the same issue: pub fn sendRequest(conn: *Connection, requests: []chunk.ChunkPosition) !void {
if(requests.len == 0) return;
var data = try main.threadAllocator.alloc(u8, 16*requests.len);
defer main.threadAllocator.free(data);
var remaining = data;
for(requests) |req| {
std.mem.writeIntBig(chunk.ChunkCoordinate, remaining[0..4], req.wx);
std.mem.writeIntBig(chunk.ChunkCoordinate, remaining[4..8], req.wy);
std.mem.writeIntBig(chunk.ChunkCoordinate, remaining[8..12], req.wz);
std.mem.writeIntBig(chunk.ChunkCoordinate, remaining[12..16], req.voxelSize); // ← this line
remaining = remaining[16..];
}
try conn.sendImportant(id, data);
}
This pattern continues, cycling through {1, 2, 4, 8, 16, 32, 64, 128} If I try to print the |
I just updated to |
I'm able to reproduce this (or something similar) with Vexu/bun@94d54c3 and running |
Reduction: fn FnPtrStage2Wrap(comptime T: anytype) @TypeOf(&struct {
const FnPtrType = T;
pub const fn_ptr: FnPtrType = undefined;
}.fn_ptr) {
return &struct {
const FnPtrType = T;
pub const fn_ptr: FnPtrType = undefined;
}.fn_ptr;
}
fn foo() u32 {
return 0;
}
test {
const a: @TypeOf(FnPtrStage2Wrap(@TypeOf(foo))) = foo;
_ = a();
}
|
Zig Version
0.10.0-dev.4640+20925b2f5
Steps to Reproduce and Observed Behavior
I tried to reduce this error, but I was unable to do that. Whenever I remove too many lines of code the error transforms into #13348. I think the error requires a certain function(+inlined calls) size. Maybe llvm tries to make the function external if it gets too big?
Anyways because I wasn't able to reduce it, here is a link to the exact commit that I tested it with: PixelGuys/Cubyz@d4e9fa2
This is the output that I get:
Expected Behavior
It should compile without an error like in release-small and release-safe and debug.
The text was updated successfully, but these errors were encountered: