Skip to content

ziglibcbuild: Bundle compiler_rt with shared objects #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ziglibcbuild.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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(.{
Expand All @@ -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) {
Expand Down