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
11001100 error.MalformedObject,
11011101 error.MalformedArchive,
11021102 error.MismatchedEflags,
1103 error.InvalidCpuArch,
1103 error.InvalidMachineType,
11041104 => continue, // already reported
11051105 else => |e| try self.reportParseError(
11061106 obj.path,
......@@ -1187,7 +1187,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod
11871187
11881188 for (system_libs.items) |lib| {
11891189 self.parseLibrary(lib, false) catch |err| switch (err) {
1190 error.MalformedObject, error.MalformedArchive, error.InvalidCpuArch => continue, // already reported
1190 error.MalformedObject, error.MalformedArchive, error.InvalidMachineType => continue, // already reported
11911191 else => |e| try self.reportParseError(
11921192 lib.path,
11931193 "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
12131213 error.MalformedObject,
12141214 error.MalformedArchive,
12151215 error.MismatchedEflags,
1216 error.InvalidCpuArch,
1216 error.InvalidMachineType,
12171217 => continue, // already reported
12181218 else => |e| try self.reportParseError(
12191219 obj.path,
......@@ -1642,7 +1642,7 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {
16421642pub const ParseError = error{
16431643 MalformedObject,
16441644 MalformedArchive,
1645 InvalidCpuArch,
1645 InvalidMachineType,
16461646 MismatchedEflags,
16471647 OutOfMemory,
16481648 Overflow,
......@@ -1813,7 +1813,7 @@ fn parseLdScript(self: *Elf, lib: SystemLib) ParseError!void {
18131813 .needed = scr_obj.needed,
18141814 .path = full_path,
18151815 }, false) catch |err| switch (err) {
1816 error.MalformedObject, error.MalformedArchive, error.InvalidCpuArch => continue, // already reported
1816 error.MalformedObject, error.MalformedArchive, error.InvalidMachineType => continue, // already reported
18171817 else => |e| try self.reportParseError(
18181818 full_path,
18191819 "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
112112 "invalid ELF machine type: {s}",
113113 .{@tagName(self.header.?.e_machine)},
114114 );
115 return error.InvalidCpuArch;
115 return error.InvalidMachineType;
116116 }
117117 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 {
6363 "invalid ELF machine type: {s}",
6464 .{@tagName(self.header.?.e_machine)},
6565 );
66 return error.InvalidCpuArch;
66 return error.InvalidMachineType;
6767 }
6868
6969 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
2121 parsePositional(elf_file, obj.path) catch |err| switch (err) {
2222 error.MalformedObject,
2323 error.MalformedArchive,
24 error.InvalidCpuArch,
24 error.InvalidMachineType,
2525 error.MismatchedEflags,
2626 => continue, // already reported
2727 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
178178 elf_file.parsePositional(obj.path, obj.must_link) catch |err| switch (err) {
179179 error.MalformedObject,
180180 error.MalformedArchive,
181 error.InvalidCpuArch,
181 error.InvalidMachineType,
182182 error.MismatchedEflags,
183183 => continue, // already reported
184184 else => |e| try elf_file.reportParseError(
src/link/MachO.zig+1-1
......@@ -921,7 +921,7 @@ fn parseInputFileWorker(self: *MachO, file: File) void {
921921 error.MalformedObject,
922922 error.MalformedDylib,
923923 error.MalformedTbd,
924 error.InvalidCpuArch,
924 error.InvalidMachineType,
925925 error.InvalidTarget,
926926 => {}, // already reported
927927 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 {
7575 macho.CPU_TYPE_X86_64 => .x86_64,
7676 else => |x| {
7777 try macho_file.reportParseError2(self.index, "unknown cpu architecture: {d}", .{x});
78 return error.InvalidCpuArch;
78 return error.InvalidMachineType;
7979 },
8080 };
8181 if (macho_file.getTarget().cpu.arch != this_cpu_arch) {
8282 try macho_file.reportParseError2(self.index, "invalid cpu architecture: {s}", .{@tagName(this_cpu_arch)});
83 return error.InvalidCpuArch;
83 return error.InvalidMachineType;
8484 }
8585
8686 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 {
9191 macho.CPU_TYPE_X86_64 => .x86_64,
9292 else => |x| {
9393 try macho_file.reportParseError2(self.index, "unknown cpu architecture: {d}", .{x});
94 return error.InvalidCpuArch;
94 return error.InvalidMachineType;
9595 },
9696 };
9797 if (cpu_arch != this_cpu_arch) {
9898 try macho_file.reportParseError2(self.index, "invalid cpu architecture: {s}", .{@tagName(this_cpu_arch)});
99 return error.InvalidCpuArch;
99 return error.InvalidMachineType;
100100 }
101101
102102 const lc_buffer = try gpa.alloc(u8, self.header.?.sizeofcmds);
......@@ -1648,12 +1648,12 @@ pub fn parseAr(self: *Object, macho_file: *MachO) !void {
16481648 macho.CPU_TYPE_X86_64 => .x86_64,
16491649 else => |x| {
16501650 try macho_file.reportParseError2(self.index, "unknown cpu architecture: {d}", .{x});
1651 return error.InvalidCpuArch;
1651 return error.InvalidMachineType;
16521652 },
16531653 };
16541654 if (macho_file.getTarget().cpu.arch != this_cpu_arch) {
16551655 try macho_file.reportParseError2(self.index, "invalid cpu architecture: {s}", .{@tagName(this_cpu_arch)});
1656 return error.InvalidCpuArch;
1656 return error.InvalidMachineType;
16571657 }
16581658
16591659 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 {
232232
233233 for (macho_file.objects.items) |index| {
234234 macho_file.getFile(index).?.parseAr(macho_file) catch |err| switch (err) {
235 error.InvalidCpuArch => {}, // already reported
235 error.InvalidMachineType => {}, // already reported
236236 else => |e| try macho_file.reportParseError2(index, "unexpected error: parsing input file failed with error {s}", .{@errorName(e)}),
237237 };
238238 }