Commit cf46cd5f2b
Changed files (3)
src/link.cpp
@@ -31,11 +31,7 @@ static const char *get_libc_static_file(CodeGen *g, const char *file) {
return buf_ptr(out_buf);
}
-static Buf *build_o(CodeGen *parent_gen, const char *oname) {
- Buf *source_basename = buf_sprintf("%s.zig", oname);
- Buf *full_path = buf_alloc();
- os_path_join(parent_gen->zig_std_special_dir, source_basename, full_path);
-
+static Buf *build_o_raw(CodeGen *parent_gen, const char *oname, Buf *full_path) {
ZigTarget *child_target = parent_gen->is_native_target ? nullptr : &parent_gen->zig_target;
CodeGen *child_gen = codegen_create(full_path, child_target, OutTypeObj, parent_gen->build_mode);
@@ -65,6 +61,23 @@ static Buf *build_o(CodeGen *parent_gen, const char *oname) {
return output_path;
}
+static Buf *build_o(CodeGen *parent_gen, const char *oname) {
+ Buf *source_basename = buf_sprintf("%s.zig", oname);
+ Buf *full_path = buf_alloc();
+ os_path_join(parent_gen->zig_std_special_dir, source_basename, full_path);
+
+ return build_o_raw(parent_gen, oname, full_path);
+}
+
+static Buf *build_compiler_rt(CodeGen *parent_gen) {
+ Buf *dir_path = buf_alloc();
+ os_path_join(parent_gen->zig_std_special_dir, buf_create_from_str("compiler_rt"), dir_path);
+ Buf *full_path = buf_alloc();
+ os_path_join(dir_path, buf_create_from_str("index.zig"), full_path);
+
+ return build_o_raw(parent_gen, "compiler_rt", full_path);
+}
+
static const char *get_exe_file_extension(CodeGen *g) {
if (g->zig_target.os == ZigLLVM_Win32) {
return ".exe";
@@ -263,7 +276,7 @@ static void construct_linker_job_elf(LinkJob *lj) {
Buf *builtin_o_path = build_o(g, "builtin");
lj->args.append(buf_ptr(builtin_o_path));
- Buf *compiler_rt_o_path = build_o(g, "compiler_rt");
+ Buf *compiler_rt_o_path = build_compiler_rt(g);
lj->args.append(buf_ptr(compiler_rt_o_path));
}
@@ -401,7 +414,7 @@ static void construct_linker_job_coff(LinkJob *lj) {
Buf *builtin_o_path = build_o(g, "builtin");
lj->args.append(buf_ptr(builtin_o_path));
- Buf *compiler_rt_o_path = build_o(g, "compiler_rt");
+ Buf *compiler_rt_o_path = build_compiler_rt(g);
lj->args.append(buf_ptr(compiler_rt_o_path));
}
std/special/compiler_rt.zig → std/special/compiler_rt/index.zig
File renamed without changes
CMakeLists.txt
@@ -311,7 +311,7 @@ install(FILES "${CMAKE_SOURCE_DIR}/std/special/bootstrap.zig" DESTINATION "${ZIG
install(FILES "${CMAKE_SOURCE_DIR}/std/special/build_file_template.zig" DESTINATION "${ZIG_STD_DEST}/special")
install(FILES "${CMAKE_SOURCE_DIR}/std/special/build_runner.zig" DESTINATION "${ZIG_STD_DEST}/special")
install(FILES "${CMAKE_SOURCE_DIR}/std/special/builtin.zig" DESTINATION "${ZIG_STD_DEST}/special")
-install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt.zig" DESTINATION "${ZIG_STD_DEST}/special")
+install(FILES "${CMAKE_SOURCE_DIR}/std/special/compiler_rt/index.zig" DESTINATION "${ZIG_STD_DEST}/special/compiler_rt")
install(FILES "${CMAKE_SOURCE_DIR}/std/special/test_runner.zig" DESTINATION "${ZIG_STD_DEST}/special")
install(FILES "${CMAKE_SOURCE_DIR}/std/special/zigrt.zig" DESTINATION "${ZIG_STD_DEST}/special")