authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-23 10:40:35+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-23 19:56:29+02:00
logfb6f5a30b2d6334d0f1415446849d39fe00d3af0
tree3455ae3d513a4ed7ce7269a15fb1253d66d031d2
parenta69f55a7cc3980f4d4dfcce6cb9d21a597975c7f
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

link: Rename InvalidCpuArch error to InvalidMachineType.


8 files changed, 17 insertions(+), 17 deletions(-)

src/link/Elf.zig+5-5
...@@ -1100,7 +1100,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod...@@ -1100,7 +1100,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod
1100 error.MalformedObject,1100 error.MalformedObject,
1101 error.MalformedArchive,1101 error.MalformedArchive,
1102 error.MismatchedEflags,1102 error.MismatchedEflags,
1103 error.InvalidCpuArch,1103 error.InvalidMachineType,
1104 => continue, // already reported1104 => continue, // already reported
1105 else => |e| try self.reportParseError(1105 else => |e| try self.reportParseError(
1106 obj.path,1106 obj.path,
...@@ -1187,7 +1187,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod...@@ -1187,7 +1187,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod
11871187
1188 for (system_libs.items) |lib| {1188 for (system_libs.items) |lib| {
1189 self.parseLibrary(lib, false) catch |err| switch (err) {1189 self.parseLibrary(lib, false) catch |err| switch (err) {
1190 error.MalformedObject, error.MalformedArchive, error.InvalidCpuArch => continue, // already reported1190 error.MalformedObject, error.MalformedArchive, error.InvalidMachineType => continue, // already reported
1191 else => |e| try self.reportParseError(1191 else => |e| try self.reportParseError(
1192 lib.path,1192 lib.path,
1193 "unexpected error: parsing library failed with error {s}",1193 "unexpected error: parsing library failed with error {s}",
...@@ -1213,7 +1213,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod...@@ -1213,7 +1213,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod
1213 error.MalformedObject,1213 error.MalformedObject,
1214 error.MalformedArchive,1214 error.MalformedArchive,
1215 error.MismatchedEflags,1215 error.MismatchedEflags,
1216 error.InvalidCpuArch,1216 error.InvalidMachineType,
1217 => continue, // already reported1217 => continue, // already reported
1218 else => |e| try self.reportParseError(1218 else => |e| try self.reportParseError(
1219 obj.path,1219 obj.path,
...@@ -1642,7 +1642,7 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {...@@ -1642,7 +1642,7 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {
1642pub const ParseError = error{1642pub const ParseError = error{
1643 MalformedObject,1643 MalformedObject,
1644 MalformedArchive,1644 MalformedArchive,
1645 InvalidCpuArch,1645 InvalidMachineType,
1646 MismatchedEflags,1646 MismatchedEflags,
1647 OutOfMemory,1647 OutOfMemory,
1648 Overflow,1648 Overflow,
...@@ -1813,7 +1813,7 @@ fn parseLdScript(self: *Elf, lib: SystemLib) ParseError!void {...@@ -1813,7 +1813,7 @@ fn parseLdScript(self: *Elf, lib: SystemLib) ParseError!void {
1813 .needed = scr_obj.needed,1813 .needed = scr_obj.needed,
1814 .path = full_path,1814 .path = full_path,
1815 }, false) catch |err| switch (err) {1815 }, false) catch |err| switch (err) {
1816 error.MalformedObject, error.MalformedArchive, error.InvalidCpuArch => continue, // already reported1816 error.MalformedObject, error.MalformedArchive, error.InvalidMachineType => continue, // already reported
1817 else => |e| try self.reportParseError(1817 else => |e| try self.reportParseError(
1818 full_path,1818 full_path,
1819 "unexpected error: parsing library failed with error {s}",1819 "unexpected error: parsing library failed with error {s}",
src/link/Elf/Object.zig+1-1
...@@ -112,7 +112,7 @@ fn parseCommon(self: *Object, allocator: Allocator, handle: std.fs.File, elf_fil...@@ -112,7 +112,7 @@ fn parseCommon(self: *Object, allocator: Allocator, handle: std.fs.File, elf_fil
112 "invalid ELF machine type: {s}",112 "invalid ELF machine type: {s}",
113 .{@tagName(self.header.?.e_machine)},113 .{@tagName(self.header.?.e_machine)},
114 );114 );
115 return error.InvalidCpuArch;115 return error.InvalidMachineType;
116 }116 }
117 try elf_file.validateEFlags(self.index, self.header.?.e_flags);117 try elf_file.validateEFlags(self.index, self.header.?.e_flags);
118118
src/link/Elf/SharedObject.zig+1-1
...@@ -63,7 +63,7 @@ pub fn parse(self: *SharedObject, elf_file: *Elf, handle: std.fs.File) !void {...@@ -63,7 +63,7 @@ pub fn parse(self: *SharedObject, elf_file: *Elf, handle: std.fs.File) !void {
63 "invalid ELF machine type: {s}",63 "invalid ELF machine type: {s}",
64 .{@tagName(self.header.?.e_machine)},64 .{@tagName(self.header.?.e_machine)},
65 );65 );
66 return error.InvalidCpuArch;66 return error.InvalidMachineType;
67 }67 }
6868
69 const shoff = std.math.cast(usize, self.header.?.e_shoff) orelse return error.Overflow;69 const shoff = std.math.cast(usize, self.header.?.e_shoff) orelse return error.Overflow;
src/link/Elf/relocatable.zig+2-2
...@@ -21,7 +21,7 @@ pub fn flushStaticLib(elf_file: *Elf, comp: *Compilation, module_obj_path: ?[]co...@@ -21,7 +21,7 @@ pub fn flushStaticLib(elf_file: *Elf, comp: *Compilation, module_obj_path: ?[]co
21 parsePositional(elf_file, obj.path) catch |err| switch (err) {21 parsePositional(elf_file, obj.path) catch |err| switch (err) {
22 error.MalformedObject,22 error.MalformedObject,
23 error.MalformedArchive,23 error.MalformedArchive,
24 error.InvalidCpuArch,24 error.InvalidMachineType,
25 error.MismatchedEflags,25 error.MismatchedEflags,
26 => continue, // already reported26 => continue, // already reported
27 error.UnknownFileType => try elf_file.reportParseError(obj.path, "unknown file type for an object file", .{}),27 error.UnknownFileType => try elf_file.reportParseError(obj.path, "unknown file type for an object file", .{}),
...@@ -178,7 +178,7 @@ pub fn flushObject(elf_file: *Elf, comp: *Compilation, module_obj_path: ?[]const...@@ -178,7 +178,7 @@ pub fn flushObject(elf_file: *Elf, comp: *Compilation, module_obj_path: ?[]const
178 elf_file.parsePositional(obj.path, obj.must_link) catch |err| switch (err) {178 elf_file.parsePositional(obj.path, obj.must_link) catch |err| switch (err) {
179 error.MalformedObject,179 error.MalformedObject,
180 error.MalformedArchive,180 error.MalformedArchive,
181 error.InvalidCpuArch,181 error.InvalidMachineType,
182 error.MismatchedEflags,182 error.MismatchedEflags,
183 => continue, // already reported183 => continue, // already reported
184 else => |e| try elf_file.reportParseError(184 else => |e| try elf_file.reportParseError(
src/link/MachO.zig+1-1
...@@ -921,7 +921,7 @@ fn parseInputFileWorker(self: *MachO, file: File) void {...@@ -921,7 +921,7 @@ fn parseInputFileWorker(self: *MachO, file: File) void {
921 error.MalformedObject,921 error.MalformedObject,
922 error.MalformedDylib,922 error.MalformedDylib,
923 error.MalformedTbd,923 error.MalformedTbd,
924 error.InvalidCpuArch,924 error.InvalidMachineType,
925 error.InvalidTarget,925 error.InvalidTarget,
926 => {}, // already reported926 => {}, // already reported
927 else => |e| self.reportParseError2(file.getIndex(), "unexpected error: parsing input file failed with error {s}", .{@errorName(e)}) catch {},927 else => |e| self.reportParseError2(file.getIndex(), "unexpected error: parsing input file failed with error {s}", .{@errorName(e)}) catch {},
src/link/MachO/Dylib.zig+2-2
...@@ -75,12 +75,12 @@ fn parseBinary(self: *Dylib, macho_file: *MachO) !void {...@@ -75,12 +75,12 @@ fn parseBinary(self: *Dylib, macho_file: *MachO) !void {
75 macho.CPU_TYPE_X86_64 => .x86_64,75 macho.CPU_TYPE_X86_64 => .x86_64,
76 else => |x| {76 else => |x| {
77 try macho_file.reportParseError2(self.index, "unknown cpu architecture: {d}", .{x});77 try macho_file.reportParseError2(self.index, "unknown cpu architecture: {d}", .{x});
78 return error.InvalidCpuArch;78 return error.InvalidMachineType;
79 },79 },
80 };80 };
81 if (macho_file.getTarget().cpu.arch != this_cpu_arch) {81 if (macho_file.getTarget().cpu.arch != this_cpu_arch) {
82 try macho_file.reportParseError2(self.index, "invalid cpu architecture: {s}", .{@tagName(this_cpu_arch)});82 try macho_file.reportParseError2(self.index, "invalid cpu architecture: {s}", .{@tagName(this_cpu_arch)});
83 return error.InvalidCpuArch;83 return error.InvalidMachineType;
84 }84 }
8585
86 const lc_buffer = try gpa.alloc(u8, header.sizeofcmds);86 const lc_buffer = try gpa.alloc(u8, header.sizeofcmds);
src/link/MachO/Object.zig+4-4
...@@ -91,12 +91,12 @@ pub fn parse(self: *Object, macho_file: *MachO) !void {...@@ -91,12 +91,12 @@ pub fn parse(self: *Object, macho_file: *MachO) !void {
91 macho.CPU_TYPE_X86_64 => .x86_64,91 macho.CPU_TYPE_X86_64 => .x86_64,
92 else => |x| {92 else => |x| {
93 try macho_file.reportParseError2(self.index, "unknown cpu architecture: {d}", .{x});93 try macho_file.reportParseError2(self.index, "unknown cpu architecture: {d}", .{x});
94 return error.InvalidCpuArch;94 return error.InvalidMachineType;
95 },95 },
96 };96 };
97 if (cpu_arch != this_cpu_arch) {97 if (cpu_arch != this_cpu_arch) {
98 try macho_file.reportParseError2(self.index, "invalid cpu architecture: {s}", .{@tagName(this_cpu_arch)});98 try macho_file.reportParseError2(self.index, "invalid cpu architecture: {s}", .{@tagName(this_cpu_arch)});
99 return error.InvalidCpuArch;99 return error.InvalidMachineType;
100 }100 }
101101
102 const lc_buffer = try gpa.alloc(u8, self.header.?.sizeofcmds);102 const lc_buffer = try gpa.alloc(u8, self.header.?.sizeofcmds);
...@@ -1648,12 +1648,12 @@ pub fn parseAr(self: *Object, macho_file: *MachO) !void {...@@ -1648,12 +1648,12 @@ pub fn parseAr(self: *Object, macho_file: *MachO) !void {
1648 macho.CPU_TYPE_X86_64 => .x86_64,1648 macho.CPU_TYPE_X86_64 => .x86_64,
1649 else => |x| {1649 else => |x| {
1650 try macho_file.reportParseError2(self.index, "unknown cpu architecture: {d}", .{x});1650 try macho_file.reportParseError2(self.index, "unknown cpu architecture: {d}", .{x});
1651 return error.InvalidCpuArch;1651 return error.InvalidMachineType;
1652 },1652 },
1653 };1653 };
1654 if (macho_file.getTarget().cpu.arch != this_cpu_arch) {1654 if (macho_file.getTarget().cpu.arch != this_cpu_arch) {
1655 try macho_file.reportParseError2(self.index, "invalid cpu architecture: {s}", .{@tagName(this_cpu_arch)});1655 try macho_file.reportParseError2(self.index, "invalid cpu architecture: {s}", .{@tagName(this_cpu_arch)});
1656 return error.InvalidCpuArch;1656 return error.InvalidMachineType;
1657 }1657 }
16581658
1659 const lc_buffer = try gpa.alloc(u8, self.header.?.sizeofcmds);1659 const lc_buffer = try gpa.alloc(u8, self.header.?.sizeofcmds);
src/link/MachO/relocatable.zig+1-1
...@@ -232,7 +232,7 @@ fn parseInputFilesAr(macho_file: *MachO) !void {...@@ -232,7 +232,7 @@ fn parseInputFilesAr(macho_file: *MachO) !void {
232232
233 for (macho_file.objects.items) |index| {233 for (macho_file.objects.items) |index| {
234 macho_file.getFile(index).?.parseAr(macho_file) catch |err| switch (err) {234 macho_file.getFile(index).?.parseAr(macho_file) catch |err| switch (err) {
235 error.InvalidCpuArch => {}, // already reported235 error.InvalidMachineType => {}, // already reported
236 else => |e| try macho_file.reportParseError2(index, "unexpected error: parsing input file failed with error {s}", .{@errorName(e)}),236 else => |e| try macho_file.reportParseError2(index, "unexpected error: parsing input file failed with error {s}", .{@errorName(e)}),
237 };237 };
238 }238 }