authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-12-27 16:11:31+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-12-27 16:43:35+01:00
log6925ef0f1af0497c6ea454348b0c3fbe451313a9
tree58738ad2baef9fd4157e5ef72686784040deb877
parent8adcc2258fbe09ac282e0a6dcf1a358ac5ed5ee0

zld: exclude strtab padding from uuid calculation


2 files changed, 5 insertions(+), 4 deletions(-)

src/link/MachO/zld.zig+2-1
...@@ -2727,7 +2727,8 @@ pub const Zld = struct {...@@ -2727,7 +2727,8 @@ pub const Zld = struct {
2727 conformUuid(&self.uuid_cmd.uuid);2727 conformUuid(&self.uuid_cmd.uuid);
2728 },2728 },
2729 else => {2729 else => {
2730 const max_file_end = self.symtab_cmd.stroff + self.symtab_cmd.strsize;2730 // We set the max file size to the actual strtab buffer length to exclude any strtab padding.
2731 const max_file_end = @intCast(u32, self.symtab_cmd.stroff + self.strtab.buffer.items.len);
27312732
2732 const FileSubsection = struct {2733 const FileSubsection = struct {
2733 start: u32,2734 start: u32,
test/link/macho/uuid/build.zig+3-3
...@@ -5,9 +5,9 @@ const LibExeObjectStep = std.build.LibExeObjStep;...@@ -5,9 +5,9 @@ const LibExeObjectStep = std.build.LibExeObjStep;
5pub fn build(b: *Builder) void {5pub fn build(b: *Builder) void {
6 const test_step = b.step("test", "Test");6 const test_step = b.step("test", "Test");
7 test_step.dependOn(b.getInstallStep());7 test_step.dependOn(b.getInstallStep());
8 testUuid(b, test_step, .ReleaseSafe, "eb1203019e453d808d4f1e71053af9af");8 testUuid(b, test_step, .ReleaseSafe, "46b333df88f5314686fc0cba3b939ca8");
9 testUuid(b, test_step, .ReleaseFast, "eb1203019e453d808d4f1e71053af9af");9 testUuid(b, test_step, .ReleaseFast, "46b333df88f5314686fc0cba3b939ca8");
10 testUuid(b, test_step, .ReleaseSmall, "eb1203019e453d808d4f1e71053af9af");10 testUuid(b, test_step, .ReleaseSmall, "46b333df88f5314686fc0cba3b939ca8");
11}11}
1212
13fn testUuid(b: *Builder, test_step: *std.build.Step, mode: std.builtin.Mode, comptime exp: []const u8) void {13fn testUuid(b: *Builder, test_step: *std.build.Step, mode: std.builtin.Mode, comptime exp: []const u8) void {