Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/build-reusable.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build WebKit (Reusable)

env:
LLVM_VERSION: 19
LLVM_VERSION: 21
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

on:
workflow_call:
Expand Down Expand Up @@ -98,20 +98,20 @@ jobs:
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
run: |
echo "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin" >> $GITHUB_PATH
brew install llvm@${{env.LLVM_VERSION}} python icu4c ninja -f --overwrite
brew link llvm@${{env.LLVM_VERSION}} -f --overwrite
echo "${{matrix.brew_prefix}}/llvm@21/bin" >> $GITHUB_PATH
brew install llvm@21 python icu4c ninja -f --overwrite
brew link llvm@21 -f --overwrite
- name: Run
env:
ICU_INCLUDE_DIRS: ${{matrix.brew_prefix}}/icu4c/include
ICU_ROOT: ${{matrix.brew_prefix}}/icu4c
LDFLAGS: "${{env.LDFLAGS}} "
CC: "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin/clang"
CXX: "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin/clang++"
RANLIB: "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin/llvm-ranlib"
AR: "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin/llvm-ar"
CMAKE_C_COMPILER: "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin/clang"
CMAKE_CXX_COMPILER: "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin/clang++"
CC: "${{matrix.brew_prefix}}/llvm@21/bin/clang"
CXX: "${{matrix.brew_prefix}}/llvm@21/bin/clang++"
RANLIB: "${{matrix.brew_prefix}}/llvm@21/bin/llvm-ranlib"
AR: "${{matrix.brew_prefix}}/llvm@21/bin/llvm-ar"
CMAKE_C_COMPILER: "${{matrix.brew_prefix}}/llvm@21/bin/clang"
CMAKE_CXX_COMPILER: "${{matrix.brew_prefix}}/llvm@21/bin/clang++"
Comment on lines +101 to +114

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/build-reusable.yml | head -150

Repository: oven-sh/WebKit

Length of output: 6715


🏁 Script executed:

rg "llvm@" .github/workflows/build-reusable.yml

Repository: oven-sh/WebKit

Length of output: 671


🏁 Script executed:

rg -B5 -A5 "llvm@21.1.8" .github/workflows/build-reusable.yml

Repository: oven-sh/WebKit

Length of output: 598


Use env.LLVM_VERSION instead of hardcoded llvm@21 in macOS steps.

The workflow accepts inputs.llvm_version and sets env.LLVM_VERSION on line 85, but the macOS build steps (lines 101-114) ignore this and hardcode llvm@21. This prevents version overrides from taking effect. Replace all hardcoded llvm@21 references with llvm@${{ env.LLVM_VERSION }}.

🔧 Proposed fix
-          echo "${{matrix.brew_prefix}}/llvm@21/bin" >> $GITHUB_PATH
-          brew install llvm@21 python icu4c ninja -f --overwrite
-          brew link llvm@21 -f --overwrite
+          echo "${{matrix.brew_prefix}}/llvm@${{ env.LLVM_VERSION }}/bin" >> $GITHUB_PATH
+          brew install llvm@${{ env.LLVM_VERSION }} python icu4c ninja -f --overwrite
+          brew link llvm@${{ env.LLVM_VERSION }} -f --overwrite
-          CC: "${{matrix.brew_prefix}}/llvm@21/bin/clang"
-          CXX: "${{matrix.brew_prefix}}/llvm@21/bin/clang++"
-          RANLIB: "${{matrix.brew_prefix}}/llvm@21/bin/llvm-ranlib"
-          AR: "${{matrix.brew_prefix}}/llvm@21/bin/llvm-ar"
-          CMAKE_C_COMPILER: "${{matrix.brew_prefix}}/llvm@21/bin/clang"
-          CMAKE_CXX_COMPILER: "${{matrix.brew_prefix}}/llvm@21/bin/clang++"
+          CC: "${{matrix.brew_prefix}}/llvm@${{ env.LLVM_VERSION }}/bin/clang"
+          CXX: "${{matrix.brew_prefix}}/llvm@${{ env.LLVM_VERSION }}/bin/clang++"
+          RANLIB: "${{matrix.brew_prefix}}/llvm@${{ env.LLVM_VERSION }}/bin/llvm-ranlib"
+          AR: "${{matrix.brew_prefix}}/llvm@${{ env.LLVM_VERSION }}/bin/llvm-ar"
+          CMAKE_C_COMPILER: "${{matrix.brew_prefix}}/llvm@${{ env.LLVM_VERSION }}/bin/clang"
+          CMAKE_CXX_COMPILER: "${{matrix.brew_prefix}}/llvm@${{ env.LLVM_VERSION }}/bin/clang++"
🤖 Prompt for AI Agents
In @.github/workflows/build-reusable.yml around lines 101 - 114, Replace all
occurrences of the hardcoded "llvm@21" in the macOS workflow steps with the
parameterized "llvm@${{ env.LLVM_VERSION }}" so the input override is honored;
specifically update the PATH addition, brew install/brew link references and the
environment variables that reference the toolchain (CC, CXX, RANLIB, AR,
CMAKE_C_COMPILER, CMAKE_CXX_COMPILER) which currently use
"${{matrix.brew_prefix}}/llvm@21/bin/..." to instead use
"${{matrix.brew_prefix}}/llvm@${{ env.LLVM_VERSION }}/bin/..." (leave
matrix.brew_prefix and ICU_* vars unchanged).

