Source: gmp Version: 6.1.2+dfsg-1 Severity: wishlist Tags: upstream patch Attached is a patched providing very basic initial suport for arm64ilp32, using the generic C support. To some degreee it is a placeholder until a less hacky patch is developed, although it does work and builds the packages.
ILP32 is a new ABI for arm64(aarch64) exactly equivalent to x32 on x86 (32-bit ints, longs and pointers in the ABI, but a 64-bit instruction set). https://wiki.linaro.org/Platform/arm64-ilp32 The patching of configure.ac is crude and almost certainly wrong, as I'm really not sure exacltly how it all fits together, but I hope it makes fairly clear the sort of thing that is needed. It might actually make sense to restructure the arm/arm64 support a little as it currently seems to list a lot of possibilities then exclude some of them. aarch64 can support ILP32, and it should use the arm64 dirs, but I couldn't get that to work. Because the ABI is 32-bit, the epilogues/prologues of this code probably need munging to deal with 32-bit paramaters. That is a little bit beyond my area of expertise, so I stuck with the generic code for now, especially as a compiler person tells me it's quite likely to be faster anyway. The triplet is aarch64-linux-gnu_ilp32 (much like x32), which should default to that ABI (which is the active bit of code in the current patch, and should work without the -mabi=ilp32 option - that is only needed on a native arm64 system (aarch64-linux-gnu) aka 'LP64' ABI, building for the non-default ILP32 ABI. I'd be very happy to work with someone who understands the details to make a proper non-hacky patch for this. Perhaps I should just talk to upstream? A dh_autoreconf is needed to get the configure.ac changes into the configure that gets run. This gives some warnings, so some more work there might be a good idea, although it seems to work OK. I just realised that this patch doesn't include a build-dep for that (dh-autoreconf). That needs fixing. There are also a set of symbols changes for libgmp10. Most match with the arm64 exceptions, but 3 are extra. I'm not sure if this is due to using 'generic' rather than 'arm64' functions? So apologies for this being a bit rough, but I thought it best to file before I forgot what I did. -- System Information: Debian Release: 8.9 APT prefers oldstable-updates APT policy: (500, 'oldstable-updates'), (500, 'oldstable') Architecture: amd64 (x86_64) Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system)
diff -Nru gmp-6.1.2+dfsg/debian/libgmp10.symbols gmp-6.1.2+dfsg/debian/libgmp10.symbols --- gmp-6.1.2+dfsg/debian/libgmp10.symbols 2017-07-25 14:59:42.000000000 +0100 +++ gmp-6.1.2+dfsg/debian/libgmp10.symbols 2016-12-21 05:39:47.000000000 +0000 @@ -215,7 +215,7 @@ (arch=any-i386)__gmpn_add_n_pentium@Base 2:5.1.1 __gmpn_add_n_sub_n@Base 2:5.1.1 (arch=any-i386)__gmpn_add_n_x86@Base 2:5.1.1 - (arch=!hppa !nios2 !mips !mipsel !tilegx !m68k !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_add_nc@Base 0 + (arch=!arm64ilp32 !hppa !nios2 !mips !mipsel !tilegx !m68k !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_add_nc@Base 0 (arch=any-i386)__gmpn_add_nc_atom@Base 2:5.1.1 (arch=any-i386)__gmpn_add_nc_k6@Base 2:5.1.1 (arch=any-i386)__gmpn_add_nc_k7@Base 2:5.1.1 @@ -224,9 +224,9 @@ (arch=any-i386)__gmpn_add_nc_pentium@Base 2:5.1.1 (arch=any-i386)__gmpn_add_nc_x86@Base 2:5.1.1 (arch=any-amd64)__gmpn_addaddmul_1msb0@Base 0 - (arch=!arm64 !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !sparc !sparc64 !sh4)__gmpn_addlsh1_n@Base 0 + (arch=!arm64 !arm64ilp32 !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !sparc !sparc64 !sh4)__gmpn_addlsh1_n@Base 0 (arch=any-i386)__gmpn_addlsh1_n_init@Base 2:5.1.1 - (arch=!arm64 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !s390x !sh4 !sparc !sparc64)__gmpn_addlsh2_n@Base 0 + (arch=!arm64 !arm64ilp32 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !s390x !sh4 !sparc !sparc64)__gmpn_addlsh2_n@Base 0 (arch=any-i386)__gmpn_addlsh2_n_init@Base 2:5.1.1 (arch=any-amd64)__gmpn_addlsh_n@Base 0 __gmpn_addmul_1@Base 0 @@ -394,7 +394,7 @@ __gmpn_hgcd_reduce_itch@Base 2:5.1.1 __gmpn_hgcd_step@Base 2:5.1.1 __gmpn_invert@Base 0 - (arch=!hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !sparc !sparc64 !sh4 !any-i386)__gmpn_invert_limb@Base 0 + (arch=!arm64ilp32 !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !sparc !sparc64 !sh4 !any-i386)__gmpn_invert_limb@Base 0 __gmpn_invertappr@Base 0 __gmpn_ior_n@Base 0 __gmpn_iorn_n@Base 0 @@ -507,7 +507,7 @@ (arch=any-i386)__gmpn_mul_1_pentium@Base 2:5.1.1 (arch=any-i386)__gmpn_mul_1_pentium_mmx@Base 2:5.1.1 (arch=any-i386)__gmpn_mul_1_x86@Base 2:5.1.1 - (arch=!arm64 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_mul_1c@Base 0 + (arch=!arm64 !arm64ilp32 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_mul_1c@Base 0 (arch=any-i386)__gmpn_mul_1c_atom_sse2@Base 2:5.1.1 (arch=any-i386)__gmpn_mul_1c_k6@Base 2:5.1.1 (arch=any-i386)__gmpn_mul_1c_k7@Base 2:5.1.1 @@ -571,13 +571,13 @@ __gmpn_redc_n@Base 0 __gmpn_remove@Base 0 __gmpn_rootrem@Base 0 - (arch=!alpha !arm64 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !sh4 !sparc !sparc64 !any-i386)__gmpn_rsblsh1_n@Base 0 - (arch=!alpha !arm64 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_rsblsh2_n@Base 0 - (arch=!alpha !arm64 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !ppc64 !ppc64el !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_rsblsh_n@Base 0 - (arch=!alpha !arm64 !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_rsh1add_n@Base 0 - (arch=!alpha !arm64 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !ppc64 !ppc64el !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_rsh1add_nc@Base 0 - (arch=!alpha !arm64 !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_rsh1sub_n@Base 0 - (arch=!alpha !arm64 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !ppc64 !ppc64el !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_rsh1sub_nc@Base 0 + (arch=!alpha !arm64 !arm64ilp32 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !sh4 !sparc !sparc64 !any-i386)__gmpn_rsblsh1_n@Base 0 + (arch=!alpha !arm64 !arm64ilp32 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_rsblsh2_n@Base 0 + (arch=!alpha !arm64 !arm64ilp32 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !ppc64 !ppc64el !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_rsblsh_n@Base 0 + (arch=!alpha !arm64 !arm64ilp32 !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_rsh1add_n@Base 0 + (arch=!alpha !arm64 !arm64ilp32 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !ppc64 !ppc64el !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_rsh1add_nc@Base 0 + (arch=!alpha !arm64 !arm64ilp32 !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_rsh1sub_n@Base 0 + (arch=!alpha !arm64 !arm64ilp32 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !powerpc !powerpcspe !ppc64 !ppc64el !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_rsh1sub_nc@Base 0 __gmpn_rshift@Base 0 (arch=any-i386)__gmpn_rshift_atom@Base 2:5.1.1 (arch=any-i386)__gmpn_rshift_init@Base 2:5.1.1 @@ -629,7 +629,7 @@ (arch=any-i386)__gmpn_sqr_basecase_pentium4_sse2@Base 2:5.1.1 (arch=any-i386)__gmpn_sqr_basecase_pentium@Base 2:5.1.1 (arch=any-i386)__gmpn_sqr_basecase_x86@Base 2:5.1.1 - (arch=!arm64 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !ppc64 !ppc64el !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_sqr_diag_addlsh1@Base 2:6.0.0 + (arch=!arm64 !arm64ilp32 !armel !armhf !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !ppc64 !ppc64el !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_sqr_diag_addlsh1@Base 2:6.0.0 __gmpn_sqrlo@Base 2:6.1.0 __gmpn_sqrlo_basecase@Base 2:6.1.0 __gmpn_sqrmod_bnm1@Base 0 @@ -649,7 +649,7 @@ (arch=any-i386)__gmpn_sub_n_pentium4_sse2@Base 2:5.1.1 (arch=any-i386)__gmpn_sub_n_pentium@Base 2:5.1.1 (arch=any-i386)__gmpn_sub_n_x86@Base 2:5.1.1 - (arch=!hppa !nios2 !mips !mipsel !tilegx !m68k !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_sub_nc@Base 0 + (arch=!arm64ilp32 !hppa !nios2 !mips !mipsel !tilegx !m68k !s390x !sh4 !sparc !sparc64 !any-i386)__gmpn_sub_nc@Base 0 (arch=any-i386)__gmpn_sub_nc_atom@Base 2:5.1.1 (arch=any-i386)__gmpn_sub_nc_k6@Base 2:5.1.1 (arch=any-i386)__gmpn_sub_nc_k7@Base 2:5.1.1 @@ -657,7 +657,7 @@ (arch=any-i386)__gmpn_sub_nc_pentium4_sse2@Base 2:5.1.1 (arch=any-i386)__gmpn_sub_nc_pentium@Base 2:5.1.1 (arch=any-i386)__gmpn_sub_nc_x86@Base 2:5.1.1 - (arch=!arm64 !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !sh4 !sparc !sparc64)__gmpn_sublsh1_n@Base 0 + (arch=!arm64 !arm64ilp32 !hppa !nios2 !mips !mipsel !mips64 !mips64el !tilegx !m68k !sh4 !sparc !sparc64)__gmpn_sublsh1_n@Base 0 (arch=any-i386)__gmpn_sublsh1_n_init@Base 2:5.1.1 (arch=alpha ppc64 ppc64el)__gmpn_sublsh2_n@Base 2:5.1.1 __gmpn_submul_1@Base 0 diff -Nru gmp-6.1.2+dfsg/debian/patches/add-arm64ilp32-generic-support.patch gmp-6.1.2+dfsg/debian/patches/add-arm64ilp32-generic-support.patch --- gmp-6.1.2+dfsg/debian/patches/add-arm64ilp32-generic-support.patch 1970-01-01 01:00:00.000000000 +0100 +++ gmp-6.1.2+dfsg/debian/patches/add-arm64ilp32-generic-support.patch 2016-12-21 05:39:47.000000000 +0000 @@ -0,0 +1,57 @@ +Description: Add arm64ilp32 support, using generic C + Most of this patch is probably unnecessary. I have not fully tested what + the minimum/correct fix needed to make this work is. This does at least + make it build, and can be refined by someone with clue. It should also be + possible to use the existing arm64 assembly with minor prolog/epilog changes, + but that requires deeper understanding of the codebase. + . +Author: Wookey <woo...@debian.org> +Last-Update: 2017-07-25 + +--- gmp-6.1.2+dfsg.orig/configure.ac ++++ gmp-6.1.2+dfsg/configure.ac +@@ -592,16 +592,19 @@ case $host in + + + arm*-*-* | aarch64*-*-*) +- abilist="32" ++ abilist="64 ilp32 32" + gcc_cflags="$gcc_cflags $fomit_frame_pointer" + gcc_cflags_optlist="arch fpmode neon tune" + gcc_64_cflags_optlist="arch tune" ++ gcc_ilp32_cflags_optlist="arch tune" + gcc_testlist="gcc-arm-umodsi" + gcc_64_testlist="" + CALLING_CONVENTIONS_OBJS='arm32call.lo arm32check.lo' + CALLING_CONVENTIONS_OBJS_64="" + cclist_64="gcc cc" ++ cclist_ilp32="gcc cc" + any_32_testlist="sizeof-long-4" ++ any_ilp32_testlist="sizeof-long-4" + any_64_testlist="sizeof-long-8" + + # This is needed for clang, which is not content with flags like -mfpu=neon +@@ -737,13 +740,22 @@ case $host in + gcc_cflags_tune="-mtune=xgene1" + ;; + aarch64*) +- abilist="64 32" ++ abilist="64 ilp32 32" + path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" ++ path_ilp32="generic" + path_64="arm64" + gcc_cflags_arch="-march=armv8-a" ++ gcc_ilp32_cflags="-mabi=ilp32" + gcc_cflags_neon="-mfpu=neon" + gcc_cflags_tune="" + ;; ++ aarch64*_ilp32) ++ abilist="ilp32" ++ path="generic" ++ gcc_cflags_arch="-march=armv8-a" ++ gcc_cflags="-mabi=ilp32" ++ gcc_cflags_tune="" ++ ;; + *) + path="arm" + gcc_cflags_arch="-march=armv4" diff -Nru gmp-6.1.2+dfsg/debian/patches/series gmp-6.1.2+dfsg/debian/patches/series --- gmp-6.1.2+dfsg/debian/patches/series 2017-07-25 14:58:32.000000000 +0100 +++ gmp-6.1.2+dfsg/debian/patches/series 2016-12-21 05:39:47.000000000 +0000 @@ -0,0 +1 @@ +add-arm64ilp32-generic-support.patch diff -Nru gmp-6.1.2+dfsg/debian/rules gmp-6.1.2+dfsg/debian/rules --- gmp-6.1.2+dfsg/debian/rules 2017-07-25 15:39:52.000000000 +0100 +++ gmp-6.1.2+dfsg/debian/rules 2016-12-21 05:39:47.000000000 +0000 @@ -62,6 +62,10 @@ confflags += ABI=x32 endif +ifneq (,$(findstring $(DEB_HOST_ARCH), ilp32)) + confflags += ABI=ilp32 +endif + ifneq (,$(filter $(DEB_HOST_ARCH), mips64 mips64el)) confflags += ABI=64 endif @@ -91,6 +95,7 @@ configure: configure-stamp configure-stamp: mkdir -p build + dh_autoreconf cd build && ../configure $(confflags_ma) \ AR=$(AR) CC="$(CC)" CFLAGS="$(CFLAGS)" \ CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" @@ -107,6 +112,7 @@ dh_testdir dh_testroot rm -rf build build-stamp + dh_autoreconf_clean dh_clean install-prep:
-- debian-science-maintainers mailing list debian-science-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-science-maintainers