File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 4
4
// REQUIRES: lld_lto
5
5
6
6
// RUN: %empty-directory(%t)
7
- // RUN: %target-swiftc_driver -emit-library -static -lto=llvm-full -emit-module %S/Inputs/lto/module1.swift -working-directory %t
8
- // RUN: %target-swiftc_driver -lto=llvm-full %s -I%t -L%t -lmodule1 -module-name main -o %t/main
7
+ // RUN: %target-swiftc_driver -emit-library -static -lto=llvm-full %lto_flags -emit-module %S/Inputs/lto/module1.swift -working-directory %t
8
+ // RUN: %target-swiftc_driver -lto=llvm-full %lto_flags % s -I%t -L%t -lmodule1 -module-name main -o %t/main
9
9
// RUN: %llvm-nm --defined-only %t/main | %FileCheck %s
10
10
11
11
// CHECK-NOT: _$s7module120unusedPublicFunctionyyF
Original file line number Diff line number Diff line change @@ -219,12 +219,22 @@ lit_config.note('Using cmake: ' + config.cmake)
219
219
config .llvm_src_root = getattr (config , 'llvm_src_root' , None )
220
220
config .llvm_obj_root = getattr (config , 'llvm_obj_root' , None )
221
221
222
+ lto_flags = ""
223
+
222
224
if platform .system () == 'OpenBSD' :
223
225
llvm_libs_dir = getattr (config , 'llvm_libs_dir' , None )
224
226
if not llvm_libs_dir :
225
227
lit_config .fatal ('No LLVM libs dir set.' )
226
228
config .environment ['LD_LIBRARY_PATH' ] = llvm_libs_dir
227
229
230
+ elif platform .system () == 'Darwin' :
231
+ llvm_libs_dir = getattr (config , 'llvm_libs_dir' , None )
232
+ if not llvm_libs_dir :
233
+ lit_config .fatal ('No LLVM libs dir set.' )
234
+ lto_flags = "-Xlinker -lto_library -Xlinker %s/libLTO.dylib" % llvm_libs_dir
235
+
236
+ config .substitutions .append ( ('%lto_flags' , lto_flags ) )
237
+
228
238
def append_to_env_path (directory ):
229
239
config .environment ['PATH' ] = \
230
240
os .path .pathsep .join ((directory , config .environment ['PATH' ]))
You can’t perform that action at this time.
0 commit comments