COMDAT

Jim Dehnert dehnert at baalbek.engr.sgi.com
Sat Sep 2 07:49:38 UTC 2000


> From: Mark Mitchell <mark at codesourcery.com>
> 
> >>>>> "Jim" == Jim Dehnert <dehnert at baalbek.engr.sgi.com> writes:
> 
>     Jim> not.  The reason is that the usual "as if" rule makes it
>     Jim> unnecessary.  (We haven't explicitly stated the rule -- I
>     Jim> always assume it -- but could.)
> 
> Well, this goes a little beyond the normal as-if rule, which simply
> says that a program cannot detect the difference.  (For example, in
> C's abstract machine, if `x * 2' is implemented as `x + x', no
> conforming program can ever know how the operation was actually
> calculated.)
> 
> But here, `nm' is certainly going to say something different about
> what's where.  So, I think there's a little more of an issue.

I don't think nm's behavior is relevant.  The 'as if' rule involves
whether the program itself can see a difference, not whether some
external agent can see it.  After all, a debugger that looks at
instructions can see the difference between x*2 and x+x.  And nm can
see the difference when we inline all calls to a subprogram and remove
the out-of-line version.  But we allow both of these.

The reason this case seems more complicated is that its impact goes
beyond the object file where it occurs, and needs to behave properly in
the presence of objects from multiple compilers.  But the principle is
the same -- if the program itself can't detect the difference, there is
no difference.

> Practically speaking, some vendors are not going to have COMDAT groups
> right away.  It would still be nice if they cna produce ABI-compliant
> binaries.  We have to be careful that we are not designing an ABI that
> will be slightly misimplemented in various incompatible ways -- it
> would be better to do something slightly less technically ambitious
> that permitted widespread implementation and interoperation.

I agree with this.  But I think it's better to suggest an alternate
implementation in a separate document than in the ABI itself.  I guess
I'm not convinced that we've thought of all the potential complications
of mixed implementations.  And I know that I don't want to encourage a
situation where, for instance, a carefully crafted fall-through
alternate entry in a DSO is pre-empted by a weak thunk in the main
executable.  The COMDAT stuff is new, but let's encourage its use, even
while we recognize that, practically speaking, it will be phased in.
Much of the rest of the ABI will be, too.

Jim

-	    Jim Dehnert		dehnert at sgi.com
				(650)933-4272




More information about the cxx-abi-dev mailing list