scons: support --linker="mold" for gcc < 12.

Now, to use mold linker for gcc prior to version 12.1.0, you need
to manually set the LINKFLAGS_EXTRA scons variable. This is because
older gcc doesn't support "-fuse-ld=mold" option.

To make it more convenient for users, this patch adds support for
'--linker="mold"' option for older versions of gcc. A -B option will
be passed to gcc automatically if '/usr/libexec/mold' or
'/usr/local/libexec/mold' exist.


Change-Id: Id1cd780d98c39fc837066d826a9ff942579748fe
Tested-by: kokoro <>
Reviewed-by: Jason Lowe-Power <>
Maintainer: Jason Lowe-Power <>
1 file changed