summaryrefslogtreecommitdiff
path: root/scripts/build/libc
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/build/libc
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/build/libc')
-rw-r--r--scripts/build/libc/glibc.sh22
1 files changed, 19 insertions, 3 deletions
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index cff6d95..c419603 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -111,13 +111,29 @@ do_libc_backend() {
# (default target, not multilib)
multi_last=y
fi
+
+ # GCC makes the distinction between:
+ # multilib (-print-multi-lib or -print-multi-directory) and
+ # multilib-os (--print-multi-os-directory)
+ # as the gcc library and gcc sysroot library paths, respectively.
+ # For example, on x86_64:
+ # multilib: -m32=32 -m64=.
+ # multilib-os: -m32=../lib -m64=../lib64
+ # Moreover, while some multilibs can coexist in the same sysroot (e.g.
+ # on x86), some have a "sysroot suffix" to separate incompatible variants.
+ # Such sysroot suffixes combine with multilib-os directories, e.g.
+ # on sh4 with -m4a multilib, the search order in sysroot is (dropping some
+ # directories for brevity:
+ # <sysroot>/m4a/lib/m4a/
+ # <sysroot>/m4a/usr/lib/m4a/
+ # <sysroot>/m4a/lib/
+ # <sysroot>/m4a/usr/lib/
+ multi_flags=$( echo "${multilib#*;}" | ${sed} -r -e 's/@/ -/g;' )
multi_dir="${multilib%%;*}"
if [ "${multi_dir}" != "." ]; then
CT_DoStep INFO "Building for multilib subdir='${multi_dir}'"
- extra_flags="$( echo "${multilib#*;}" \
- |${sed} -r -e 's/@/ -/g;' \
- )"
+ extra_flags="${multi_flags}"
extra_dir="/${multi_dir}"
# glibc install its files in ${extra_dir}/{usr/,}lib