Commit 87ee799
build-logic: link sanitizer runtime for the fuzzer shared lib (#646)
commonLinuxLinkerArgs() carries -Wl,-z,defs, which forbids undefined
symbols in the output. The fuzzer objects are instrumented with
-fsanitize=address,undefined and therefore reference __asan_*/__ubsan_*,
but -fsanitize=address only links the sanitizer runtime into
*executables*, not shared libraries. So the fuzzer .so ends up with
undefined __asan_*/__ubsan_* and the link fails under -z defs on any box
where the fuzzer config is active (clang with libFuzzer, non-musl).
The asan config already solves this by linking the matching runtime
explicitly via locateLibasan (-lclang_rt.asan-<arch> on clang, which also
provides UBSan symbols; -lasan + -lubsan on gcc). Apply the same,
already-proven treatment to configureFuzzer: thread the detected compiler
through and add the runtime to the Linux linker args.
CI never hit this because its publish/build path passes
--exclude-task compileFuzzer and only assembles the release jar, so the
fuzzer is never linked there. It only bites a local build that links all
active configs (e.g. publishToMavenLocal on a clang box). The macOS branch
is unchanged.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent e22b8f9 commit 87ee799
1 file changed
Lines changed: 25 additions & 3 deletions
Lines changed: 25 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | | - | |
| 316 | + | |
| 317 | + | |
317 | 318 | | |
318 | 319 | | |
319 | 320 | | |
| |||
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
342 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
343 | 365 | | |
344 | 366 | | |
345 | 367 | | |
| |||
0 commit comments