summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-11-21 23:11:51 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-11-21 23:11:51 (GMT)
commit170091aa2a61a286d41b2f51cb9f33728b55b419 (patch)
tree0fc3a41cbedd4a9f86ba56bf195f65e3b4a8b54b
parenta2e7a536e05eb39dc3a9583bad3cfd47b8c2f46e (diff)
libc/glibc: set the endian option according to extra CFLAGS
When building a multilib, some extra CFLAGS can override the default config option. This is the case for the endianness selection. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
-rw-r--r--scripts/build/libc/glibc-eglibc.sh-common19
1 files changed, 18 insertions, 1 deletions
diff --git a/scripts/build/libc/glibc-eglibc.sh-common b/scripts/build/libc/glibc-eglibc.sh-common
index 2533f14..6441e84 100644
--- a/scripts/build/libc/glibc-eglibc.sh-common
+++ b/scripts/build/libc/glibc-eglibc.sh-common
@@ -78,6 +78,7 @@ do_libc_backend() {
local -a extra_make_args
local glibc_cflags
local float_extra
+ local endian_extra
while [ $# -ne 0 ]; do
eval "${1// /\\ }"
@@ -169,7 +170,23 @@ do_libc_backend() {
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
fi
- extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
+ # Extract the endianness options if any
+ # This should cover all possible endianness options
+ # in gcc, but it is prone to bit-rot... :-(
+ endian_extra="$( echo "${extra_flags}" \
+ |${sed} -r -e '/^(.*[[:space:]])?-(E[BL]|m((big|little)(-endian)?|e?[bl]))([[:space:]].*)?$/!d;' \
+ -e 's//\2/;' \
+ )"
+ case "${endian_extra}" in
+ EB|mbig-endian|mbig|meb|mb)
+ extra_cc_args="${extra_cc_args} ${endian_extra}"
+ ;;
+ EL|mlittle-endian|mlittle|mel|ml)
+ extra_cc_args="${extra_cc_args} ${endian_extra}"
+ ;;
+ "") extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
+ ;;
+ esac
touch config.cache
if [ "${CT_LIBC_GLIBC_FORCE_UNWIND}" = "y" ]; then