diff options
author | Alexey Brodkin <abrodkin@synopsys.com> | 2019-04-24 14:49:45 +0300 |
---|---|---|
committer | Alexey Brodkin <abrodkin@synopsys.com> | 2019-06-14 17:50:46 +0300 |
commit | de76f7cc82eedac5653283a99c1c7083d7a0d43b (patch) | |
tree | 189a6109af8fe0a16a2bebaa94595acb9c064e9f | |
parent | afaf7b9a25b5d77991002936be5c47fc5ff549de (diff) | |
download | crosstool-ng-de76f7cc82eedac5653283a99c1c7083d7a0d43b.tar.gz crosstool-ng-de76f7cc82eedac5653283a99c1c7083d7a0d43b.tar.bz2 crosstool-ng-de76f7cc82eedac5653283a99c1c7083d7a0d43b.zip |
ARC: Support building of multi-lib Glibc toolchain
From GCC's standpoint ARC's multilib items are defined by "mcpu" values
which we have quite a few and for all of them might be built optimized
cross-toolchain.
From Glibc's standpoint multilib is just multi-ABI [1] and so very limited
versions are supposed to co-exist (e.g. arc700 & archs).
Here we force Glibc to install libraries in GCC's multilib folder to create
a universal cross-toolchain that has libs optimized for multiple CPU types.
But note we only need to mess with installation paths in case of real
multilib, otherwise we keep default "lib/" paths so that GCC finds default
(the one and only) libs where it expects them to be.
Also here we add a sample which allows to build universal Glibc Linux
toolchain for ARC.
[1] https://sourceware.org/ml/libc-alpha/2019-06/msg00018.html
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
-rw-r--r-- | samples/arc-multilib-linux-gnu/crosstool.config | 7 | ||||
-rw-r--r-- | samples/arc-multilib-linux-gnu/reported.by | 3 | ||||
-rw-r--r-- | scripts/build/arch/arc.sh | 36 |
3 files changed, 46 insertions, 0 deletions
diff --git a/samples/arc-multilib-linux-gnu/crosstool.config b/samples/arc-multilib-linux-gnu/crosstool.config new file mode 100644 index 00000000..3dc78027 --- /dev/null +++ b/samples/arc-multilib-linux-gnu/crosstool.config @@ -0,0 +1,7 @@ +CT_CONFIG_VERSION="3" +CT_ARCH_ARC=y +CT_MULTILIB=y +CT_TARGET_CFLAGS="-matomic" +CT_TARGET_VENDOR="multilib" +CT_TARGET_ALIAS="arc-linux" +CT_KERNEL_LINUX=y diff --git a/samples/arc-multilib-linux-gnu/reported.by b/samples/arc-multilib-linux-gnu/reported.by new file mode 100644 index 00000000..e98760ae --- /dev/null +++ b/samples/arc-multilib-linux-gnu/reported.by @@ -0,0 +1,3 @@ +reporter_name="Alexey Brodkin" +reporter_url="http://embarc.org" +reporter_comment="ARC multilib GNU Linux toolchain" diff --git a/scripts/build/arch/arc.sh b/scripts/build/arch/arc.sh index b13ef0eb..d15f73f3 100644 --- a/scripts/build/arch/arc.sh +++ b/scripts/build/arch/arc.sh @@ -29,3 +29,39 @@ CT_DoArchUClibcCflags() esac done } + +# Multilib: Adjust configure arguments for GLIBC +# Usage: CT_DoArchGlibcAdjustConfigure <configure-args-array-name> <cflags> +# +# From GCC's standpoint ARC's multilib items are defined by "mcpu" values +# which we have quite a few and for all of them might be built optimized +# cross-toolchain. +# +# From Glibc's standpoint multilib is multi-ABI and so very limited +# versions are supposed to co-exist. +# +# Here we force Glibc to install libraries in per-multilib folder to create +# a universal cross-toolchain that has libs optimized for multiple CPU types. +CT_DoArchGlibcAdjustConfigure() { + local -a add_args + local array="${1}" + local cflags="${2}" + local opt + local mcpu + + # If building for multilib, set proper installation paths + if [ "${CT_MULTILIB}" = "y" ]; then + for opt in ${cflags}; do + case "${opt}" in + -mcpu=*) + mcpu="${opt#*=}" + add_args+=( "libc_cv_rtlddir=/lib/${mcpu}" ) + add_args+=( "libc_cv_slibdir=/lib/${mcpu}" ) + add_args+=( "--libdir=/usr/lib/${mcpu}" ) + ;; + esac + done + fi + + eval "${array}+=( \"\${add_args[@]}\" )" +} |