gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / patches / clang-3.8-libc-search-path.patch
1 Clang attempts to guess file names based on the OS and distro (yes!),
2 but unfortunately, that doesn't work for us.
3
4 This patch makes it easy to insert libc's $libdir so that Clang passes the
5 correct absolute file name of crt1.o etc. to 'ld'. It also disables all
6 the distro-specific stuff and removes the hard-coded FHS directory names
7 to make sure Clang also works on non-GuixSD systems.
8
9 This patch makes slight adjustments over "clang-libc-search-path.patch" for
10 changes in clang 3.8.
11
12 --- cfe-3.8.0.src/lib/Driver/ToolChains.cpp
13 +++ cfe-3.8.0.src/lib/Driver/ToolChains.cpp
14 @@ -3661,6 +3661,9 @@
15 GCCInstallation.getTriple().str() + "/bin")
16 .str());
17
18 + // Comment out the distro-specific tweaks so that they don't bite when
19 + // using Guix on a foreign distro.
20 +#if 0
21 Distro Distro = DetectDistro(D, Arch);
22
23 if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) {
24 @@ -3702,6 +3705,7 @@
25
26 if (IsOpenSUSE(Distro))
27 ExtraOpts.push_back("--enable-new-dtags");
28 +#endif
29
30 // The selection of paths to try here is designed to match the patterns which
31 // the GCC driver itself uses, as this is part of the GCC-compatible driver.
32 @@ -3771,14 +3775,12 @@
33 addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);
34 }
35
36 - addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
37 - addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);
38 - addPathIfExists(D, SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
39 - addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
40 -
41 // Try walking via the GCC triple path in case of biarch or multiarch GCC
42 // installations with strange symlinks.
43 if (GCCInstallation.isValid()) {
44 + // The following code would end up adding things like
45 + // "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
46 +#if 0
47 addPathIfExists(D,
48 SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
49 "/../../" + OSLibDir,
50 @@ -3791,6 +3793,7 @@
51 BiarchSibling.gccSuffix(),
52 Paths);
53 }
54 +#endif
55
56 // See comments above on the multilib variant for details of why this is
57 // included even from outside the sysroot.
58 @@ -3815,8 +3818,9 @@
59 if (StringRef(D.Dir).startswith(SysRoot))
60 addPathIfExists(D, D.Dir + "/../lib", Paths);
61
62 - addPathIfExists(D, SysRoot + "/lib", Paths);
63 - addPathIfExists(D, SysRoot + "/usr/lib", Paths);
64 + // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
65 + // and friends can be found.
66 + addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
67 }
68
69 bool Linux::HasNativeLLVMSupport() const { return true; }