diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 69b97177a6447..b0b08c8bf2eba 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -838,6 +838,14 @@ proc execLinkCmd(conf: ConfigRef; linkCmd: string) = execExternalProgram(conf, linkCmd, if optListCmd in conf.globalOptions or conf.verbosity > 1: hintExecuting else: hintLinking) +proc maybeRunDsymutil(conf: ConfigRef; exe: AbsoluteFile) = + when not defined(osx): return + if optCDebug notin conf.globalOptions: return + # if needed, add an option to skip or override location + let cmd = "dsymutil " & $(exe).quoteShell + tryExceptOSErrorMessage(conf, "invocation of dsymutil failed."): + execExternalProgram(conf, cmd, hintExecuting) + proc execCmdsInParallel(conf: ConfigRef; cmds: seq[string]; prettyCb: proc (idx: int)) = let runCb = proc (idx: int, p: Process) = let exitCode = p.peekExitCode @@ -979,6 +987,7 @@ proc callCCompiler*(conf: ConfigRef) = linkViaResponseFile(conf, linkCmd) else: execLinkCmd(conf, linkCmd) + maybeRunDsymutil(conf, mainOutput) else: linkCmd = "" if optGenScript in conf.globalOptions: