On Wed, Dec 04, 2013 at 09:52:19PM +0100, Andy Polyakov wrote:
> >A new Linux ABI, called ELFv2, was created for the little-endian PPC64
> >platform. It includes several changes to the current ABI and affects
> >mainly how functions are called between modules/objects. Functions
> >descriptors are not used in the new ABI and this patch updates how the
> >directives .globl and .size generates code to LE.
> >
> >Further information can be found at
> >http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01141.html
> 
> It suggests that there ought to be .abiversion 2 and .localentry.

You are right. It seems the GNU linker is not enforcing that. But it 
should use .abiversion 2

> 
> >---
> > crypto/perlasm/ppc-xlate.pl | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> >diff --git a/crypto/perlasm/ppc-xlate.pl b/crypto/perlasm/ppc-xlate.pl
> >index 118da16..7a3f858 100755
> >--- a/crypto/perlasm/ppc-xlate.pl
> >+++ b/crypto/perlasm/ppc-xlate.pl
> >@@ -27,7 +27,8 @@ my $globl = sub {
> >     /osx/           && do { $name = "_$name";
> >                             last;
> >                           };
> >-    /linux.*32/     && do { $ret .= ".globl $name\n";
> >+    /linux.*32/     ||
> >+    /linux.*64le/   && do { $ret .= ".globl $name\n";
> 
> This doesn't look right from operator associativity viewpoint...

Yes, it should affect 32-bit. I checked the generated assembly code for
linux-ppc, linux-ppc64 and linu-ppc64le before submitting. But I was
unlucky and linux-ppc ended up being handled by the if (!$ret)
statement.

> 
> http://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=f586d97191ad9821faea026df68aceaba45d1800
> 

No need for .localentry here. It is necessary when local and global
entry points don't coincide. That usually happens when the function, or
any other function that might be called by it, needs to access data via 
TOC and then r2 needs to be set properly.

That is an example of the intended usage (based on FUNC_START macro):

.type some_function,@function
.globl some_function
some_function:
0:  addis 2,12,(.TOC.-0b)@ha
    aaddi 2,2,(.TOC.-0b)@l
    .localentry some_function,.-some_function
    # function code goes here
    blr

In that case, .localentry will include in ELF the offset (2) between
both entry points.

Regards,
Marcelo

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to