summaryrefslogtreecommitdiff
path: root/vere/ext/gmp/build.zig
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-10-05 21:56:51 +0700
committerpolwex <polwex@sortug.com>2025-10-05 21:56:51 +0700
commitfcedfddf00b3f994e4f4e40332ac7fc192c63244 (patch)
tree51d38e62c7bdfcc5f9a5e9435fe820c93cfc9a3d /vere/ext/gmp/build.zig
claude is gud
Diffstat (limited to 'vere/ext/gmp/build.zig')
-rw-r--r--vere/ext/gmp/build.zig969
1 files changed, 969 insertions, 0 deletions
diff --git a/vere/ext/gmp/build.zig b/vere/ext/gmp/build.zig
new file mode 100644
index 0000000..7e26a8f
--- /dev/null
+++ b/vere/ext/gmp/build.zig
@@ -0,0 +1,969 @@
+const std = @import("std");
+
+pub fn build(b: *std.Build) void {
+ const target = b.standardTargetOptions(.{});
+ const optimize = b.standardOptimizeOption(.{});
+ const t = target.result;
+
+ const dep_c = b.dependency("gmp", .{
+ .target = target,
+ .optimize = optimize,
+ });
+
+ const lib = b.addStaticLibrary(.{
+ .name = "gmp",
+ .target = target,
+ .optimize = optimize,
+ });
+
+ lib.linkLibC();
+
+ // TODO: Finish this
+ if (t.os.tag != .windows) {
+ const gmp_h = b.addConfigHeader(.{
+ .style = .{
+ .cmake = dep_c.path("gmp-h.in"),
+ },
+ .include_path = "gmp.h",
+ }, .{
+ .HAVE_HOST_CPU_FAMILY_power = 0,
+ .HAVE_HOST_CPU_FAMILY_powerpc = 0,
+ .GMP_LIMB_BITS = 64,
+ .GMP_NAIL_BITS = 0,
+ .DEFN_LONG_LONG_LIMB = "",
+ .LIBGMP_DLL = 0,
+ .CC = "gcc",
+ .CFLAGS = "-O2 -pedantic -march=armv8-a",
+ });
+
+ lib.addConfigHeader(gmp_h);
+ lib.installConfigHeader(gmp_h);
+ }
+
+ // Static headers
+ lib.addIncludePath(dep_c.path("."));
+ lib.addIncludePath(dep_c.path("mpf"));
+ lib.addIncludePath(dep_c.path("mpn"));
+ lib.addIncludePath(dep_c.path("mpq"));
+ lib.addIncludePath(dep_c.path("mpz"));
+ lib.addIncludePath(dep_c.path("printf"));
+ lib.addIncludePath(dep_c.path("rand"));
+ lib.addIncludePath(dep_c.path("scanf"));
+ if (t.cpu.arch.isAARCH64()) {
+ lib.addIncludePath(dep_c.path("mpn/arm64"));
+ } else if (t.cpu.arch.isX86()) {
+ lib.addIncludePath(dep_c.path("mpn/x86_64"));
+ }
+
+ // Generated Sources
+ if (t.os.tag == .macos and t.cpu.arch == .aarch64) {
+ lib.addIncludePath(b.path("gen/aarch64-macos"));
+ lib.addIncludePath(b.path("gen/aarch64-macos/mpn"));
+ for (aarch64_macos_asm_sources) |rel_path| {
+ lib.addAssemblyFile(b.path(rel_path));
+ }
+ lib.addCSourceFiles(.{
+ .root = b.path("gen/aarch64-macos"),
+ .files = &.{
+ "mpn/mp_bases.c",
+ "mpn/fib_table.c",
+ },
+ .flags = &.{
+ "-fno-sanitize=all",
+ },
+ });
+ }
+ if (t.os.tag == .macos and t.cpu.arch == .x86_64) {
+ lib.addIncludePath(b.path("gen/x86_64-macos"));
+ lib.addIncludePath(b.path("gen/x86_64-macos/mpn"));
+ for (x86_64_macos_asm_sources) |rel_path| {
+ lib.addAssemblyFile(b.path(rel_path));
+ }
+ lib.addCSourceFiles(.{
+ .root = b.path("gen/x86_64-macos"),
+ .files = &.{
+ "mpn/mp_bases.c",
+ "mpn/fib_table.c",
+ },
+ .flags = &.{
+ "-fno-sanitize=all",
+ },
+ });
+ }
+ if (t.os.tag == .linux and t.cpu.arch == .aarch64) {
+ lib.addIncludePath(b.path("gen/aarch64-linux"));
+ lib.addIncludePath(b.path("gen/aarch64-linux/mpn"));
+ for (aarch64_linux_asm_sources) |rel_path| {
+ lib.addAssemblyFile(b.path(rel_path));
+ }
+ lib.addCSourceFiles(.{
+ .root = b.path("gen/aarch64-linux"),
+ .files = &.{
+ "mpn/mp_bases.c",
+ "mpn/fib_table.c",
+ },
+ .flags = &.{
+ "-fno-sanitize=all",
+ },
+ });
+ }
+ if (t.os.tag == .linux and t.cpu.arch == .x86_64) {
+ lib.addIncludePath(b.path("gen/x86_64-linux"));
+ lib.addIncludePath(b.path("gen/x86_64-linux/mpn"));
+ for (x86_64_linux_asm_sources) |rel_path| {
+ lib.addAssemblyFile(b.path(rel_path));
+ }
+ lib.addCSourceFiles(.{
+ .root = b.path("gen/x86_64-linux"),
+ .files = &.{
+ "mpn/mp_bases.c",
+ "mpn/fib_table.c",
+ },
+ .flags = &.{
+ "-fno-sanitize=all",
+ },
+ });
+ }
+
+ if (t.os.tag == .windows and t.cpu.arch == .x86_64) {
+ lib.addIncludePath(b.path("gen/x86_64-windows"));
+ lib.addIncludePath(b.path("gen/x86_64-windows/mpn"));
+ for (x86_64_windows_asm_sources) |rel_path| {
+ lib.addAssemblyFile(b.path(rel_path));
+ }
+ lib.addCSourceFiles(.{
+ .root = b.path("gen/x86_64-windows"),
+ .files = &.{
+ "mpn/mp_bases.c",
+ "mpn/fib_table.c",
+ },
+ .flags = &.{
+ "-fno-sanitize=all",
+ },
+ });
+ }
+
+ // Generic C Sources
+ lib.addCSourceFiles(.{
+ .root = dep_c.path(""),
+ .files = &generic_c_sources,
+ .flags = &.{
+ "-fno-sanitize=all",
+ },
+ });
+
+ // These files need to be compiles twice with different macros
+ lib.addCSourceFiles(.{
+ .root = dep_c.path(""),
+ .files = &.{
+ "mpn/generic/sec_div.c",
+ "mpn/generic/sec_pi1_div.c",
+ "mpn/generic/sec_aors_1.c",
+ },
+ .flags = &.{
+ "-fno-sanitize=all",
+ "-DOPERATION_sec_div_qr", // sec_div.c
+ "-DOPERATION_sec_pi1_div_qr", // sec_pi1_div.c
+ "-DOPERATION_sec_add_1", // sec_aors_1.c
+ },
+ });
+ lib.addCSourceFiles(.{
+ .root = dep_c.path(""),
+ .files = &.{
+ "mpn/generic/sec_div.c",
+ "mpn/generic/sec_pi1_div.c",
+ "mpn/generic/sec_aors_1.c",
+ },
+ .flags = &.{
+ "-fno-sanitize=all",
+ "-DOPERATION_sec_div_r", // sec_div.c
+ "-DOPERATION_sec_pi1_div_r", // sec_pi1_div.c
+ "-DOPERATION_sec_sub_1", // sec_aors_1.c
+ },
+ });
+
+ if (t.os.tag == .windows) {
+ lib.installHeader(b.path("gen/x86_64-windows/gmp.h"), "gmp.h");
+ }
+
+ b.installArtifact(lib);
+}
+
+const aarch64_macos_asm_sources = [_][]const u8{
+ "gen/aarch64-macos/mpn/add_n.s",
+ "gen/aarch64-macos/mpn/addlsh1_n.s",
+ "gen/aarch64-macos/mpn/addlsh2_n.s",
+ "gen/aarch64-macos/mpn/addmul_1.s",
+ "gen/aarch64-macos/mpn/and_n.s",
+ "gen/aarch64-macos/mpn/andn_n.s",
+ "gen/aarch64-macos/mpn/bdiv_dbm1c.s",
+ "gen/aarch64-macos/mpn/bdiv_q_1.s",
+ "gen/aarch64-macos/mpn/cnd_add_n.s",
+ "gen/aarch64-macos/mpn/cnd_sub_n.s",
+ "gen/aarch64-macos/mpn/com.s",
+ "gen/aarch64-macos/mpn/copyd.s",
+ "gen/aarch64-macos/mpn/copyi.s",
+ "gen/aarch64-macos/mpn/gcd_11.s",
+ "gen/aarch64-macos/mpn/gcd_22.s",
+ "gen/aarch64-macos/mpn/hamdist.s",
+ "gen/aarch64-macos/mpn/invert_limb.s",
+ "gen/aarch64-macos/mpn/ior_n.s",
+ "gen/aarch64-macos/mpn/iorn_n.s",
+ "gen/aarch64-macos/mpn/lshift.s",
+ "gen/aarch64-macos/mpn/lshiftc.s",
+ "gen/aarch64-macos/mpn/mod_34lsub1.s",
+ "gen/aarch64-macos/mpn/mul_1.s",
+ "gen/aarch64-macos/mpn/nand_n.s",
+ "gen/aarch64-macos/mpn/nior_n.s",
+ "gen/aarch64-macos/mpn/popcount.s",
+ "gen/aarch64-macos/mpn/rsblsh1_n.s",
+ "gen/aarch64-macos/mpn/rsblsh2_n.s",
+ "gen/aarch64-macos/mpn/rsh1add_n.s",
+ "gen/aarch64-macos/mpn/rsh1sub_n.s",
+ "gen/aarch64-macos/mpn/rshift.s",
+ "gen/aarch64-macos/mpn/sec_tabselect.s",
+ "gen/aarch64-macos/mpn/sqr_diag_addlsh1.s",
+ "gen/aarch64-macos/mpn/sub_n.s",
+ "gen/aarch64-macos/mpn/sublsh1_n.s",
+ "gen/aarch64-macos/mpn/sublsh2_n.s",
+ "gen/aarch64-macos/mpn/submul_1.s",
+ "gen/aarch64-macos/mpn/xnor_n.s",
+ "gen/aarch64-macos/mpn/xor_n.s",
+};
+
+const x86_64_macos_asm_sources = [_][]const u8{
+ "gen/x86_64-macos/mpn/add_err1_n.s",
+ "gen/x86_64-macos/mpn/add_err2_n.s",
+ "gen/x86_64-macos/mpn/add_err3_n.s",
+ "gen/x86_64-macos/mpn/add_n.s",
+ "gen/x86_64-macos/mpn/addlsh1_n.s",
+ "gen/x86_64-macos/mpn/addlsh2_n.s",
+ "gen/x86_64-macos/mpn/addlsh_n.s",
+ "gen/x86_64-macos/mpn/addmul_1.s",
+ "gen/x86_64-macos/mpn/addmul_2.s",
+ "gen/x86_64-macos/mpn/and_n.s",
+ "gen/x86_64-macos/mpn/andn_n.s",
+ "gen/x86_64-macos/mpn/bdiv_dbm1c.s",
+ "gen/x86_64-macos/mpn/bdiv_q_1.s",
+ "gen/x86_64-macos/mpn/cnd_add_n.s",
+ "gen/x86_64-macos/mpn/cnd_sub_n.s",
+ "gen/x86_64-macos/mpn/com.s",
+ "gen/x86_64-macos/mpn/copyd.s",
+ "gen/x86_64-macos/mpn/copyi.s",
+ "gen/x86_64-macos/mpn/div_qr_1n_pi1.s",
+ "gen/x86_64-macos/mpn/div_qr_2n_pi1.s",
+ "gen/x86_64-macos/mpn/div_qr_2u_pi1.s",
+ "gen/x86_64-macos/mpn/dive_1.s",
+ "gen/x86_64-macos/mpn/divrem_1.s",
+ "gen/x86_64-macos/mpn/divrem_2.s",
+ "gen/x86_64-macos/mpn/gcd_11.s",
+ "gen/x86_64-macos/mpn/gcd_22.s",
+ "gen/x86_64-macos/mpn/hamdist.s",
+ "gen/x86_64-macos/mpn/invert_limb.s",
+ "gen/x86_64-macos/mpn/invert_limb_table.s",
+ "gen/x86_64-macos/mpn/ior_n.s",
+ "gen/x86_64-macos/mpn/iorn_n.s",
+ "gen/x86_64-macos/mpn/lshift.s",
+ "gen/x86_64-macos/mpn/lshiftc.s",
+ "gen/x86_64-macos/mpn/mod_1_1.s",
+ "gen/x86_64-macos/mpn/mod_1_2.s",
+ "gen/x86_64-macos/mpn/mod_1_4.s",
+ "gen/x86_64-macos/mpn/mod_34lsub1.s",
+ "gen/x86_64-macos/mpn/mode1o.s",
+ "gen/x86_64-macos/mpn/mul_1.s",
+ "gen/x86_64-macos/mpn/mul_2.s",
+ "gen/x86_64-macos/mpn/mul_basecase.s",
+ "gen/x86_64-macos/mpn/mullo_basecase.s",
+ "gen/x86_64-macos/mpn/nand_n.s",
+ "gen/x86_64-macos/mpn/nior_n.s",
+ "gen/x86_64-macos/mpn/popcount.s",
+ "gen/x86_64-macos/mpn/redc_1.s",
+ "gen/x86_64-macos/mpn/rsblsh1_n.s",
+ "gen/x86_64-macos/mpn/rsblsh2_n.s",
+ "gen/x86_64-macos/mpn/rsblsh_n.s",
+ "gen/x86_64-macos/mpn/rsh1add_n.s",
+ "gen/x86_64-macos/mpn/rsh1sub_n.s",
+ "gen/x86_64-macos/mpn/rshift.s",
+ "gen/x86_64-macos/mpn/sec_tabselect.s",
+ "gen/x86_64-macos/mpn/sqr_basecase.s",
+ "gen/x86_64-macos/mpn/sqr_diag_addlsh1.s",
+ "gen/x86_64-macos/mpn/sub_err1_n.s",
+ "gen/x86_64-macos/mpn/sub_err2_n.s",
+ "gen/x86_64-macos/mpn/sub_err3_n.s",
+ "gen/x86_64-macos/mpn/sub_n.s",
+ "gen/x86_64-macos/mpn/sublsh1_n.s",
+ "gen/x86_64-macos/mpn/sublsh2_n.s",
+ "gen/x86_64-macos/mpn/submul_1.s",
+ "gen/x86_64-macos/mpn/xnor_n.s",
+ "gen/x86_64-macos/mpn/xor_n.s",
+};
+
+const x86_64_windows_asm_sources = [_][]const u8{
+ "gen/x86_64-windows/mpn/add_n.s",
+ "gen/x86_64-windows/mpn/addaddmul_1msb0.s",
+ "gen/x86_64-windows/mpn/addlsh1_n.s",
+ "gen/x86_64-windows/mpn/addlsh2_n.s",
+ "gen/x86_64-windows/mpn/addlsh_n.s",
+ "gen/x86_64-windows/mpn/addmul_1.s",
+ "gen/x86_64-windows/mpn/addmul_2.s",
+ "gen/x86_64-windows/mpn/and_n.s",
+ "gen/x86_64-windows/mpn/andn_n.s",
+ "gen/x86_64-windows/mpn/bdiv_dbm1c.s",
+ "gen/x86_64-windows/mpn/bdiv_q_1.s",
+ "gen/x86_64-windows/mpn/cnd_add_n.s",
+ "gen/x86_64-windows/mpn/cnd_sub_n.s",
+ "gen/x86_64-windows/mpn/com.s",
+ "gen/x86_64-windows/mpn/copyd.s",
+ "gen/x86_64-windows/mpn/copyi.s",
+ "gen/x86_64-windows/mpn/div_qr_2n_pi1.s",
+ "gen/x86_64-windows/mpn/dive_1.s",
+ "gen/x86_64-windows/mpn/divrem_1.s",
+ "gen/x86_64-windows/mpn/divrem_2.s",
+ "gen/x86_64-windows/mpn/gcd_11.s",
+ "gen/x86_64-windows/mpn/hamdist.s",
+ "gen/x86_64-windows/mpn/invert_limb.s",
+ "gen/x86_64-windows/mpn/invert_limb_table.s",
+ "gen/x86_64-windows/mpn/ior_n.s",
+ "gen/x86_64-windows/mpn/iorn_n.s",
+ "gen/x86_64-windows/mpn/lshift.s",
+ "gen/x86_64-windows/mpn/lshiftc.s",
+ "gen/x86_64-windows/mpn/mod_1_1.s",
+ "gen/x86_64-windows/mpn/mod_1_2.s",
+ "gen/x86_64-windows/mpn/mod_1_4.s",
+ "gen/x86_64-windows/mpn/mod_34lsub1.s",
+ "gen/x86_64-windows/mpn/mode1o.s",
+ "gen/x86_64-windows/mpn/mul_1.s",
+ "gen/x86_64-windows/mpn/mul_2.s",
+ "gen/x86_64-windows/mpn/mul_basecase.s",
+ "gen/x86_64-windows/mpn/mullo_basecase.s",
+ "gen/x86_64-windows/mpn/mulmid_basecase.s",
+ "gen/x86_64-windows/mpn/nand_n.s",
+ "gen/x86_64-windows/mpn/nior_n.s",
+ "gen/x86_64-windows/mpn/popcount.s",
+ "gen/x86_64-windows/mpn/redc_1.s",
+ "gen/x86_64-windows/mpn/rsblsh1_n.s",
+ "gen/x86_64-windows/mpn/rsblsh2_n.s",
+ "gen/x86_64-windows/mpn/rsblsh_n.s",
+ "gen/x86_64-windows/mpn/rsh1add_n.s",
+ "gen/x86_64-windows/mpn/rsh1sub_n.s",
+ "gen/x86_64-windows/mpn/rshift.s",
+ "gen/x86_64-windows/mpn/sec_tabselect.s",
+ "gen/x86_64-windows/mpn/sqr_basecase.s",
+ "gen/x86_64-windows/mpn/sqr_diag_addlsh1.s",
+ "gen/x86_64-windows/mpn/sub_n.s",
+ "gen/x86_64-windows/mpn/sublsh1_n.s",
+ "gen/x86_64-windows/mpn/submul_1.s",
+ "gen/x86_64-windows/mpn/xnor_n.s",
+ "gen/x86_64-windows/mpn/xor_n.s",
+};
+
+const aarch64_linux_asm_sources = [_][]const u8{
+ "gen/aarch64-linux/mpn/add_n.s",
+ "gen/aarch64-linux/mpn/addlsh1_n.s",
+ "gen/aarch64-linux/mpn/addlsh2_n.s",
+ "gen/aarch64-linux/mpn/addmul_1.s",
+ "gen/aarch64-linux/mpn/and_n.s",
+ "gen/aarch64-linux/mpn/andn_n.s",
+ "gen/aarch64-linux/mpn/bdiv_dbm1c.s",
+ "gen/aarch64-linux/mpn/bdiv_q_1.s",
+ "gen/aarch64-linux/mpn/cnd_add_n.s",
+ "gen/aarch64-linux/mpn/cnd_sub_n.s",
+ "gen/aarch64-linux/mpn/com.s",
+ "gen/aarch64-linux/mpn/copyd.s",
+ "gen/aarch64-linux/mpn/copyi.s",
+ "gen/aarch64-linux/mpn/gcd_11.s",
+ "gen/aarch64-linux/mpn/gcd_22.s",
+ "gen/aarch64-linux/mpn/hamdist.s",
+ "gen/aarch64-linux/mpn/invert_limb.s",
+ "gen/aarch64-linux/mpn/ior_n.s",
+ "gen/aarch64-linux/mpn/iorn_n.s",
+ "gen/aarch64-linux/mpn/lshift.s",
+ "gen/aarch64-linux/mpn/lshiftc.s",
+ "gen/aarch64-linux/mpn/mod_34lsub1.s",
+ "gen/aarch64-linux/mpn/mul_1.s",
+ "gen/aarch64-linux/mpn/nand_n.s",
+ "gen/aarch64-linux/mpn/nior_n.s",
+ "gen/aarch64-linux/mpn/popcount.s",
+ "gen/aarch64-linux/mpn/rsblsh1_n.s",
+ "gen/aarch64-linux/mpn/rsblsh2_n.s",
+ "gen/aarch64-linux/mpn/rsh1add_n.s",
+ "gen/aarch64-linux/mpn/rsh1sub_n.s",
+ "gen/aarch64-linux/mpn/rshift.s",
+ "gen/aarch64-linux/mpn/sec_tabselect.s",
+ "gen/aarch64-linux/mpn/sqr_diag_addlsh1.s",
+ "gen/aarch64-linux/mpn/sub_n.s",
+ "gen/aarch64-linux/mpn/sublsh1_n.s",
+ "gen/aarch64-linux/mpn/sublsh2_n.s",
+ "gen/aarch64-linux/mpn/submul_1.s",
+ "gen/aarch64-linux/mpn/xnor_n.s",
+ "gen/aarch64-linux/mpn/xor_n.s",
+};
+
+const x86_64_linux_asm_sources = [_][]const u8{
+ "gen/x86_64-linux/mpn/add_err1_n.s",
+ "gen/x86_64-linux/mpn/add_err2_n.s",
+ "gen/x86_64-linux/mpn/add_err3_n.s",
+ "gen/x86_64-linux/mpn/add_n.s",
+ "gen/x86_64-linux/mpn/addaddmul_1msb0.s",
+ "gen/x86_64-linux/mpn/addlsh1_n.s",
+ "gen/x86_64-linux/mpn/addlsh2_n.s",
+ "gen/x86_64-linux/mpn/addlsh_n.s",
+ "gen/x86_64-linux/mpn/addmul_1.s",
+ "gen/x86_64-linux/mpn/addmul_2.s",
+ "gen/x86_64-linux/mpn/and_n.s",
+ "gen/x86_64-linux/mpn/andn_n.s",
+ "gen/x86_64-linux/mpn/bdiv_dbm1c.s",
+ "gen/x86_64-linux/mpn/bdiv_q_1.s",
+ "gen/x86_64-linux/mpn/cnd_add_n.s",
+ "gen/x86_64-linux/mpn/cnd_sub_n.s",
+ "gen/x86_64-linux/mpn/com.s",
+ "gen/x86_64-linux/mpn/copyd.s",
+ "gen/x86_64-linux/mpn/copyi.s",
+ "gen/x86_64-linux/mpn/div_qr_1n_pi1.s",
+ "gen/x86_64-linux/mpn/div_qr_2n_pi1.s",
+ "gen/x86_64-linux/mpn/div_qr_2u_pi1.s",
+ "gen/x86_64-linux/mpn/dive_1.s",
+ "gen/x86_64-linux/mpn/divrem_1.s",
+ "gen/x86_64-linux/mpn/divrem_2.s",
+ "gen/x86_64-linux/mpn/gcd_11.s",
+ "gen/x86_64-linux/mpn/gcd_22.s",
+ "gen/x86_64-linux/mpn/hamdist.s",
+ "gen/x86_64-linux/mpn/invert_limb.s",
+ "gen/x86_64-linux/mpn/invert_limb_table.s",
+ "gen/x86_64-linux/mpn/ior_n.s",
+ "gen/x86_64-linux/mpn/iorn_n.s",
+ "gen/x86_64-linux/mpn/lshift.s",
+ "gen/x86_64-linux/mpn/lshiftc.s",
+ "gen/x86_64-linux/mpn/mod_1_1.s",
+ "gen/x86_64-linux/mpn/mod_1_2.s",
+ "gen/x86_64-linux/mpn/mod_1_4.s",
+ "gen/x86_64-linux/mpn/mod_34lsub1.s",
+ "gen/x86_64-linux/mpn/mode1o.s",
+ "gen/x86_64-linux/mpn/mul_1.s",
+ "gen/x86_64-linux/mpn/mul_2.s",
+ "gen/x86_64-linux/mpn/mul_basecase.s",
+ "gen/x86_64-linux/mpn/mullo_basecase.s",
+ "gen/x86_64-linux/mpn/mulmid_basecase.s",
+ "gen/x86_64-linux/mpn/nand_n.s",
+ "gen/x86_64-linux/mpn/nior_n.s",
+ "gen/x86_64-linux/mpn/popcount.s",
+ "gen/x86_64-linux/mpn/redc_1.s",
+ "gen/x86_64-linux/mpn/rsblsh1_n.s",
+ "gen/x86_64-linux/mpn/rsblsh2_n.s",
+ "gen/x86_64-linux/mpn/rsblsh_n.s",
+ "gen/x86_64-linux/mpn/rsh1add_n.s",
+ "gen/x86_64-linux/mpn/rsh1sub_n.s",
+ "gen/x86_64-linux/mpn/rshift.s",
+ "gen/x86_64-linux/mpn/sec_tabselect.s",
+ "gen/x86_64-linux/mpn/sqr_basecase.s",
+ "gen/x86_64-linux/mpn/sqr_diag_addlsh1.s",
+ "gen/x86_64-linux/mpn/sub_err1_n.s",
+ "gen/x86_64-linux/mpn/sub_err2_n.s",
+ "gen/x86_64-linux/mpn/sub_err3_n.s",
+ "gen/x86_64-linux/mpn/sub_n.s",
+ "gen/x86_64-linux/mpn/sublsh1_n.s",
+ "gen/x86_64-linux/mpn/submul_1.s",
+ "gen/x86_64-linux/mpn/xnor_n.s",
+ "gen/x86_64-linux/mpn/xor_n.s",
+};
+
+const generic_c_sources = [_][]const u8{
+ "assert.c",
+ "bootstrap.c",
+ "compat.c",
+ "errno.c",
+ "extract-dbl.c",
+ // "gen-bases.c",
+ // "gen-fac.c",
+ // "gen-fib.c",
+ // "gen-jacobitab.c",
+ // "gen-psqr.c",
+ // "gen-trialdivtab.c",
+ "invalid.c",
+ "memory.c",
+ "mp_bpl.c",
+ "mp_clz_tab.c",
+ "mp_dv_tab.c",
+ "mp_get_fns.c",
+ "mp_minv_tab.c",
+ "mp_set_fns.c",
+ "nextprime.c",
+ "primesieve.c",
+ // "tal-debug.c",
+ // "tal-notreent.c",
+ "tal-reent.c",
+ "version.c",
+
+ "mpf/abs.c",
+ "mpf/add.c",
+ "mpf/add_ui.c",
+ "mpf/ceilfloor.c",
+ "mpf/clear.c",
+ "mpf/clears.c",
+ "mpf/cmp.c",
+ "mpf/cmp_d.c",
+ "mpf/cmp_si.c",
+ "mpf/cmp_ui.c",
+ "mpf/cmp_z.c",
+ "mpf/div.c",
+ "mpf/div_2exp.c",
+ "mpf/div_ui.c",
+ "mpf/dump.c",
+ "mpf/eq.c",
+ "mpf/fits_sint.c",
+ "mpf/fits_slong.c",
+ "mpf/fits_sshort.c",
+ "mpf/fits_uint.c",
+ "mpf/fits_ulong.c",
+ "mpf/fits_ushort.c",
+ "mpf/get_d.c",
+ "mpf/get_d_2exp.c",
+ "mpf/get_dfl_prec.c",
+ "mpf/get_prc.c",
+ "mpf/get_si.c",
+ "mpf/get_str.c",
+ "mpf/get_ui.c",
+ "mpf/init.c",
+ "mpf/init2.c",
+ "mpf/inits.c",
+ "mpf/inp_str.c",
+ "mpf/int_p.c",
+ "mpf/iset.c",
+ "mpf/iset_d.c",
+ "mpf/iset_si.c",
+ "mpf/iset_str.c",
+ "mpf/iset_ui.c",
+ "mpf/mul.c",
+ "mpf/mul_2exp.c",
+ "mpf/mul_ui.c",
+ "mpf/neg.c",
+ "mpf/out_str.c",
+ "mpf/pow_ui.c",
+ "mpf/random2.c",
+ "mpf/reldiff.c",
+ "mpf/set.c",
+ "mpf/set_d.c",
+ "mpf/set_dfl_prec.c",
+ "mpf/set_prc.c",
+ "mpf/set_prc_raw.c",
+ "mpf/set_q.c",
+ "mpf/set_si.c",
+ "mpf/set_str.c",
+ "mpf/set_ui.c",
+ "mpf/set_z.c",
+ "mpf/size.c",
+ "mpf/sqrt.c",
+ "mpf/sqrt_ui.c",
+ "mpf/sub.c",
+ "mpf/sub_ui.c",
+ "mpf/swap.c",
+ "mpf/trunc.c",
+ "mpf/ui_div.c",
+ "mpf/ui_sub.c",
+ "mpf/urandomb.c",
+
+ "mpn/generic/add.c",
+ "mpn/generic/add_1.c",
+ "mpn/generic/add_err1_n.c",
+ "mpn/generic/add_err2_n.c",
+ "mpn/generic/add_err3_n.c",
+ "mpn/generic/add_n_sub_n.c",
+ "mpn/generic/bdiv_q.c",
+ "mpn/generic/bdiv_qr.c",
+ "mpn/generic/binvert.c",
+ "mpn/generic/broot.c",
+ "mpn/generic/brootinv.c",
+ "mpn/generic/bsqrt.c",
+ "mpn/generic/bsqrtinv.c",
+ "mpn/generic/cmp.c",
+ "mpn/generic/cnd_swap.c",
+ "mpn/generic/comb_tables.c",
+ "mpn/generic/compute_powtab.c",
+ "mpn/generic/dcpi1_bdiv_q.c",
+ "mpn/generic/dcpi1_bdiv_qr.c",
+ "mpn/generic/dcpi1_div_q.c",
+ "mpn/generic/dcpi1_div_qr.c",
+ "mpn/generic/dcpi1_divappr_q.c",
+ "mpn/generic/div_q.c",
+ "mpn/generic/div_qr_1.c",
+ "mpn/generic/div_qr_1n_pi1.c",
+ "mpn/generic/div_qr_2.c",
+ "mpn/generic/div_qr_2n_pi1.c",
+ "mpn/generic/div_qr_2u_pi1.c",
+ "mpn/generic/dive_1.c",
+ "mpn/generic/diveby3.c",
+ "mpn/generic/divexact.c",
+ "mpn/generic/divis.c",
+ "mpn/generic/divrem.c",
+ "mpn/generic/divrem_1.c",
+ "mpn/generic/divrem_2.c",
+ "mpn/generic/dump.c",
+ "mpn/generic/fib2_ui.c",
+ "mpn/generic/fib2m.c",
+ "mpn/generic/gcd.c",
+ "mpn/generic/gcd_1.c",
+ "mpn/generic/gcd_subdiv_step.c",
+ "mpn/generic/gcdext.c",
+ "mpn/generic/gcdext_1.c",
+ "mpn/generic/gcdext_lehmer.c",
+ "mpn/generic/get_d.c",
+ "mpn/generic/get_str.c",
+ "mpn/generic/hgcd.c",
+ "mpn/generic/hgcd2.c",
+ "mpn/generic/hgcd2_jacobi.c",
+ "mpn/generic/hgcd_appr.c",
+ "mpn/generic/hgcd_jacobi.c",
+ "mpn/generic/hgcd_matrix.c",
+ "mpn/generic/hgcd_reduce.c",
+ "mpn/generic/hgcd_step.c",
+ "mpn/generic/invert.c",
+ "mpn/generic/invertappr.c",
+ "mpn/generic/jacbase.c",
+ "mpn/generic/jacobi.c",
+ "mpn/generic/jacobi_2.c",
+ "mpn/generic/matrix22_mul.c",
+ "mpn/generic/matrix22_mul1_inverse_vector.c",
+ "mpn/generic/mod_1.c",
+ "mpn/generic/mod_1_1.c",
+ "mpn/generic/mod_1_2.c",
+ "mpn/generic/mod_1_3.c",
+ "mpn/generic/mod_1_4.c",
+ "mpn/generic/mode1o.c",
+ "mpn/generic/mu_bdiv_q.c",
+ "mpn/generic/mu_bdiv_qr.c",
+ "mpn/generic/mu_div_q.c",
+ "mpn/generic/mu_div_qr.c",
+ "mpn/generic/mu_divappr_q.c",
+ "mpn/generic/mul.c",
+ "mpn/generic/mul_basecase.c",
+ "mpn/generic/mul_fft.c",
+ "mpn/generic/mul_n.c",
+ "mpn/generic/mullo_basecase.c",
+ "mpn/generic/mullo_n.c",
+ "mpn/generic/mulmid.c",
+ "mpn/generic/mulmid_basecase.c",
+ "mpn/generic/mulmid_n.c",
+ "mpn/generic/mulmod_bnm1.c",
+ "mpn/generic/mulmod_bknp1.c",
+ "mpn/generic/neg.c",
+ "mpn/generic/nussbaumer_mul.c",
+ "mpn/generic/perfpow.c",
+ "mpn/generic/perfsqr.c",
+ "mpn/generic/pow_1.c",
+ "mpn/generic/powlo.c",
+ "mpn/generic/powm.c",
+ "mpn/generic/pre_divrem_1.c",
+ "mpn/generic/pre_mod_1.c",
+ "mpn/generic/random.c",
+ "mpn/generic/random2.c",
+ "mpn/generic/redc_1.c",
+ "mpn/generic/redc_2.c",
+ "mpn/generic/redc_n.c",
+ "mpn/generic/remove.c",
+ "mpn/generic/rootrem.c",
+ "mpn/generic/sbpi1_bdiv_q.c",
+ "mpn/generic/sbpi1_bdiv_qr.c",
+ "mpn/generic/sbpi1_bdiv_r.c",
+ "mpn/generic/sbpi1_div_q.c",
+ "mpn/generic/sbpi1_div_qr.c",
+ "mpn/generic/sbpi1_divappr_q.c",
+ "mpn/generic/scan0.c",
+ "mpn/generic/scan1.c",
+ // "mpn/generic/sec_aors_1.c",
+ // "mpn/generic/sec_div.c",
+ "mpn/generic/sec_invert.c",
+ "mpn/generic/sec_mul.c",
+ // "mpn/generic/sec_pi1_div.c",
+ "mpn/generic/sec_powm.c",
+ "mpn/generic/sec_sqr.c",
+ "mpn/generic/set_str.c",
+ "mpn/generic/sizeinbase.c",
+ "mpn/generic/sqr.c",
+ "mpn/generic/sqr_basecase.c",
+ "mpn/generic/sqrlo.c",
+ "mpn/generic/sqrlo_basecase.c",
+ "mpn/generic/sqrmod_bnm1.c",
+ "mpn/generic/sqrtrem.c",
+ "mpn/generic/strongfibo.c",
+ "mpn/generic/sub.c",
+ "mpn/generic/sub_1.c",
+ "mpn/generic/sub_err1_n.c",
+ "mpn/generic/sub_err2_n.c",
+ "mpn/generic/sub_err3_n.c",
+ "mpn/generic/tdiv_qr.c",
+ "mpn/generic/toom22_mul.c",
+ "mpn/generic/toom2_sqr.c",
+ "mpn/generic/toom32_mul.c",
+ "mpn/generic/toom33_mul.c",
+ "mpn/generic/toom3_sqr.c",
+ "mpn/generic/toom42_mul.c",
+ "mpn/generic/toom42_mulmid.c",
+ "mpn/generic/toom43_mul.c",
+ "mpn/generic/toom44_mul.c",
+ "mpn/generic/toom4_sqr.c",
+ "mpn/generic/toom52_mul.c",
+ "mpn/generic/toom53_mul.c",
+ "mpn/generic/toom54_mul.c",
+ "mpn/generic/toom62_mul.c",
+ "mpn/generic/toom63_mul.c",
+ "mpn/generic/toom6_sqr.c",
+ "mpn/generic/toom6h_mul.c",
+ "mpn/generic/toom8_sqr.c",
+ "mpn/generic/toom8h_mul.c",
+ "mpn/generic/toom_couple_handling.c",
+ "mpn/generic/toom_eval_dgr3_pm1.c",
+ "mpn/generic/toom_eval_dgr3_pm2.c",
+ "mpn/generic/toom_eval_pm1.c",
+ "mpn/generic/toom_eval_pm2.c",
+ "mpn/generic/toom_eval_pm2exp.c",
+ "mpn/generic/toom_eval_pm2rexp.c",
+ "mpn/generic/toom_interpolate_12pts.c",
+ "mpn/generic/toom_interpolate_16pts.c",
+ "mpn/generic/toom_interpolate_5pts.c",
+ "mpn/generic/toom_interpolate_6pts.c",
+ "mpn/generic/toom_interpolate_7pts.c",
+ "mpn/generic/toom_interpolate_8pts.c",
+ "mpn/generic/trialdiv.c",
+ "mpn/generic/zero.c",
+ "mpn/generic/zero_p.c",
+
+ "mpq/abs.c",
+ "mpq/aors.c",
+ "mpq/canonicalize.c",
+ "mpq/clear.c",
+ "mpq/clears.c",
+ "mpq/cmp.c",
+ "mpq/cmp_si.c",
+ "mpq/cmp_ui.c",
+ "mpq/div.c",
+ "mpq/equal.c",
+ "mpq/get_d.c",
+ "mpq/get_den.c",
+ "mpq/get_num.c",
+ "mpq/get_str.c",
+ "mpq/init.c",
+ "mpq/inits.c",
+ "mpq/inp_str.c",
+ "mpq/inv.c",
+ "mpq/md_2exp.c",
+ "mpq/mul.c",
+ "mpq/neg.c",
+ "mpq/out_str.c",
+ "mpq/set.c",
+ "mpq/set_d.c",
+ "mpq/set_den.c",
+ "mpq/set_f.c",
+ "mpq/set_num.c",
+ "mpq/set_si.c",
+ "mpq/set_str.c",
+ "mpq/set_ui.c",
+ "mpq/set_z.c",
+ "mpq/swap.c",
+
+ "mpz/2fac_ui.c",
+ "mpz/abs.c",
+ "mpz/add.c",
+ "mpz/add_ui.c",
+ "mpz/and.c",
+ "mpz/aorsmul.c",
+ "mpz/aorsmul_i.c",
+ "mpz/array_init.c",
+ "mpz/bin_ui.c",
+ "mpz/bin_uiui.c",
+ "mpz/cdiv_q.c",
+ "mpz/cdiv_q_ui.c",
+ "mpz/cdiv_qr.c",
+ "mpz/cdiv_qr_ui.c",
+ "mpz/cdiv_r.c",
+ "mpz/cdiv_r_ui.c",
+ "mpz/cdiv_ui.c",
+ "mpz/cfdiv_q_2exp.c",
+ "mpz/cfdiv_r_2exp.c",
+ "mpz/clear.c",
+ "mpz/clears.c",
+ "mpz/clrbit.c",
+ "mpz/cmp.c",
+ "mpz/cmp_d.c",
+ "mpz/cmp_si.c",
+ "mpz/cmp_ui.c",
+ "mpz/cmpabs.c",
+ "mpz/cmpabs_d.c",
+ "mpz/cmpabs_ui.c",
+ "mpz/com.c",
+ "mpz/combit.c",
+ "mpz/cong.c",
+ "mpz/cong_2exp.c",
+ "mpz/cong_ui.c",
+ "mpz/dive_ui.c",
+ "mpz/divegcd.c",
+ "mpz/divexact.c",
+ "mpz/divis.c",
+ "mpz/divis_2exp.c",
+ "mpz/divis_ui.c",
+ "mpz/dump.c",
+ "mpz/export.c",
+ "mpz/fac_ui.c",
+ "mpz/fdiv_q.c",
+ "mpz/fdiv_q_ui.c",
+ "mpz/fdiv_qr.c",
+ "mpz/fdiv_qr_ui.c",
+ "mpz/fdiv_r.c",
+ "mpz/fdiv_r_ui.c",
+ "mpz/fdiv_ui.c",
+ "mpz/fib2_ui.c",
+ "mpz/fib_ui.c",
+ "mpz/fits_sint.c",
+ "mpz/fits_slong.c",
+ "mpz/fits_sshort.c",
+ "mpz/fits_uint.c",
+ "mpz/fits_ulong.c",
+ "mpz/fits_ushort.c",
+ "mpz/gcd.c",
+ "mpz/gcd_ui.c",
+ "mpz/gcdext.c",
+ "mpz/get_d.c",
+ "mpz/get_d_2exp.c",
+ "mpz/get_si.c",
+ "mpz/get_str.c",
+ "mpz/get_ui.c",
+ "mpz/getlimbn.c",
+ "mpz/hamdist.c",
+ "mpz/import.c",
+ "mpz/init.c",
+ "mpz/init2.c",
+ "mpz/inits.c",
+ "mpz/inp_raw.c",
+ "mpz/inp_str.c",
+ "mpz/invert.c",
+ "mpz/ior.c",
+ "mpz/iset.c",
+ "mpz/iset_d.c",
+ "mpz/iset_si.c",
+ "mpz/iset_str.c",
+ "mpz/iset_ui.c",
+ "mpz/jacobi.c",
+ "mpz/kronsz.c",
+ "mpz/kronuz.c",
+ "mpz/kronzs.c",
+ "mpz/kronzu.c",
+ "mpz/lcm.c",
+ "mpz/lcm_ui.c",
+ "mpz/limbs_finish.c",
+ "mpz/limbs_modify.c",
+ "mpz/limbs_read.c",
+ "mpz/limbs_write.c",
+ "mpz/lucmod.c",
+ "mpz/lucnum2_ui.c",
+ "mpz/lucnum_ui.c",
+ "mpz/mfac_uiui.c",
+ "mpz/millerrabin.c",
+ "mpz/mod.c",
+ "mpz/mul.c",
+ "mpz/mul_2exp.c",
+ "mpz/mul_si.c",
+ "mpz/mul_ui.c",
+ "mpz/n_pow_ui.c",
+ "mpz/neg.c",
+ "mpz/nextprime.c",
+ "mpz/oddfac_1.c",
+ "mpz/out_raw.c",
+ "mpz/out_str.c",
+ "mpz/perfpow.c",
+ "mpz/perfsqr.c",
+ "mpz/popcount.c",
+ "mpz/pow_ui.c",
+ "mpz/powm.c",
+ "mpz/powm_sec.c",
+ "mpz/powm_ui.c",
+ "mpz/pprime_p.c",
+ "mpz/primorial_ui.c",
+ "mpz/prodlimbs.c",
+ "mpz/random.c",
+ "mpz/random2.c",
+ "mpz/realloc.c",
+ "mpz/realloc2.c",
+ "mpz/remove.c",
+ "mpz/roinit_n.c",
+ "mpz/root.c",
+ "mpz/rootrem.c",
+ "mpz/rrandomb.c",
+ "mpz/scan0.c",
+ "mpz/scan1.c",
+ "mpz/set.c",
+ "mpz/set_d.c",
+ "mpz/set_f.c",
+ "mpz/set_q.c",
+ "mpz/set_si.c",
+ "mpz/set_str.c",
+ "mpz/set_ui.c",
+ "mpz/setbit.c",
+ "mpz/size.c",
+ "mpz/sizeinbase.c",
+ "mpz/sqrt.c",
+ "mpz/sqrtrem.c",
+ "mpz/stronglucas.c",
+ "mpz/sub.c",
+ "mpz/sub_ui.c",
+ "mpz/swap.c",
+ "mpz/tdiv_q.c",
+ "mpz/tdiv_q_2exp.c",
+ "mpz/tdiv_q_ui.c",
+ "mpz/tdiv_qr.c",
+ "mpz/tdiv_qr_ui.c",
+ "mpz/tdiv_r.c",
+ "mpz/tdiv_r_2exp.c",
+ "mpz/tdiv_r_ui.c",
+ "mpz/tdiv_ui.c",
+ "mpz/tstbit.c",
+ "mpz/ui_pow_ui.c",
+ "mpz/ui_sub.c",
+ "mpz/urandomb.c",
+ "mpz/urandomm.c",
+ "mpz/xor.c",
+
+ "printf/asprintf.c",
+ "printf/asprntffuns.c",
+ "printf/doprnt.c",
+ "printf/doprntf.c",
+ "printf/doprnti.c",
+ "printf/fprintf.c",
+ "printf/obprintf.c",
+ "printf/obprntffuns.c",
+ "printf/obvprintf.c",
+ "printf/printf.c",
+ "printf/printffuns.c",
+ "printf/repl-vsnprintf.c",
+ "printf/snprintf.c",
+ "printf/snprntffuns.c",
+ "printf/sprintf.c",
+ "printf/sprintffuns.c",
+ "printf/vasprintf.c",
+ "printf/vfprintf.c",
+ "printf/vprintf.c",
+ "printf/vsnprintf.c",
+ "printf/vsprintf.c",
+
+ "rand/rand.c",
+ "rand/randbui.c",
+ "rand/randclr.c",
+ "rand/randdef.c",
+ "rand/randiset.c",
+ "rand/randlc2s.c",
+ "rand/randlc2x.c",
+ "rand/randmt.c",
+ "rand/randmts.c",
+ "rand/randmui.c",
+ "rand/rands.c",
+ "rand/randsd.c",
+ "rand/randsdui.c",
+
+ "scanf/doscan.c",
+ "scanf/fscanf.c",
+ "scanf/fscanffuns.c",
+ "scanf/scanf.c",
+ "scanf/sscanf.c",
+ "scanf/sscanffuns.c",
+ "scanf/vfscanf.c",
+ "scanf/vscanf.c",
+ "scanf/vsscanf.c",
+};