From 2bd0ae452d0eac9dc50342d26915b1b8097a2f21 Mon Sep 17 00:00:00 2001 From: Will Newton Date: Thu, 13 Nov 2014 14:24:07 +0000 Subject: Add AArch64 multilib support for lp64 and ilp32 Change-Id: I50e3d132eae94ff1d9a40e6cac4c9ffca39f7ecc --- abe.sh | 9 +++++++++ config/gcc.conf | 6 +++--- lib/common.sh | 2 +- lib/configure.sh | 3 +++ lib/globals.sh | 2 ++ lib/make.sh | 26 ++++++++++---------------- lib/stamp.sh | 2 +- 7 files changed, 29 insertions(+), 21 deletions(-) diff --git a/abe.sh b/abe.sh index 6d98c24a..a9d4d70e 100755 --- a/abe.sh +++ b/abe.sh @@ -31,6 +31,7 @@ usage() [--set {languages}={c|c++|fortran|go|lto|objc|java|ada}] [--set {cflags|ldflags|runtestflgs|makeflags}=XXX] [--set {package}={toolchain|gdb|sysroot}] + [--set {abi}={lp64|ilp32}] [--snapshots ] [--target ] [--usage] [--interactive] [{binutils|gcc|gmp|mpft|mpc|eglibc|glibc|newlib} @@ -214,6 +215,9 @@ OPTIONS The default set for most platforms is c, c++, go, fortran, and lto. + --set {abi}={lp64|ilp32} + This sets the ABI or ABIs used for AArch64 builds. + --snapshots /path/to/alternative/local_snapshots/directory Use an alternative path to a local snapshots directory. @@ -416,6 +420,11 @@ set_package() notice "Overriding ${setting} to CFLAGS" return 0 ;; + abi) + aarch64_abilist="${setting}" + notice "Setting AArch64 ABI list to ${setting}" + return 0 + ;; libc) # Range check user input against supported C libraries. case ${setting} in diff --git a/config/gcc.conf b/config/gcc.conf index 223102d5..6f307109 100644 --- a/config/gcc.conf +++ b/config/gcc.conf @@ -27,7 +27,7 @@ default_configure_flags="${default_configure_flags} --with-cloog=no --with-ppl=n default_configure_flags="${default_configure_flags} --disable-nls" # enable multiarch -default_configure_flags="${default_configure_flags} --enable-multiarch --disable-multilib" +default_configure_flags="${default_configure_flags} --enable-multiarch" # C99 is the latest standard, and has improved numerics support, so we want it # http://en.wikipedia.org/wiki/C99 @@ -102,7 +102,7 @@ if test x"${build}" != x"${target}"; then need_qemu=yes ;; aarch64*-linux-gnu) - default_configure_flags="${default_configure_flags} --with-arch=armv8-a" # LDFLAGS_FOR_TARGET=-static + default_configure_flags="${default_configure_flags} --with-arch=armv8-a --with-multilib-list=${aarch64_abilist}" # LDFLAGS_FOR_TARGET=-static need_qemu=yes ;; *-mingw32) @@ -190,7 +190,7 @@ else #default_configure_flags="${default_configure_flags}" ;; aarch64*-linux-gnu) - #default_configure_flags="${default_configure_flags}" + default_configure_flags="${default_configure_flags} --with-arch=armv8-a --with-multilib-list=${aarch64_abilist}" ;; x86-pc-linux-gnu) default_configure_flags="${default_configure_flags} --enable-linker-build-id --without-included-gettext --enable-threads=posix --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-objc-gc --enable-multiarch --disable-sjlj-exceptions" diff --git a/lib/common.sh b/lib/common.sh index 996e1e89..96dd3d52 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -276,7 +276,7 @@ get_builddir() if test x"$2" = x"libgloss"; then echo "${local_builds}/${host}/${target}/${dir}/${target}/libgloss" else - echo "${local_builds}/${host}/${target}/${dir}${2:+-$2}" + echo "${local_builds}/${host}/${target}/${dir}${ABI:+-$ABI}${2:+-$2}" fi return 0 diff --git a/lib/configure.sh b/lib/configure.sh index d93e51cf..e21e7e9d 100755 --- a/lib/configure.sh +++ b/lib/configure.sh @@ -170,6 +170,9 @@ configure_build() ;; *libc) local opts="${opts} --build=${build} --host=${target} --target=${target} --prefix=/usr" + if test x"${ABI}" != x; then + local opts="${opts} CC=\"${target}-gcc -mabi=${ABI}\"" + fi dryrun "(mkdir -p ${sysroots}/usr/lib)" ;; gcc*) diff --git a/lib/globals.sh b/lib/globals.sh index dbf8ae2a..84827e14 100644 --- a/lib/globals.sh +++ b/lib/globals.sh @@ -96,6 +96,8 @@ override_cflags= override_ldflags= override_runtestflags= +aarch64_abilist=lp64 + if test x"${BUILD_NUMBER}" = x; then export BUILD_NUMBER=${RANDOM} fi diff --git a/lib/make.sh b/lib/make.sh index 25fc8eba..24924226 100755 --- a/lib/make.sh +++ b/lib/make.sh @@ -90,7 +90,16 @@ build_all() if test x"${clibrary}" = x"eglibc"; then build ${eglibc_version} elif test x"${clibrary}" = x"glibc"; then - build ${glibc_version} + if test `echo ${target} | grep -c aarch64` -gt 0; then + if test `echo ${aarch64_abilist} | grep -c lp64` -gt 0 ; then + ABI=lp64 build ${glibc_version} + fi + if test `echo ${aarch64_abilist} | grep -c ilp32` -gt 0 ; then + ABI=ilp32 build ${glibc_version} + fi + else + build ${glibc_version} + fi elif test x"${clibrary}" = x"newlib"; then build ${newlib_version} build ${newlib_version} libgloss @@ -582,21 +591,6 @@ make_install() dryrun "copy_gcc_libs_to_sysroot \"${local_builds}/destdir/${host}/bin/${target}-gcc --sysroot=${sysroots}\"" fi - if test "`echo ${tool} | grep -c glibc`" -gt 0 -a "`echo ${target} | grep -c aarch64`" -gt 0; then - local dynamic_linker - dynamic_linker="$(find_dynamic_linker "$sysroots" true)" - local dynamic_linker_name="`basename ${dynamic_linker}`" - - # 64 bit architectures don't populate sysroot/lib, which unfortunately other - # things look in for shared libraries. - dryrun "rsync -a ${sysroots}/lib/ ${sysroots}/lib64/" - dryrun "rm -rf ${sysroots}/lib" - dryrun "(cd ${sysroots} && ln -sfnT lib64 lib)" -# dryrun "(mv ${sysroots}/lib/ld-linux-aarch64.so.1 ${sysroots}/lib/ld-linux-aarch64.so.1.symlink)" - dryrun "rm -f ${sysroots}/lib/ld-linux-aarch64.so.1" - dryrun "ln -sfnT ${dynamic_linker_name} ${sysroots}/lib64/ld-linux-aarch64.so.1" - fi - # FIXME: this is a seriously ugly hack required for building Canadian Crosses. # Basically the gcc/auto-host.h produced when configuring GCC stage2 has a # conflict as sys/types.h defines a typedef for caddr_t, and autoheader screws diff --git a/lib/stamp.sh b/lib/stamp.sh index af71648e..4d7f230a 100644 --- a/lib/stamp.sh +++ b/lib/stamp.sh @@ -50,7 +50,7 @@ get_stamp_name() fi #local stamp_name="stamp-${stamptype}-${name_fragment}${suffix:+-${suffix}}" - local stamp_name="${name_fragment}${suffix:+-${suffix}}-${stamptype}.stamp" + local stamp_name="${name_fragment}${suffix:+-${suffix}}${ABI:+-${ABI}}-${stamptype}.stamp" echo "${stamp_name}" return 0 } -- cgit v1.2.3