diff options
Diffstat (limited to 'scripts/build/cc/gcc.sh')
-rw-r--r-- | scripts/build/cc/gcc.sh | 94 |
1 files changed, 74 insertions, 20 deletions
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index 275e239c..57f5f222 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -43,7 +43,7 @@ cc_gcc_lang_list() { [ "${CT_CC_LANG_CXX}" = "y" ] && lang_list+=",c++" [ "${CT_CC_LANG_FORTRAN}" = "y" ] && lang_list+=",fortran" [ "${CT_CC_LANG_ADA}" = "y" ] && lang_list+=",ada" - [ "${CT_CC_LANG_D}" = "y" ] && lang_list+=",d" + [ "${CT_CC_LANG_D}" = "y" ] && lang_list+=",d" [ "${CT_CC_LANG_JAVA}" = "y" ] && lang_list+=",java" [ "${CT_CC_LANG_JIT}" = "y" ] && lang_list+=",jit" [ "${CT_CC_LANG_OBJC}" = "y" ] && lang_list+=",objc" @@ -282,6 +282,7 @@ do_gcc_core_backend() { gcc_build|gcc_host) CT_DoLog EXTRA "Configuring final gcc compiler" extra_config+=( "${CT_CC_SYSROOT_ARG[@]}" ) + extra_config+=( "--with-headers=${CT_PREFIX_DIR}/${CT_TARGET}/include" ) extra_user_config=( "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" ) log_txt="final gcc compiler" # to inhibit the libiberty and libgcc tricks later on @@ -388,16 +389,32 @@ do_gcc_core_backend() { "") extra_config+=("--disable-libstdcxx-verbose");; esac + if [ "${build_libstdcxx}" = "yes" ]; then + if [ "x${CT_CC_GCC_LIBSTDCXX}" = "x" ]; then + build_libstdcxx="no" + elif [ "${CT_CC_GCC_LIBSTDCXX}" = "y" ]; then + extra_config+=("--enable-libstdcxx") + fi + + if [ "${CT_LIBC_AVR_LIBC}" = "y" ]; then + extra_config+=("--enable-cstdio=stdio_pure") + fi + + if [ "${CT_CC_GCC_LIBSTDCXX_HOSTED_DISABLE}" = "y" ]; then + extra_config+=("--disable-libstdcxx-hosted") + fi + fi + if [ "${build_libstdcxx}" = "no" ]; then extra_config+=(--disable-libstdcxx) fi if [ "${CT_LIBC_PICOLIBC}" = "y" ]; then - extra_config+=("--with-default-libc=picolibc") - extra_config+=("--enable-stdio=pure") - if [ "${CT_PICOLIBC_older_than_1_8}" = "y" ]; then - extra_config+=("--disable-wchar_t") - fi + extra_config+=("--with-default-libc=picolibc") + extra_config+=("--enable-stdio=pure") + if [ "${CT_PICOLIBC_older_than_1_8}" = "y" ]; then + extra_config+=("--disable-wchar_t") + fi fi core_LDFLAGS+=("${ldflags}") @@ -494,6 +511,12 @@ do_gcc_core_backend() { *) extra_config+=( "--enable-decimal-float=${CT_CC_GCC_DEC_FLOATS}" );; esac + if [ "${CT_CC_GCC_ENABLE_PLUGINS}" = "y" ]; then + extra_config+=( --enable-plugin ) + else + extra_config+=( --disable-plugin ) + fi + case "${CT_ARCH}" in mips) case "${CT_CC_GCC_mips_llsc}" in @@ -528,6 +551,22 @@ do_gcc_core_backend() { "") extra_config+=("--disable-tls");; esac + # In baremetal, we only build the Ada compiler without its runtime. + # The runtime will need to be provided externaly by the user. + if [ "${mode}" = "baremetal" \ + -a "${CT_CC_LANG_ADA}" = "y" \ + ]; then + extra_config+=("--disable-libada" ) + fi + + # In baremetal, we only build the D compiler without its runtime. + # The runtime will need to be provided externaly by the user. + if [ "${mode}" = "baremetal" \ + -a "${CT_CC_LANG_D}" = "y" \ + ]; then + extra_config+=("--disable-libphobos" ) + fi + # Some versions of gcc have a defective --enable-multilib. # Since that's the default, only pass --disable-multilib. For multilib, # also enable multiarch. Without explicit --enable-multiarch, core @@ -680,9 +719,7 @@ do_gcc_core_backend() { else # build_libgcc core_targets=( gcc ) fi # ! build libgcc - if [ "${build_libstdcxx}" = "yes" \ - -a "${CT_CC_LANG_CXX}" = "y" \ - ]; then + if [ "${build_libstdcxx}" = "yes" ]; then core_targets+=( target-libstdc++-v3 ) fi @@ -710,6 +747,14 @@ do_gcc_core_backend() { CT_DoLog EXTRA "Building ${log_txt}" CT_DoExecLog ALL make ${CT_JOBSFLAGS} ${core_targets_all} + # In case of baremetal, the gnat* tools are not built automatically. + if [ "${mode}" = "baremetal" \ + -a "${CT_CC_LANG_ADA}" = "y" \ + ]; then + CT_DoLog EXTRA "Building gnattools for baremetal" + CT_DoExecLog ALL make -C gcc ${CT_JOBSFLAGS} cross-gnattools + fi + # Do not pass ${CT_JOBSFLAGS} here: recent GCC builds have been failing # in parallel 'make install' at random locations: libitm, libcilk, # always for the files that are installed more than once to the same @@ -785,9 +830,7 @@ do_cc_for_build() { # lack of such a compiler, but better safe than sorry... build_final_opts+=( "mode=baremetal" ) build_final_opts+=( "build_libgcc=yes" ) - if [ "${CT_LIBC_NONE}" != "y" ]; then - build_final_opts+=( "build_libstdcxx=yes" ) - fi + build_final_opts+=( "build_libstdcxx=yes" ) build_final_opts+=( "build_libgfortran=yes" ) if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then build_final_opts+=( "build_staticlinked=yes" ) @@ -870,15 +913,14 @@ do_cc_for_host() { final_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) final_opts+=( "lang_list=$( cc_gcc_lang_list )" ) final_opts+=( "build_step=gcc_host" ) + final_opts+=( "extra_cxxflags_for_target=${CT_CC_GCC_LIBSTDCXX_TARGET_CXXFLAGS}" ) if [ "${CT_BUILD_MANUALS}" = "y" ]; then final_opts+=( "build_manuals=yes" ) fi if [ "${CT_BARE_METAL}" = "y" ]; then final_opts+=( "mode=baremetal" ) final_opts+=( "build_libgcc=yes" ) - if [ "${CT_LIBC_NONE}" != "y" ]; then - final_opts+=( "build_libstdcxx=yes" ) - fi + final_opts+=( "build_libstdcxx=yes" ) final_opts+=( "build_libgfortran=yes" ) if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then final_opts+=( "build_staticlinked=yes" ) @@ -1050,16 +1092,24 @@ do_gcc_backend() { "") extra_config+=("--disable-libstdcxx-verbose");; esac - if [ "${build_libstdcxx}" = "no" ]; then + if [ "x${CT_CC_GCC_LIBSTDCXX}" = "x" ]; then extra_config+=(--disable-libstdcxx) - elif [ "${CT_CC_GCC_EXTRA_LIBSTDCXX}" = "y" ]; then + elif [ "${CT_CC_GCC_LIBSTDCXX}" = "y" ]; then extra_config+=(--enable-libstdcxx) fi + if [ "${CT_CC_GCC_LIBSTDCXX_HOSTED_DISABLE}" = "y" ]; then + extra_config+=("--disable-libstdcxx-hosted") + fi + + if [ "${CT_LIBC_AVR_LIBC}" = "y" ]; then + extra_config+=("--enable-cstdio=stdio_pure") + fi + if [ "${CT_LIBC_PICOLIBC}" = "y" ]; then - extra_config+=("--with-default-libc=picolibc") - extra_config+=("--enable-stdio=pure") - extra_config+=("--disable-wchar_t") + extra_config+=("--with-default-libc=picolibc") + extra_config+=("--enable-stdio=pure") + extra_config+=("--disable-wchar_t") fi final_LDFLAGS+=("${ldflags}") @@ -1126,6 +1176,10 @@ do_gcc_backend() { fi fi + if [ "${CT_CC_GCC_ENABLE_DEFAULT_PIE}" = "y" ]; then + extra_config+=("--enable-default-pie") + fi + if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ] || \ [ "${enable_optspace}" = "yes" ]; then extra_config+=("--enable-target-optspace") |