From mboxrd@z Thu Jan  1 00:00:00 1970
From: Ken Raeburn <raeburn@cygnus.com>
To: Manfred Hollstein <manfred@s-direktnet.de>
Cc: rth@cygnus.com, bfd@cygnus.com, gas2@cygnus.com
Subject: Re: Bugs in recent snapshots on Solaris
Date: Fri, 13 Mar 1998 16:09:00 -0000
Message-id: <tx13egmqgj2.fsf@cygnus.com>
References: <13576.61624.313896.482781@slsvhmt> <13576.63996.735032.948934@slsvhmt>
X-SW-Source: 1998/msg00020.html

Yes, it appears that the symbol shlib_shlibvar1, which names a
function in the text section that has its address taken at various
points, has gotten moved in the shared library to the .plt section.
(The correct code is still in the text section, just without a name.)

The code at that .plt location, at run time, becomes a very tight
loop.  In the .so file:

DYNAMIC RELOCATION RECORDS
OFFSET   TYPE              VALUE 
...
00010790 R_SPARC_JMP_SLOT  shlib_shlibvar1
...

Disassembly of section .plt:

00010754 <shlib_shlibcalled-30>:
        ...

00010784 <shlib_shlibcalled>:
   10784:       03 00 00 30     sethi  %hi(0xc000), %g1
   10788:       30 bf ff f3     b,a   10754 <_PROCEDURE_LINKAGE_TABLE_>
   1078c:       01 00 00 00     nop 

00010790 <shlib_shlibvar1>:
   10790:       03 00 00 3c     sethi  %hi(0xf000), %g1
   10794:       30 bf ff f0     b,a   10754 <_PROCEDURE_LINKAGE_TABLE_>
   10798:       01 00 00 00     nop 
   1079c:       03 00 00 48     sethi  %hi(0x12000), %g1
   107a0:       30 bf ff ed     b,a   10754 <_PROCEDURE_LINKAGE_TABLE_>
   107a4:       01 00 00 00     nop 
   107a8:       01 00 00 00     nop 

And run time:

(gdb) x/20i &shlib_shlibvar1
0xef7a0790 <shlib_shlibvar1>:   sethi  %hi(0xf000), %g1
0xef7a0794 <shlib_shlibvar1+4>: sethi  %hi(0xef7a0400), %g1
0xef7a0798 <shlib_shlibvar1+8>:
    jmp  %g1 + 0x390    ! 0xef7a0790 <shlib_shlibvar1>
0xef7a079c <shlib_shlibvar1+12>:        sethi  %hi(0x12000), %g1


I'm not familiar with the shared library linker support, so for the
moment, I'll leave the rest to Richard.

Ken