mirror of
https://git.proxmox.com/git/llvm-toolchain
synced 2025-07-17 19:02:32 +00:00
hurd/hurd-cxx-paths.diff: Drop part of patch applied upstream
and fix it so it can be applied
This commit is contained in:
parent
2fb108a317
commit
53c6e38e88
5
debian/changelog
vendored
5
debian/changelog
vendored
@ -1,10 +1,15 @@
|
||||
llvm-toolchain-snapshot (1:11~++20200124010400+805c157e8ae-1~exp1) UNRELEASED; urgency=medium
|
||||
|
||||
[ Sylvestre Ledru ]
|
||||
* experimental New snapshot release
|
||||
* Install clang-tidy headers in libclang-X.Y-dev
|
||||
Path: usr/lib/llvm-11/include/clang-tidy/
|
||||
Introduced upstream in https://reviews.llvm.org/D73236
|
||||
|
||||
[ Samuel Thibault ]
|
||||
* hurd/hurd-cxx-paths.diff: Drop part of patch applied upstream, fix it so
|
||||
it can be applied.
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Fri, 24 Jan 2020 13:06:56 +0100
|
||||
|
||||
llvm-toolchain-snapshot (1:11~++20200123111717+04fd2041561-1~exp1) experimental; urgency=medium
|
||||
|
122
debian/patches/hurd/hurd-cxx-paths.diff
vendored
122
debian/patches/hurd/hurd-cxx-paths.diff
vendored
@ -6,7 +6,7 @@ Index: llvm-toolchain-9-9.0.0/clang/lib/Driver/ToolChains/Hurd.cpp
|
||||
===================================================================
|
||||
--- llvm-toolchain-9-9.0.0.orig/clang/lib/Driver/ToolChains/Hurd.cpp
|
||||
+++ llvm-toolchain-9-9.0.0/clang/lib/Driver/ToolChains/Hurd.cpp
|
||||
@@ -61,17 +61,107 @@ static StringRef getOSLibDir(const llvm:
|
||||
@@ -61,21 +61,107 @@ static StringRef getOSLibDir(const llvm:
|
||||
return Triple.isArch32Bit() ? "lib" : "lib64";
|
||||
}
|
||||
|
||||
@ -42,10 +42,6 @@ Index: llvm-toolchain-9-9.0.0/clang/lib/Driver/ToolChains/Hurd.cpp
|
||||
+ .str());
|
||||
+ }
|
||||
+
|
||||
+#ifdef ENABLE_LINKER_BUILD_ID
|
||||
+ ExtraOpts.push_back("--build-id");
|
||||
+#endif
|
||||
+
|
||||
+ // The selection of paths to try here is designed to match the patterns which
|
||||
+ // the GCC driver itself uses, as this is part of the GCC-compatible driver.
|
||||
+ // This was determined by running GCC in a fake filesystem, creating all
|
||||
@ -56,6 +52,10 @@ Index: llvm-toolchain-9-9.0.0/clang/lib/Driver/ToolChains/Hurd.cpp
|
||||
const std::string OSLibDir = getOSLibDir(Triple, Args);
|
||||
const std::string MultiarchTriple = getMultiarchTriple(D, Triple, SysRoot);
|
||||
|
||||
#ifdef ENABLE_LINKER_BUILD_ID
|
||||
ExtraOpts.push_back("--build-id");
|
||||
#endif
|
||||
|
||||
- // If we are currently running Clang inside of the requested system root, add
|
||||
- // its parent library paths to those searched.
|
||||
+ // Add the multilib suffixed paths where they are available.
|
||||
@ -177,115 +177,3 @@ Index: llvm-toolchain-9-9.0.0/clang/lib/Driver/ToolChains/Hurd.cpp
|
||||
if (getTriple().getArch() == llvm::Triple::x86) {
|
||||
std::string Path = SysRoot + "/usr/include/i386-gnu";
|
||||
if (D.getVFS().exists(Path))
|
||||
@@ -166,3 +299,94 @@ void Hurd::AddClangSystemIncludeArgs(con
|
||||
|
||||
addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
|
||||
}
|
||||
+
|
||||
+static std::string DetectLibcxxIncludePath(llvm::vfs::FileSystem &vfs,
|
||||
+ StringRef base) {
|
||||
+ std::error_code EC;
|
||||
+ int MaxVersion = 0;
|
||||
+ std::string MaxVersionString = "";
|
||||
+ for (llvm::vfs::directory_iterator LI = vfs.dir_begin(base, EC), LE;
|
||||
+ !EC && LI != LE; LI = LI.increment(EC)) {
|
||||
+ StringRef VersionText = llvm::sys::path::filename(LI->path());
|
||||
+ int Version;
|
||||
+ if (VersionText[0] == 'v' &&
|
||||
+ !VersionText.slice(1, StringRef::npos).getAsInteger(10, Version)) {
|
||||
+ if (Version > MaxVersion) {
|
||||
+ MaxVersion = Version;
|
||||
+ MaxVersionString = VersionText;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return MaxVersion ? (base + "/" + MaxVersionString).str() : "";
|
||||
+}
|
||||
+
|
||||
+void Hurd::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
|
||||
+ llvm::opt::ArgStringList &CC1Args) const {
|
||||
+ const std::string& SysRoot = computeSysRoot();
|
||||
+ const std::string LibCXXIncludePathCandidates[] = {
|
||||
+ DetectLibcxxIncludePath(getVFS(), getDriver().Dir + "/../include/c++"),
|
||||
+ // If this is a development, non-installed, clang, libcxx will
|
||||
+ // not be found at ../include/c++ but it likely to be found at
|
||||
+ // one of the following two locations:
|
||||
+ DetectLibcxxIncludePath(getVFS(), SysRoot + "/usr/local/include/c++"),
|
||||
+ DetectLibcxxIncludePath(getVFS(), SysRoot + "/usr/include/c++") };
|
||||
+ for (const auto &IncludePath : LibCXXIncludePathCandidates) {
|
||||
+ if (IncludePath.empty() || !getVFS().exists(IncludePath))
|
||||
+ continue;
|
||||
+ // Use the first candidate that exists.
|
||||
+ addSystemInclude(DriverArgs, CC1Args, IncludePath);
|
||||
+ return;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void Hurd::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
|
||||
+ llvm::opt::ArgStringList &CC1Args) const {
|
||||
+ // We need a detected GCC installation on Hurd to provide libstdc++'s
|
||||
+ // headers.
|
||||
+ if (!GCCInstallation.isValid())
|
||||
+ return;
|
||||
+
|
||||
+ // By default, look for the C++ headers in an include directory adjacent to
|
||||
+ // the lib directory of the GCC installation. Note that this is expect to be
|
||||
+ // equivalent to '/usr/include/c++/X.Y' in almost all cases.
|
||||
+ StringRef LibDir = GCCInstallation.getParentLibPath();
|
||||
+ StringRef InstallDir = GCCInstallation.getInstallPath();
|
||||
+ StringRef TripleStr = GCCInstallation.getTriple().str();
|
||||
+ const Multilib &Multilib = GCCInstallation.getMultilib();
|
||||
+ const std::string GCCMultiarchTriple = getMultiarchTriple(
|
||||
+ getDriver(), GCCInstallation.getTriple(), getDriver().SysRoot);
|
||||
+ const std::string TargetMultiarchTriple =
|
||||
+ getMultiarchTriple(getDriver(), getTriple(), getDriver().SysRoot);
|
||||
+ const GCCVersion &Version = GCCInstallation.getVersion();
|
||||
+
|
||||
+ // The primary search for libstdc++ supports multiarch variants.
|
||||
+ if (addLibStdCXXIncludePaths(LibDir.str() + "/../include",
|
||||
+ "/c++/" + Version.Text, TripleStr,
|
||||
+ GCCMultiarchTriple, TargetMultiarchTriple,
|
||||
+ Multilib.includeSuffix(), DriverArgs, CC1Args))
|
||||
+ return;
|
||||
+
|
||||
+ // Otherwise, fall back on a bunch of options which don't use multiarch
|
||||
+ // layouts for simplicity.
|
||||
+ const std::string LibStdCXXIncludePathCandidates[] = {
|
||||
+ // Gentoo is weird and places its headers inside the GCC install,
|
||||
+ // so if the first attempt to find the headers fails, try these patterns.
|
||||
+ InstallDir.str() + "/include/g++-v" + Version.Text,
|
||||
+ InstallDir.str() + "/include/g++-v" + Version.MajorStr + "." +
|
||||
+ Version.MinorStr,
|
||||
+ InstallDir.str() + "/include/g++-v" + Version.MajorStr,
|
||||
+ // Android standalone toolchain has C++ headers in yet another place.
|
||||
+ LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.Text,
|
||||
+ // Freescale SDK C++ headers are directly in <sysroot>/usr/include/c++,
|
||||
+ // without a subdirectory corresponding to the gcc version.
|
||||
+ LibDir.str() + "/../include/c++",
|
||||
+ };
|
||||
+
|
||||
+ for (const auto &IncludePath : LibStdCXXIncludePathCandidates) {
|
||||
+ if (addLibStdCXXIncludePaths(IncludePath, /*Suffix*/ "", TripleStr,
|
||||
+ /*GCCMultiarchTriple*/ "",
|
||||
+ /*TargetMultiarchTriple*/ "",
|
||||
+ Multilib.includeSuffix(), DriverArgs, CC1Args))
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
Index: llvm-toolchain-9-9.0.0/clang/lib/Driver/ToolChains/Hurd.h
|
||||
===================================================================
|
||||
--- llvm-toolchain-9-9.0.0.orig/clang/lib/Driver/ToolChains/Hurd.h
|
||||
+++ llvm-toolchain-9-9.0.0/clang/lib/Driver/ToolChains/Hurd.h
|
||||
@@ -26,6 +26,12 @@ public:
|
||||
void
|
||||
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args) const override;
|
||||
+ void addLibCxxIncludePaths(
|
||||
+ const llvm::opt::ArgList &DriverArgs,
|
||||
+ llvm::opt::ArgStringList &CC1Args) const override;
|
||||
+ void addLibStdCxxIncludePaths(
|
||||
+ const llvm::opt::ArgList &DriverArgs,
|
||||
+ llvm::opt::ArgStringList &CC1Args) const override;
|
||||
|
||||
virtual std::string computeSysRoot() const;
|
||||
|
||||
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
@ -97,6 +97,7 @@ remove-apple-clang-manpage.diff
|
||||
0049-Use-Debian-provided-MathJax-everywhere.patch
|
||||
|
||||
# Hurd port
|
||||
hurd/hurd-cxx-paths.diff
|
||||
hurd/hurd-pathmax.diff
|
||||
|
||||
# powerpcspe
|
||||
|
Loading…
Reference in New Issue
Block a user