Zig fails to cache linker warnings #30563

Open
opened 2025-12-22 08:18:34 +01:00 by sagehane · 0 comments

Version

Tested most recently on the following:

$ zig version
0.16.0-dev.1484+d0ba6642b

Has been an issue since at least 0.13.0 and probably far earlier.

Relevant GitHub issues and comments

Disparity between self-hosted and LLD linker

The reason why I figured it might be worth migrating the issue to continue the discussion. Could be fleshed out as its own issue, I guess.

I noticed that the self-hosted x86_64 linker behaves differently from the LLD:

main.zig:

pub const _start = {};
$ zig build-exe -fno-lld main.zig
$ zig build-exe -fllvm -flld main.zig # LLD not compatible with the self-hosted backend
warning(link): unexpected LLD stderr:
ld.lld: warning: cannot find entry symbol _start; not setting start address
### Version Tested most recently on the following: ``` $ zig version 0.16.0-dev.1484+d0ba6642b ``` Has been an issue since at least `0.13.0` and probably far earlier. ### Relevant GitHub issues and comments - https://github.com/ziglang/zig/issues/21416 (direct duplicate to migrate) - https://github.com/ziglang/zig/issues/14962#issuecomment-2126663571 - https://github.com/ziglang/zig/issues/10800 (About C warnings and not linkers, but the discussion on whether the build system should attempt to cache warnings or instead convert warnings to errors is relevant) ### Disparity between self-hosted and LLD linker The reason why I figured it might be worth migrating the issue to continue the discussion. Could be fleshed out as its own issue, I guess. I noticed that the self-hosted x86_64 linker behaves differently from the LLD: `main.zig`: ```zig pub const _start = {}; ``` ```sh-session $ zig build-exe -fno-lld main.zig ``` ```sh-session $ zig build-exe -fllvm -flld main.zig # LLD not compatible with the self-hosted backend warning(link): unexpected LLD stderr: ld.lld: warning: cannot find entry symbol _start; not setting start address ```
Sign in to join this conversation.
No labels
abi/f32
abi/ilp32
abi/n32
abi/sf
abi/x32
accepted
arch/1750a
arch/21k
arch/6502
arch/a29k
arch/aarch64
arch/alpha
arch/amdgcn
arch/arc
arch/arc32
arch/arc64
arch/arm
arch/avr
arch/avr32
arch/bfin
arch/bpf
arch/clipper
arch/colossus
arch/cr16
arch/cris
arch/csky
arch/dlx
arch/dsp16xx
arch/elxsi
arch/epiphany
arch/fr30
arch/frv
arch/h8300
arch/h8500
arch/hexagon
arch/hppa
arch/hppa64
arch/i370
arch/i860
arch/i960
arch/ia64
arch/ip2k
arch/kalimba
arch/kvx
arch/lanai
arch/lm32
arch/loongarch32
arch/loongarch64
arch/m32r
arch/m68k
arch/m88k
arch/maxq
arch/mcore
arch/metag
arch/microblaze
arch/mips
arch/mips64
arch/mmix
arch/mn10200
arch/mn10300
arch/moxie
arch/mrisc32
arch/msp430
arch/nds32
arch/nios2
arch/ns32k
arch/nvptx
arch/or1k
arch/pdp10
arch/pdp11
arch/pj
arch/powerpc
arch/powerpc64
arch/propeller
arch/riscv32
arch/riscv64
arch/rl78
arch/rx
arch/s390
arch/s390x
arch/sh
arch/sh64
arch/sparc
arch/sparc64
arch/spirv
arch/spu
arch/st200
arch/starcore
arch/tilegx
arch/tilepro
arch/tricore
arch/ts
arch/v850
arch/vax
arch/vc4
arch/ve
arch/wasm
arch/we32k
arch/x86
arch/x86_16
arch/x86_64
arch/xcore
arch/xgate
arch/xstormy16
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/aix
os/android
os/bridgeos
os/contiki
os/dragonfly
os/driverkit
os/emscripten
os/freebsd
os/fuchsia
os/haiku
os/hermit
os/hurd
os/illumos
os/ios
os/kfreebsd
os/linux
os/maccatalyst
os/macos
os/managarm
os/netbsd
os/ohos
os/openbsd
os/plan9
os/redox
os/rtems
os/serenity
os/solaris
os/tvos
os/uefi
os/visionos
os/wali
os/wasi
os/watchos
os/windows
os/zos
proposal
release notes
testing
tier system
zig cc
zig fmt
bounty
bug
contributor-friendly
downstream
enhancement
infra
optimization
question
regression
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ziglang/zig#30563
No description provided.