summaryrefslogtreecommitdiff
path: root/scripts/build/libc
diff options
context:
space:
mode:
authorDmitry Pankratov <dp@ubiquitech.com>2016-06-18 14:02:15 (GMT)
committerDmitry Pankratov <dp@ubiquitech.com>2016-06-18 14:02:15 (GMT)
commit91b8280e8c9458e81fc94d1f9983f2a642ebb7a8 (patch)
tree9279482c6f4e8a28420c2f1adf19dcb084dc9f04 /scripts/build/libc
parentf6d8dc44111c6e96706eed8b0ae0483e2fb63856 (diff)
parent6e7c61650a39a67ee02ed58c11d64c94c436bb33 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'scripts/build/libc')
-rw-r--r--scripts/build/libc/glibc.sh43
1 files changed, 38 insertions, 5 deletions
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 0a09cbd..472acad 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -73,6 +73,7 @@ do_libc_backend() {
local multi_dir
local multi_flags
local extra_dir
+ local target
local libc_headers libc_startfiles libc_full
local hdr
local arg
@@ -136,11 +137,36 @@ do_libc_backend() {
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}${extra_dir//\//_}"
+ target=$( CT_DoMultilibTarget "${CT_TARGET}" ${extra_flags} )
+ case "${target}" in
+ # SPARC quirk: glibc 2.23 and newer dropped support for SPARCv8 and
+ # earlier (corresponding pthread barrier code is missing). Until this
+ # support is reintroduced, configure as sparcv9.
+ sparc-*)
+ if [ "${CT_LIBC_GLIBC_2_23_or_later}" = y ]; then
+ target=${target/#sparc-/sparcv9-}
+ fi
+ ;;
+ # x86 quirk: architecture name is i386, but glibc expects i[4567]86 - to
+ # indicate the desired optimization. If it was a multilib variant of x86_64,
+ # then it targets at least NetBurst a.k.a. i786, but we'll follow arch/x86.sh
+ # and set the optimization to i686. Otherwise, replace with the most
+ # conservative choice, i486.
+ i386-*)
+ if [ "${CT_TARGET_ARCH}" = "x86_64" ]; then
+ target=${target/#i386-/i686-}
+ else
+ target=${target/#i386-/i486-}
+ fi
+ ;;
+ esac
+
do_libc_backend_once extra_dir="${extra_dir}" \
extra_flags="${extra_flags}" \
libc_headers="${libc_headers}" \
libc_startfiles="${libc_startfiles}" \
- libc_full="${libc_full}"
+ libc_full="${libc_full}" \
+ target="${target}"
CT_Popd
@@ -179,6 +205,7 @@ do_libc_backend() {
# libc_full : Build full libc : bool : n
# extra_flags : Extra CFLAGS to use (for multilib) : string : (empty)
# extra_dir : Extra subdir for multilib : string : (empty)
+# target : Build libc using this target (for multilib) : string : ${CT_TARGET}
do_libc_backend_once() {
local libc_headers
local libc_startfiles
@@ -192,12 +219,17 @@ do_libc_backend_once() {
local glibc_cflags
local float_extra
local endian_extra
+ local target
local arg
for arg in "$@"; do
eval "${arg// /\\ }"
done
+ if [ "${target}" = "" ]; then
+ target="${CT_TARGET}"
+ fi
+
CT_DoLog EXTRA "Configuring C library"
case "${CT_LIBC}" in
@@ -273,12 +305,12 @@ do_libc_backend_once() {
|${sed} -r -e '/^(.*[[:space:]])?-(E[BL]|m((big|little)(-endian)?|e?[bl]))([[:space:]].*)?$/!d;' \
-e 's//\2/;' \
)"
+ # If extra_flags contained an endianness option, no need to add it again. Otherwise,
+ # add the option from the configuration.
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}"
;;
@@ -341,7 +373,7 @@ do_libc_backend_once() {
"${src_dir}/configure" \
--prefix=/usr \
--build=${CT_BUILD} \
- --host=${CT_TARGET} \
+ --host=${target} \
--cache-file="$(pwd)/config.cache" \
--without-cvs \
--disable-profile \
@@ -443,7 +475,8 @@ do_libc_backend_once() {
# However, since we will never actually execute its code,
# it doesn't matter what it contains. So, treating '/dev/null'
# as a C source file, we produce a dummy 'libc.so' in one step
- CT_DoExecLog ALL "${cross_cc}" -nostdlib \
+ CT_DoExecLog ALL "${cross_cc}" ${extra_flags} \
+ -nostdlib \
-nostartfiles \
-shared \
-x c /dev/null \