Repository navigation
Drop .llvm_addrsig in localize_rust_c_symbols.sh so clang-21 builds link - #130174
alexey-milovidov merged 1 commit into
Conversation
With clang/lld 21 (the minimum supported version), a default build fails at the final link of clickhouse: ld.lld-21: error: rust/workspace/lib_ch_rust_skim_rust.a(c16f17691ff6f04b-cxx.o): --icf=safe conservatively ignores SHT_LLVM_ADDRSIG [index 1337] with sh_link=0 (likely created using objcopy or ld -r) and the same for 885040bead2806a0-lib.rs.o (the cxx bridge of skim). clang-21 emits the C++ exception glue (DW.ref.__gxx_personality_v0, __clang_call_terminate) into llvm-libc's memmem.cpp.o; clang-22 does not with the same flags. These two weak symbols are then in the reference set of localize_rust_c_symbols.sh, the cxx bridge objects define them too, so llvm-objcopy-21 localizes them there. Rewriting the symbol table makes the non-empty .llvm_addrsig table stale and objcopy sets its sh_link to 0, which lld --icf=safe reports, and --fatal-warnings turns into an error. GNU objcopy zeroes sh_link on every table it rewrites. Remove the section in both objcopy calls of the script, as strip_rust_symbols.sh already does (ClickHouse#122904). lld then treats these objects conservatively, as it does when it ignores the table. Patch by @ snelheidai in ClickHouse#130064. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review (1 nit).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20261108-161900 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261108-141000 |
|
cc @thevar1able @pamarcos, could you review this and add the |
|
Workflow [PR], commit [385c54f] Summary: ✅
AI ReviewSummaryReviewed #130174 at Missing context / blind spots
Final Verdict✅ Approve. No new inline findings to post. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline. |
5d6ef30
Related: #130064
Related: #126478
Related: #122904
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Building with clang/lld 21, the minimum supported compiler, no longer fails at the final
clickhouselink:cmake/localize_rust_c_symbols.shnow removes the.llvm_addrsigsections thatobjcopyinvalidates, ascmake/strip_rust_symbols.shalready does.Description
A default build with clang/lld 21.1.8 (
cmake -G Ninja -DCMAKE_C_COMPILER=clang-21 -DCMAKE_CXX_COMPILER=clang++-21, RelWithDebInfo,CMAKE_OBJCOPY=llvm-objcopy-21) fails on master:and the same for
885040bead2806a0-lib.rs.o. clang-21 puts the C++ exception glue (DW.ref.__gxx_personality_v0,__clang_call_terminate) into llvm-libc'smemmem.cpp.o(clang-22 does not, with the same flags), so these weak symbols join the localize set. The cxx-bridge objects of skim define them too, and whenllvm-objcopylocalizes them it setssh_linkof their.llvm_addrsigto 0;--fatal-warningsturns lld's warning into an error. CI (clang-22) is not affected.The patch removes the section in both
objcopycalls of the script. lld then treats these objects conservatively, as it does when it ignores the table. Patch by @ snelheidai from #130064.Validation, master vs this PR: the clang-21 build fails / links (no
.llvm_addrsigleft in the 8 localized archives, localization unchanged,clickhouse localruns), and the clang-22 Debug build links both ways. The price is +19 KB of.text(+0.003%) in the clang-22 Debug build and +128 bytes in the clang-21 RelWithDebInfo build.#126478 is independent and still needed: with GNU objcopy this patch removes the addrsig errors too, but the link then fails on
relocation refers to a symbol in a discarded section(DW.ref.rust_eh_personality,__clang_call_terminate), which master already has behind the addrsig errors (measured with clang-21) and which selecting the LLVM objcopy avoids.Workflow [PR]
Sync PR [sync-upstream/pr/130174]
Version info
26.11.1.1700-master(included in26.11and later)