From 4dc0a051fd21d997eff9a21a77bbcb1da044ce13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Cavaill=C3=A9?= Date: Thu, 20 Jun 2013 13:35:15 +0000 Subject: [PATCH] Add patch to find correctly LLVMGold.so with -O4 (Closes: #712437) --- debian/changelog | 3 ++ debian/patches/0010-shared-lib-paths.patch | 37 ++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 41 insertions(+) create mode 100644 debian/patches/0010-shared-lib-paths.patch diff --git a/debian/changelog b/debian/changelog index 5ba7aafc..3d669ce7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,9 @@ llvm-toolchain-3.3 (1:3.3-2) unstable; urgency=low * Add lldb-X.Y manpage * Hopefully fix the ftbfs under mipsel (mipsel-ftbfs.diff) + [ Léo Cavaillé ] + * Add patch to find correctly LLVMGold.so with -O4 (Closes: #712437) + -- Sylvestre Ledru Fri, 14 Jun 2013 11:45:26 +0200 llvm-toolchain-3.3 (1:3.3-1) unstable; urgency=low diff --git a/debian/patches/0010-shared-lib-paths.patch b/debian/patches/0010-shared-lib-paths.patch new file mode 100644 index 00000000..a9f86ca3 --- /dev/null +++ b/debian/patches/0010-shared-lib-paths.patch @@ -0,0 +1,37 @@ +Index: llvm-toolchain-snapshot_3.4~svn184409/clang/lib/Driver/ToolChains.cpp +=================================================================== +--- llvm-toolchain-snapshot_3.4~svn184409/clang/lib/Driver/ToolChains.cpp (revision 184409) ++++ llvm-toolchain-snapshot_3.4~svn184409/clang/lib/Driver/ToolChains.cpp (working copy) +@@ -2328,6 +2328,13 @@ + addPathIfExists(SysRoot + "/usr/lib/" + MultiarchTriple, Paths); + addPathIfExists(SysRoot + "/usr/lib/../" + Multilib, Paths); + ++ // In Debian we install LLVM lib with version string ++ // /usr/lib/llvm-X.Y/lib/LLVMGold.so ++ if (IsDebian(Distro)) { ++ addPathIfExists(SysRoot + "/usr/lib/llvm-" + CLANG_VERSION_STRING + "/lib/", ++ Paths); ++ } ++ + // Try walking via the GCC triple path in case of multiarch GCC + // installations with strange symlinks. + if (GCCInstallation.isValid()) +Index: llvm-toolchain-snapshot_3.4~svn184409/clang/lib/Driver/Tools.cpp +=================================================================== +--- llvm-toolchain-snapshot_3.4~svn184409/clang/lib/Driver/Tools.cpp (revision 184409) ++++ llvm-toolchain-snapshot_3.4~svn184409/clang/lib/Driver/Tools.cpp (working copy) +@@ -6147,6 +6147,14 @@ + if (D.IsUsingLTO(Args) || Args.hasArg(options::OPT_use_gold_plugin)) { + CmdArgs.push_back("-plugin"); + std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so"; ++ if ( ! llvm::sys::fs::exists(Plugin)) { ++ // Plugin is not in driver-based relative path, try system libs ++ // on Debian for instance ++ std::string PluginSystem = ToolChain.GetFilePath("LLVMgold.so"); ++ if (llvm::sys::fs::exists(PluginSystem)){ ++ Plugin = PluginSystem; ++ } ++ } + CmdArgs.push_back(Args.MakeArgString(Plugin)); + + // Try to pass driver level flags relevant to LTO code generation down to diff --git a/debian/patches/series b/debian/patches/series index 8c0c058d..3924b72f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -8,6 +8,7 @@ profile_rt.diff 30-kfreebsd.diff 0003-Debian-version-info-and-bugreport.patch +0010-shared-lib-paths.patch 0021-shared-lib-debian.patch 0023-link-libopagent.patch 0044-soname.diff