build/toolchain/musl-host-gcc: handle non-workspace-root execution

This is needed to build stdlib with cgo, which is in turn required for
the race checker to be enabled.

Change-Id: Ic81542925a02c626f157dfd8c6650de3dbb30c7d
Reviewed-on: https://review.monogon.dev/c/monogon/+/1832
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/build/toolchain/musl-host-gcc/musl.spec b/build/toolchain/musl-host-gcc/musl.spec
index 376d0d9..c726fe5 100644
--- a/build/toolchain/musl-host-gcc/musl.spec
+++ b/build/toolchain/musl-host-gcc/musl.spec
@@ -1,25 +1,25 @@
 %rename cpp_options old_cpp_options
 
 *cpp_options:
--nostdinc %(old_cpp_options) -isystem external/musl_sysroot/include
+-nostdinc %(old_cpp_options) -isystem $SYSROOT/include
 
 *cc1:
-%(cc1_cpu) -nostdinc -isystem external/musl_sysroot/include
+%(cc1_cpu) -nostdinc -isystem $SYSROOT/include
 
 *link_libgcc:
--L .%s -L external/musl_sysroot/lib
+-L .%s -L %R/lib
 
 *libgcc:
 libgcc.a%s %:if-exists(libgcc_eh.a%s)
 
 *startfile:
-%{!shared: external/musl_sysroot/lib/Scrt1.o} external/musl_sysroot/lib/crti.o crtbeginS.o%s
+%{!shared: %R/lib/Scrt1.o} %R/lib/crti.o crtbeginS.o%s
 
 *endfile:
-crtendS.o%s external/musl_sysroot/lib/crtn.o
+crtendS.o%s %R/lib/crtn.o
 
 *link:
--nostdlib -no-dynamic-linker -static %{rdynamic:-export-dynamic}
+-no-dynamic-linker -nostdlib -static %{rdynamic:-export-dynamic}
 
 *esp_link: