Initial stub of a Makefile and patches for LLVM

Nothing much, but getting some patches from chimera linux that should
work.
This commit is contained in:
cowmonk 2025-10-25 16:23:17 -07:00
parent 636c6f0163
commit 6110995cfb
33 changed files with 1813 additions and 0 deletions

View file

@ -0,0 +1,30 @@
From eaf3a6393892bd36899f3ccb8782e7c6a06d6a8f Mon Sep 17 00:00:00 2001
From: q66 <q66@chimera-linux.org>
Date: Sun, 14 Apr 2024 14:48:51 +0200
Subject: [PATCH 17/29] clang: use --as-needed by default
---
clang/lib/Driver/ToolChains/Gnu.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index f56eeda3c..5230be404 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -541,6 +541,13 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
addLinkerCompressDebugSectionsOption(ToolChain, Args, CmdArgs);
+
+ // Use --as-needed by default for all explicit linker inputs on Linux
+ // We don't reset it afterwards because explicit argument does not
+ // get reset either (and that is permitted, so it should be fine)
+ if (Triple.isOSLinux())
+ CmdArgs.push_back("--as-needed");
+
AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
addHIPRuntimeLibArgs(ToolChain, C, Args, CmdArgs);
--
2.49.0