You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
elf: native backend has no default library search path (can't find libgcc_s/libc) #116
reld's native ELF backend can't link a real Rust build because it has no default system library search paths — it only searches the -L directories rustc passes (the rust sysroot + build-script raw-dylibs).
reld: error: Couldn't find library `gcc_s` on library search path
The linker command links -lgcc_s -lutil -lrt -lpthread -lm -ldl -lc, but reld never finds libgcc_s.so/libc.so/etc. because the gcc driver (which normally supplies those system search paths) is bypassed when reld is the direct linker.
Why
args.lib_search_path() is populated only by -L (see args/elf.rs). Unlike mold/lld, reld adds no host/toolchain default search paths (e.g. /usr/lib/x86_64-linux-gnu, /lib/x86_64-linux-gnu, the gcc install's lib and lib/gcc/<triple>/<ver> dirs). The -B<…>/gcc-ld flag rustc passes (which would point at the toolchain) is currently a no-op.
Fix
Derive default library search paths the way a real linker does:
honor -B <prefix> / --sysroot to locate the toolchain's lib and lib/gcc/<triple>/<ver>,
plus a host-appropriate default list (/usr/lib/x86_64-linux-gnu, /lib/x86_64-linux-gnu, /usr/local/lib, …), and/or LIBRARY_PATH.
This is the next blocker after the flag-parsing fix (#115); after it, the remaining work is verifying reld's relocation/dynamic-linking paths actually produce a runnable binary.
Same root cause and resolution as #117. reld is a pure linker; it does not (and should not) maintain its own default library search paths. When driven through clang (clang --ld-path=reld), the driver passes the -L search paths and CRT, so -lgcc_s/-lc resolve without reld adding defaults of its own.
The correct integration is the soldr-side fix soldr#3261, not reld-side search-path injection (which would diverge from lld/mold/wild).
Activity
zackees commentedon Sep 16, 2026
Same root cause and resolution as #117. reld is a pure linker; it does not (and should not) maintain its own default library search paths. When driven through clang (
clang --ld-path=reld), the driver passes the-Lsearch paths and CRT, so-lgcc_s/-lcresolve without reld adding defaults of its own.The correct integration is the soldr-side fix soldr#3261, not reld-side search-path injection (which would diverge from lld/mold/wild).