This is the mail archive of the gcc@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]

Re: AIX vtable issues


	This actually is similar to a problem that Torbjorn and I are
working on.  The original GCC port to RS/6000 played fast and loose with
AIX symbols. 

	AIX allows two types of objects to be placed in the symbol table:
CSECT (like subsections), e.g. .csect foo[RW], and labels, e.g.
foo: .long 8.

So one can produce

        .toc
LC..0:
        .tc _ZTT4MostIiE[TC],_ZTT4MostIiE[RW]

and

	.csect .data[RW]
	.globl _ZTT4MostIiE
_ZTT4MostIiE:
	.long 8

which the assembler creates a reference to an unefined external csect
_ZTT4MostIiE[RW] and externalizes _ZTT4MostIiE.  The linker only cares
about the symbol name, not the type of object, so it combines the two.
This type of code punts to the linker instead of allowing the assembler to
handle the reference directly.

	AIX XLC code normally produces code equivalent to GCC
-fdata-sections

	.csect _ZTT4MostIiE[RW]
	.globl _ZTT4MostIiE[RW]
_ZTT4MostIiE:
	.long 8

I do not know if Kenner's original references to externals via their CSECT
name was for correctness or that it just happened to work.

	What I mean is that I do not know if there is a subtle case for
the type of code that GCC could produce in reference to XLC code for which

        .toc
LC..0:
        .tc _ZTT4MostIiE[TC],_ZTT4MostIiE[RW]

is correct and

        .toc
LC..0:
        .tc _ZTT4MostIiE[TC],_ZTT4MostIiE

is not.  Because the linker fixes up the references, it has not been a
problem.  I know that the AIX assembler can have problems because it is
overly simplistic -- reading the assembly output in one pass.  It does not
handle forward references very well and it may be more lenient about
forward CSECT references than about forward label references.

	We probably should try this vtables example with Torbjorn and my
patch which should strip off the decoration in more cases where it is
correct to reference the label.

David

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