@@ -661,7 +661,7 @@ def process_runtime_libraries(build, args, lib_path):
661
661
# We include an RPATH entry so that the Swift libraries can be found
662
662
# relative to where it will be installed (in 'lib/swift/pm/...').
663
663
runtime_lib_path = os .path .join (lib_path , "libPackageDescription.so" )
664
- cmd = [args .swiftc_path , "-Xlinker" , "-shared " , "-o" , runtime_lib_path ,
664
+ cmd = [args .swiftc_path , "-emit-library " , "-o" , runtime_lib_path ,
665
665
"-Xlinker" , "--whole-archive" ,
666
666
"-Xlinker" , input_lib_path ,
667
667
"-Xlinker" , "--no-whole-archive" , "-lswiftGlibc" ,
@@ -680,14 +680,7 @@ def process_runtime_libraries(build, args, lib_path):
680
680
# Unqoute any quoted characters.
681
681
link_cmd = [arg .replace ("\\ " , "" ) for arg in link_cmd ]
682
682
683
- # Drop any .o files, and the -Xlinker which precedes '-shared'.
684
- try :
685
- idx = link_cmd .index ("-shared" )
686
- except :
687
- idx = - 1
688
- if idx == - 1 or link_cmd [idx - 1 ] != "-Xlinker" :
689
- raise SystemExit ("unable to understand 'swiftc' driver commands" )
690
- del link_cmd [idx - 1 ]
683
+ # Drop any .o files
691
684
cmd = [arg for arg in link_cmd
692
685
if arg .endswith (("swift_begin.o" , "swift_end.o" )) or
693
686
(not arg .endswith ((".o" , ".autolink" )))]
0 commit comments