File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -2042,10 +2042,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
2042
2042
for (mingw .always_link_libs ) | name | {
2043
2043
try comp .bin_file .options .system_libs .put (comp .gpa , name , .{});
2044
2044
}
2045
-
2046
- // LLD might drop some symbols as unused during LTO and GCing, therefore,
2047
- // we force mark them for resolution here.
2048
- try comp .bin_file .options .force_undefined_symbols .put (comp .gpa , "_tls_index" , {});
2049
2045
}
2050
2046
// Generate Windows import libs.
2051
2047
if (target .os .tag == .windows ) {
@@ -2067,6 +2063,18 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
2067
2063
try comp .work_queue .writeItem (.libtsan );
2068
2064
}
2069
2065
2066
+ if (comp .getTarget ().isMinGW () and ! comp .bin_file .options .single_threaded ) {
2067
+ // LLD might drop some symbols as unused during LTO and GCing, therefore,
2068
+ // we force mark them for resolution here.
2069
+
2070
+ var tls_index_sym = switch (comp .getTarget ().cpu .arch ) {
2071
+ .x86 = > "__tls_index" ,
2072
+ else = > "_tls_index" ,
2073
+ };
2074
+
2075
+ try comp .bin_file .options .force_undefined_symbols .put (comp .gpa , tls_index_sym , {});
2076
+ }
2077
+
2070
2078
if (comp .bin_file .options .include_compiler_rt and capable_of_building_compiler_rt ) {
2071
2079
if (is_exe_or_dyn_lib ) {
2072
2080
log .debug ("queuing a job to build compiler_rt_lib" , .{});
You can’t perform that action at this time.
0 commit comments