add --bundle-compiler-rt function to link options

and use it when building libuserland.a

The self-hosted part of stage1 relies on zig's compiler-rt, and so we
include it in libuserland.a.

This should potentially be the default, but for now it's behind a linker
option.

self-hosted translate-c: small progress on translating functions.
This commit is contained in:
Andrew Kelley
2019-05-08 20:49:07 -04:00
parent 3bd5c16f39
commit 9bbd71c9ab
8 changed files with 246 additions and 212 deletions

View File

@@ -86,6 +86,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) {
" --override-std-dir [arg] use an alternate Zig standard library\n"
"\n"
"Link Options:\n"
" --bundle-compiler-rt [path] for static libraries, include compiler-rt symbols\n"
" --dynamic-linker [path] set the path to ld.so\n"
" --each-lib-rpath add rpath for each used dynamic library\n"
" --library [lib] link against lib\n"
@@ -442,6 +443,7 @@ int main(int argc, char **argv) {
TargetSubsystem subsystem = TargetSubsystemAuto;
bool want_single_threaded = false;
bool disable_gen_h = false;
bool bundle_compiler_rt = false;
Buf *override_std_dir = nullptr;
Buf *override_lib_dir = nullptr;
Buf *main_pkg_path = nullptr;
@@ -652,6 +654,8 @@ int main(int argc, char **argv) {
want_single_threaded = true;
} else if (strcmp(arg, "--disable-gen-h") == 0) {
disable_gen_h = true;
} else if (strcmp(arg, "--bundle-compiler-rt") == 0) {
bundle_compiler_rt = true;
} else if (strcmp(arg, "--test-cmd-bin") == 0) {
test_exec_args.append(nullptr);
} else if (arg[1] == 'L' && arg[2] != 0) {
@@ -1070,6 +1074,7 @@ int main(int argc, char **argv) {
g->verbose_cc = verbose_cc;
g->output_dir = output_dir;
g->disable_gen_h = disable_gen_h;
g->bundle_compiler_rt = bundle_compiler_rt;
codegen_set_errmsg_color(g, color);
g->system_linker_hack = system_linker_hack;