-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
fixes to 32-bit handling, to support 32-bit arm #4870
Conversation
@@ -811,7 +815,7 @@ pub const NativeTargetInfo = struct { | |||
} | |||
|
|||
fn preadMin(file: fs.File, buf: []u8, offset: u64, min_read_len: usize) !usize { | |||
var i: u64 = 0; | |||
var i: usize = 0; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fn is allowed to return short reads. i
is just an offset, which is relative to min_read_len
. usize
was the correct type all along.
const rpoff_usize = std.math.cast(usize, rpoff) catch |err| switch (err) { | ||
error.Overflow => return error.InvalidElfFile, | ||
}; | ||
const rpath_list = mem.spanZ(@ptrCast([*:0]u8, strtab[rpoff_usize..].ptr)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this was strtab[rpoff_usize..:0].
could we remove the @ptrCast
? (and TODO above)
@@ -645,7 +646,7 @@ pub const NativeTargetInfo = struct { | |||
{ | |||
var dyn_off = elfInt(is_64, need_bswap, ph32.p_offset, ph64.p_offset); | |||
const p_filesz = elfInt(is_64, need_bswap, ph32.p_filesz, ph64.p_filesz); | |||
const dyn_size: u64 = if (is_64) @sizeOf(elf.Elf64_Dyn) else @sizeOf(elf.Elf32_Dyn); | |||
const dyn_size: usize = if (is_64) @sizeOf(elf.Elf64_Dyn) else @sizeOf(elf.Elf32_Dyn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does peer-type resolution not work here? (i.e. omit the type?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_64
is runtime known, so it hits #137
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh interesting. I thought @sizeOf
would return a comptime-known usize
rather than a comptime_int
With these changes, I was able to use ziglang/bootstrap to cross-compile an arm-linux-musleabihf tarball.