diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-06-21 20:55:11 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-06-21 20:55:11 +0000 |
commit | 5bfa656e132560e616310b455d65604a49e33e35 (patch) | |
tree | 39e23f7645917e1b485e666e0cb43142e1a70eb4 /lib/Driver | |
parent | ed798951b46555946c95cb76568ea3cf0b16c9ab (diff) |
Driver/Darwin: When invoking the linker, automatically pass -object_path_lto so
that the linker has a place to put the temporary object file and can leave it
around (for the driver to clean up). This is important so that the object file
references in the debug info are preserved for possible use by dsymutil.
- <rdar://problem/8294279> executable has no debug symbols when compiled with LTO
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133543 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver')
-rw-r--r-- | lib/Driver/Tools.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index b3cef73e52..41efccfb93 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2907,6 +2907,17 @@ void darwin::Link::AddLinkArgs(Compilation &C, CmdArgs.push_back("-demangle"); } + // If we are using LTO, then automatically create a temporary file path for + // the linker to use, so that it's lifetime will extend past a possible + // dsymutil step. + if (Version[0] >= 100 && D.IsUsingLTO(Args)) { + const char *TmpPath = C.getArgs().MakeArgString( + D.GetTemporaryPath(types::getTypeTempSuffix(types::TY_Object))); + C.addTempFile(TmpPath); + CmdArgs.push_back("-object_path_lto"); + CmdArgs.push_back(TmpPath); + } + // Derived from the "link" spec. Args.AddAllArgs(CmdArgs, options::OPT_static); if (!Args.hasArg(options::OPT_static)) |