Subject: bug#74217: Bootstrapping Zig with no Binary Blobs

From: Hilton Chain <[email-masked]>
Date: Thu, 14 Nov 2024 09:05:41 +0800

On Thu, 14 Nov 2024 07:40:05 +0800,
Hilton Chain wrote:
>
> On Thu, 14 Nov 2024 02:10:44 +0800,
> Efraim Flashner wrote:
> >
> > > I think this is due to Zig's implemention of its own linking logic, which
> > > bypasses our ld-wrapper.
> >
> > I wonder if switching from lld to make-lld-wrapper would make a
> > difference here.
>
> Thanks for mentioning!  This should do the work!
>
> I thought Zig was using lld as a library for linking.  Just looked at
> src/link/Elf.zig, this is not true, it invokes ld.lld.
>
> I have more time today.  I'll test this out and see if lld-as-ld-wrapper can
> also add glibc RUNPATH.

Zig manages linking to libc seperately, if this approach works, we have to
keep validate-runpath? off for Zig.  Reference to ld.lld can't be patched
since it's both native-inputs (for building Zig) and inputs (for using the
built Zig), maybe we can add a zig-toolchain (zig + lld-wrapper) later?