mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-19 21:07:54 +00:00
Unify core passes
With libc_headers step before pass-1, there is no need to distinguish pass-1 and pass-2; they are configured identically (note that with the current configuration, core pass-2 is only used for win32 - hence, uses build_libgcc=yes and mode=static). Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
parent
93be629f2b
commit
5a0be8b4ec
2
TODO
2
TODO
@ -75,7 +75,7 @@ A (slightly) ordered set of tasks for crosstool-NG. Written in a cryptic languag
|
|||||||
[ ] add passthrough to configure, for host/target
|
[ ] add passthrough to configure, for host/target
|
||||||
[ ] Read/spellcheck configs & scripts
|
[ ] Read/spellcheck configs & scripts
|
||||||
[ ] 'ct-ng olddefconfig'
|
[ ] 'ct-ng olddefconfig'
|
||||||
[ ] Install a "trap" C++ compiler as ${CT_TARGET}-g++ during pass-1/pass-2 to trap attempts to compile target code with g++ (currently glibc detects host g++ and warns that it uses g++ w/o target triplet)
|
[ ] Install a "trap" C++ compiler as ${CT_TARGET}-g++ during core compiler build to trap attempts to compile target code with g++ (currently glibc detects host g++ and warns that it uses g++ w/o target triplet)
|
||||||
[ ] Somehow it needs to be functional during the configure step - export env var while running in CT_DoExecLog with CFG level, and forward it to host compiler?
|
[ ] Somehow it needs to be functional during the configure step - export env var while running in CT_DoExecLog with CFG level, and forward it to host compiler?
|
||||||
[ ] elf2flt not compatible with multiple linkers enabled in binutils (ld.bfd + ld.gold) - fix upstream?
|
[ ] elf2flt not compatible with multiple linkers enabled in binutils (ld.bfd + ld.gold) - fix upstream?
|
||||||
[ ] Companion libs
|
[ ] Companion libs
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
|
|
||||||
menu "C compiler"
|
menu "C compiler"
|
||||||
|
|
||||||
config CC_CORE_PASS_1_NEEDED
|
config CC_CORE_NEEDED
|
||||||
bool
|
|
||||||
|
|
||||||
config CC_CORE_PASS_2_NEEDED
|
|
||||||
bool
|
bool
|
||||||
|
|
||||||
config CC_SUPPORT_CXX
|
config CC_SUPPORT_CXX
|
||||||
|
@ -55,7 +55,7 @@ config CC_GCC_ENABLE_CXX_FLAGS
|
|||||||
config CC_GCC_CORE_EXTRA_CONFIG_ARRAY
|
config CC_GCC_CORE_EXTRA_CONFIG_ARRAY
|
||||||
string "Core gcc extra config"
|
string "Core gcc extra config"
|
||||||
default ""
|
default ""
|
||||||
depends on CC_CORE_PASS_1_NEEDED || CC_CORE_PASS_2_NEEDED
|
depends on CC_CORE_NEEDED
|
||||||
help
|
help
|
||||||
Extra flags to pass onto ./configure when configuring the core gcc.
|
Extra flags to pass onto ./configure when configuring the core gcc.
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
## depends on ! WINDOWS && ! BARE_METAL && ARCH_USE_MMU
|
## depends on ! WINDOWS && ! BARE_METAL && ARCH_USE_MMU
|
||||||
## select LIBC_SUPPORT_THREADS_NATIVE
|
## select LIBC_SUPPORT_THREADS_NATIVE
|
||||||
## select CC_CORE_PASS_1_NEEDED
|
## select CC_CORE_NEEDED
|
||||||
# TBD: select GETTEXT for build only, not for host
|
# TBD: select GETTEXT for build only, not for host
|
||||||
## select GETTEXT_NEEDED
|
## select GETTEXT_NEEDED
|
||||||
## select BINUTILS_FORCE_LD_BFD_DEFAULT
|
## select BINUTILS_FORCE_LD_BFD_DEFAULT
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
##
|
##
|
||||||
## select LIBC_SUPPORT_THREADS_NATIVE
|
## select LIBC_SUPPORT_THREADS_NATIVE
|
||||||
## select LIBC_SUPPORT_THREADS_POSIX
|
## select LIBC_SUPPORT_THREADS_POSIX
|
||||||
## select CC_CORE_PASS_2_NEEDED
|
## select CC_CORE_NEEDED
|
||||||
## select BINUTILS_FORCE_LD_BFD_DEFAULT
|
## select BINUTILS_FORCE_LD_BFD_DEFAULT
|
||||||
##
|
##
|
||||||
## help The de-facto standard for Mingw distributions.
|
## help The de-facto standard for Mingw distributions.
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
## select LIBC_SUPPORT_THREADS_NONE
|
## select LIBC_SUPPORT_THREADS_NONE
|
||||||
## select COMP_TOOLS_AUTOCONF if !CONFIGURE_has_autoconf_2_65_or_newer || !CONFIGURE_has_autoreconf_2_64_or_newer
|
## select COMP_TOOLS_AUTOCONF if !CONFIGURE_has_autoconf_2_65_or_newer || !CONFIGURE_has_autoreconf_2_64_or_newer
|
||||||
## select COMP_TOOLS_AUTOMAKE if !CONFIGURE_has_automake_1_15_or_newer
|
## select COMP_TOOLS_AUTOMAKE if !CONFIGURE_has_automake_1_15_or_newer
|
||||||
## select CC_CORE_PASS_1_NEEDED
|
## select CC_CORE_NEEDED
|
||||||
## select LIBELF_NEEDED
|
## select LIBELF_NEEDED
|
||||||
##
|
##
|
||||||
## help Secure execution runtime for Moxie architecture.
|
## help Secure execution runtime for Moxie architecture.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
## depends on ! WINDOWS && ! BARE_METAL
|
## depends on ! WINDOWS && ! BARE_METAL
|
||||||
## depends on EXPERIMENTAL
|
## depends on EXPERIMENTAL
|
||||||
## select LIBC_SUPPORT_THREADS_NATIVE
|
## select LIBC_SUPPORT_THREADS_NATIVE
|
||||||
## select CC_CORE_PASS_1_NEEDED
|
## select CC_CORE_NEEDED
|
||||||
|
|
||||||
## help Musl is a new standard library to power a new generation of Linux-based
|
## help Musl is a new standard library to power a new generation of Linux-based
|
||||||
## help devices. musl is lightweight, fast, simple, free, and strives to be
|
## help devices. musl is lightweight, fast, simple, free, and strives to be
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
## depends on BARE_METAL
|
## depends on BARE_METAL
|
||||||
## select LIBC_PROVIDES_CXA_ATEXIT
|
## select LIBC_PROVIDES_CXA_ATEXIT
|
||||||
## select LIBC_SUPPORT_THREADS_NONE
|
## select LIBC_SUPPORT_THREADS_NONE
|
||||||
## select CC_CORE_PASS_1_NEEDED
|
## select CC_CORE_NEEDED
|
||||||
|
|
||||||
## help Newlib is a C library intended for use on embedded systems. It is a
|
## help Newlib is a C library intended for use on embedded systems. It is a
|
||||||
## help conglomeration of several library parts, all under free software
|
## help conglomeration of several library parts, all under free software
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
## select LIBC_SUPPORT_THREADS_LT
|
## select LIBC_SUPPORT_THREADS_LT
|
||||||
## select LIBC_SUPPORT_THREADS_NONE
|
## select LIBC_SUPPORT_THREADS_NONE
|
||||||
## select LIBC_SUPPORT_THREADS_NATIVE
|
## select LIBC_SUPPORT_THREADS_NATIVE
|
||||||
## select CC_CORE_PASS_1_NEEDED
|
## select CC_CORE_NEEDED
|
||||||
##
|
##
|
||||||
## help The de-facto standard for embeded linux systems.
|
## help The de-facto standard for embeded linux systems.
|
||||||
## help
|
## help
|
||||||
|
4
ct-ng.in
4
ct-ng.in
@ -268,7 +268,6 @@ build.%:
|
|||||||
# but are actual steps for canadian and cross-native.
|
# but are actual steps for canadian and cross-native.
|
||||||
# Please keep the last line with a '\' and keep the following empty line:
|
# Please keep the last line with a '\' and keep the following empty line:
|
||||||
# it helps when diffing and merging.
|
# it helps when diffing and merging.
|
||||||
# TBD move kernel headers and unify pass_1/pass_2?
|
|
||||||
CT_STEPS := \
|
CT_STEPS := \
|
||||||
companion_tools_for_build \
|
companion_tools_for_build \
|
||||||
companion_libs_for_build \
|
companion_libs_for_build \
|
||||||
@ -277,9 +276,8 @@ CT_STEPS := \
|
|||||||
companion_libs_for_host \
|
companion_libs_for_host \
|
||||||
binutils_for_host \
|
binutils_for_host \
|
||||||
libc_headers \
|
libc_headers \
|
||||||
cc_core_pass_1 \
|
|
||||||
kernel_headers \
|
kernel_headers \
|
||||||
cc_core_pass_2 \
|
cc_core \
|
||||||
libc_main \
|
libc_main \
|
||||||
cc_for_build \
|
cc_for_build \
|
||||||
cc_for_host \
|
cc_for_host \
|
||||||
|
@ -134,7 +134,7 @@ evaluate_multilib_cflags()
|
|||||||
# 1. On MIPS target, gcc (or rather, ld, which it invokes under the hood) chokes
|
# 1. On MIPS target, gcc (or rather, ld, which it invokes under the hood) chokes
|
||||||
# if supplied with two -mabi=* options. I.e., 'gcc -mabi=n32' and 'gcc -mabi=32' both
|
# if supplied with two -mabi=* options. I.e., 'gcc -mabi=n32' and 'gcc -mabi=32' both
|
||||||
# work, but 'gcc -mabi=32 -mabi=n32' produces an internal error in ld. Thus we do
|
# work, but 'gcc -mabi=32 -mabi=n32' produces an internal error in ld. Thus we do
|
||||||
# not supply target's CFLAGS in multilib builds - and after compiling pass-1 gcc,
|
# not supply target's CFLAGS in multilib builds - and after compiling core gcc,
|
||||||
# attempt to determine which CFLAGS need to be filtered out.
|
# attempt to determine which CFLAGS need to be filtered out.
|
||||||
#
|
#
|
||||||
# 2. If "demultilibing" is in effect, create top-level directories for any
|
# 2. If "demultilibing" is in effect, create top-level directories for any
|
||||||
@ -186,11 +186,10 @@ cc_gcc_multilib_housekeeping() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Core gcc pass 1
|
do_cc_core() {
|
||||||
do_cc_core_pass_1() {
|
|
||||||
local -a core_opts
|
local -a core_opts
|
||||||
|
|
||||||
if [ "${CT_CC_CORE_PASS_1_NEEDED}" != "y" ]; then
|
if [ "${CT_CC_CORE_NEEDED}" != "y" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -201,62 +200,12 @@ do_cc_core_pass_1() {
|
|||||||
core_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
|
core_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
|
||||||
core_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
|
core_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
|
||||||
core_opts+=( "lang_list=c" )
|
core_opts+=( "lang_list=c" )
|
||||||
core_opts+=( "build_step=core1" )
|
core_opts+=( "build_step=core" )
|
||||||
core_opts+=( "mode=static" )
|
core_opts+=( "mode=static" )
|
||||||
core_opts+=( "build_libgcc=yes" )
|
core_opts+=( "build_libgcc=yes" )
|
||||||
|
|
||||||
CT_DoStep INFO "Installing pass-1 core C gcc compiler"
|
CT_DoStep INFO "Installing core C gcc compiler"
|
||||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-core-pass-1"
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-core"
|
||||||
|
|
||||||
do_gcc_core_backend "${core_opts[@]}"
|
|
||||||
|
|
||||||
CT_Popd
|
|
||||||
CT_EndStep
|
|
||||||
}
|
|
||||||
|
|
||||||
# Core gcc pass 2
|
|
||||||
do_cc_core_pass_2() {
|
|
||||||
local -a core_opts
|
|
||||||
|
|
||||||
if [ "${CT_CC_CORE_PASS_2_NEEDED}" != "y" ]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Common options:
|
|
||||||
core_opts+=( "host=${CT_BUILD}" )
|
|
||||||
core_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
|
|
||||||
core_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" )
|
|
||||||
core_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
|
|
||||||
core_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
|
|
||||||
core_opts+=( "lang_list=c" )
|
|
||||||
core_opts+=( "build_step=core2" )
|
|
||||||
|
|
||||||
# Different conditions are at stake here:
|
|
||||||
# - In case the threading model is NPTL, we need a shared-capable core
|
|
||||||
# gcc; in all other cases, we need a static-only core gcc.
|
|
||||||
# - In case the threading model is NPTL or win32, or gcc is 4.3 or
|
|
||||||
# later, we need to build libgcc
|
|
||||||
case "${CT_THREADS}" in
|
|
||||||
nptl)
|
|
||||||
if [ "${CT_SHARED_LIBS}" = "y" ]; then
|
|
||||||
core_opts+=( "mode=shared" )
|
|
||||||
else
|
|
||||||
core_opts+=( "mode=static" )
|
|
||||||
fi
|
|
||||||
core_opts+=( "build_libgcc=yes" )
|
|
||||||
;;
|
|
||||||
win32)
|
|
||||||
core_opts+=( "mode=static" )
|
|
||||||
core_opts+=( "build_libgcc=yes" )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
core_opts+=( "mode=static" )
|
|
||||||
core_opts+=( "build_libgcc=yes" )
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CT_DoStep INFO "Installing pass-2 core C gcc compiler"
|
|
||||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-core-pass-2"
|
|
||||||
|
|
||||||
do_gcc_core_backend "${core_opts[@]}"
|
do_gcc_core_backend "${core_opts[@]}"
|
||||||
|
|
||||||
@ -281,9 +230,8 @@ do_cc_core_pass_2() {
|
|||||||
# build_manuals : whether to build manuals or not : bool : no
|
# build_manuals : whether to build manuals or not : bool : no
|
||||||
# cflags : cflags to use : string : (empty)
|
# cflags : cflags to use : string : (empty)
|
||||||
# ldflags : ldflags to use : string : (empty)
|
# ldflags : ldflags to use : string : (empty)
|
||||||
# build_step : build step 'core1', 'core2', 'gcc_build',
|
# build_step : build step 'core', 'gcc_build',
|
||||||
# 'libstdcxx'
|
# 'libstdcxx' or 'gcc_host' : string : (none)
|
||||||
# or 'gcc_host' : string : (none)
|
|
||||||
# Usage: do_gcc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no]
|
# Usage: do_gcc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no]
|
||||||
do_gcc_core_backend() {
|
do_gcc_core_backend() {
|
||||||
local mode
|
local mode
|
||||||
@ -321,7 +269,7 @@ do_gcc_core_backend() {
|
|||||||
|
|
||||||
# This function gets called in case of a bare metal compiler for the final gcc, too.
|
# This function gets called in case of a bare metal compiler for the final gcc, too.
|
||||||
case "${build_step}" in
|
case "${build_step}" in
|
||||||
core1|core2)
|
core)
|
||||||
CT_DoLog EXTRA "Configuring core C gcc compiler"
|
CT_DoLog EXTRA "Configuring core C gcc compiler"
|
||||||
log_txt="gcc"
|
log_txt="gcc"
|
||||||
extra_config+=( "${CT_CC_CORE_SYSROOT_ARG[@]}" )
|
extra_config+=( "${CT_CC_CORE_SYSROOT_ARG[@]}" )
|
||||||
@ -351,7 +299,7 @@ do_gcc_core_backend() {
|
|||||||
build_libgcc=no
|
build_libgcc=no
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
CT_Abort "Internal Error: 'build_step' must be one of: 'core1', 'core2', 'gcc_build', 'gcc_host' or 'libstdcxx', not '${build_step:-(empty)}'"
|
CT_Abort "Internal Error: 'build_step' must be one of: 'core', 'gcc_build', 'gcc_host' or 'libstdcxx', not '${build_step:-(empty)}'"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -501,8 +449,6 @@ do_gcc_core_backend() {
|
|||||||
|
|
||||||
if [ "${CT_LIBC_GLIBC}" = "y" ]; then
|
if [ "${CT_LIBC_GLIBC}" = "y" ]; then
|
||||||
# Report GLIBC's version to GCC, it affects the defaults on other options.
|
# Report GLIBC's version to GCC, it affects the defaults on other options.
|
||||||
# Pass-2 should be able to get it from the headers, but for some options
|
|
||||||
# (such as --with-long-double-128) we need to get it right even in pass-1.
|
|
||||||
# GCC expects just two numbers separated by a dot.
|
# GCC expects just two numbers separated by a dot.
|
||||||
local glibc_version
|
local glibc_version
|
||||||
|
|
||||||
@ -571,11 +517,10 @@ do_gcc_core_backend() {
|
|||||||
|
|
||||||
# Some versions of gcc have a defective --enable-multilib.
|
# Some versions of gcc have a defective --enable-multilib.
|
||||||
# Since that's the default, only pass --disable-multilib. For multilib,
|
# Since that's the default, only pass --disable-multilib. For multilib,
|
||||||
# also enable multiarch. Without explicit --enable-multiarch, pass-1
|
# also enable multiarch. Without explicit --enable-multiarch, core
|
||||||
# compiler is configured as multilib/no-multiarch and pass-2/final
|
# compiler is configured as multilib/no-multiarch (because gcc autodetects
|
||||||
# are multilib/multiarch (because gcc autodetects multiarch based on
|
# multiarch based on multiple instances of crt*.o in the install directory
|
||||||
# multiple instances of crt*.o in the install directory - which do
|
# which do not exist in the core pass).
|
||||||
# not exist in pass-1).
|
|
||||||
if [ "${CT_MULTILIB}" != "y" ]; then
|
if [ "${CT_MULTILIB}" != "y" ]; then
|
||||||
extra_config+=("--disable-multilib")
|
extra_config+=("--disable-multilib")
|
||||||
else
|
else
|
||||||
@ -609,7 +554,7 @@ do_gcc_core_backend() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# For non-sysrooted toolchain, GCC doesn't search except at the installation
|
# For non-sysrooted toolchain, GCC doesn't search except at the installation
|
||||||
# prefix; in core-1/2 stage we use a temporary installation prefix - but
|
# prefix; in core stage we use a temporary installation prefix - but
|
||||||
# we may have installed something into the final prefix. This is less than ideal:
|
# we may have installed something into the final prefix. This is less than ideal:
|
||||||
# in the installation prefix GCC also handles subdirectories for multilibs
|
# in the installation prefix GCC also handles subdirectories for multilibs
|
||||||
# (e.g. first trying ${prefix}/include/${arch-triplet}) but
|
# (e.g. first trying ${prefix}/include/${arch-triplet}) but
|
||||||
|
@ -34,7 +34,7 @@ uClibc_ng_backend_once()
|
|||||||
|
|
||||||
# Construct make arguments:
|
# Construct make arguments:
|
||||||
# - uClibc uses the CROSS environment variable as a prefix to the compiler
|
# - uClibc uses the CROSS environment variable as a prefix to the compiler
|
||||||
# tools to use. Since it requires core pass-1, thusly named compiler is
|
# tools to use. Since it requires core compiler, thusly named compiler is
|
||||||
# already available.
|
# already available.
|
||||||
# - Note about CFLAGS: In uClibc, CFLAGS are generated by Rules.mak,
|
# - Note about CFLAGS: In uClibc, CFLAGS are generated by Rules.mak,
|
||||||
# depending on the configuration of the library. That is, they are tailored
|
# depending on the configuration of the library. That is, they are tailored
|
||||||
|
Loading…
Reference in New Issue
Block a user