mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
generate_linux_syscalls: Bring loongarch64 generation code in line with other newer ports.
This commit is contained in:
parent
38e0f049c5
commit
c9664cb657
@ -427,16 +427,11 @@ pub fn main() !void {
|
|||||||
try writer.writeAll("};\n\n");
|
try writer.writeAll("};\n\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
try writer.writeAll(
|
try writer.writeAll("pub const LoongArch64 = enum(usize) {\n");
|
||||||
\\
|
|
||||||
\\pub const LoongArch64 = enum(usize) {
|
|
||||||
\\
|
|
||||||
);
|
|
||||||
|
|
||||||
const child_args = [_][]const u8{
|
const child_args = [_][]const u8{
|
||||||
zig_exe,
|
zig_exe,
|
||||||
"cc",
|
"cc",
|
||||||
"-march=loongarch64",
|
|
||||||
"-target",
|
"-target",
|
||||||
"loongarch64-linux-gnu",
|
"loongarch64-linux-gnu",
|
||||||
"-E",
|
"-E",
|
||||||
@ -445,6 +440,8 @@ pub fn main() !void {
|
|||||||
"-nostdinc",
|
"-nostdinc",
|
||||||
"-Iinclude",
|
"-Iinclude",
|
||||||
"-Iinclude/uapi",
|
"-Iinclude/uapi",
|
||||||
|
"-Iarch/loongarch/include/uapi",
|
||||||
|
"-D __SYSCALL(nr, nm)=zigsyscall nm nr",
|
||||||
"arch/loongarch/include/uapi/asm/unistd.h",
|
"arch/loongarch/include/uapi/asm/unistd.h",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -468,27 +465,21 @@ pub fn main() !void {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var lines = mem.tokenizeScalar(u8, defines, '\n');
|
var lines = mem.tokenizeScalar(u8, defines, '\n');
|
||||||
loop: while (lines.next()) |line| {
|
while (lines.next()) |line| {
|
||||||
var fields = mem.tokenizeAny(u8, line, " \t");
|
var fields = mem.tokenizeAny(u8, line, " ");
|
||||||
const cmd = fields.next() orelse return error.Incomplete;
|
const prefix = fields.next() orelse return error.Incomplete;
|
||||||
if (!mem.eql(u8, cmd, "#define")) continue;
|
|
||||||
const define = fields.next() orelse return error.Incomplete;
|
|
||||||
const number = fields.next() orelse continue;
|
|
||||||
|
|
||||||
if (!std.ascii.isDigit(number[0])) continue;
|
if (!mem.eql(u8, prefix, "zigsyscall")) continue;
|
||||||
if (!mem.startsWith(u8, define, "__NR")) continue;
|
|
||||||
const name = mem.trimLeft(u8, mem.trimLeft(u8, define, "__NR3264_"), "__NR_");
|
|
||||||
if (mem.eql(u8, name, "arch_specific_syscall")) continue;
|
|
||||||
if (mem.eql(u8, name, "syscalls")) break :loop;
|
|
||||||
|
|
||||||
const fixed_name = if (stdlib_renames.get(name)) |fixed| fixed else name;
|
const sys_name = fields.next() orelse return error.Incomplete;
|
||||||
try writer.print(" {p} = {s},\n", .{ zig.fmtId(fixed_name), number });
|
const value = fields.rest();
|
||||||
|
const name = (getOverridenNameNew(value) orelse sys_name)["sys_".len..];
|
||||||
|
const fixed_name = if (stdlib_renames_new.get(name)) |f| f else if (stdlib_renames.get(name)) |f| f else name;
|
||||||
|
|
||||||
|
try writer.print(" {p} = {s},\n", .{ zig.fmtId(fixed_name), value });
|
||||||
}
|
}
|
||||||
|
|
||||||
try writer.writeAll(
|
try writer.writeAll("};\n\n");
|
||||||
\\};
|
|
||||||
\\
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try buf_out.flush();
|
try buf_out.flush();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user