Commit 8a22c50c08

daurnimator <quae@daurnimator.com>
2020-03-12 14:55:52
Remove unused static_crt_dir field from libc config
1 parent 214af69
Changed files (4)
src/stage2.cpp
@@ -272,8 +272,6 @@ enum Error stage2_libc_parse(struct Stage2LibCInstallation *libc, const char *li
     libc->sys_include_dir_len = strlen(libc->sys_include_dir);
     libc->crt_dir = "";
     libc->crt_dir_len = strlen(libc->crt_dir);
-    libc->static_crt_dir = "";
-    libc->static_crt_dir_len = strlen(libc->static_crt_dir);
     libc->msvc_lib_dir = "";
     libc->msvc_lib_dir_len = strlen(libc->msvc_lib_dir);
     libc->kernel32_lib_dir = "";
src/stage2.h
@@ -209,8 +209,6 @@ struct Stage2LibCInstallation {
     size_t sys_include_dir_len;
     const char *crt_dir;
     size_t crt_dir_len;
-    const char *static_crt_dir;
-    size_t static_crt_dir_len;
     const char *msvc_lib_dir;
     size_t msvc_lib_dir_len;
     const char *kernel32_lib_dir;
src-self-hosted/libc_installation.zig
@@ -17,7 +17,6 @@ pub const LibCInstallation = struct {
     include_dir: ?[:0]const u8 = null,
     sys_include_dir: ?[:0]const u8 = null,
     crt_dir: ?[:0]const u8 = null,
-    static_crt_dir: ?[:0]const u8 = null,
     msvc_lib_dir: ?[:0]const u8 = null,
     kernel32_lib_dir: ?[:0]const u8 = null,
 
@@ -98,13 +97,6 @@ pub const LibCInstallation = struct {
             try stderr.print("crt_dir may not be empty for {}\n", .{@tagName(Target.current.os.tag)});
             return error.ParseError;
         }
-        if (self.static_crt_dir == null and is_windows and is_gnu) {
-            try stderr.print("static_crt_dir may not be empty for {}-{}\n", .{
-                @tagName(Target.current.os.tag),
-                @tagName(Target.current.abi),
-            });
-            return error.ParseError;
-        }
         if (self.msvc_lib_dir == null and is_windows and !is_gnu) {
             try stderr.print("msvc_lib_dir may not be empty for {}-{}\n", .{
                 @tagName(Target.current.os.tag),
@@ -128,7 +120,6 @@ pub const LibCInstallation = struct {
         const include_dir = self.include_dir orelse "";
         const sys_include_dir = self.sys_include_dir orelse "";
         const crt_dir = self.crt_dir orelse "";
-        const static_crt_dir = self.static_crt_dir orelse "";
         const msvc_lib_dir = self.msvc_lib_dir orelse "";
         const kernel32_lib_dir = self.kernel32_lib_dir orelse "";
 
@@ -147,11 +138,6 @@ pub const LibCInstallation = struct {
             \\# Not needed when targeting MacOS.
             \\crt_dir={}
             \\
-            \\# The directory that contains `crtbegin.o`.
-            \\# On POSIX, can be found with `cc -print-file-name=crtbegin.o`.
-            \\# Only needed when targeting MinGW-w64 on Windows.
-            \\static_crt_dir={}
-            \\
             \\# The directory that contains `vcruntime.lib`.
             \\# Only needed when targeting MSVC on Windows.
             \\msvc_lib_dir={}
@@ -164,7 +150,6 @@ pub const LibCInstallation = struct {
             include_dir,
             sys_include_dir,
             crt_dir,
-            static_crt_dir,
             msvc_lib_dir,
             kernel32_lib_dir,
         });
@@ -186,7 +171,6 @@ pub const LibCInstallation = struct {
                 var batch = Batch(FindError!void, 3, .auto_async).init();
                 batch.add(&async self.findNativeIncludeDirPosix(args));
                 batch.add(&async self.findNativeCrtDirPosix(args));
-                batch.add(&async self.findNativeStaticCrtDirPosix(args));
                 try batch.wait();
             } else {
                 var sdk: *ZigWindowsSDK = undefined;
@@ -428,15 +412,6 @@ pub const LibCInstallation = struct {
         });
     }
 
-    fn findNativeStaticCrtDirPosix(self: *LibCInstallation, args: FindNativeOptions) FindError!void {
-        self.static_crt_dir = try ccPrintFileName(.{
-            .allocator = args.allocator,
-            .search_basename = "crtbegin.o",
-            .want_dirname = .only_dir,
-            .verbose = args.verbose,
-        });
-    }
-
     fn findNativeKernel32LibDir(
         self: *LibCInstallation,
         args: FindNativeOptions,
src-self-hosted/stage2.zig
@@ -744,8 +744,6 @@ const Stage2LibCInstallation = extern struct {
     sys_include_dir_len: usize,
     crt_dir: [*:0]const u8,
     crt_dir_len: usize,
-    static_crt_dir: [*:0]const u8,
-    static_crt_dir_len: usize,
     msvc_lib_dir: [*:0]const u8,
     msvc_lib_dir_len: usize,
     kernel32_lib_dir: [*:0]const u8,
@@ -773,13 +771,6 @@ const Stage2LibCInstallation = extern struct {
             self.crt_dir = "";
             self.crt_dir_len = 0;
         }
-        if (libc.static_crt_dir) |s| {
-            self.static_crt_dir = s.ptr;
-            self.static_crt_dir_len = s.len;
-        } else {
-            self.static_crt_dir = "";
-            self.static_crt_dir_len = 0;
-        }
         if (libc.msvc_lib_dir) |s| {
             self.msvc_lib_dir = s.ptr;
             self.msvc_lib_dir_len = s.len;
@@ -807,9 +798,6 @@ const Stage2LibCInstallation = extern struct {
         if (self.crt_dir_len != 0) {
             libc.crt_dir = self.crt_dir[0..self.crt_dir_len :0];
         }
-        if (self.static_crt_dir_len != 0) {
-            libc.static_crt_dir = self.static_crt_dir[0..self.static_crt_dir_len :0];
-        }
         if (self.msvc_lib_dir_len != 0) {
             libc.msvc_lib_dir = self.msvc_lib_dir[0..self.msvc_lib_dir_len :0];
         }