This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] Make calls in virtual thunks local if possible
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc-patches at gcc dot gnu dot org
- Cc: jakub at redhat dot com, binutils at sources dot redhat dot com
- Date: Wed, 25 Jun 2003 11:46:20 -0400 (EDT)
- Subject: Re: [PATCH] Make calls in virtual thunks local if possible
This patch has broken the hppa-unknown-linux-gnu port.
/home/dave/gcc-3.4/objdir/gcc/xgcc -shared-libgcc -B/home/dave/gcc-3.4/objdir/gcc/ -nostdinc++ -L/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/src -L/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/src/.libs -B/home/dave/opt/gnu/hppa-linux/bin/ -B/home/dave/opt/gnu/hppa-linux/lib/ -isystem /home/dave/opt/gnu/hppa-linux/include -isystem /home/dave/opt/gnu/hppa-linux/sys-include -shared -nostdlib /home/dave/opt/gnu/lib/crti.o /home/dave/gcc-3.4/objdir/gcc/crtbeginS.o .libs/allocator-inst.o .libs/codecvt.o .libs/complex_io.o .libs/concept-inst.o .libs/ctype.o .libs/demangle.o .libs/ext-inst.o .libs/fstream-inst.o .libs/functexcept.o .libs/globals.o .libs/io-inst.o .libs/ios.o .libs/istream-inst.o .libs/limits.o .libs/locale.o .libs/locale-inst.o .libs/localename.o .libs/misc-inst.o .libs/ostream-inst.o .libs/sstream-inst.o .libs/stdexcept.o .libs/streambuf-inst.o .libs/string-inst.o .libs/strstream.o .libs/valarray-inst.o .libs/wstring-inst.o .libs/codecvt_members.o .lib!
s/collate_members.o .libs/ctype_members.o .libs/messages_members.o .libs/monetary_members.o .libs/numeric_members.o .libs/time_members.o .libs/basic_file.o .libs/c++locale.o -Wl,--whole-archive ../libmath/.libs/libmath.a ../libsupc++/.libs/libsupc++convenience.a -Wl,--no-whole-archive -L/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/src -L/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/src/.libs -lm ../libmath/.libs/libmath.a -lm ../libsupc++/.libs/libsupc++convenience.a -lm -L/home/dave/gcc-3.4/objdir/gcc -L/home/dave/opt/gnu/hppa-linux/bin -L/home/dave/opt/gnu/hppa-linux/lib -L/home/dave/opt/gnu/lib -L/home/dave/opt/gnu/lib/gcc-lib/hppa-linux/3.4 -L/home/dave/opt/gnu/lib/gcc-lib/hppa-linux/3.4/../../../../hppa-linux/lib -L/home/dave/opt/gnu/lib/gcc-lib/hppa-linux/3.4/../../.. -lgcc_s -lgcc -lc -lgcc_s -lm -lgcc_s -lgcc -lc -lgcc_s /home/dave/gcc-3.4/objdir/gcc/crtendS.o /home/dave/opt/gnu/lib/crtn.o -Wl,-O1 -Wl,--version-script=libstdc++-symbol.ver -Wl,-soname -W!
l,libstdc++.so.6 -o .libs/libstdc++.so.6.0.0
/home/dave/opt/gnu/bin/ld: BFD 2.14.90 20030602 internal error, aborting at ../../src/bfd/elf32-hppa.c line 3864 in elf32_hppa_relocate_section
/home/dave/opt/gnu/bin/ld: Please report this bug.
collect2: ld returned 1 exit status
I'm not entirely sure what's wrong but it appears that ld can't handle
the following situation (from io-inst.s):
.section .gnu.linkonce.t._ZNSdD1Ev,"ax",@progbits
.align 4
.weak _ZNSdD1Ev
.type _ZNSdD1Ev, @function
.LFB1804:
_ZNSdD1Ev:
...
.set .LTHUNK1,_ZNSdD1Ev
...
.data
.align 4
.LTHN0:
.word P'.LTHUNK1
The P' is a procedure descriptor (plabel) constructor. Using a procedure
descriptor for the branch from the thunk was necessary under hpux. This
prevents the linker from adding a stub between the branch and its target.
This technique was carried over to linux. It might be possible to
change linux to use a simple pc-relative branch in the thunk. The
stubs inserted by the linux linker don't mess with the return pointer
(except in the multispace model which the kernel doesn't currently
support). Possibly, we won't get a stub at all if the branch is local.
However, it can be seen that the thunk follows the function. As a result,
we can't be certain that a pc-relative branch will be able to reach the
start of the function. It would be better to have the thunk just before the
function if possible.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)