Re: [PATCH] Support powerpc64le-linux platform
Ulrich Weigand ulrich.weig...@de.ibm.com writes: Testing cpp symbols for ABI version makes me a bit nervous. Such things can easily get out-of-synch. It might be more resilient to check a generated object. Well, the _CALL_ELF check is what we use for all other packages that needed ELFv2 changes, starting from glibc ... So if that ever gets out of sync, we'll have bigger problems anyway. That's reassuring. :o) Is the setting of of a TOC pointer unconditionally really needed (presumably for a call from another shlib including the main program) even for leaf functions which also don't use the TOC? If a function does not use the TOC (either explicitly or implicitly e.g. because it performs a function call), then we do not need to set it up in the prolog. However, since there was just a single PROLOGUE macro, it seemed the safe course to set it always. Now, if we know for sure that none of the functions needs a TOC, we can omit it completely. Or else, we could introduce two versions of the PROLOGUE macro, and let each function choose the right one. We have for other machines allowed an optional 2nd argument for PROLOGUE. I'm not sure if this is really worth the effort though: it makes a difference only if the function is called externally (from another shared library or via function pointer). Aren't those routines mostly called locally anyway? Local calls will bypass the TOC setup automatically anyway. It will help time-critical end-user programs which call documented mpn functions directly. Some asm files do use the TOC (typically mode1o.asm, invert_limb.asm, mod_1_[1234].asm, gcd_1.asm). I'd suggest using PROLOGUE(fn,toc) for the latter functions, and PROLOGUE(fn) for other functions. For the v1 ABI, I assume we cannot be clever about this. Is there a way we could test powerpc64le-linux or the new abi? We try to have (automated) tests for every ABI which we claim to be supporting. Right now there is no base OS for powerpc64le-linux that you could install readily, and there's also no easy way to get a machine to run this on. I'm sure once we're a bit farther along, we'll try to make a powerpc64le-linux test machine available, e.g. in the GCC compile farm. I usually simulate GMP test systems. Torbjörn ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel
Re: [PATCH] Support powerpc64le-linux platform
Ulrich Weigand uweig...@de.ibm.com writes: this patch updates GMP to support the little-endian PowerPC64 platform (powerpc64le-linux). This requires two changes: - Update configfsf.guess/sub to current upstream versions. I think Niels volunteered to do that... - Change mpn/powerpc64/elf.m4 to generate appropriate assembler code for the new ELFv2 ABI. The relevant change here is that we no longer require function descriptors; instead, functions that use the TOC register need to provide a pair of global and local entry points. For more details, see the GCC patch messages here: http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01144.html http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01141.html Tested using make check on powerpc64le-linux; in addition, we've been using this patch for a while when building GMP to use with the native GCC on the platform. Also, built and tested with no regressions on powerpc64-linux. Good! Comments: Testing cpp symbols for ABI version makes me a bit nervous. Such things can easily get out-of-synch. It might be more resilient to check a generated object. Is the setting of of a TOC pointer unconditionally really needed (presumably for a call from another shlib including the main program) even for leaf functions which also don't use the TOC? Is there a way we could test powerpc64le-linux or the new abi? We try to have (automated) tests for every ABI which we claim to be supporting. -- Torbjörn ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel
Re: [PATCH] Support powerpc64le-linux platform
Ulrich Weigand uweig...@de.ibm.com writes: - Update configfsf.guess/sub to current upstream versions. We should definitely do that, independent of the other fixes. Please remind if we don't get to that within a week or so (I can't do it right away). - Change mpn/powerpc64/elf.m4 to generate appropriate assembler code for the new ELFv2 ABI. The relevant change here is that we no longer require function descriptors; instead, functions that use the TOC register need to provide a pair of global and local entry points. For more details, see the GCC patch messages here: http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01144.html http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01141.html Looks sane to me (without understanding the fine details). Maybe Torbjörn has some comments. I'm not really familiar neither with how ABI variants are handled in GMP, nor with powerpc assembly. Would this be OK for GMP mainline? I think so. (I haven't submitted a GMP patch before; if there's anything else I should be doing to facilitate this process, please let me know!) We ask for FSF copyright assignments for all substantial changes. Yours is maybe borderline, but I think we'd still like to have some paperwork. We can arrange it off-list. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel
[PATCH] Support powerpc64le-linux platform
Hello, this patch updates GMP to support the little-endian PowerPC64 platform (powerpc64le-linux). This requires two changes: - Update configfsf.guess/sub to current upstream versions. - Change mpn/powerpc64/elf.m4 to generate appropriate assembler code for the new ELFv2 ABI. The relevant change here is that we no longer require function descriptors; instead, functions that use the TOC register need to provide a pair of global and local entry points. For more details, see the GCC patch messages here: http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01144.html http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01141.html Tested using make check on powerpc64le-linux; in addition, we've been using this patch for a while when building GMP to use with the native GCC on the platform. Also, built and tested with no regressions on powerpc64-linux. Would this be OK for GMP mainline? (I haven't submitted a GMP patch before; if there's anything else I should be doing to facilitate this process, please let me know!) Bye, Ulrich ChangeLog: 2013-12-03 Ulrich Weigand ulrich.weig...@de.ibm.com * configure.ac: Check for ELFv2 ABI on PowerPC. * mpn/powerpc64/elf.m4: Set assembler ABI version for ELFv2 and use appropriate PROLOGUE_cpu/EPILOGUE_cpu sequences. * configfsf.guess: Update to 2013-11-29 version. * configfsf.sub: Update to 2013-10-01 version. diff -ur gmp.orig/configure.ac gmp/configure.ac --- gmp.orig/configure.ac 2013-12-03 16:21:33.0 + +++ gmp/configure.ac2013-12-03 17:08:30.500059789 + @@ -3504,6 +3504,14 @@ GMP_ASM_POWERPC_PIC_ALWAYS GMP_ASM_POWERPC_R_REGISTERS GMP_INCLUDE_MPN(powerpc32/powerpc-defs.m4) + + # Check for Linux ELFv2 ABI + AC_EGREP_CPP(yes, +[#if _CALL_ELF == 2 +yes +#endif], + [GMP_DEFINE_RAW([define(ELFv2_ABI)])]) + case $host in *-*-aix*) case $ABI in diff -ur gmp.orig/mpn/powerpc64/elf.m4 gmp/mpn/powerpc64/elf.m4 --- gmp.orig/mpn/powerpc64/elf.m4 2013-12-03 16:21:35.0 + +++ gmp/mpn/powerpc64/elf.m42013-12-03 17:08:30.500059789 + @@ -18,7 +18,11 @@ dnl You should have received a copy of the GNU Lesser General Public License dnl along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. -define(`ASM_START',`') +define(`ASM_START', +`ifdef(`ELFv2_ABI', +` + .abiversion 2 +')') dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo) dnl EPILOGUE_cpu(GSYM_PREFIX`'foo) @@ -26,7 +30,17 @@ define(`PROLOGUE_cpu', m4_assert_numargs(1) - ` +`ifdef(`ELFv2_ABI', +` + .globl $1 + .type $1, @function + .section.text + .align 5 +$1: +0: addis 2, 12, (.TOC.-0b)@ha + addi2, 2, (.TOC.-0b)@l + .localentry $1, .-$1 +',` .globl $1 .globl .$1 .section.opd,aw @@ -37,11 +51,16 @@ .type .$1, @function .section.text .align 5 -.$1:') +.$1: +')') define(`EPILOGUE_cpu', m4_assert_numargs(1) -` .size .$1, .-.$1') +`ifdef(`ELFv2_ABI',` + .size $1, .-$1 +',` + .size .$1, .-.$1 +')') define(`TOC_ENTRY', `') diff -ur gmp.orig/configfsf.guess gmp/configfsf.guess --- gmp.orig/configfsf.guess2013-12-03 16:21:32.0 + +++ gmp/configfsf.guess 2013-12-03 17:03:24.130054884 + @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2012-09-25' +timestamp='2013-11-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -17,24 +15,22 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see https://www.gnu.org/licenses/. +# along with this program; if not, see http://www.gnu.org/licenses/. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to config-patc...@gnu.org and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +#