-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes: - Shrink the 32bit build significantly by limiting the target support to X86 and AMDGPU, and also only building LLVM. Also disable several additional features not needed for the 32bit build - And ARM and WebAssembly target support to the 64bit build for users cross-compiling - Get ccache working properly, and add debugging information so that it's possible to see how effective it is. - Disable building with PGO (this is temporary and will be re-enabled post LLVM 19) - Add openmp support (libomp) - Add clang-tools-extra (clang-tidy plus many other tools) so that we can build a more generally useful LLVM distribution for users. - Create `clang-tools` subpackage and move all of the build artifacts of `clang-tools-extra` there as well as clang-analyzer and other tools that were in `clang` that were not strictly necessary for compilation - Ensure that subpackage rundeps effectively pull in the packages they need. For instance `clang-devel` now depends on `llvm-devel` - Update various package descriptions - Build lld, clang, and llvm-ar so that they use the mimalloc memory allocator (improves performance by ~7%) - Patch LLD so that it always behaves as though `--build-id=sha1` was passed (this matches binutils/mold) - Patch LLD so that it always behaves as though `--compress-debug-symbols=zstd` was passed (this matches binutils/mold) Signed-off-by: Reilly Brogan <[email protected]>
- Loading branch information
1 parent
ede4d48
commit 557782d
Showing
23 changed files
with
1,199 additions
and
479 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <bits/wordsize.h> | ||
|
||
#if __WORDSIZE == 32 | ||
#include "32/@@REPLACE@@" | ||
#elif __WORDSIZE == 64 | ||
#include "64/@@REPLACE@@" | ||
#else | ||
#error "Unknown word size" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#include <bits/wordsize.h> | ||
|
||
#if __WORDSIZE == 32 | ||
#include "llvm-config-32.h" | ||
#include "llvm-config32.h" | ||
#elif __WORDSIZE == 64 | ||
#include "llvm-config-64.h" | ||
#include "llvm-config64.h" | ||
#else | ||
#error "Unknown word size" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,11 @@ From: Reilly Brogan <[email protected]> | |
Date: Fri, 2 Aug 2024 15:55:23 -0500 | ||
Subject: [PATCH] Build lld libraries shared | ||
|
||
We don't want to enable `ENABLE_SHARED` since it causes every LLVM library to be built shared even if they're intended to be private. | ||
|
||
Origin: vendor | ||
Forwarded: not-needed | ||
Last-Update: 2025-01-10 | ||
--- | ||
lld/cmake/modules/AddLLD.cmake | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ From: Reilly Brogan <[email protected]> | |
Date: Fri, 2 Aug 2024 17:24:39 -0500 | ||
Subject: [PATCH] Build polly libraries shared | ||
|
||
Origin: vendor | ||
Forwarded: not-needed | ||
Last-Update: 2025-01-10 | ||
--- | ||
polly/cmake/polly_macros.cmake | 4 +--- | ||
2 files changed, 1 insertion(+), 5 deletions(-) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,11 @@ From: Reilly Brogan <[email protected]> | |
Date: Sun, 26 May 2024 16:08:54 -0500 | ||
Subject: [PATCH] Emit relocations for BOLT | ||
|
||
Ensure that relocations are always emitted for the libraries/binaries that we want to BOLT. This allows us to not have them emitted for all other files. | ||
|
||
Origin: vendor | ||
Forwarded: not-needed | ||
Last-Update: 2025-01-10 | ||
--- | ||
clang/tools/clang-shlib/CMakeLists.txt | 2 ++ | ||
clang/tools/driver/CMakeLists.txt | 2 ++ | ||
|
27 changes: 27 additions & 0 deletions
27
l/llvm/pkg/patches/build/0001-downstream-Suppress-runpath-in-openmp.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Reilly Brogan <[email protected]> | ||
Date: Thu, 9 Jan 2025 23:27:13 -0600 | ||
Subject: [PATCH] downstream: Suppress runpath in openmp | ||
|
||
The libraries for openmp are installed into libdir, so RUNPATH is unnecessary. If this argument is not set then a relative RUNPATH is added to `llvm-omp-*` binaries which Boulder can't currently handle. | ||
|
||
Origin: vendor | ||
Forwarded: not-needed | ||
Last-Update: 2025-01-10 | ||
--- | ||
openmp/libomptarget/tools/CMakeLists.txt | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/openmp/libomptarget/tools/CMakeLists.txt b/openmp/libomptarget/tools/CMakeLists.txt | ||
index a850647fbd58..1eaa784e5f50 100644 | ||
--- a/openmp/libomptarget/tools/CMakeLists.txt | ||
+++ b/openmp/libomptarget/tools/CMakeLists.txt | ||
@@ -17,7 +17,7 @@ mark_as_advanced(OPENMP_TOOLS_INSTALL_DIR) | ||
# Move these macros to AddOpenMP if such a CMake module is ever created. | ||
|
||
macro(add_openmp_tool name) | ||
- llvm_add_tool(OPENMP ${ARGV}) | ||
+ llvm_add_tool(OPENMP ${ARGV} NO_INSTALL_RPATH) | ||
endmacro() | ||
|
||
macro(add_openmp_tool_symlink name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ From: Tom Stellard <[email protected]> | |
Date: Fri, 31 Jan 2020 11:04:57 -0800 | ||
Subject: [PATCH][clang] Don't install static libraries | ||
|
||
Origin: vendor | ||
Forwarded: not-needed | ||
Last-Update: 2025-01-10 | ||
--- | ||
clang/cmake/modules/AddClang.cmake | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,9 @@ From: Peter O'Connor <[email protected]> | |
Date: Mon, 5 Jul 2021 14:22:14 +1000 | ||
Subject: [PATCH] Make gnu hash the default for lld and clang | ||
|
||
Signed-off-by: Peter O'Connor <[email protected]> | ||
Origin: vendor | ||
Forwarded: not-needed | ||
Last-Update: 2025-01-10 | ||
--- | ||
lld/ELF/Driver.cpp | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
54 changes: 54 additions & 0 deletions
54
l/llvm/pkg/patches/config/0001-lld-Always-enable-build-id-and-use-20-byte-hashes.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Reilly Brogan <[email protected]> | ||
Date: Thu, 12 Dec 2024 13:14:41 -0600 | ||
Subject: [PATCH] lld: Always enable build-id and use 20-byte hashes | ||
|
||
Always ensure that build-id is used, and ensure that is is 20bytes in length. If the user does not want this behavior they can use `--build-id=none` explicitly. | ||
|
||
Note that though this patch uses "sha1" LLVM actually uses the BLAKE3 algorithm and truncates the output after the first 20 bytes. | ||
|
||
It would be nice if llvm supported configuring this at build time like binutils does. | ||
|
||
Origin: vendor | ||
Forwarded: not-needed | ||
Last-Update: 2025-01-10 | ||
--- | ||
lld/ELF/Config.h | 2 +- | ||
lld/ELF/Driver.cpp | 4 ++-- | ||
2 files changed, 3 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h | ||
index 28726d48e428..5b2a1541e529 100644 | ||
--- a/lld/ELF/Config.h | ||
+++ b/lld/ELF/Config.h | ||
@@ -351,7 +351,7 @@ struct Config { | ||
GcsPolicy zGcs; | ||
bool power10Stubs; | ||
ARMVFPArgKind armVFPArgs = ARMVFPArgKind::Default; | ||
- BuildIdKind buildId = BuildIdKind::None; | ||
+ BuildIdKind buildId = BuildIdKind::Sha1; | ||
SeparateSegmentKind zSeparate; | ||
ELFKind ekind = ELFNoneKind; | ||
uint16_t emachine = llvm::ELF::EM_NONE; | ||
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp | ||
index bcc7971042c6..7a0a4006a099 100644 | ||
--- a/lld/ELF/Driver.cpp | ||
+++ b/lld/ELF/Driver.cpp | ||
@@ -900,7 +900,7 @@ static std::pair<BuildIdKind, SmallVector<uint8_t, 0>> | ||
getBuildId(opt::InputArgList &args) { | ||
auto *arg = args.getLastArg(OPT_build_id); | ||
if (!arg) | ||
- return {BuildIdKind::None, {}}; | ||
+ return {BuildIdKind::Sha1, {}}; | ||
|
||
StringRef s = arg->getValue(); | ||
if (s == "fast") | ||
@@ -916,7 +916,7 @@ getBuildId(opt::InputArgList &args) { | ||
|
||
if (s != "none") | ||
error("unknown --build-id style: " + s); | ||
- return {BuildIdKind::None, {}}; | ||
+ return {BuildIdKind::Sha1, {}}; | ||
} | ||
|
||
static std::pair<bool, bool> getPackDynRelocs(opt::InputArgList &args) { |
120 changes: 120 additions & 0 deletions
120
l/llvm/pkg/patches/config/0001-lld-Use-zstd-compression-for-debug-symbols-by-defa.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Reilly Brogan <[email protected]> | ||
Date: Thu, 12 Dec 2024 20:50:14 -0600 | ||
Subject: [PATCH] lld: Use zstd compression for debug symbols by default | ||
|
||
This causes LLVM to always behave as though `--compress-debug-sections=zstd` is present. | ||
|
||
It would be nice if llvm supported configuring this at build time like binutils does. | ||
|
||
Origin: vendor | ||
Forwarded: not-needed | ||
Last-Update: 2025-01-10 | ||
--- | ||
clang/include/clang/Driver/Options.td | 4 ++-- | ||
clang/tools/driver/cc1as_main.cpp | 4 ++-- | ||
lld/ELF/Config.h | 2 +- | ||
lld/ELF/Driver.cpp | 8 ++++---- | ||
lld/ELF/Options.td | 2 +- | ||
llvm/tools/llvm-objcopy/ObjcopyOpts.td | 4 ++-- | ||
6 files changed, 12 insertions(+), 12 deletions(-) | ||
|
||
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td | ||
index b8d1608a1453..b517f4aadb51 100644 | ||
--- a/clang/include/clang/Driver/Options.td | ||
+++ b/clang/include/clang/Driver/Options.td | ||
@@ -6781,9 +6781,9 @@ def record_command_line : Separate<["-"], "record-command-line">, | ||
def compress_debug_sections_EQ : Joined<["-", "--"], "compress-debug-sections=">, | ||
HelpText<"DWARF debug sections compression type">, Values<"none,zlib,zstd">, | ||
NormalizedValuesScope<"llvm::DebugCompressionType">, NormalizedValues<["None", "Zlib", "Zstd"]>, | ||
- MarshallingInfoEnum<CodeGenOpts<"CompressDebugSections">, "None">; | ||
+ MarshallingInfoEnum<CodeGenOpts<"CompressDebugSections">, "Zstd">; | ||
def compress_debug_sections : Flag<["-", "--"], "compress-debug-sections">, | ||
- Alias<compress_debug_sections_EQ>, AliasArgs<["zlib"]>; | ||
+ Alias<compress_debug_sections_EQ>, AliasArgs<["zstd"]>; | ||
def mno_exec_stack : Flag<["-"], "mnoexecstack">, | ||
HelpText<"Mark the file as not needing an executable stack">, | ||
MarshallingInfoFlag<CodeGenOpts<"NoExecStack">>; | ||
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp | ||
index bc398fa0731f..62bdf73939da 100644 | ||
--- a/clang/tools/driver/cc1as_main.cpp | ||
+++ b/clang/tools/driver/cc1as_main.cpp | ||
@@ -100,7 +100,7 @@ struct AssemblerInvocation { | ||
std::string DebugCompilationDir; | ||
llvm::SmallVector<std::pair<std::string, std::string>, 0> DebugPrefixMap; | ||
llvm::DebugCompressionType CompressDebugSections = | ||
- llvm::DebugCompressionType::None; | ||
+ llvm::DebugCompressionType::Zstd; | ||
std::string MainFileName; | ||
std::string SplitDwarfOutput; | ||
|
||
@@ -263,7 +263,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, | ||
.Case("none", llvm::DebugCompressionType::None) | ||
.Case("zlib", llvm::DebugCompressionType::Zlib) | ||
.Case("zstd", llvm::DebugCompressionType::Zstd) | ||
- .Default(llvm::DebugCompressionType::None); | ||
+ .Default(llvm::DebugCompressionType::Zstd); | ||
} | ||
|
||
Opts.RelaxELFRelocations = !Args.hasArg(OPT_mrelax_relocations_no); | ||
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h | ||
index 3a4a47d900fe..0ec8ea5b144c 100644 | ||
--- a/lld/ELF/Config.h | ||
+++ b/lld/ELF/Config.h | ||
@@ -221,7 +221,7 @@ struct Config { | ||
CGProfileSortKind callGraphProfileSort; | ||
bool checkSections; | ||
bool checkDynamicRelocs; | ||
- llvm::DebugCompressionType compressDebugSections; | ||
+ llvm::DebugCompressionType compressDebugSections = llvm::DebugCompressionType::Zstd; | ||
bool cref; | ||
llvm::SmallVector<std::pair<llvm::GlobPattern, uint64_t>, 0> | ||
deadRelocInNonAlloc; | ||
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp | ||
index 8079be691436..3fa84a7cb4d3 100644 | ||
--- a/lld/ELF/Driver.cpp | ||
+++ b/lld/ELF/Driver.cpp | ||
@@ -1086,10 +1086,10 @@ static CGProfileSortKind getCGProfileSortKind(opt::InputArgList &args) { | ||
static DebugCompressionType getCompressionType(StringRef s, StringRef option) { | ||
DebugCompressionType type = StringSwitch<DebugCompressionType>(s) | ||
.Case("zlib", DebugCompressionType::Zlib) | ||
- .Case("zstd", DebugCompressionType::Zstd) | ||
- .Default(DebugCompressionType::None); | ||
- if (type == DebugCompressionType::None) { | ||
- if (s != "none") | ||
+ .Case("none", DebugCompressionType::None) | ||
+ .Default(DebugCompressionType::Zstd); | ||
+ if (type == DebugCompressionType::Zstd) { | ||
+ if (s != "zstd") | ||
error("unknown " + option + " value: " + s); | ||
} else if (const char *reason = compression::getReasonIfUnsupported( | ||
compression::formatFor(type))) { | ||
diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td | ||
index 35d9c5ffa29b..2cc5c296c0ca 100644 | ||
--- a/lld/ELF/Options.td | ||
+++ b/lld/ELF/Options.td | ||
@@ -64,7 +64,7 @@ defm check_sections: B<"check-sections", | ||
"Do not check section addresses for overlaps">; | ||
|
||
defm compress_debug_sections: | ||
- Eq<"compress-debug-sections", "Compress DWARF debug sections">, | ||
+ Eq<"compress-debug-sections", "Compress DWARF debug sections (default: zstd)">, | ||
MetaVarName<"[none,zlib,zstd]">; | ||
|
||
defm defsym: Eq<"defsym", "Define a symbol alias">, MetaVarName<"<symbol>=<value>">; | ||
diff --git a/llvm/tools/llvm-objcopy/ObjcopyOpts.td b/llvm/tools/llvm-objcopy/ObjcopyOpts.td | ||
index ead8cd28d387..16b3dd8830ae 100644 | ||
--- a/llvm/tools/llvm-objcopy/ObjcopyOpts.td | ||
+++ b/llvm/tools/llvm-objcopy/ObjcopyOpts.td | ||
@@ -33,9 +33,9 @@ def compress_debug_sections | ||
: Joined<["--"], "compress-debug-sections=">, | ||
MetaVarName<"format">, | ||
HelpText<"Compress DWARF debug sections using specified format. Supported " | ||
- "formats: zlib, zstd. Select zlib if <format> is omitted">; | ||
+ "formats: zlib, zstd. Select zstd if <format> is omitted.">; | ||
def : Flag<["--"], "compress-debug-sections">, Alias<compress_debug_sections>, | ||
- AliasArgs<["zlib"]>; | ||
+ AliasArgs<["zstd"]>; | ||
def decompress_debug_sections : Flag<["--"], "decompress-debug-sections">, | ||
HelpText<"Decompress DWARF debug sections">; | ||
defm split_dwo |
File renamed without changes.
Oops, something went wrong.