[ia64-abi] Issue 82: Initializer priorities

Cary Coutant cary at cup.hp.com
Fri Mar 31 18:03:33 UTC 2000


>Since I promised to summarize the minimum ABI support required for this:
>
>	Define a new section type, SHT_CXX_PRIORITY_INIT.
>
>	The linker must concatenate the SHT_CXX_PRIORITY_INIT sections
>	in the linked output file.  (Note that this is the defined
>	default behavior for an unrecognized section type.)
>
>On a system where the linker does no more than this, the C++
>implementation must do the following:
>
>	In bracketing files for the link (e.g. crt1.o and crtn.o),
>	emit delimiting labels in the SHT_CXX_PRIORITY_INIT section,
>	and entries in INITARRAY that call an initialization
>	routine that passes the labels (all STV_HIDDEN to avoid
>	conflicts between DSOs).  The call at the beginning would
>	sort the SHT_CXX_PRIORITY_INIT vector by priority and invoke
>	the negative-priority initializers, and the one at the end
>	would invoke the positive-priority initializers.

I agree with Ulrich that "CXX" does not belong in the name. But I also 
believe that you don't even need a special section type. I don't see any 
special treatment required of this section beyond SHT_PROGBITS. Your 
bracketing files provide the necessary labels so that the initialization 
routine can find the section.

I understand the argument that the special section type might allow a 
linker to do the sorting if it chose to do so, but you can do that with a 
vendor-specific section type, and the compatibility rules ensure that 
other linkers will treat that section type properly.

This description sounds like it affects the initializer order only within 
a DSO. How does it address reordering of initializers across DSOs?

-cary




More information about the cxx-abi-dev mailing list