CMAKE_C_FLAGS: " -fno-exceptions ${{matrix.cpp_flags}} -fvisibility=hidden -fvisibility-inlines-hidden -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -faddrsig "
CMAKE_CXX_FLAGS: " -fno-exceptions ${{matrix.cpp_flags}} -fvisibility=hidden -fvisibility-inlines-hidden -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -faddrsig -fno-c++-static-destructors "
CMAKE_OSX_DEPLOYMENT_TARGET: "13.0"
Expand Down Expand Up @@ -273,7 +273,7 @@ jobs:
run: |
"C:\Program Files\7-Zip" >> $Env:GITHUB_PATH
scoop config use_external_7zip true
scoop install ninja llvm@19.1.7
scoop install ninja llvm@21.1.8
Join-Path (Resolve-Path ~).Path "scoop\apps\llvm\current\bin" >> $Env:GITHUB_PATH
- name: Install LLVM and Ninja (ARM64)
if: matrix.platform == 'ARM64'
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG WEBKIT_RELEASE_TYPE=Release
ARG CPU=native
ARG LTO_FLAG="-flto=full -fwhole-program-vtables -fforce-emit-vtables "
ARG RELEASE_FLAGS="-O3 -DNDEBUG=1"
ARG LLVM_VERSION="19"
ARG LLVM_VERSION="21"
ARG DEFAULT_CFLAGS="-mno-omit-leaf-frame-pointer -g -fno-omit-frame-pointer -ffunction-sections -fdata-sections -faddrsig -fno-unwind-tables -fno-asynchronous-unwind-tables -DU_STATIC_IMPLEMENTATION=1 "
ARG ENABLE_SANITIZERS=""

Expand Down Expand Up @@ -71,10 +71,10 @@ RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 130 \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-13 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-13

# Install LLVM 19
# Install LLVM 21
RUN wget https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh 19 all \
&& ./llvm.sh 21 all \
&& rm llvm.sh \
Comment on lines +74 to 78

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat Dockerfile

Repository: oven-sh/WebKit

Length of output: 9782


Use the LLVM_VERSION ARG when invoking llvm.sh.

Hardcoding 21 ignores overridden build args and creates inconsistency with the symlink configuration below (which correctly uses ${LLVM_VERSION}), potentially causing toolchain mismatches.

🔧 Proposed fix
-# Install LLVM 21
+# Install LLVM ${LLVM_VERSION}
 RUN wget https://apt.llvm.org/llvm.sh \
     && chmod +x llvm.sh \
-    && ./llvm.sh 21 all \
+    && ./llvm.sh ${LLVM_VERSION} all \
     && rm llvm.sh \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Install LLVM 21
RUN wget https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh 19 all \
&& ./llvm.sh 21 all \
&& rm llvm.sh \
# Install LLVM ${LLVM_VERSION}
RUN wget https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh ${LLVM_VERSION} all \
&& rm llvm.sh \
🧰 Tools
🪛 Hadolint (2.14.0)

[info] 75-75: Avoid use of wget without progress bar. Use wget --progress=dot:giga <url>. Or consider using -q or -nv (shorthands for --quiet or --no-verbose).

(DL3047)

🤖 Prompt for AI Agents
In `@Dockerfile` around lines 74 - 78, The RUN step invokes ./llvm.sh with a
hardcoded "21"; change it to use the build arg variable so it honors overrides
and matches the symlink logic—invoke ./llvm.sh ${LLVM_VERSION} (or quoted
"${LLVM_VERSION}") instead of ./llvm.sh 21 and ensure the ARG LLVM_VERSION is
defined earlier in the Dockerfile; update the command that calls llvm.sh (the
llvm.sh invocation in the RUN block) so the same ${LLVM_VERSION} value is used
throughout.

