mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-02-07 11:20:14 +00:00
gcc: Assume '-O2' by default for building gcc target libraries
The gcc target libraries (e.g. libstdc++) are currently built without any optimisation flag when `CT_CC_GCC_ENABLE_TARGET_OPTSPACE` is not enabled and default to `-O0` unless user explicitly specifies an optimisation flag. This commit updates the gcc build script to assume `-O2` for building target libraries unless user provides a different optimisation flag. Note also that this is the default behaviour for gcc when C[XX]FLAGS_FOR_TARGET is not overridden. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
parent
6dd60ca694
commit
3c637c1eec
@ -608,6 +608,9 @@ do_gcc_core_backend() {
|
|||||||
cflags_for_target="${cflags_for_target} -idirafter ${CT_HEADERS_DIR}"
|
cflags_for_target="${cflags_for_target} -idirafter ${CT_HEADERS_DIR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Assume '-O2' by default for building target libraries.
|
||||||
|
cflags_for_target="-g -O2 ${cflags_for_target}"
|
||||||
|
|
||||||
# Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532).
|
# Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532).
|
||||||
# Pass only user-specified CFLAGS/LDFLAGS in CFLAGS_FOR_TARGET/LDFLAGS_FOR_TARGET: during
|
# Pass only user-specified CFLAGS/LDFLAGS in CFLAGS_FOR_TARGET/LDFLAGS_FOR_TARGET: during
|
||||||
# the build of, for example, libatomic, GCC tried to compile multiple variants for runtime
|
# the build of, for example, libatomic, GCC tried to compile multiple variants for runtime
|
||||||
@ -936,6 +939,7 @@ do_gcc_backend() {
|
|||||||
local lang_list
|
local lang_list
|
||||||
local cflags
|
local cflags
|
||||||
local cflags_for_build
|
local cflags_for_build
|
||||||
|
local cflags_for_target
|
||||||
local ldflags
|
local ldflags
|
||||||
local build_manuals
|
local build_manuals
|
||||||
local exec_prefix
|
local exec_prefix
|
||||||
@ -1200,8 +1204,9 @@ do_gcc_backend() {
|
|||||||
|
|
||||||
CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
|
CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
|
||||||
|
|
||||||
# We may need to modify host/build CFLAGS separately below
|
# We may need to modify host/build/target CFLAGS separately below
|
||||||
cflags_for_build="${cflags}"
|
cflags_for_build="${cflags}"
|
||||||
|
cflags_for_target="${CT_TARGET_CFLAGS}"
|
||||||
|
|
||||||
# Clang's default bracket-depth is 256, and building GCC
|
# Clang's default bracket-depth is 256, and building GCC
|
||||||
# requires somewhere between 257 and 512.
|
# requires somewhere between 257 and 512.
|
||||||
@ -1217,6 +1222,9 @@ do_gcc_backend() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Assume '-O2' by default for building target libraries.
|
||||||
|
cflags_for_target="-g -O2 ${cflags_for_target}"
|
||||||
|
|
||||||
# NB: not using CT_ALL_TARGET_CFLAGS/CT_ALL_TARGET_LDFLAGS here!
|
# NB: not using CT_ALL_TARGET_CFLAGS/CT_ALL_TARGET_LDFLAGS here!
|
||||||
# See do_gcc_core_backend for explanation.
|
# See do_gcc_core_backend for explanation.
|
||||||
CT_DoExecLog CFG \
|
CT_DoExecLog CFG \
|
||||||
@ -1226,8 +1234,8 @@ do_gcc_backend() {
|
|||||||
CXXFLAGS="${cflags}" \
|
CXXFLAGS="${cflags}" \
|
||||||
CXXFLAGS_FOR_BUILD="${cflags_for_build}" \
|
CXXFLAGS_FOR_BUILD="${cflags_for_build}" \
|
||||||
LDFLAGS="${final_LDFLAGS[*]}" \
|
LDFLAGS="${final_LDFLAGS[*]}" \
|
||||||
CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \
|
CFLAGS_FOR_TARGET="${cflags_for_target}" \
|
||||||
CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \
|
CXXFLAGS_FOR_TARGET="${cflags_for_target}" \
|
||||||
LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \
|
LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \
|
||||||
${CONFIG_SHELL} \
|
${CONFIG_SHELL} \
|
||||||
"${CT_SRC_DIR}/gcc/configure" \
|
"${CT_SRC_DIR}/gcc/configure" \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user