mips static constructor changes

joel@OARcorp.com joel@OARcorp.com
Wed Apr 14 06:07:00 GMT 1999


What version of egcs is this patch against?  I can not get it to apply
cleanly to 1.1.2.

Also there has been a general discussion on the RTEMS lists about what is
required from the linker script and specs files to make C++ work on an
embedded target.  Remember RTEMS uses the specs extensions to specify most
of the linker information.  I am looking at about 10 gcc RTEMS targets
and do not understand the big picture enough to make it work on all of
them.  I understand the general scheme of the global constructors, I
just get lost in the target dependent details of actually linking an
executable.  If someone would like to explain this to me, I would
very much appreciate it.


On Tue, 13 Apr 1999, Jeffrey A Law wrote:

> 
>   In message < 199904131639.JAA29815@cygint.cygnus.com >you write:
>   >   I'm attaching a patch which changes the way that static constructors
>   > are handled for mips platforms.  In the past, we've used collect to
>   > build the constructor tables.  This patch will cause the compiler to
>   > build them which will bring the mips targets in line with other elf
>   > platforms.  This is important because it allows us to take advantage
>   > of generic elf developments which center around the use of crtbegin/
>   > crtend.  The patch also fixes a problem that is caused because ld/collect
>   > cannot discern whether or not the constructor tables need to be
>   > accessed with 32 or 64 bit pointers.  
>   > 
>   >   The vxworks, linux and rtems platforms will probably need a little work
>   > to get them to function properly with this change.  For the time being,
>   > these platforms have disabled the new functionality by undefining the CTOR macros
>   > .
>   > Please let me know if you need any assistance in upgrading to the new
>   > static ctor/dtor support.
>   > 
>   >   The patch also requires linker script changes to gather the new
>   > .ctor/.dtor sections.  I will include a sample link script at the end of the patch.
>   > 
>   >   Thanks,
>   > 
>   >   --catherine
>   > 
>   > Mon Apr 12 12:58:03 1999  Catherine Moore  <clm@cygnus.com>
>   > 
>   > 	* config/mips/elf.h, config/mips/elf64.h
>   > 	(CTORS_SECTION_ASM_OP): Define.
>   > 	(DTORS_SECTION_ASM_OP): Define.
>   > 	(EXTRA_SECTIONS): Define.
>   > 	(INVOKE__main): Define.
>   > 	(NAME__MAIN): Define.
>   > 	(SYMBOL__MAIN): Define.
>   > 	(EXTRA_SECTIONS_FUNCTIONS): Define.
>   > 	(SECTION_FUNCTION_TEMPLATE): Define.
>   > 	(ASM_OUTPUT_CONSTRUCTOR): Define.
>   > 	(ASM_OUTPUT_DESTRUCTOR): Define.
>   > 	(CTOR_LIST_BEGIN): Define.
>   > 	(CTOR_LIST_END): Define.
>   > 	(DTOR_LIST_BEGIN): Define.
>   > 	(DTOR_LIST_END): Define.
>   > 	(LIB_SPEC): Define.
>   > 	(STARTFILE_SPEC): Define.
>   > 	(ENDFILE_SPEC): Define.
>   > 	* config/mips/linux.h:  Undefine all of the above.
>   > 	* config/mips/rtems64.h: Likewise.
>   > 	* config/mips/t-r3900: Likewise.
>   > 	* config/mips/t-elf: New file.
>   > 	* config/mips/vxworks.h: New file.
>   > 	* configure.in (mips-wrs-vxworks): Use mips/vxworks.h.
>   > 	(mips*-*-*elf*):  Use t-elf instead of t-ecoff.
>   > 	* configure: Regenerate.
> It looks good to me.  I think you should go ahead and install it.  Hopefully
> the vxworks & rtems targets will get updated soon and can use the cleaner 
> ctor/dtor implementation.
> 
> Thanks!
> jeff
> 



More information about the Gcc-patches mailing list