From d65c062a42bb906981aeed7c2739944937172c09 Mon Sep 17 00:00:00 2001 From: midipix Date: May 31 2021 09:58:19 +0000 Subject: build system: configure: config_host(): added freestanding environment support. --- diff --git a/configure b/configure index 725cd6f..f770ae1 100755 --- a/configure +++ b/configure @@ -859,8 +859,22 @@ config_host() mb_cfghost_cflags="${mb_cfghost_cflags#*: }" - printf 'int main(void){return 0;}' \ - > "$mb_cfghost_tmpname" + if [ $mb_cc_environment = 'freestanding' ]; then + if [ -z "mb_cc_underscore" ]; then + mb_cfghost_start_fn='_start' + else + mb_cfghost_start_fn='start' + fi + + printf 'int %s(void){return 0;}' "$mb_cfghost_start_fn" \ + > "$mb_cfghost_tmpname" + + mb_cfghost_cflags="$mb_cfghost_cflags -ffreestanding" + mb_cfghost_cflags="$mb_cfghost_cflags -nostdlib" + else + printf 'int main(void){return 0;}' \ + > "$mb_cfghost_tmpname" + fi # log printf '\n' >&3