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 c++/11331] [Regression 3.4] ld: BFD 2.14.90 20030602 internal error


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From jakub at gcc dot gnu dot org  2003-06-27 09:36 -------
I admit I know nothing about PA assembly, but I find it very surprising
a branch (even if long branch) is more expensive than short branch to .plt
and call through that or load from .got and indirect jump to that.
As to what advantages does it bring on other arches, I'll mention just a few,
others have similar advantages:
ia32, -fpic -O2 before the patch:
        movl    4(%esp), %eax
        movl    (%eax), %ecx
        addl    -12(%ecx), %eax
        movl    %eax, 4(%esp)
        call    .L85
.L85:   popl    %ecx
        addl    $_GLOBAL_OFFSET_TABLE_+[.-.L85], %ecx
        movl    _ZN1CD1Ev@GOT(%ecx), %ecx
        jmp     *%ecx

ia32, -fpic -O2 after the patch (plus likely one less dynamic relocation):
        movl    4(%esp), %eax
        movl    (%eax), %ecx
        addl    -12(%ecx), %eax
        movl    %eax, 4(%esp)
        jmp     .LTHUNK0

amd64, -fpic -O2 before:
        movq    (%rdi), %r10
        addq    -24(%r10), %rdi
        jmp     *_ZN1CD1Ev@GOTPCREL(%rip)

amd64, -fpic -O2 after:
        movq    (%rdi), %r10
        addq    -24(%r10), %rdi
        jmp     .LTHUNK0

s390, -fPIC -O2 before:
        lhi     %r1,-12
        a       %r1,0(%r2)
        a       %r2,0(%r1)
        basr    %r1,0
.L96:   l       %r0,.L97-4-.L96(%r1)
        a       %r1,.L97-.L96(%r1)
        ar      %r1,%r0
        l       %r1,0(%r1)
        br      %r1
        .align  4
        .long   _ZN1CD1Ev@GOT
.L97:   .long   _GLOBAL_OFFSET_TABLE_-.L96

s390, -fPIC -O2 after:
        lhi     %r1,-12
        a       %r1,0(%r2)
        a       %r2,0(%r1)
        basr    %r1,0
.L96:   a       %r1,.L97-.L96(%r1)
        br      %r1
        .align  4
.L97:   .long   .LTHUNK0-.L96

s390x, -fpic -O2 before:
        lghi    %r1,-24
        ag      %r1,0(%r2)
        ag      %r2,0(%r1)
        jg      _ZN1CD1Ev@PLT
# Where in the better case resolved plt slot looks like:
        larl    %r1,XX@GOTENT
        lg      %r1,0(%r1)
        bcr     %r15,%r1

s390x, -fpic -O2 after:
        lghi    %r1,-24
        ag      %r1,0(%r2)
        ag      %r2,0(%r1)
        jg      .LTHUNK0

ppc32, -fpic -O2 before:
        lwz 9,0(3)
        lwz 0,-12(9)
        add 3,3,0
        b _ZN1CD1Ev@plt
# Where plt slot after resolving will likely be a relative branch

ppc32, -fpic -O2 after:
        lwz 9,0(3)
        lwz 0,-12(9)
        add 3,3,0
        b .LTHUNK0@local

Also, what is totally unclear to me is why simple short branch is acceptable
on hppa without -fpic but i not with -fpic. Do you have different size limitations for shared libraries and binaries?


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