[SR-3863] swift emits a temporary swiftmodule when swiftmodule of main module is passed with -emit-executable #46448
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
legacy driver
Area → compiler: the integrated C++ legacy driver. Succeeded by the swift-driver project
Additional Detail from JIRA
md5: d9ab529c699f3022365b81a2ce367a09
duplicates:
relates to:
Issue Description:
I am not really sure if this a bug or not. Basically I am trying to fix https://bugs.swift.org/browse/SR-3280 by passing swiftmodule file of main executable along with objects in swiftpm's link command.
It works but swift tries to generate a temporary module which makes it want all the search paths again. For example this is what happens on linux:
$ cat main.swift
let str = "Hello world"
print(str)
$ swiftc -module-name foo -g -emit-object -c main.swift
$ swiftc -module-name foo -g -emit-module -emit-module-path foo.swiftmodule main.swift
Now, as per SR-3280, this produces executable but is not debuggable.
$ swiftc -module-name foo -g -o foo -emit-executable main.o
$ lldb foo -o "b main.swift:2" -o r -o "po str" -b
Passing swiftmodule makes the executable debuggable as expected:
$ swiftc -module-name foo -g -o foo -emit-executable main.o foo.swiftmodule
$ lldb foo -o "b main.swift:2" -o r -o "po str" -b
But it also generates an intermediate swiftmodule:
$ swiftc -module-name foo -g -o foo -emit-executable main.o foo.swiftmodule -###
Shouldn't swift not do that because it already has foo.swiftmodule and run the modulewrap command directly?
The text was updated successfully, but these errors were encountered: