| 1 | From eca9994181dc355cfba61e726c038832d5ff6975 Mon Sep 17 00:00:00 2001
|
| 2 | From: Daniel Kolesa <[email protected]>
|
| 3 | Date: Sun, 23 Oct 2022 00:47:57 +0200
|
| 4 | Subject: [PATCH 1/4] clang: add fortify include paths for musl triplets
|
| 5 |
|
| 6 | When we have fortify headers this lets them get included.
|
| 7 | ---
|
| 8 | lib/Driver/ToolChains/Linux.cpp | 12 ++++++++----
|
| 9 | 1 file changed, 8 insertions(+), 4 deletions(-)
|
| 10 |
|
| 11 | diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
|
| 12 | index 7fcdcf125..d5df4a240 100644
|
| 13 | |
| 14 | |
| 15 | @@ -671,10 +671,14 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
|
| 16 | if (getTriple().getOS() == llvm::Triple::RTEMS)
|
| 17 | return;
|
| 18 |
|
| 19 | - // Add an include of '/include' directly. This isn't provided by default by
|
| 20 | - // system GCCs, but is often used with cross-compiling GCCs, and harmless to
|
| 21 | - // add even when Clang is acting as-if it were a system compiler.
|
| 22 | - addExternCSystemInclude(DriverArgs, CC1Args, concat(SysRoot, "/include"));
|
| 23 | + if (getTriple().isMusl()) {
|
| 24 | + addExternCSystemInclude(DriverArgs, CC1Args, concat(SysRoot, "/usr/include/fortify"));
|
| 25 | + } else {
|
| 26 | + // Preserve original clang behavior for non-musl triples, but for musl
|
| 27 | + // this just gets in the way and none of our crosstoolchains are ever
|
| 28 | + // actually built this way (and we'd have to figure out fortify for it)
|
| 29 | + addExternCSystemInclude(DriverArgs, CC1Args, concat(SysRoot, "/include"));
|
| 30 | + }
|
| 31 |
|
| 32 | addExternCSystemInclude(DriverArgs, CC1Args, concat(SysRoot, "/usr/include"));
|
| 33 |
|
| 34 | --
|
| 35 | 2.38.0
|
| 36 |
|