%rename cpp_options old_cpp_options

*cpp_options:
-nostdinc -isystem %:getenv(MUSL_SYSROOT /include) -isystem include%s %(old_cpp_options)

*cc1:
%(cc1_cpu) -nostdinc -isystem %:getenv(MUSL_SYSROOT /include) -isystem include%s

*link_libgcc:
-L%:getenv(MUSL_SYSROOT /lib) -L .%s

*libgcc:
libgcc.a%s %:if-exists(libgcc_eh.a%s)

*startfile:
%{static-pie: %:getenv(MUSL_SYSROOT /lib/rcrt1.o); !shared: %:getenv(MUSL_SYSROOT /lib/Scrt1.o)} %:getenv(MUSL_SYSROOT /lib/crti.o) crtbeginS.o%s

*endfile:
crtendS.o%s %:getenv(MUSL_SYSROOT /lib/crtn.o)

*link:
%{!r:--build-id} \
--hash-style=gnu \
%{static-pie: -no-dynamic-linker -pie; !static: -dynamic-linker /lib/ld-musl-%:getenv(MUSL_ARCH).so.1} \
-nostdlib \
%{shared:-shared} \
%{static|static-pie:-static} \
%{rdynamic:-export-dynamic} \
%{!static: -eh-frame-hdr}

*esp_link:


*esp_options:


*esp_cpp_options:


