aboutsummaryrefslogtreecommitdiff
path: root/rakelib/gcc.rake
diff options
context:
space:
mode:
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