aports/main/clang15/clang-001-fortify-include.patch
psykose 314d661ecd main/clang15: move from community
needed back in main for libclc
2023-07-11 16:36:20 +02:00

36 lines
1.5 KiB
Diff

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