SUBMISSION: New Library for kdesupport: indexlib

Bernhard Rosenkraenzer bero at arklinux.org
Mon Jun 13 22:54:50 BST 2005


On Sunday 12 June 2005 16:54, Thiago Macieira wrote:
> Objdump reveals, for the first function:
>   12:   8b 81 00 00 00 00       mov    0x0(%ecx),%eax
>                         14: R_386_GOT32 QCoreApplication::self
>   18:   83 38 00                cmpl   $0x0,(%eax)
>
> While the second has:
>   3a:   89 81 00 00 00 00       mov    %eax,0x0(%ecx)
>                         3c: R_386_GOTOFF        QCoreApplication::self
>
> Note the difference in relocation. The second relocation vanishes when
> linking the .o into .so.

This seems to have been fixed. I just ran your test case through my g++ 
(gcc-c++-3.4.5-0.20050613.1ark -- basically gcc-3_4-branch as of today w/ the 
visibility patch and a couple of bugfix patches grabbed from gcc's bugzilla) 
and while I'm not an ELF expert, this looks right to me:

00000000 <QCoreApplicationPrivate::checkInstance(char const*)>:
   0:   e8 00 00 00 00          call   5 
<QCoreApplicationPrivate::checkInstance(char const*)+0x5>
   5:   59                      pop    %ecx
   6:   81 c1 03 00 00 00       add    $0x3,%ecx
                        8: R_386_GOTPC  _GLOBAL_OFFSET_TABLE_
   c:   55                      push   %ebp
   d:   8b 81 00 00 00 00       mov    0x0(%ecx),%eax
                        f: R_386_GOT32  QCoreApplication::self
  13:   89 e5                   mov    %esp,%ebp
  15:   5d                      pop    %ebp
  16:   8b 00                   mov    (%eax),%eax
  18:   85 c0                   test   %eax,%eax
  1a:   0f 95 c0                setne  %al
  1d:   25 ff 00 00 00          and    $0xff,%eax
  22:   c3                      ret
  23:   90                      nop
  24:   8d b6 00 00 00 00       lea    0x0(%esi),%esi
  2a:   8d bf 00 00 00 00       lea    0x0(%edi),%edi

00000030 <QCoreApplication::init()>:
  30:   55                      push   %ebp
  31:   e8 00 00 00 00          call   36 <QCoreApplication::init()+0x6>
  36:   59                      pop    %ecx
  37:   81 c1 03 00 00 00       add    $0x3,%ecx
                        39: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
  3d:   89 e5                   mov    %esp,%ebp
  3f:   8b 81 00 00 00 00       mov    0x0(%ecx),%eax
                        41: R_386_GOT32 QCoreApplication::self
  45:   8b 55 08                mov    0x8(%ebp),%edx
  48:   89 10                   mov    %edx,(%eax)
  4a:   5d                      pop    %ebp
  4b:   c3                      ret


I used g++ -O2 -fvisibility=hidden -fPIC -o test.o something.ii to test -- do 
I need to pass any other compiler flags to reproduce this, or is it safe to 
assume this is a problem with older gcc 3.4.x versions only?

LLaP
bero




More information about the kde-core-devel mailing list