[patch] libgloss/m68k/fido.sc: Catch more sections.

Jeff Johnston jjohnstn@redhat.com
Fri Apr 27 16:05:00 GMT 2007


Patch applied.

-- Jeff J.

Kazu Hirata wrote:
> Hi,
> 
> Attached is a patch to catch more sections.
> 
> Specifically, we need to catch
> 
>   .text.*
>   .rodata.*
>   .data.*
>   .bss.*
> 
> to cope with newer versions of gcc emitting symbols in sections of the
> form .text.foo.
> 
> Also, we need to include .ctor.* and .dtor.* to catch ctor symbols
> with priorities.  At the same time, we need to wrap those
> ctor/dtor-related sections with KEEP so that the garbage collector
> won't remove them.
> 
> Tested on fido-none-elf.  OK to apply?
>  
> Kazu Hirata
> 
> 2007-04-26  Kazu Hirata  <kazu@codesourcery.com>
> 
> 	* libgloss/m68k/fido.sc: Catch .text.*, .rodata.*, .data.*,
> 	.bss.*, .ctor.*, and .dtor.*.  Wrap ctor/dtor-related sections
> 	with KEEP.
> 
> Index: libgloss/m68k/fido.sc
> ===================================================================
> RCS file: /cvs/src/src/libgloss/m68k/fido.sc,v
> retrieving revision 1.2
> diff -u -d -p -r1.2 fido.sc
> --- libgloss/m68k/fido.sc	18 Dec 2006 21:48:18 -0000	1.2
> +++ libgloss/m68k/fido.sc	26 Apr 2007 15:16:49 -0000
> @@ -142,21 +142,22 @@ SECTIONS {
>    /* Text section.  */
>    .text :
>    {
> -    *(.text .gnu.linkonce.t.*)
> +    *(.text .text.*)
> +    *(.gnu.linkonce.t.*)
> +
>      . = ALIGN(0x4);
> -     __CTOR_LIST__ = .;
> -    ___CTOR_LIST__ = .;
> -    LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
> -    *(.ctors)
> -    LONG(0)
> -    __CTOR_END__ = .;
> -    __DTOR_LIST__ = .;
> -    ___DTOR_LIST__ = .;
> -    LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
> -    *(.dtors)
> -     LONG(0)
> -    __DTOR_END__ = .;
> -    *(.rodata* .gnu.linkonce.r.*)
> +    /* These are for running static constructors and destructors under ELF.  */
> +    KEEP (*crtbegin.o(.ctors))
> +    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
> +    KEEP (*(SORT(.ctors.*)))
> +    KEEP (*crtend.o(.ctors))
> +    KEEP (*crtbegin.o(.dtors))
> +    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
> +    KEEP (*(SORT(.dtors.*)))
> +    KEEP (*crtend.o(.dtors))
> +
> +    *(.rodata .rodata.*)
> +    *(.gnu.linkonce.r.*)
>      *(.gcc_except_table) 
>      *(.eh_frame)
>  
> @@ -188,7 +189,8 @@ SECTIONS {
>      _data = .;
>      KEEP (*(.jcr));
>      *(.shdata);
> -    *(.data .gnu.linkonce.d.*);
> +    *(.data .data.*)
> +    *(.gnu.linkonce.d.*)
>      _edata_cksum = .;
>      *(checksum);
>      _edata = .;
> @@ -200,7 +202,8 @@ SECTIONS {
>      . = ALIGN(0x4);
>      __bss_start = . ;
>      *(.shbss)
> -    *(.bss .gnu.linkonce.b.*)
> +    *(.bss .bss.*)
> +    *(.gnu.linkonce.b.*)
>      *(COMMON)
>      _end =  ALIGN (0x8);
>      __end = _end;



More information about the Newlib mailing list