Skip to content

Commit f8b5881

Browse files
gmilosaciidgh
authored andcommitted
Use swiftc driver in -emit-library mode, to better handle flags.
1 parent 3516833 commit f8b5881

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

Utilities/bootstrap

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ def process_runtime_libraries(build, args, lib_path):
661661
# We include an RPATH entry so that the Swift libraries can be found
662662
# relative to where it will be installed (in 'lib/swift/pm/...').
663663
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,
665665
"-Xlinker", "--whole-archive",
666666
"-Xlinker", input_lib_path,
667667
"-Xlinker", "--no-whole-archive", "-lswiftGlibc",
@@ -680,14 +680,7 @@ def process_runtime_libraries(build, args, lib_path):
680680
# Unqoute any quoted characters.
681681
link_cmd = [arg.replace("\\", "") for arg in link_cmd]
682682

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
691684
cmd = [arg for arg in link_cmd
692685
if arg.endswith(("swift_begin.o", "swift_end.o")) or
693686
(not arg.endswith((".o", ".autolink")))]

0 commit comments

Comments
 (0)