zld: exclude strtab padding from uuid calculation

This commit is contained in:
Jakub Konka 2022-12-27 16:11:31 +01:00
parent 8adcc2258f
commit 6925ef0f1a
2 changed files with 5 additions and 4 deletions

View File

@ -2727,7 +2727,8 @@ pub const Zld = struct {
conformUuid(&self.uuid_cmd.uuid);
},
else => {
const max_file_end = self.symtab_cmd.stroff + self.symtab_cmd.strsize;
// We set the max file size to the actual strtab buffer length to exclude any strtab padding.
const max_file_end = @intCast(u32, self.symtab_cmd.stroff + self.strtab.buffer.items.len);
const FileSubsection = struct {
start: u32,

View File

@ -5,9 +5,9 @@ const LibExeObjectStep = std.build.LibExeObjStep;
pub fn build(b: *Builder) void {
const test_step = b.step("test", "Test");
test_step.dependOn(b.getInstallStep());
testUuid(b, test_step, .ReleaseSafe, "eb1203019e453d808d4f1e71053af9af");
testUuid(b, test_step, .ReleaseFast, "eb1203019e453d808d4f1e71053af9af");
testUuid(b, test_step, .ReleaseSmall, "eb1203019e453d808d4f1e71053af9af");
testUuid(b, test_step, .ReleaseSafe, "46b333df88f5314686fc0cba3b939ca8");
testUuid(b, test_step, .ReleaseFast, "46b333df88f5314686fc0cba3b939ca8");
testUuid(b, test_step, .ReleaseSmall, "46b333df88f5314686fc0cba3b939ca8");
}
fn testUuid(b: *Builder, test_step: *std.build.Step, mode: std.builtin.Mode, comptime exp: []const u8) void {