&& rm -rf /var/lib/apt/lists/*

Expand Down
18 changes: 9 additions & 9 deletions Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ ARG MARCH_FLAG=""
ARG WEBKIT_RELEASE_TYPE=Release
ARG CPU=native
ARG LTO_FLAG="-flto=full -fwhole-program-vtables -fforce-emit-vtables "
ARG LLVM_VERSION="19"
ARG LLVM_VERSION="21"
ARG DEFAULT_CFLAGS="-mno-omit-leaf-frame-pointer -g -fno-omit-frame-pointer -ffunction-sections -fdata-sections -faddrsig -fno-unwind-tables -fno-asynchronous-unwind-tables -DU_STATIC_IMPLEMENTATION=1 "

FROM alpine:3.21 as base
FROM alpine:3.23 as base

ARG MARCH_FLAG
ARG WEBKIT_RELEASE_TYPE
Expand All @@ -15,13 +15,13 @@ ARG LLVM_VERSION
ARG DEFAULT_CFLAGS

RUN apk update
RUN apk add --no-cache cmake make clang19 clang19-static clang19-dev llvm19-dev llvm19-static musl-dev git lld libgcc gcc g++ libstdc++ build-base lld-dev llvm19-libs libc-dev xz zlib zlib-dev libxml2 libxml2-dev
RUN apk add --no-cache cmake make clang21 clang21-static clang21-dev llvm21-dev llvm21-static musl-dev git lld libgcc gcc g++ libstdc++ build-base lld-dev llvm21-libs libc-dev xz zlib zlib-dev libxml2 libxml2-dev
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

ENV CXX=clang++-19
ENV CC=clang-19
ENV LDFLAGS='-L/usr/include -L/usr/include/llvm19'
ENV CXXFLAGS="-I/usr/include -I/usr/include/llvm19"
ENV PATH="/usr/bin:/usr/local/bin:/zig/bin:/usr/lib/llvm19/bin:$PATH"
ENV CXX=clang++-21
ENV CC=clang-21
ENV LDFLAGS='-L/usr/include -L/usr/include/llvm21'
ENV CXXFLAGS="-I/usr/include -I/usr/include/llvm21"
ENV PATH="/usr/bin:/usr/local/bin:/zig/bin:/usr/lib/llvm21/bin:$PATH"
Comment on lines +20 to +24

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Parameterize toolchain env vars with LLVM_VERSION.

This avoids drift if the LLVM version is bumped again.

♻️ Proposed refactor
-ENV CXX=clang++-21
-ENV CC=clang-21
-ENV LDFLAGS='-L/usr/include -L/usr/include/llvm21'
-ENV CXXFLAGS="-I/usr/include -I/usr/include/llvm21"
-ENV PATH="/usr/bin:/usr/local/bin:/zig/bin:/usr/lib/llvm21/bin:$PATH"
+ENV CXX=clang++-${LLVM_VERSION}
+ENV CC=clang-${LLVM_VERSION}
+ENV LDFLAGS="-L/usr/include -L/usr/include/llvm${LLVM_VERSION}"
+ENV CXXFLAGS="-I/usr/include -I/usr/include/llvm${LLVM_VERSION}"
+ENV PATH="/usr/bin:/usr/local/bin:/zig/bin:/usr/lib/llvm${LLVM_VERSION}/bin:$PATH"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ENV CXX=clang++-21
ENV CC=clang-21
ENV LDFLAGS='-L/usr/include -L/usr/include/llvm21'
ENV CXXFLAGS="-I/usr/include -I/usr/include/llvm21"
ENV PATH="/usr/bin:/usr/local/bin:/zig/bin:/usr/lib/llvm21/bin:$PATH"
ENV CXX=clang++-${LLVM_VERSION}
ENV CC=clang-${LLVM_VERSION}
ENV LDFLAGS="-L/usr/include -L/usr/include/llvm${LLVM_VERSION}"
ENV CXXFLAGS="-I/usr/include -I/usr/include/llvm${LLVM_VERSION}"
ENV PATH="/usr/bin:/usr/local/bin:/zig/bin:/usr/lib/llvm${LLVM_VERSION}/bin:$PATH"
🤖 Prompt for AI Agents
In `@Dockerfile.musl` around lines 20 - 24, Add an LLVM_VERSION env var and use it
to parameterize the toolchain settings: replace hard-coded "21" in the CXX and
CC ENV values and the llvm21 paths in LDFLAGS, CXXFLAGS, and PATH with the
LLVM_VERSION substitution (referencing the ENV names CXX, CC, LDFLAGS, CXXFLAGS,
PATH and the new ENV LLVM_VERSION) so bumping LLVM only requires updating
LLVM_VERSION.

ENV CPU=${CPU}
ENV MARCH_FLAG=${MARCH_FLAG}
ENV WEBKIT_OUT_DIR=/webkitbuild
Expand Down Expand Up @@ -66,7 +66,7 @@ ARG LTO_FLAG
ARG LLVM_VERSION
ARG DEFAULT_CFLAGS

RUN apk add --no-cache cpio curl file gnupg ninja ruby unzip rsync perl python3 openssl-dev openssl linux-headers
RUN apk add --no-cache cpio curl file gnupg ninja ruby ruby-getoptlong unzip rsync perl python3 openssl-dev openssl linux-headers

ENV WEBKIT_OUT_DIR=/webkitbuild
# These are unnecessary on musl
Expand Down
1 change: 1 addition & 0 deletions Source/bmalloc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ endif ()

if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
list(APPEND bmalloc_SOURCES
bmalloc/LibcxxHashMemoryShim.cpp
bmalloc/TZoneLog.cpp
)
endif ()
Expand Down
40 changes: 40 additions & 0 deletions Source/bmalloc/bmalloc/LibcxxHashMemoryShim.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* LLVM 21's libc++ moved std::__hash_memory from an inline function to an
* external symbol exported from libc++.dylib (llvm/llvm-project#127040).
* On macOS, the system /usr/lib/libc++.1.dylib doesn't have this symbol,
* causing link failures and runtime crashes.
*
* This shim provides the missing symbol using libc++'s own cityhash
* implementation (which is still available in the headers).
*
* See: https://github.com/llvm/llvm-project/issues/77653
* TODO: Remove this when the system libc++ on our minimum macOS version
* includes __hash_memory, or when LLVM fixes the driver (issue #77653).
*/

