i386-specific G++ bug
Charles M. Hannum
mycroft@mit.edu
Sun Sep 28 14:02:00 GMT 1997
Richard Henderson <rth@dot.cygnus.com> writes:
>
> > The problem is that the following instruction is output:
> >
> > movl _foo__Fv@GOT(%ebx),%edx
> >
> > for the reference to foo() inside bar(). Since foo() is static, this
> > is an invalid GOT reference. The correct instruction would be:
> >
> > leal _foo__Fv@GOTOFF(%ebx),%edx
>
> While the later is more efficient, and should in fact be used in this
> situation, the former should work. If it doesn't, it is a linker bug.
It is unfortunately the case that, in the i386 a.out PIC format
(derived from SunOS), there is no correct way of representing the
relocation for the former instruction when it refers to a static/local
symbol. There is only one relocation type for GOT entries and offsets
from the GOT, and the `external' bit is overloaded to differentiate
between the two. (Yah, so it sucks. I can't do anything about that.)
Regardless, it's pretty clear that the C++ frontend is doing something
wrong here.
More information about the Gcc
mailing list