m68k linker scripts

Jeff Johnston jjohnstn@redhat.com
Wed Dec 7 15:11:00 GMT 2005


Patch checked in.  Thanks.

-- Jeff J.

Paul Brook wrote:
> When compiling C++ code it's common to get comdat sections with names 
> like .bss.foo. In the final output file these should be places in .bss.  The 
> libgloss m68k linker scripts don't handle these sections so ld sometimes 
> places them after _end, with catastrophic results.
> 
> The attached patch fixes the linker scripts to include these sections.
> 
> Ok?
> 
> Paul
> 
> 2005-12-06  Paul Brook  <paul@codesourcery.com>
> 
> libgloss/
> 	* m68k/bcc.ld: Add .text.*, .rodata.*, .data.* and .bss.*.
> 	* m68k/idp.ld: Ditto.
> 	* m68k/idpgdb: Ditto.
> 	* m68k/mvme135.ld: Ditto.
> 	* m68k/sbc5204.ld: Ditto.
> 	* m68k/sbc5206.ld: Ditto.
> 	* m68k/sim.ld: Ditto.
> 	
> 
> 
> ------------------------------------------------------------------------
> 
> Index: libgloss/m68k/bcc.ld
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/libgloss/m68k/bcc.ld,v
> retrieving revision 1.1
> diff -u -p -r1.1 bcc.ld
> --- libgloss/m68k/bcc.ld	17 Mar 2000 22:48:50 -0000	1.1
> +++ libgloss/m68k/bcc.ld	6 Dec 2005 16:12:34 -0000
> @@ -63,7 +63,7 @@ SECTIONS
>  {
>    .text :
>    {
> -    *(.text)
> +    *(.text .text.*)
>      . = ALIGN(0x4);
>       __CTOR_LIST__ = .;
>      ___CTOR_LIST__ = .;
> @@ -77,7 +77,7 @@ SECTIONS
>      *(.dtors)
>       LONG(0)
>      __DTOR_END__ = .;
> -    *(.rodata)
> +    *(.rodata .rodata.*)
>      *(.gcc_except_table) 
>  
>      . = ALIGN(0x2);
> @@ -100,7 +100,7 @@ SECTIONS
>    .data :
>    {
>      *(.shdata)
> -    *(.data)
> +    *(.data .data.*)
>      _edata = .;
>    } > ram
>  
> @@ -109,7 +109,7 @@ SECTIONS
>      . = ALIGN(0x4);
>      __bss_start = . ;
>      *(.shbss)
> -    *(.bss)
> +    *(.bss .bss.*)
>      *(COMMON)
>      _end =  ALIGN (0x8);
>      __end = _end;
> Index: libgloss/m68k/idp.ld
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/libgloss/m68k/idp.ld,v
> retrieving revision 1.1
> diff -u -p -r1.1 idp.ld
> --- libgloss/m68k/idp.ld	17 Mar 2000 22:48:50 -0000	1.1
> +++ libgloss/m68k/idp.ld	6 Dec 2005 16:13:32 -0000
> @@ -77,7 +77,7 @@ SECTIONS
>    .text :
>    {
>      CREATE_OBJECT_SYMBOLS
> -    *(.text)
> +    *(.text .text.*)
>  
>      . = ALIGN(0x4);
>      /* These are for running static constructors and destructors under ELF.  */
> @@ -90,7 +90,7 @@ SECTIONS
>      KEEP (*(SORT(.dtors.*)))
>      KEEP (*(.dtors))
>  
> -    *(.rodata)
> +    *(.rodata .rodata.*)
>  
>      . = ALIGN(0x4);
>      *(.gcc_except_table) 
> @@ -119,7 +119,7 @@ SECTIONS
>    .data :
>    {
>      *(.shdata)
> -    *(.data)
> +    *(.data .data.*)
>      _edata = .;
>    } > ram
>  
> @@ -128,7 +128,7 @@ SECTIONS
>      . = ALIGN(0x4);
>      __bss_start = . ;
>      *(.shbss)
> -    *(.bss)
> +    *(.bss .bss.*)
>      *(COMMON)
>      _end =  ALIGN (0x8);
>      __end = _end;
> Index: libgloss/m68k/idpgdb.ld
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/libgloss/m68k/idpgdb.ld,v
> retrieving revision 1.1
> diff -u -p -r1.1 idpgdb.ld
> --- libgloss/m68k/idpgdb.ld	10 Sep 2001 23:47:42 -0000	1.1
> +++ libgloss/m68k/idpgdb.ld	6 Dec 2005 16:13:03 -0000
> @@ -77,7 +77,7 @@ SECTIONS
>    .text :
>    {
>      CREATE_OBJECT_SYMBOLS
> -    *(.text)
> +    *(.text .text.*)
>  
>      . = ALIGN(0x4);
>      /* These are for running static constructors and destructors under ELF.  */
> @@ -90,7 +90,7 @@ SECTIONS
>      KEEP (*(SORT(.dtors.*)))
>      KEEP (*(.dtors))
>  
> -    *(.rodata)
> +    *(.rodata .rodata.*)
>  
>      . = ALIGN(0x4);
>      *(.gcc_except_table) 
> @@ -119,7 +119,7 @@ SECTIONS
>    .data :
>    {
>      *(.shdata)
> -    *(.data)
> +    *(.data .data.*)
>      _edata = .;
>    } > ram
>  
> @@ -128,7 +128,7 @@ SECTIONS
>      . = ALIGN(0x4);
>      __bss_start = . ;
>      *(.shbss)
> -    *(.bss)
> +    *(.bss .bss.*)
>      *(COMMON)
>      _end =  ALIGN (0x8);
>      __end = _end;
> Index: libgloss/m68k/mvme135.ld
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/libgloss/m68k/mvme135.ld,v
> retrieving revision 1.1
> diff -u -p -r1.1 mvme135.ld
> --- libgloss/m68k/mvme135.ld	17 Mar 2000 22:48:51 -0000	1.1
> +++ libgloss/m68k/mvme135.ld	6 Dec 2005 16:14:02 -0000
> @@ -64,7 +64,7 @@ SECTIONS
>  {
>    .text :
>    {
> -    *(.text)
> +    *(.text .text.*)
>      . = ALIGN(0x4);
>       __CTOR_LIST__ = .;
>      ___CTOR_LIST__ = .;
> @@ -78,7 +78,7 @@ SECTIONS
>      *(.dtors)
>       LONG(0)
>      __DTOR_END__ = .;
> -    *(.rodata)
> +    *(.rodata .rodata.*)
>      *(.gcc_except_table) 
>  
>      . = ALIGN(0x2);
> @@ -101,7 +101,7 @@ SECTIONS
>    .data :
>    {
>      *(.shdata)
> -    *(.data)
> +    *(.data .data.*)
>      _edata = .;
>    } > ram
>  
> @@ -110,7 +110,7 @@ SECTIONS
>      . = ALIGN(0x4);
>      __bss_start = . ;
>      *(.shbss)
> -    *(.bss)
> +    *(.bss .bss.*)
>      *(COMMON)
>      _end =  ALIGN (0x8);
>      __end = _end;
> Index: libgloss/m68k/mvme162.ld
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/libgloss/m68k/mvme162.ld,v
> retrieving revision 1.1
> diff -u -p -r1.1 mvme162.ld
> --- libgloss/m68k/mvme162.ld	17 Mar 2000 22:48:51 -0000	1.1
> +++ libgloss/m68k/mvme162.ld	6 Dec 2005 16:14:36 -0000
> @@ -65,7 +65,7 @@ SECTIONS
>  {
>    .text :
>    {
> -    *(.text)
> +    *(.text .text.*)
>      . = ALIGN(0x4);
>       __CTOR_LIST__ = .;
>      ___CTOR_LIST__ = .;
> @@ -79,7 +79,7 @@ SECTIONS
>      *(.dtors)
>       LONG(0)
>      __DTOR_END__ = .;
> -    *(.rodata)
> +    *(.rodata .rodata.*)
>      *(.gcc_except_table) 
>  
>      . = ALIGN(0x2);
> @@ -102,7 +102,7 @@ SECTIONS
>    .data :
>    {
>      *(.shdata)
> -    *(.data)
> +    *(.data .data.*)
>      _edata = .;
>    } > ram
>  
> @@ -111,7 +111,7 @@ SECTIONS
>      . = ALIGN(0x4);
>      __bss_start = . ;
>      *(.shbss)
> -    *(.bss)
> +    *(.bss .bss.*)
>      *(COMMON)
>      _end =  ALIGN (0x8);
>      __end = _end;
> Index: libgloss/m68k/sbc5204.ld
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/libgloss/m68k/sbc5204.ld,v
> retrieving revision 1.1
> diff -u -p -r1.1 sbc5204.ld
> --- libgloss/m68k/sbc5204.ld	17 Mar 2000 22:48:51 -0000	1.1
> +++ libgloss/m68k/sbc5204.ld	6 Dec 2005 16:15:05 -0000
> @@ -63,7 +63,7 @@ SECTIONS
>  {
>    .text :
>    {
> -    *(.text)
> +    *(.text .text.*)
>      . = ALIGN(0x4);
>       __CTOR_LIST__ = .;
>      ___CTOR_LIST__ = .;
> @@ -77,7 +77,7 @@ SECTIONS
>      *(.dtors)
>       LONG(0)
>      __DTOR_END__ = .;
> -    *(.rodata)
> +    *(.rodata .rodata.*)
>      *(.gcc_except_table) 
>  
>      . = ALIGN(0x2);
> @@ -100,7 +100,7 @@ SECTIONS
>    .data :
>    {
>      *(.shdata)
> -    *(.data)
> +    *(.data .data.*)
>      _edata = .;
>    } > ram
>  
> @@ -109,7 +109,7 @@ SECTIONS
>      . = ALIGN(0x4);
>      __bss_start = . ;
>      *(.shbss)
> -    *(.bss)
> +    *(.bss .bss.*)
>      *(COMMON)
>      _end =  ALIGN (0x8);
>      __end = _end;
> Index: libgloss/m68k/sbc5206.ld
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/libgloss/m68k/sbc5206.ld,v
> retrieving revision 1.1
> diff -u -p -r1.1 sbc5206.ld
> --- libgloss/m68k/sbc5206.ld	17 Mar 2000 22:48:51 -0000	1.1
> +++ libgloss/m68k/sbc5206.ld	6 Dec 2005 16:15:31 -0000
> @@ -63,7 +63,7 @@ SECTIONS
>  {
>    .text :
>    {
> -    *(.text)
> +    *(.text .text.*)
>      . = ALIGN(0x4);
>       __CTOR_LIST__ = .;
>      ___CTOR_LIST__ = .;
> @@ -77,7 +77,7 @@ SECTIONS
>      *(.dtors)
>       LONG(0)
>      __DTOR_END__ = .;
> -    *(.rodata)
> +    *(.rodata .rodata.*)
>      *(.gcc_except_table) 
>  
>      . = ALIGN(0x2);
> @@ -100,7 +100,7 @@ SECTIONS
>    .data :
>    {
>      *(.shdata)
> -    *(.data)
> +    *(.data .data.*)
>      _edata = .;
>    } > ram
>  
> @@ -109,7 +109,7 @@ SECTIONS
>      . = ALIGN(0x4);
>      __bss_start = . ;
>      *(.shbss)
> -    *(.bss)
> +    *(.bss .bss.*)
>      *(COMMON)
>      _end =  ALIGN (0x8);
>      __end = _end;
> Index: libgloss/m68k/sim.ld
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/libgloss/m68k/sim.ld,v
> retrieving revision 1.1
> diff -u -p -r1.1 sim.ld
> --- libgloss/m68k/sim.ld	28 Feb 2001 18:41:57 -0000	1.1
> +++ libgloss/m68k/sim.ld	6 Dec 2005 16:15:34 -0000
> @@ -18,7 +18,7 @@ SECTIONS
>    .text :
>    {
>      CREATE_OBJECT_SYMBOLS
> -    *(.text)
> +    *(.text .text.*)
>  
>      . = ALIGN(0x4);
>      /* These are for running static constructors and destructors under ELF.  */
> @@ -31,7 +31,7 @@ SECTIONS
>      KEEP (*(SORT(.dtors.*)))
>      KEEP (*(.dtors))
>  
> -    *(.rodata)
> +    *(.rodata .rodata.*)
>  
>      . = ALIGN(0x4);
>      *(.gcc_except_table) 
> @@ -60,7 +60,7 @@ SECTIONS
>    .data :
>    {
>      *(.shdata)
> -    *(.data)
> +    *(.data .data.*)
>      _edata = .;
>    } > ram
>  
> @@ -69,7 +69,7 @@ SECTIONS
>      . = ALIGN(0x4);
>      __bss_start = . ;
>      *(.shbss)
> -    *(.bss)
> +    *(.bss .bss.*)
>      *(COMMON)
>      _end =  ALIGN (0x8);
>      __end = _end;



More information about the Newlib mailing list