#if defined(__APPLE__)

#include <__config>
#include <__functional/hash.h>
#include <cstddef>

#if _LIBCPP_VERSION >= 220000
#error "LLVM 22+ detected. Check if __hash_memory is still missing from the system libc++.dylib. " \
"If the symbol is now available (or LLVM fixed issue #77653), remove this shim."
#endif

#if _LIBCPP_AVAILABILITY_HAS_HASH_MEMORY

_LIBCPP_BEGIN_NAMESPACE_STD

[[__gnu__::__pure__]]
_LIBCPP_EXPORTED_FROM_ABI
size_t __hash_memory(_LIBCPP_NOESCAPE const void* __ptr, size_t __size) _NOEXCEPT {
return __murmur2_or_cityhash<size_t>()(__ptr, __size);
}

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP_AVAILABILITY_HAS_HASH_MEMORY

#endif // __APPLE__
4 changes: 2 additions & 2 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ const HAS_CCACHE = CCACHE !== null;
// On Windows, use clang-cl for MSVC compatibility
const CC_BASE = IS_WINDOWS
? findExecutable(["clang-cl.exe", "clang-cl"]) || "clang-cl"
: findExecutable(["clang-19", "clang"]) || "clang";
: findExecutable(["clang-21", "clang"]) || "clang";
const CXX_BASE = IS_WINDOWS
? findExecutable(["clang-cl.exe", "clang-cl"]) || "clang-cl"
: findExecutable(["clang++-19", "clang++"]) || "clang++";
: findExecutable(["clang++-21", "clang++"]) || "clang++";

const CC = HAS_CCACHE ? CCACHE : CC_BASE;
const CXX = HAS_CCACHE ? CCACHE : CXX_BASE;
Expand Down
2 changes: 1 addition & 1 deletion mac-release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -euxo pipefail
THIS_DIR=$(pwd)

# Set default values for environment variables that are not set.
CMAKE_C_COMPILER=${CMAKE_C_COMPILER:-clang-19}
CMAKE_C_COMPILER=${CMAKE_C_COMPILER:-clang-21}
CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER:-clang++}
Comment on lines +12 to 13

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent compiler version specification between C and C++ compilers.

CMAKE_C_COMPILER defaults to clang-21 (version-specific), but CMAKE_CXX_COMPILER defaults to clang++ (generic). This could result in mixing different compiler versions if clang++ resolves to a different LLVM version on the system.

Proposed fix
 CMAKE_C_COMPILER=${CMAKE_C_COMPILER:-clang-21}
-CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER:-clang++}
+CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER:-clang++-21}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
CMAKE_C_COMPILER=${CMAKE_C_COMPILER:-clang-21}
CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER:-clang++}
CMAKE_C_COMPILER=${CMAKE_C_COMPILER:-clang-21}
CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER:-clang++-21}
🤖 Prompt for AI Agents
In `@mac-release.bash` around lines 12 - 13, The defaults for the compilers are
inconsistent: CMAKE_C_COMPILER is version-pinned to clang-21 while
CMAKE_CXX_COMPILER is unpinned (clang++), which may mix toolchain versions;
update the CMAKE_CXX_COMPILER default to match the C compiler (use the same
versioned binary, e.g., clang++-21) so both CMAKE_C_COMPILER and
CMAKE_CXX_COMPILER use the same compiler version, or alternatively make both
unversioned—change the default assignment for CMAKE_CXX_COMPILER in
mac-release.bash accordingly.

CMAKE_C_FLAGS=${CMAKE_C_FLAGS:-}
CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS:-}
Expand Down
Loading