This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/16092] New: wrong thunk code produced with -fPIC and visibility("hidden")


non-virtual thunk code produced without -fPIC (regardless if function has
__attribute((visibility("hidden"))) or not) is (seems correct):

_ZThn16_N18nsDirectoryService6AddRefEv:
        addq    $-16, %rdi
        jmp     _ZN18nsDirectoryService6AddRefEv

The same thunk code produced with -fPIC for function w/o visibility("hidden")
attribute (still seems correct):

_ZThn16_N18nsDirectoryService6AddRefEv:
        addq    $-16, %rdi
        jmp     *_ZN18nsDirectoryService6AddRefEv@GOTPCREL(%rip)

But with -fPIC for function with visibility("hidden") attribute it's:

_ZThn16_N18nsDirectoryService6AddRefEv:
        addq    $-16, %rdi
        jmp     _ZN18nsDirectoryService6AddRefEv(%rip)

i.e. indirect jump with function address, which tries to take function code
as its address and jump there... causing SEGV.

Tested with gcc 3.3.3 and 3.3.4.

-- 
           Summary: wrong thunk code produced with -fPIC and
                    visibility("hidden")
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: qboosh at pld-linux dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: amd64-linux
  GCC host triplet: amd64-linux
GCC target triplet: amd64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16092


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]