summaryrefslogtreecommitdiff
path: root/scripts/crosstool-NG.sh.in
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2016-03-30 19:15:54 (GMT)
committerAlexey Neyman <stilor@att.net>2016-08-23 18:00:27 (GMT)
commit82072d0cbc238000fd1547551deb198aa8c8d466 (patch)
tree47497379bd1d9a1f0c2c2bb264f3e6dc9ab81705 /scripts/crosstool-NG.sh.in
parentcc86d80da26aa27c382dee5ef44d21f450b3ae60 (diff)
multilib: Determine which options may pass through.
On some arches (e.g. MIPS) the options like -mabi do not work if specified more than once (see the comment in 100-gcc.sh). Therefore, we need to determine which of the options produced by <arch>.sh can be passed to multilib builds and which must be removed (i.e., which options vary among the multilibs). This presents a chicken-and-egg problem. GCC developers, in their infinite wisdom, do not allow arbitrary multilib specification to be supplied to GCC's configure. Instead, the target (and sometimes some extra options) determine the set of multilibs - which may include different CPUs, different ABIs, different endianness, different FPUs, different floating-point ABIs, ... That is, we don't know which parts vary until we build GCC and ask it. So, the solution implemented here is: - For multilib builds, start with empty CT_ARCH_TARGET_CFLAGS/LDFLAGS. - For multilib builds, require core pass 1. Pass 1 does not build any target binaries, so at that point, our target options have not been used yet. - Provide an API to modify the environment variables for the steps that follow the current one. - As a part of multilib-related housekeeping, determine the variable part of multilibs and filter out these options; pass the rest into CT_TARGET_CFLAGS/LDFLAGS. This still does not handle extra dependencies between GCC options (like -ma implying -mcpu=X -mtune=Y, etc.) but I feel that would complicate matters too much. Let's leave this until there's a compelling case for it. Also, query GCC's sysroot suffix for targets that use it (SuperH, for example) - the default multilib may not work if the command line specifies the default option explicitly (%sysroot_suffix_spec is not aware of multilib defaults). Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'scripts/crosstool-NG.sh.in')
-rw-r--r--scripts/crosstool-NG.sh.in10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in
index 6ae9d5d..9a4091a 100644
--- a/scripts/crosstool-NG.sh.in
+++ b/scripts/crosstool-NG.sh.in
@@ -292,7 +292,7 @@ if [ -z "${CT_RESTART}" ]; then
*/*) CT_Abort "Sysroot name contains forbidden slash(es): '${CT_SYSROOT_NAME}'";;
esac
- # Arrange paths depending on wether we use sysroot or not.
+ # Arrange paths depending on whether we use sysroot or not.
if [ "${CT_USE_SYSROOT}" = "y" ]; then
CT_SYSROOT_REL_DIR="${CT_SYSROOT_DIR_PREFIX:+${CT_SYSROOT_DIR_PREFIX}/}${CT_SYSROOT_NAME}"
CT_SYSROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}/${CT_SYSROOT_REL_DIR}"
@@ -628,6 +628,14 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" -a "${CT_ONLY_EXTRACT}" != "y" ]; then
# sub-shell ending with !0. bash-3 does not, while bash-4 does,
# so the following line is for bash-3; bash-4 would choke above.
[ $? -eq 0 ]
+ # Pick up environment changes.
+ if [ -r "${CT_BUILD_DIR}/env.modify.sh" ]; then
+ CT_DoLog DEBUG "Step '${step}' modified the environment:"
+ CT_DoExecLog DEBUG cat "${CT_BUILD_DIR}/env.modify.sh"
+ . "${CT_BUILD_DIR}/env.modify.sh"
+ CT_DoExecLog DEBUG rm -f "${CT_BUILD_DIR}/env.modify.sh"
+
+ fi
if [ "${CT_STOP}" = "${step}" ]; then
do_stop=1
fi