aboutsummaryrefslogtreecommitdiff
path: root/rakelib/gcc.rake
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-07-17 15:50:14 +0200
committerEugen Wissner <belka@caraus.de>2026-07-17 15:50:14 +0200
commitdb528ae1fbec5219fa34e1b780590eef89e9618c (patch)
tree329b07c0bc2c4f3a48eefbe6a915ae288d1745cc /rakelib/gcc.rake
parent44a0c221d51c9aa036b47b218a6caea4424f5996 (diff)
downloadelna-db528ae1fbec5219fa34e1b780590eef89e9618c.tar.gz
Upgrade to GCC 16.1
Diffstat (limited to 'rakelib/gcc.rake')
-rw-r--r--rakelib/gcc.rake15
1 files changed, 13 insertions, 2 deletions
diff --git a/rakelib/gcc.rake b/rakelib/gcc.rake
index 62a9781..b1f8c18 100644
--- a/rakelib/gcc.rake
+++ b/rakelib/gcc.rake
@@ -64,10 +64,10 @@ end
namespace :gcc do
# Dependencies.
- GCC_VERSION = "15.3.0"
+ GCC_VERSION = "16.1.0"
HOST_GCC = 'build/host/gcc'
GCC_TREE = Pathname.new "build/tools/gcc-#{GCC_VERSION}"
- GCC_PATCH = 'https://raw.githubusercontent.com/Homebrew/homebrew-core/refs/heads/main/Patches/gcc/gcc-15.3.0.diff'
+ GCC_PATCH = 'https://raw.githubusercontent.com/Homebrew/homebrew-core/refs/heads/main/Patches/gcc/gcc-16.1.0.diff'
directory HOST_GCC
directory 'build/host/install'
@@ -80,6 +80,17 @@ namespace :gcc do
download_and_pipe url, GCC_TREE.dirname, ['tar', '-Jxv']
download_and_pipe URI.parse(GCC_PATCH), GCC_TREE, ['patch', '-p1']
+ # GCC 16.1.0 registers 17 languages but CL_PARAMS is at bit 16,
+ # which collides with the 17th language class (CL_Rust). Shift
+ # every CL_* constant from bit 16 upward by one position.
+ File.open(GCC_TREE + 'gcc/opts.h', 'r+') do |opts_h|
+ content = opts_h.read.gsub(/\(1U << (\d+)\)/) do |m|
+ "(1U << #{$1.to_i + 1})"
+ end
+ opts_h.seek 0, IO::SEEK_SET
+ opts_h.write content
+ end
+
sh 'contrib/download_prerequisites', chdir: GCC_TREE.to_path
end