run clean compilation when link inputs change on incremental update #32081
Labels
No labels
abi/f32
abi/ilp32
abi/sf
accepted
arch/21k
arch/6502
arch/aarch64
arch/alpha
arch/amdgcn
arch/arc
arch/arc32
arch/arc64
arch/arm
arch/avr
arch/bfin
arch/bpf
arch/colossus
arch/cris
arch/csky
arch/dlx
arch/epiphany
arch/fr30
arch/frv
arch/hexagon
arch/hppa
arch/hppa64
arch/ia64
arch/kalimba
arch/kvx
arch/lanai
arch/lm32
arch/loongarch32
arch/loongarch64
arch/m32r
arch/m68k
arch/m88k
arch/mcore
arch/microblaze
arch/mips
arch/mips64
arch/mmix
arch/moxie
arch/mrisc32
arch/msp430
arch/nds32
arch/ns32k
arch/nvptx
arch/or1k
arch/powerpc
arch/powerpc64
arch/propeller
arch/riscv32
arch/riscv64
arch/rl78
arch/rx
arch/s390x
arch/sh
arch/sparc
arch/sparc64
arch/spirv
arch/spu
arch/tricore
arch/v850
arch/vax
arch/vc4
arch/ve
arch/wasm
arch/x86
arch/x86_64
arch/xcore
arch/xtensa
autodoc
backend/c
backend/llvm
backend/self-hosted
binutils
breaking
build system
debug info
docs
error message
frontend
fuzzing
incremental
lib/c
lib/compiler-rt
lib/cxx
lib/std
lib/tsan
lib/ubsan-rt
lib/unwind
linking
miscompilation
os/android
os/dragonfly
os/driverkit
os/emscripten
os/freebsd
os/fuchsia
os/haiku
os/hurd
os/illumos
os/ios
os/linux
os/maccatalyst
os/macos
os/managarm
os/netbsd
os/ohos
os/openbsd
os/plan9
os/redox
os/rtems
os/serenity
os/tvos
os/uefi
os/visionos
os/wasi
os/watchos
os/windows
proposal
release notes
testing
zig cc
zig fmt
zig reduce
bounty
bug
contributor-friendly
downstream
enhancement
infra
optimization
question
regression
upstream
use case
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ziglang/zig#32081
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Zig compiler has the concept of the "prelink" phase, which handles all non-incremental inputs (i.e. objects, archives, and shared libraries) are processed before incremental handling of Zig code begins. However, as originally reported in #22501, this has implications for handling incremental updates when link inputs are changed: if a C source file input is modified on an incremental update, the self-hosted linkers will currently fail to handle the change correctly because they have already finish their prelink work.
#22501 suggested solving this by forcing linker implementations to support re-running prelink when link inputs change, but I recall us later agreeing that, at least for now, it would be fine for modification of non-Zig link inputs to force a clean build.
Therefore, the Zig compiler frontend should handle non-incremental link inputs being updated, by including them in the cache manifest when
CacheMode.incrementalis used (and recreating the compilation if the cache check misses). This means no work is required from linker implementations: they can simply assume that all link inputs are non-incremental.Of course, we can (and I suspect ultimately will) consider another enhancement down the line to allow linkers to handle modifications of link inputs while keeping the existing incremental ZCU state. But for now, let's simplify our lives a bit and reduce the risk of exposing users to untested/buggy edge cases.