This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to add missing KEEP()s to MIPS linker scripts


On Mon, 11 Apr 2005, Richard Sandiford wrote:

> When using the linker --gc-sections option, the contents of .init and
> .fini must always be kept.  Unfortunately, of the MIPS libgloss linker
> scripts, only ddb*.ld was wrapping these section in KEEP(...).  The patch
> below makes the other scripts do the same thing.
> 
> The change to idt.ld was tested on mips-elf, where it fixes the gcc
> special/gcsec-1.c failure.  The other changes are done by symmetry.
> OK to install?
>

Yes.  Go ahead.

-- Jeff J.
 
> 
> 	* mips/array.ld, mips/cfe.ld, mips/dve.ld, mips/idt32.ld, mips/idt64.ld
> 	* mips/idtecoff.ld, mips/idt.ld, mips/jmr3904app-java.ld,
> 	* mips/jmr3904app.ld, mips/jmr3904dram-java.ld, mips/jmr3904dram.ld
> 	* mips/lsi.ld, mips/nullmon.ld, mips/pmon.ld: Keep .init and .fini.
> 
> Index: libgloss/mips/array.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/array.ld,v
> retrieving revision 1.3
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 array.ld
> --- libgloss/mips/array.ld	5 May 2004 12:16:31 -0000	1.3
> +++ libgloss/mips/array.ld	11 Apr 2005 18:56:08 -0000
> @@ -84,7 +84,7 @@ SECTIONS
>    . = 0x80020000;
>    .text : {
>       _ftext = . ;
> -    *(.init)
> +    KEEP (*(.init))
>       eprol  =  .;
>      *(.text)
>      *(.text.*)
> @@ -94,7 +94,7 @@ SECTIONS
>      PROVIDE (__runtime_reloc_start = .);
>      *(.rel.sdata)
>      PROVIDE (__runtime_reloc_stop = .);
> -    *(.fini)
> +    KEEP (*(.fini))
>       etext  =  .;
>       _etext  =  .;
>    }
> Index: libgloss/mips/cfe.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/cfe.ld,v
> retrieving revision 1.4
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.4 cfe.ld
> --- libgloss/mips/cfe.ld	5 May 2004 12:16:31 -0000	1.4
> +++ libgloss/mips/cfe.ld	11 Apr 2005 18:56:08 -0000
> @@ -41,10 +41,10 @@ SECTIONS
>      *(.mips16.call.*)
>    }
>    .init : {
> -    *(.init)
> +    KEEP (*(.init))
>    }
>    .fini : {
> -    *(.fini)
> +    KEEP (*(.fini))
>    }
>    .rel.sdata : {
>      PROVIDE (__runtime_reloc_start = .);
> Index: libgloss/mips/dve.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/dve.ld,v
> retrieving revision 1.4
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.4 dve.ld
> --- libgloss/mips/dve.ld	5 May 2004 12:16:31 -0000	1.4
> +++ libgloss/mips/dve.ld	11 Apr 2005 18:56:08 -0000
> @@ -33,7 +33,7 @@ SECTIONS
>    . = 0xA0040000;
>    .text : {
>       _ftext = . ;
> -    *(.init)
> +    KEEP (*(.init))
>       eprol  =  .;
>      *(.text)
>      *(.text.*)
> @@ -43,7 +43,7 @@ SECTIONS
>      PROVIDE (__runtime_reloc_start = .);
>      *(.rel.sdata)
>      PROVIDE (__runtime_reloc_stop = .);
> -    *(.fini)
> +    KEEP (*(.fini))
>       etext  =  .;
>       _etext  =  .;
>    }
> Index: libgloss/mips/idt32.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/idt32.ld,v
> retrieving revision 1.3
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 idt32.ld
> --- libgloss/mips/idt32.ld	5 May 2004 12:16:31 -0000	1.3
> +++ libgloss/mips/idt32.ld	11 Apr 2005 18:56:08 -0000
> @@ -43,10 +43,10 @@ SECTIONS
>      *(.mips16.call.*)
>    }
>    .init : {
> -    *(.init)
> +    KEEP (*(.init))
>    }
>    .fini : {
> -    *(.fini)
> +    KEEP (*(.fini))
>    }
>    .rel.sdata : {
>      PROVIDE (__runtime_reloc_start = .);
> Index: libgloss/mips/idt64.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/idt64.ld,v
> retrieving revision 1.3
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 idt64.ld
> --- libgloss/mips/idt64.ld	5 May 2004 12:16:31 -0000	1.3
> +++ libgloss/mips/idt64.ld	11 Apr 2005 18:56:08 -0000
> @@ -43,10 +43,10 @@ SECTIONS
>      *(.mips16.call.*)
>    }
>    .init : {
> -    *(.init)
> +    KEEP (*(.init))
>    }
>    .fini : {
> -    *(.fini)
> +    KEEP (*(.fini))
>    }
>    .rel.sdata : {
>      PROVIDE (__runtime_reloc_start = .);
> Index: libgloss/mips/idtecoff.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/idtecoff.ld,v
> retrieving revision 1.2
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.2 idtecoff.ld
> --- libgloss/mips/idtecoff.ld	12 Jul 2002 15:37:04 -0000	1.2
> +++ libgloss/mips/idtecoff.ld	11 Apr 2005 18:56:08 -0000
> @@ -35,7 +35,7 @@ SECTIONS
>    . = 0xA0020000;
>    .text : {
>       _ftext = . ;
> -    *(.init)
> +    KEEP (*(.init))
>       eprol  =  .;
>      *(.text)
>      *(.text.*)
> @@ -45,7 +45,7 @@ SECTIONS
>      PROVIDE (__runtime_reloc_start = .);
>      *(.rel.sdata)
>      PROVIDE (__runtime_reloc_stop = .);
> -    *(.fini)
> +    KEEP (*(.fini))
>       etext  =  .;
>       _etext  =  .;
>    }
> Index: libgloss/mips/idt.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/idt.ld,v
> retrieving revision 1.5
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.5 idt.ld
> --- libgloss/mips/idt.ld	5 May 2004 12:16:31 -0000	1.5
> +++ libgloss/mips/idt.ld	11 Apr 2005 18:56:08 -0000
> @@ -42,10 +42,10 @@ SECTIONS
>      *(.mips16.call.*)
>    }
>    .init : {
> -    *(.init)
> +    KEEP (*(.init))
>    }
>    .fini : {
> -    *(.fini)
> +    KEEP (*(.fini))
>    }
>    .rel.sdata : {
>      PROVIDE (__runtime_reloc_start = .);
> Index: libgloss/mips/jmr3904app-java.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/jmr3904app-java.ld,v
> retrieving revision 1.3
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 jmr3904app-java.ld
> --- libgloss/mips/jmr3904app-java.ld	1 Aug 2002 20:21:23 -0000	1.3
> +++ libgloss/mips/jmr3904app-java.ld	11 Apr 2005 18:56:08 -0000
> @@ -35,7 +35,7 @@ SECTIONS
>        /* It fits the Cygmon ROMS */
>    .text : {
>       _ftext = . ;
> -    *(.init)
> +    KEEP (*(.init))
>       eprol  =  .;
>      *(.text)
>      *(.text.*)
> @@ -45,7 +45,7 @@ SECTIONS
>      PROVIDE (__runtime_reloc_start = .);
>      *(.rel.sdata)
>      PROVIDE (__runtime_reloc_stop = .);
> -    *(.fini)
> +    KEEP (*(.fini))
>       etext  =  .;
>       _etext  =  .;
>    }
> Index: libgloss/mips/jmr3904app.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/jmr3904app.ld,v
> retrieving revision 1.4
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.4 jmr3904app.ld
> --- libgloss/mips/jmr3904app.ld	5 May 2004 12:16:31 -0000	1.4
> +++ libgloss/mips/jmr3904app.ld	11 Apr 2005 18:56:08 -0000
> @@ -32,7 +32,7 @@ SECTIONS
>        /* It fits the Cygmon ROMS */
>    .text : {
>       _ftext = . ;
> -    *(.init)
> +    KEEP (*(.init))
>       eprol  =  .;
>      *(.text)
>      *(.text.*)
> @@ -42,7 +42,7 @@ SECTIONS
>      PROVIDE (__runtime_reloc_start = .);
>      *(.rel.sdata)
>      PROVIDE (__runtime_reloc_stop = .);
> -    *(.fini)
> +    KEEP (*(.fini))
>       etext  =  .;
>       _etext  =  .;
>    }
> Index: libgloss/mips/jmr3904dram-java.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/jmr3904dram-java.ld,v
> retrieving revision 1.3
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 jmr3904dram-java.ld
> --- libgloss/mips/jmr3904dram-java.ld	1 Aug 2002 20:21:23 -0000	1.3
> +++ libgloss/mips/jmr3904dram-java.ld	11 Apr 2005 18:56:08 -0000
> @@ -37,7 +37,7 @@ SECTIONS
>        /* It fits the Cygmon ROMS */
>    .text : {
>       _ftext = . ;
> -    *(.init)
> +    KEEP (*(.init))
>       eprol  =  .;
>      *(.text)
>      *(.text.*)
> @@ -47,7 +47,7 @@ SECTIONS
>      PROVIDE (__runtime_reloc_start = .);
>      *(.rel.sdata)
>      PROVIDE (__runtime_reloc_stop = .);
> -    *(.fini)
> +    KEEP (*(.fini))
>       etext  =  .;
>       _etext  =  .;
>    }
> Index: libgloss/mips/jmr3904dram.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/jmr3904dram.ld,v
> retrieving revision 1.3
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 jmr3904dram.ld
> --- libgloss/mips/jmr3904dram.ld	1 Aug 2002 20:21:23 -0000	1.3
> +++ libgloss/mips/jmr3904dram.ld	11 Apr 2005 18:56:08 -0000
> @@ -34,7 +34,7 @@ SECTIONS
>        /* It fits the Cygmon ROMS */
>    .text : {
>       _ftext = . ;
> -    *(.init)
> +    KEEP (*(.init))
>       eprol  =  .;
>      *(.text)
>      *(.text.*)
> @@ -44,7 +44,7 @@ SECTIONS
>      PROVIDE (__runtime_reloc_start = .);
>      *(.rel.sdata)
>      PROVIDE (__runtime_reloc_stop = .);
> -    *(.fini)
> +    KEEP (*(.fini))
>       etext  =  .;
>       _etext  =  .;
>    }
> Index: libgloss/mips/lsi.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/lsi.ld,v
> retrieving revision 1.4
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.4 lsi.ld
> --- libgloss/mips/lsi.ld	5 May 2004 12:16:31 -0000	1.4
> +++ libgloss/mips/lsi.ld	11 Apr 2005 18:56:08 -0000
> @@ -34,7 +34,7 @@ SECTIONS
>    . = 0xA0020000;
>    .text : {
>       _ftext = . ;
> -    *(.init)
> +    KEEP (*(.init))
>       eprol  =  .;
>      *(.text)
>      *(.text.*)
> @@ -42,7 +42,7 @@ SECTIONS
>      PROVIDE (__runtime_reloc_start = .);
>      *(.rel.sdata)
>      PROVIDE (__runtime_reloc_stop = .);
> -    *(.fini)
> +    KEEP (*(.fini))
>       etext  =  .;
>       _etext  =  .;
>    }
> Index: libgloss/mips/nullmon.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/nullmon.ld,v
> retrieving revision 1.4
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.4 nullmon.ld
> --- libgloss/mips/nullmon.ld	5 May 2004 12:16:31 -0000	1.4
> +++ libgloss/mips/nullmon.ld	11 Apr 2005 18:56:08 -0000
> @@ -34,7 +34,7 @@ SECTIONS
>    . = 0xA0020000;
>    .text : {
>       _ftext = . ;
> -    *(.init)
> +    KEEP (*(.init))
>       eprol  =  .;
>      *(.text)
>      *(.text.*)
> @@ -44,7 +44,7 @@ SECTIONS
>      PROVIDE (__runtime_reloc_start = .);
>      *(.rel.sdata)
>      PROVIDE (__runtime_reloc_stop = .);
> -    *(.fini)
> +    KEEP (*(.fini))
>       etext  =  .;
>       _etext  =  .;
>    }
> Index: libgloss/mips/pmon.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/pmon.ld,v
> retrieving revision 1.4
> diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.4 pmon.ld
> --- libgloss/mips/pmon.ld	5 May 2004 12:16:31 -0000	1.4
> +++ libgloss/mips/pmon.ld	11 Apr 2005 18:56:08 -0000
> @@ -34,7 +34,7 @@ SECTIONS
>    . = 0xA0020000;
>    .text : {
>       _ftext = . ;
> -    *(.init)
> +    KEEP (*(.init))
>       eprol  =  .;
>      *(.text)
>      *(.text.*)
> @@ -44,7 +44,7 @@ SECTIONS
>      PROVIDE (__runtime_reloc_start = .);
>      *(.rel.sdata)
>      PROVIDE (__runtime_reloc_stop = .);
> -    *(.fini)
> +    KEEP (*(.fini))
>       etext  =  .;
>       _etext  =  .;
>    }
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]