Update builders to clang 20
Categories
(Firefox Build System :: Toolchains, task)
Tracking
(firefox146 wontfix, firefox147 fixed)
People
(Reporter: glandium, Assigned: glandium)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
(when it's released)
| Assignee | ||
Updated•7 months ago
|
Comment 1•2 months ago
|
||
This change adds support for building Firefox with Clang 20, including
critical fixes for the clang-plugin dynamic linking on Windows.
Clang 20 introduced two breaking changes that prevented the clang-plugin
from loading on Windows:
-
The CLANG_ABI macro was added to Attr classes, causing inline methods
like classof() and getAnnotation() to generate dllimport references.
This fails because these methods are defined inline in headers, not
exported from the DLL. -
The extract_symbols.py script became more aggressive in filtering
symbols, blocking the Registry<PluginASTAction> static data members
(Head/Tail) that don't match function signature patterns.
The fix consists of three patches for the Clang 20 build:
-
add-plugin-symbols_clang_20.patch: Whitelists the Registry Head/Tail
symbols in extract_symbols.py to bypass the filtering logic. -
force-plugin-symbols_clang_20.patch: Uses /INCLUDE linker flags to
force the Registry add_node() and begin() symbols into clang.exe,
since they exist in libraries but weren't being linked due to being
unreferenced. -
remove-clang-abi-from-attrs_clang_20.patch: Removes the CLANG_ABI
macro from Attr class generation to prevent dllimport issues with
inline methods.
Additional changes:
-
Fixed toolchain.configure to accept clang-cl as a valid compiler for
the WASI target, deriving the clang.exe path when needed. Previously,
only "clang" was accepted, causing configuration failures on Windows
where clang-cl is the default. -
Modified build-clang.py to enable libxml2 for all Windows build stages,
not just the final stage, ensuring it's available during intermediate
builds. -
Fixed moz.build to apply extra_cxxflags even when LLVM_CXXFLAGS is
empty, ensuring -GR- and -EHsc are always applied on Windows.
To test this locally, check out llvm 20.1.8 alongside firefox, then
build clang by running
MOZ_FETCHES_DIR=../firefox python3 ../firefox/build/build-clang/build-clang.py -c ../firefox/build/build-clang/use-clang-cl-artifact.json -c ../firefox/build/build-clang/win64.json -c ../firefox/build/build-clang/clang-20.json -c ../firefox/build/build-clang/2stages.json
After this, update mozconfig to
export CC=[THE LLVM CHECKOUT DIRECTORY]/build/stage2/clang/bin/clang-cl.exe
ac_add_options --enable-clang-plugin
Updated•2 months ago
|
Comment 2•2 months ago
|
||
Hey again Mike,
With some small patches to llvm 20.1.8 it behaves similarly enough to llvm 19 that the plugin works again.
Using patches also allowed me to minimize the changes in build/clang-plugin/moz.build.
Is this useful to you? Should I try to polish this into a submittable change, can you use it in a patch of your own?
Comment 3•2 months ago
|
||
I realize this patch should actually go in 1941482, I'll move it there.
Comment 4•2 months ago
|
||
Comment on attachment 9519448 [details]
Bug 1923255 - Enable Clang 20 support for Firefox with Windows plugin fixes r=glandium
Revision D268255 was moved to bug 1941482. Setting attachment 9519448 [details] to obsolete.
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 5•2 months ago
|
||
Updated•2 months ago
|
| Assignee | ||
Comment 8•2 months ago
•
|
||
This was backed out along bug 1948826
Updated•2 months ago
|
Comment 10•1 month ago
|
||
| bugherder | ||
Updated•1 month ago
|
Description
•