From c9b63b15b976aae19ec6733d40f3a8b72a6cac47 Mon Sep 17 00:00:00 2001 From: Shinyzenith Date: Thu, 27 Apr 2023 01:08:07 +0530 Subject: [PATCH] ziglibcbuild: Bundle compiler_rt with shared objects Signed-off-by: Shinyzenith --- ziglibcbuild.zig | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ziglibcbuild.zig b/ziglibcbuild.zig index 3661f27..085c44e 100644 --- a/ziglibcbuild.zig +++ b/ziglibcbuild.zig @@ -57,13 +57,16 @@ pub fn addLibc(builder: *std.build.Builder, opt: ZigLibcOptions) *std.build.LibE .only_gnu => "c-only-gnu", //.full => "c", .full => "cguana", // use cguana to avoid passing in '-lc' to zig which will - // cause it to add the system libc headers + // cause it to add the system libc headers }; const trace_options = builder.addOptions(); trace_options.addOption(bool, "enabled", opt.trace); const modules_options = builder.addOptions(); - modules_options.addOption(bool, "glibcstart", switch (opt.start) { .glibc => true, else => false }); + modules_options.addOption(bool, "glibcstart", switch (opt.start) { + .glibc => true, + else => false, + }); const index = relpath("src" ++ std.fs.path.sep_str ++ "lib.zig"); const lib = switch (opt.link) { .static => builder.addStaticLibrary(.{ @@ -83,12 +86,14 @@ pub fn addLibc(builder: *std.build.Builder, opt: ZigLibcOptions) *std.build.LibE }, }), }; + + lib.bundle_compiler_rt = true; // TODO: not sure if this is reallly needed or not, but it shouldn't hurt // anything except performance to enable it lib.force_pic = true; lib.addOptions("modules", modules_options); lib.addOptions("trace_options", trace_options); - const c_flags = [_][]const u8 { + const c_flags = [_][]const u8{ "-std=c11", }; const include_cstd = switch (opt.variant) {