In the common flow, remarks are expected to be in the .dSYM bundle after dsymutil collects them from the object files and creates a standalone remark file. After that, the linked binary and the .dSYM bundle are sufficient to execute, debug, and process the remarks.
Even if users pass -object_path_lto to the linker, we generate the temporary remark files based on the output file requested through -o, which is very inconvenient when users try to separate their intermediate products from their final products. This will leave intermediate remarks in the final products, like Frameworks or other bundles.
This patch will change that behavior to try to infer the remarks file path from the path specified in -object_path_lto.
It is a little messy as the driver will try to read flags that are intended to be passed to the linker, but for now, it's the only option and hasExportSymbolDirective is already doing this.
The cleaner way to do this would be to add an interface for the linker to specify the remark output file when setting up LTO.