[Toybox] Where does the dynamic linker live in cross compile toolchains?

enh enh at google.com
Tue Jul 21 18:13:44 UTC 2026


On Mon, Jul 20, 2026 at 7:33 PM Rob Landley <rob at landley.net> wrote:
>
> On 7/20/26 13:51, enh wrote:
> > On Sun, Jul 19, 2026 at 5:57 PM Rob Landley via Toybox
> > <toybox at lists.landley.net> wrote:
> >>
> >> I'm trying to update mkroot/packages/dynamic and in theory I can
> >> ${CROSS_COMPILE}cc --print-file-name=libc.so and then copy all the
> >> shared libraries and symlinks out of that directory, but I don't know
> >> how to find and install the dynamic linker out of a compiler toolchain.
> >
> > you can't, because it's not there.
>
> And you wonder why I've only been able to test static linked binaries
> all this time. :(

the usual trick is to just run android in an emulator. (an x86-64 one,
so it's virtualized.)

> >> In musl-libc it's a symlink to libc.so so I can just do that, and I've
> >> got to admit I don't care about glibc that much, but I can't find the
> >> dynamic linker binary anywhere under the Android NDK?
> >>
> >> Bionic's libc.so is executable so maybe it pulls the same trick, but I
> >> have yet to find a way to invoke it that isn't an immediate segfault
> >> so... dunno?
> >
> > no, /system/bin/linker (for ilp32) or /system/bin/linker64 on the
> > device are the dynamic linker for that device's version of the os.
>
> I can find the paths it expects them at with readelf -a, but couldn't
> figure out what to put/link there. Alas, now I know why...
>
> Is there an obvious way to build bionic from source as a standalone
> package? I've presumably built it as part of the whole AOSP
> constellation way back when, but I've been using the NDK as an excuse
> not to ship an LLVM+bionic toolchain in https://landley.net/bin/toolchains.

https://en.wiktionary.org/wiki/jein --- you can check out a subset of
aosp, but the subset's quite large, and there's no publicly-maintained
manifest for that. (there's no internal one either, but the internal
"art only" one is close-ish.)

but bionic on the host isn't really supported anyway ... i use it
personally for a lot of my testing/benchmarking but i'm definitely in
"if i break it, i already own it anyway" territory :-)

> I should really re-engage with llvm toolchain builds, especially now the
> hexagon guys have updated
> https://git.kernel.org/pub/scm/linux/kernel/git/bcain/linux.git/tree/Documentation/arch/hexagon/qemu-boot.rst?h=hexagon-qemu-boot-04-july-2026
> I'm trying to chip away at that again. I think you linked me to the NDK
> build repo once upon a time, and should probably dig back through old
> email to find it, although what I'd _want_ to do is combine the two LLVM
> builds into one build, which seems unlikely to be easy but I've done
> worse...

eh, we upstream everything so a recent enough upstream llvm should be
fine from that perspective; all the specific ndk repo really gets you
is "we've tested this, and know that the x86-64 support is good enough
for all of google, and arm64 good enough that we couldn't find a
problem with it [or have at least reverted/backported relevant
patches]".

> Rob


More information about the Toybox mailing list