1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-13 03:09:51 +03:00
aports/community/llvm19/clang-001-fortify-include.patch
Celeste cc67b2a0ed community/llvm19: include clang and lld in projects to build
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld"

also, sort Contributors by last name
2025-07-09 03:42:38 +00:00

33 lines
1.6 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.
---
clang/lib/Driver/ToolChains/Linux.cpp | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index 35bf39069..e246996c9 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -671,10 +671,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"));