mips static constructor changes

joel@OARcorp.com joel@OARcorp.com
Fri Apr 16 09:06:00 GMT 1999


Finally, I can reply to the original message. :)

As noted in previous messages, binutils 2.9.1 does not appear to like KEEP
and SORT.  It also does not like the line to start with "(".  So I ended
up with this for the .ctors section:

  .ctors         :
  {
    ___ctors = .;
/*
 *  This version is preferable but requires a very late
 *  model binutils (post 2.9.1).
    KEEP(*crtbegin.o(.ctors));
    KEEP(*(SORT(.ctors.*)));
    KEEP(*(.ctors));
*/
    *crtbegin.o(.ctors);
    *(.ctors.*); 
    *(.ctors);
    ___ctors_end = .;
  }

This works with mips64orion-rtems and binutils 2.9.1.

My questions are:

1.  Is this right? I know binutils is happy. :)

2.  Where should crtend.o be mentioned?

I think I am getting close here. :)

--joel

On Tue, 13 Apr 1999, Catherine Moore wrote:

> 
> Index: idt.ld
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/libgloss/mips/idt.ld,v
> retrieving revision 1.8
> diff -p -r1.8 idt.ld
> *** idt.ld	1997/09/08 18:46:20	1.8
> --- idt.ld	1999/02/04 19:02:22
> *************** SECTIONS
> *** 44,49 ****
> --- 44,65 ----
>        etext  =  .;
>        _etext  =  .;
>     }
> +   .ctors         :
> +   {
> +     ___ctors = .;
> +     KEEP(*crtbegin.o(.ctors))
> +     KEEP(*(SORT(.ctors.*)))
> +     KEEP(*(.ctors))
> +     ___ctors_end = .;
> +   }
> +   .dtors         :
> +   {
> +     ___dtors = .;
> +     KEEP(*crtbegin.o(.dtors))
> +     KEEP(*(SORT(.dtors.*)))
> +     KEEP(*(.dtors))
> +     ___dtors_end = .;
> +   }
>     . = .;
>     .rdata : {
>       *(.rdata)
> *************** SECTIONS
> *** 51,57 ****
>      _fdata = ALIGN(16);
>     .data : {
>       *(.data)
> -     CONSTRUCTORS
>     }
>     . = ALIGN(8);
>     _gp = . + 0x8000;
> --- 67,72 ----
> 



More information about the Gcc-patches mailing list