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


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

Re: one more h8300 ld -r problem left


Hi Ian,

: You should build constructors based on CONSTRUCTING, not on
: RELOCATING.  That is what permits the -Ur option to work.
: 
: 	   *(.ctors)
: 
: You should only put the .ctors section into the .text section when
: CONSTRUCTING.  Otherwise, -r will break because the .ctors will be
: lost in the .text section after the relocateable link, so they will
: not be used in the final link.  I think m68kcoff.sc gets it right.

Thanks very much for pointing this out.  I actually kind of liked the
way sh.sc does it, so I have applied the patch below to fix all of the
linker scripts that I could find.  I also took this opportunity to
tidy the formatting of these scripts as well.

Cheers
	Nick

2000-11-03  Nick Clifton  <nickc@redhat.com>

	* scripttempl/h8300.sc: Use ${CONSTRUCTING...} to enclose
	constructors and destructors.
	* scripttempl/h8300h.sc: Ditto.
	* scripttempl/h8300s.sc: Ditto.
	* scripttempl/h8500.sc: Ditto.
	* scripttempl/h8500b.sc: Ditto.
	* scripttempl/h8500c.sc: Ditto.
	* scripttempl/h8500m.sc: Ditto.
	* scripttempl/h8500s.sc: Ditto.
	* scripttempl/v850.sc: Ditto.
	* scripttempl/w65.sc: Ditto.
	* scripttempl/z8000.sc: Ditto.

Index: scripttempl/h8300.sc
===================================================================
RCS file: /cvs/src//src/ld/scripttempl/h8300.sc,v
retrieving revision 1.1.1.1
diff -p -w -r1.1.1.1 h8300.sc
*** h8300.sc	1999/05/03 07:29:08	1.1.1.1
--- h8300.sc	2000/11/03 19:43:23
***************
*** 1,3 ****
--- 1,13 ----
+ TORS=".tors :
+   {
+     ___ctors = . ;
+     *(.ctors)
+     ___ctors_end = . ;
+     ___dtors = . ;
+     *(.dtors)
+     ___dtors_end = . ;
+   } > ram"
+ 
  cat <<EOF
  OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  OUTPUT_ARCH(${ARCH})
*************** MEMORY
*** 18,68 ****
  
  SECTIONS 				
  { 					
! .vectors : {
! 	/* Use something like this to place a specific function's address
! 	   into the vector table. 
  
! 	SHORT(ABSOLUTE(_foobar)) */
  
  	*(.vectors)
          } ${RELOCATING+ > vectors}
  
! .text :	{ 					
  	*(.rodata) 				
  	*(.text) 				
  	*(.strings)
     	${RELOCATING+ _etext = . ; }
- 	} ${RELOCATING+ > ram}
- .tors : {
- 	___ctors = . ;
- 	*(.ctors)
- 	___ctors_end = . ;
- 	___dtors = . ;
- 	*(.dtors)
- 	___dtors_end = . ;
  	} ${RELOCATING+ > ram}
! .data : {
  	*(.data)
  	*(.tiny)
  	${RELOCATING+ _edata = . ; }
  	} ${RELOCATING+ > ram}
! .bss : {
  	${RELOCATING+ _bss_start = . ;}
  	*(.bss)
  	*(COMMON)
  	${RELOCATING+ _end = . ;  }
  	} ${RELOCATING+ >ram}
! .stack : {
  	${RELOCATING+ _stack = . ; }
  	*(.stack)
  	} ${RELOCATING+ > topram}
! .eight : {
  	*(.eight)
  	} ${RELOCATING+ > eight}
! .stab 0 ${RELOCATING+(NOLOAD)} : {
  	[ .stab ]
  	}
! .stabstr 0 ${RELOCATING+(NOLOAD)} : {
  	[ .stabstr ]
  	}
  }
--- 28,86 ----
  
  SECTIONS 				
  { 					
! .vectors :
! 	 {
! 	  /* Use something like this to place a specific
! 	     function's address into the vector table. 
  
! 	     SHORT (ABSOLUTE (_foobar)).  */
  
  	  *(.vectors)
          } ${RELOCATING+ > vectors}
  
! .text :
! 	{ 					
  	  *(.rodata) 				
  	  *(.text) 				
  	  *(.strings)
     	  ${RELOCATING+ _etext = . ; }
  	} ${RELOCATING+ > ram}
! 	
! 	${CONSTRUCTING+${TORS}}
! 	
! .data :
! 	{
  	  *(.data)
  	  *(.tiny)
  	  ${RELOCATING+ _edata = . ; }
  	} ${RELOCATING+ > ram}
! 	
! .bss :
! 	{
  	  ${RELOCATING+ _bss_start = . ;}
  	  *(.bss)
  	  *(COMMON)
  	  ${RELOCATING+ _end = . ;  }
  	} ${RELOCATING+ >ram}
! 	
! .stack :
! 	{
  	  ${RELOCATING+ _stack = . ; }
  	  *(.stack)
  	} ${RELOCATING+ > topram}
! 	
! .eight :
! 	{
  	  *(.eight)
  	} ${RELOCATING+ > eight}
! 	
! .stab 0 ${RELOCATING+(NOLOAD)} :
! 	{
  	  [ .stab ]
  	}
! 	
! .stabstr 0 ${RELOCATING+(NOLOAD)} :
! 	{
  	  [ .stabstr ]
  	}
  }
Index: scripttempl/h8300h.sc
===================================================================
RCS file: /cvs/src//src/ld/scripttempl/h8300h.sc,v
retrieving revision 1.1.1.1
diff -p -w -r1.1.1.1 h8300h.sc
*** h8300h.sc	1999/05/03 07:29:08	1.1.1.1
--- h8300h.sc	2000/11/03 19:43:23
***************
*** 1,3 ****
--- 1,13 ----
+ TORS=".tors :
+   {
+     ___ctors = . ;
+     *(.ctors)
+     ___ctors_end = . ;
+     ___dtors = . ;
+     *(.dtors)
+     ___dtors_end = . ;
+   } > ram"
+ 
  cat <<EOF
  OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  OUTPUT_ARCH(h8300h)
*************** MEMORY
*** 23,75 ****
  }
  
  SECTIONS 				
  { 					
! .vectors : {
! 	/* Use something like this to place a specific function's address
! 	   into the vector table.
  
! 	LONG(ABSOLUTE(_foobar)) */
  
  	*(.vectors)
  	} ${RELOCATING+ > vectors}
! .text :	{ 					
  	*(.rodata) 				
  	*(.text) 				
  	*(.strings)
     	${RELOCATING+ _etext = . ; }
  	} ${RELOCATING+ > ram}
! .tors : {
! 	___ctors = . ;
! 	*(.ctors)
! 	___ctors_end = . ;
! 	___dtors = . ;
! 	*(.dtors)
! 	___dtors_end = . ;
! 	} ${RELOCATING+ > ram}
! .data : {
  	*(.data)
  	${RELOCATING+ _edata = . ; }
  	} ${RELOCATING+ > ram}
! .bss : {
  	${RELOCATING+ _bss_start = . ;}
  	*(.bss)
  	*(COMMON)
  	${RELOCATING+ _end = . ;  }
  	} ${RELOCATING+ >ram}
! .stack : {
  	${RELOCATING+ _stack = . ; }
  	*(.stack)
  	} ${RELOCATING+ > topram}
! .tiny : {
  	*(.tiny)
  	} ${RELOCATING+ > tiny}
! .eight : {
  	*(.eight)
  	} ${RELOCATING+ > eight}
! .stab 0 ${RELOCATING+(NOLOAD)} : {
  	[ .stab ]
  	}
! .stabstr 0 ${RELOCATING+(NOLOAD)} : {
  	[ .stabstr ]
  	}
  }
--- 33,96 ----
  }
  
  SECTIONS 				
+ { 					
+ .vectors :
  	{
! 	  /* Use something like this to place a specific
! 	     function's address into the vector table.
  
! 	     LONG (ABSOLUTE (_foobar)).  */
  
  	  *(.vectors)
  	} ${RELOCATING+ > vectors}
! 	
! .text :
! 	{ 					
  	  *(.rodata) 				
  	  *(.text) 				
  	  *(.strings)
     	  ${RELOCATING+ _etext = . ; }
  	} ${RELOCATING+ > ram}
! 	
! 	${CONSTRUCTING+${TORS}}
! 	
! .data :
! 	{
  	  *(.data)
  	  ${RELOCATING+ _edata = . ; }
  	} ${RELOCATING+ > ram}
! 	
! .bss :
! 	{
  	  ${RELOCATING+ _bss_start = . ;}
  	  *(.bss)
  	  *(COMMON)
  	  ${RELOCATING+ _end = . ;  }
  	} ${RELOCATING+ >ram}
! 	
! .stack :
! 	{
  	  ${RELOCATING+ _stack = . ; }
  	  *(.stack)
  	} ${RELOCATING+ > topram}
! 	
! .tiny :
! 	{
  	  *(.tiny)
  	} ${RELOCATING+ > tiny}
! 	
! .eight :
! 	{
  	  *(.eight)
  	} ${RELOCATING+ > eight}
! 	
! .stab 0 ${RELOCATING+(NOLOAD)} :
! 	{
  	  [ .stab ]
  	}
! 	
! .stabstr 0 ${RELOCATING+(NOLOAD)} :
! 	{
  	  [ .stabstr ]
  	}
  }

Index: scripttempl/h8300s.sc
===================================================================
RCS file: /cvs/src//src/ld/scripttempl/h8300s.sc,v
retrieving revision 1.1.1.1
diff -p -w -r1.1.1.1 h8300s.sc
*** h8300s.sc	1999/05/03 07:29:08	1.1.1.1
--- h8300s.sc	2000/11/03 19:43:24
***************
*** 1,3 ****
--- 1,13 ----
+ TORS=".tors :
+   {
+     ___ctors = . ;
+     *(.ctors)
+     ___ctors_end = . ;
+     ___dtors = . ;
+     *(.dtors)
+     ___dtors_end = . ;
+   } > ram"
+ 
  cat <<EOF
  OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  OUTPUT_ARCH(h8300s)
*************** MEMORY
*** 23,75 ****
  }
  
  SECTIONS 				
  { 					
- .vectors : {
  	/* Use something like this to place a specific function's address
  	   into the vector table.
  
! 	LONG(ABSOLUTE(_foobar)) */
  
  	*(.vectors)
  	} ${RELOCATING+ > vectors}
! .text :	{ 					
  	*(.rodata) 				
  	*(.text) 				
  	*(.strings)
     	${RELOCATING+ _etext = . ; }
  	} ${RELOCATING+ > ram}
! .tors : {
! 	___ctors = . ;
! 	*(.ctors)
! 	___ctors_end = . ;
! 	___dtors = . ;
! 	*(.dtors)
! 	___dtors_end = . ;
! 	} ${RELOCATING+ > ram}
! .data : {
  	*(.data)
  	${RELOCATING+ _edata = . ; }
  	} ${RELOCATING+ > ram}
! .bss : {
  	${RELOCATING+ _bss_start = . ;}
  	*(.bss)
  	*(COMMON)
  	${RELOCATING+ _end = . ;  }
  	} ${RELOCATING+ >ram}
! .stack : {
  	${RELOCATING+ _stack = . ; }
  	*(.stack)
  	} ${RELOCATING+ > topram}
! .tiny : {
  	*(.tiny)
  	} ${RELOCATING+ > tiny}
! .eight : {
  	*(.eight)
  	} ${RELOCATING+ > eight}
! .stab 0 ${RELOCATING+(NOLOAD)} : {
  	[ .stab ]
  	}
! .stabstr 0 ${RELOCATING+(NOLOAD)} : {
  	[ .stabstr ]
  	}
  }
--- 33,96 ----
  }
  
  SECTIONS 				
+ { 					
+ .vectors :
  	 {
  	  /* Use something like this to place a specific function's address
  	     into the vector table.
  
! 	     LONG (ABSOLUTE (_foobar)).  */
  
  	  *(.vectors)
  	} ${RELOCATING+ > vectors}
! 	
! .text :
! 	{ 					
  	  *(.rodata) 				
  	  *(.text) 				
  	  *(.strings)
     	  ${RELOCATING+ _etext = . ; }
  	} ${RELOCATING+ > ram}
! 	
! 	${CONSTRUCTING+${TORS}}
! 	
! .data :
! 	{
  	  *(.data)
  	  ${RELOCATING+ _edata = . ; }
  	} ${RELOCATING+ > ram}
! 	
! .bss :
! 	{
  	  ${RELOCATING+ _bss_start = . ;}
  	  *(.bss)
  	  *(COMMON)
  	  ${RELOCATING+ _end = . ;  }
  	} ${RELOCATING+ >ram}
! 	
! .stack :
! 	{
  	  ${RELOCATING+ _stack = . ; }
  	  *(.stack)
  	} ${RELOCATING+ > topram}
! 	
! .tiny :
! 	{
  	  *(.tiny)
  	} ${RELOCATING+ > tiny}
! 	
! .eight :
! 	{
  	  *(.eight)
  	} ${RELOCATING+ > eight}
! 	
! .stab 0 ${RELOCATING+(NOLOAD)} :
! 	{
  	  [ .stab ]
  	}
! 	
! .stabstr 0 ${RELOCATING+(NOLOAD)} :
! 	{
  	  [ .stabstr ]
  	}
  }

Index: scripttempl/h8500.sc
===================================================================
RCS file: /cvs/src//src/ld/scripttempl/h8500.sc,v
retrieving revision 1.1.1.1
diff -p -w -r1.1.1.1 h8500.sc
*** h8500.sc	1999/05/03 07:29:08	1.1.1.1
--- h8500.sc	2000/11/03 19:43:24
***************
*** 1,3 ****
--- 1,11 ----
+ TORS="
+     ___ctors = . ;
+     *(.ctors)
+     ___ctors_end = . ;
+     ___dtors = . ;
+     *(.dtors)
+     ___dtors_end = . ;"
+ 
  cat <<EOF
  OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  OUTPUT_ARCH(${ARCH})
*************** SECTIONS 				
*** 9,19 ****
  .text ${RELOCATING+ 0x0000 } :
  	{ 					
  	  *(.text) 				
- 
     	 ${RELOCATING+ _etext = . ; }
  	}
  
- 
  .data  ${RELOCATING+ . } :
  	{
  	*(.data)
--- 17,25 ----
*************** SECTIONS 				
*** 24,35 ****
  	{
  	*(.rdata); 
  	  *(.strings)
! 	___ctors = . ;
! 	*(.ctors)
! 	___ctors_end = . ;
! 	___dtors = . ;
! 	*(.dtors)
! 	___dtors_end = . ;
  } 
  
  .bss  ${RELOCATING+ . } :
--- 30,37 ----
  	{
  	  *(.rdata); 
  	  *(.strings)
! 	  
! 	  ${CONSTRUCTING+${TORS}}
  	} 
  
  .bss  ${RELOCATING+ . } :
*************** SECTIONS 				
*** 50,55 ****
--- 52,58 ----
  	{
  	  [ .stab ]
  	}
+ 	
  .stabstr  0 ${RELOCATING+(NOLOAD)} :
  	{
  	  [ .stabstr ]

Index: scripttempl/h8500b.sc
===================================================================
RCS file: /cvs/src//src/ld/scripttempl/h8500b.sc,v
retrieving revision 1.1.1.1
diff -p -w -r1.1.1.1 h8500b.sc
*** h8500b.sc	1999/05/03 07:29:08	1.1.1.1
--- h8500b.sc	2000/11/03 19:43:24
***************
*** 1,3 ****
--- 1,11 ----
+ TORS="
+     ___ctors = . ;
+     *(.ctors)
+     ___ctors_end = . ;
+     ___dtors = . ;
+     *(.dtors)
+     ___dtors_end = . ;"
+ 
  cat <<EOF
  OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  OUTPUT_ARCH(${ARCH})
*************** SECTIONS 				
*** 24,35 ****
  	{
  	*(.rdata); 
  	  *(.strings)
! 	___ctors = . ;
! 	*(.ctors)
! 	___ctors_end = . ;
! 	___dtors = . ;
! 	*(.dtors)
! 	___dtors_end = . ;
  } 
  
  .bss  ${RELOCATING+ 0x40000} :
--- 32,39 ----
  	{
  	*(.rdata); 
  	  *(.strings)
! 	  
! 	${CONSTRUCTING+${TORS}}
  	} 
  
  .bss  ${RELOCATING+ 0x40000} :

Index: scripttempl/h8500c.sc
===================================================================
RCS file: /cvs/src//src/ld/scripttempl/h8500c.sc,v
retrieving revision 1.1.1.1
diff -p -w -r1.1.1.1 h8500c.sc
*** h8500c.sc	1999/05/03 07:29:08	1.1.1.1
--- h8500c.sc	2000/11/03 19:43:24
***************
*** 1,3 ****
--- 1,11 ----
+ TORS="
+     ___ctors = . ;
+     *(.ctors)
+     ___ctors_end = . ;
+     ___dtors = . ;
+     *(.dtors)
+     ___dtors_end = . ;"
+ 
  cat <<EOF
  OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  OUTPUT_ARCH(${ARCH})
*************** SECTIONS 				
*** 20,33 ****
  	${RELOCATING+ _edata = . ; }
  	} ${RELOCATING+ > ram}
  
! .rdata 0x30000  : {
  	*(.rdata); 
! 	___ctors = . ;
! 	*(.ctors)
! 	___ctors_end = . ;
! 	___dtors = . ;
! 	*(.dtors)
! 	___dtors_end = . ;
  }  ${RELOCATING+ > ram}
  
  .bss  0x40000 :
--- 28,38 ----
  	${RELOCATING+ _edata = . ; }
  	} ${RELOCATING+ > ram}
  
! .rdata 0x30000  :
!        {
  	*(.rdata); 
! 	  
! 	${CONSTRUCTING+${TORS}}
  	}  ${RELOCATING+ > ram}
  
  .bss  0x40000 :

Index: scripttempl/h8500m.sc
===================================================================
RCS file: /cvs/src//src/ld/scripttempl/h8500m.sc,v
retrieving revision 1.1.1.1
diff -p -w -r1.1.1.1 h8500m.sc
*** h8500m.sc	1999/05/03 07:29:08	1.1.1.1
--- h8500m.sc	2000/11/03 19:43:24
***************
*** 1,3 ****
--- 1,11 ----
+ TORS="
+     ___ctors = . ;
+     *(.ctors)
+     ___ctors_end = . ;
+     ___dtors = . ;
+     *(.dtors)
+     ___dtors_end = . ;"
+ 
  cat <<EOF
  OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  OUTPUT_ARCH(${ARCH})
*************** SECTIONS 				
*** 12,18 ****
     	 ${RELOCATING+ _etext = . ; }
  	}
  
- 
  .data  ${RELOCATING+ 0x20000} :
  	{
  	*(.data)
--- 20,25 ----
*************** SECTIONS 				
*** 23,34 ****
  	{
  	*(.rdata); 
  	  *(.strings)
! 	___ctors = . ;
! 	*(.ctors)
! 	___ctors_end = . ;
! 	___dtors = . ;
! 	*(.dtors)
! 	___dtors_end = . ;
  	} 
  
  .bss  ${RELOCATING+ . } :
--- 30,37 ----
  	{
  	  *(.rdata); 
  	  *(.strings)
! 	  
! 	${CONSTRUCTING+${TORS}}
  	} 
  
  .bss  ${RELOCATING+ . } :
*************** SECTIONS 				
*** 49,54 ****
--- 52,58 ----
          {
            [ .stab ]
  	}
+ 	
  .stabstr  0 ${RELOCATING+(NOLOAD)} :
  	{
  	  [ .stabstr ]

Index: scripttempl/h8500s.sc
===================================================================
RCS file: /cvs/src//src/ld/scripttempl/h8500s.sc,v
retrieving revision 1.1.1.1
diff -p -w -r1.1.1.1 h8500s.sc
*** h8500s.sc	1999/05/03 07:29:08	1.1.1.1
--- h8500s.sc	2000/11/03 19:43:24
***************
*** 1,3 ****
--- 1,11 ----
+ TORS="
+     ___ctors = . ;
+     *(.ctors)
+     ___ctors_end = . ;
+     ___dtors = . ;
+     *(.dtors)
+     ___dtors_end = . ;"
+ 
  cat <<EOF
  OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  OUTPUT_ARCH(${ARCH})
*************** SECTIONS 				
*** 16,27 ****
  	{
  	*(.rdata); 
  	*(.strings)
! 	___ctors = . ;
! 	*(.ctors)
! 	___ctors_end = . ;
! 	___dtors = . ;
! 	*(.dtors)
! 	___dtors_end = . ;
  	}
  
  .data  ${RELOCATING+ . } :
--- 24,31 ----
  	{
  	  *(.rdata); 
  	  *(.strings)
! 	  
! 	  ${CONSTRUCTING+${TORS}}
  	}
  
  .data  ${RELOCATING+ . } :
*************** SECTIONS 				
*** 48,53 ****
--- 52,58 ----
  	{
            [ .stab ]
  	}
+ 	
  .stabstr  0 ${RELOCATING+(NOLOAD)} :
  	{
  	  [ .stabstr ]

Index: scripttempl/v850.sc
===================================================================
RCS file: /cvs/src//src/ld/scripttempl/v850.sc,v
retrieving revision 1.3
diff -p -w -r1.3 v850.sc
*** v850.sc	2000/09/02 20:43:22	1.3
--- v850.sc	2000/11/03 19:43:25
*************** OUTPUT_FORMAT("elf32-v850", "elf32-v850"
*** 4,16 ****
  OUTPUT_ARCH(v850)
  ENTRY(_start)
  SEARCH_DIR(.);
- /*/critters/slug/grossman/install/sun4/v850-elf/lib*/
  SECTIONS
  {
    /* This saves a little space in the ELF file, since the zda starts
       at a higher location that the ELF headers take up.  */
  
!   .zdata ${ZDATA_START_ADDR} : {
  	*(.zdata)
  	*(.zbss)
  	*(reszdata)
--- 4,16 ----
  OUTPUT_ARCH(v850)
  ENTRY(_start)
  SEARCH_DIR(.);
  SECTIONS
  {
    /* This saves a little space in the ELF file, since the zda starts
       at a higher location that the ELF headers take up.  */
  
!   .zdata ${ZDATA_START_ADDR} :
!   {
  	*(.zdata)
  	*(.zbss)
  	*(reszdata)
*************** SECTIONS
*** 23,35 ****
       section.  Specifically it prevents the zdata
       section from being marked READONLY.  */
  
!   .rozdata ${ROZDATA_START_ADDR} : {
  	*(.rozdata)
  	*(romzdata)
  	*(romzbss)
    }
  
!   /* Read-only sections, merged into text segment: */
    . = ${TEXT_START_ADDR};
    .interp	: { *(.interp) }
    .hash		: { *(.hash) }
--- 23,36 ----
       section.  Specifically it prevents the zdata
       section from being marked READONLY.  */
  
!   .rozdata ${ROZDATA_START_ADDR} :
!   {
  	*(.rozdata)
  	*(romzdata)
  	*(romzbss)
    }
  
!   /* Read-only sections, merged into text segment.  */
    . = ${TEXT_START_ADDR};
    .interp	: { *(.interp) }
    .hash		: { *(.hash) }
*************** SECTIONS
*** 58,66 ****
    .init		: { KEEP (*(.init)) } =0
    .plt		: { *(.plt) }
  
!   .text		: {
      *(.text)
      ${RELOCATING+*(.text.*)}
      /* .gnu.warning sections are handled specially by elf32.em.  */
      *(.gnu.warning)
      *(.gnu.linkonce.t*)
--- 59,69 ----
    .init		: { KEEP (*(.init)) } =0
    .plt		: { *(.plt) }
  
!   .text		:
!   {
      *(.text)
      ${RELOCATING+*(.text.*)}
+     
      /* .gnu.warning sections are handled specially by elf32.em.  */
      *(.gnu.warning)
      *(.gnu.linkonce.t*)
*************** SECTIONS
*** 73,83 ****
        It contains a small lookup table at the start followed by the
        code pointed to by entries in the lookup table.  */
  
!   .call_table_data ${CALL_TABLE_START_ADDR} : {
      ${RELOCATING+PROVIDE(__ctbp = .);}
      *(.call_table_data)
!   } = 0xff   /* fill gaps with 0xff */
!   .call_table_text : {
      *(.call_table_text)
    }
  
--- 76,89 ----
        It contains a small lookup table at the start followed by the
        code pointed to by entries in the lookup table.  */
  
!   .call_table_data ${CALL_TABLE_START_ADDR} :
!   {
      ${RELOCATING+PROVIDE(__ctbp = .);}
      *(.call_table_data)
!   } = 0xff   /* Fill gaps with 0xff.  */
!   
!   .call_table_text :
!   {
      *(.call_table_text)
    }
  
*************** SECTIONS
*** 85,117 ****
    .rodata	: { *(.rodata) ${RELOCATING+*(.rodata.*)} *(.gnu.linkonce.r*) }
    .rodata1	: { *(.rodata1) }
  
!   .data		: {
      *(.data)
      ${RELOCATING+*(.data.*)}
      *(.gnu.linkonce.d*)
      CONSTRUCTORS
    }
    .data1	: { *(.data1) }
!   .ctors	: {
!     ${RELOCATING+___ctors = .;}
      KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
      KEEP (*(SORT(.ctors.*)))
      KEEP (*crtend(.ctors))
!     ${RELOCATING+___ctors_end = .;}
    }
! 
!   .dtors	: {
!     ${RELOCATING+___dtors = .;}
      KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
      KEEP (*(SORT(.dtors.*)))
      KEEP (*crtend.o(.dtors))
!     ${RELOCATING+___dtors_end = .;}
    }
  
    .got		: { *(.got.plt) *(.got) }
    .dynamic	: { *(.dynamic) }
  
!   .tdata ${TDATA_START_ADDR} : {
  	${RELOCATING+PROVIDE (__ep = .);}
  	*(.tbyte)
  	*(.tcommon_byte)
--- 91,126 ----
    .rodata	: { *(.rodata) ${RELOCATING+*(.rodata.*)} *(.gnu.linkonce.r*) }
    .rodata1	: { *(.rodata1) }
  
!   .data		:
!   {
      *(.data)
      ${RELOCATING+*(.data.*)}
      *(.gnu.linkonce.d*)
      CONSTRUCTORS
    }
    .data1	: { *(.data1) }
!   .ctors	:
!   {
!     ${CONSTRUCTING+___ctors = .;}
      KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
      KEEP (*(SORT(.ctors.*)))
      KEEP (*crtend(.ctors))
!     ${CONSTRUCTING+___ctors_end = .;}
    }
!   .dtors	:
!   {
!     ${CONSTRUCTING+___dtors = .;}
      KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
      KEEP (*(SORT(.dtors.*)))
      KEEP (*crtend.o(.dtors))
!     ${CONSTRUCTING+___dtors_end = .;}
    }
  
    .got		: { *(.got.plt) *(.got) }
    .dynamic	: { *(.dynamic) }
  
!   .tdata ${TDATA_START_ADDR} :
!   {
  	${RELOCATING+PROVIDE (__ep = .);}
  	*(.tbyte)
  	*(.tcommon_byte)
*************** SECTIONS
*** 123,143 ****
    /* We want the small data sections together, so single-instruction offsets
       can access them all, and initialized data all before uninitialized, so
       we can shorten the on-disk segment size.  */
!   .sdata ${SDATA_START_ADDR} : {
  	${RELOCATING+PROVIDE (__gp = . + 0x8000);}
  	*(.sdata)
     }
  
    /* See comment about .rozdata. */
!   .rosdata ${ROSDATA_START_ADDR} : {
  	*(.rosdata)
    }
  
    /* We place the .sbss data section AFTER the .rosdata section, so that
       it can directly preceed the .bss section.  This allows runtime startup
       code to initialise all the zero-data sections by simply taking the
!      value of '_edata' and zeroing until it reaches '_end'  */
!   .sbss : {
  	${RELOCATING+__sbss_start = .;}
  	*(.sbss)
  	*(.scommon)
--- 132,157 ----
    /* We want the small data sections together, so single-instruction offsets
       can access them all, and initialized data all before uninitialized, so
       we can shorten the on-disk segment size.  */
!      
!   .sdata ${SDATA_START_ADDR} :
!   {
  	${RELOCATING+PROVIDE (__gp = . + 0x8000);}
  	*(.sdata)
     }
  
    /* See comment about .rozdata. */
!   .rosdata ${ROSDATA_START_ADDR} :
!   {
  	*(.rosdata)
    }
  
    /* We place the .sbss data section AFTER the .rosdata section, so that
       it can directly preceed the .bss section.  This allows runtime startup
       code to initialise all the zero-data sections by simply taking the
!      value of '_edata' and zeroing until it reaches '_end'.  */
!      
!   .sbss :
!   {
  	${RELOCATING+__sbss_start = .;}
  	*(.sbss)
  	*(.scommon)
*************** SECTIONS
*** 192,208 ****
    .debug_loc      0	: { *(.debug_loc) }
    .debug_macinfo  0	: { *(.debug_macinfo) }
  
!   /* SGI/MIPS DWARF 2 extensions */
    .debug_weaknames 0	: { *(.debug_weaknames) }
    .debug_funcnames 0	: { *(.debug_funcnames) }
    .debug_typenames 0	: { *(.debug_typenames) }
    .debug_varnames  0	: { *(.debug_varnames) }
  
!   /* User stack */
!   .stack 0x200000	: {
  	${RELOCATING+__stack = .;}
  	*(.stack)
    }
-   /* These must appear regardless of  .  */
  }
  EOF
--- 206,222 ----
    .debug_loc      0	: { *(.debug_loc) }
    .debug_macinfo  0	: { *(.debug_macinfo) }
  
!   /* SGI/MIPS DWARF 2 extensions.  */
    .debug_weaknames 0	: { *(.debug_weaknames) }
    .debug_funcnames 0	: { *(.debug_funcnames) }
    .debug_typenames 0	: { *(.debug_typenames) }
    .debug_varnames  0	: { *(.debug_varnames) }
  
!   /* User stack.  */
!   .stack 0x200000	:
!   {
  	${RELOCATING+__stack = .;}
  	*(.stack)
    }
  }
  EOF

Index: scripttempl/w65.sc
===================================================================
RCS file: /cvs/src//src/ld/scripttempl/w65.sc,v
retrieving revision 1.1.1.1
diff -p -w -r1.1.1.1 w65.sc
*** w65.sc	1999/05/03 07:29:08	1.1.1.1
--- w65.sc	2000/11/03 19:43:25
***************
*** 1,8 ****
  cat <<EOF
  OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  OUTPUT_ARCH(${ARCH})
  
! MEMORY {
  	ram   : o = 0x1000, l = 512k
  	}
  
--- 1,19 ----
+ TORS=".tors :
+   {
+     ___ctors = . ;
+     *(.ctors)
+     ___ctors_end = . ;
+     ___dtors = . ;
+     *(.dtors)
+     ___dtors_end = . ;
+   } > ram"
+ 
  cat <<EOF
  OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  OUTPUT_ARCH(${ARCH})
  
! MEMORY
! {
  	ram   : o = 0x1000, l = 512k
  }
  
*************** SECTIONS 				
*** 15,35 ****
     	 ${RELOCATING+ _etext = . ; }
  	} ${RELOCATING+ > ram}
  
  
- .tors   : {
- 	___ctors = . ;
- 	*(.ctors)
- 	___ctors_end = . ;
- 	___dtors = . ;
- 	*(.dtors)
- 	___dtors_end = . ;
- }  ${RELOCATING+ > ram}
- 
  .data  :
  	{
  	*(.data)
  	${RELOCATING+ _edata = . ; }
  	} ${RELOCATING+ > ram}
  .bss  :
  	{
  	${RELOCATING+ _bss_start = . ; }
--- 26,39 ----
     	  ${RELOCATING+ _etext = . ; }
  	} ${RELOCATING+ > ram}
  
+ 	${CONSTRUCTING+${TORS}}
  
  .data  :
  	{
  	  *(.data)
  	  ${RELOCATING+ _edata = . ; }
  	} ${RELOCATING+ > ram}
+ 	
  .bss  :
  	{
  	  ${RELOCATING+ _bss_start = . ; }
*************** SECTIONS 				
*** 37,51 ****
--- 41,58 ----
  	  *(COMMON)
  	  ${RELOCATING+ _end = . ;  }
  	} ${RELOCATING+ >ram}
+ 	
  .stack ${RELOCATING+ 0x30000 } :
  	{
  	  ${RELOCATING+ _stack = . ; }
  	  *(.stack)
  	} ${RELOCATING+ > ram}
+ 	
  .stab  . (NOLOAD) :
  	{
  	  [ .stab ]
  	}
+ 	
  .stabstr  . (NOLOAD) :
  	{
  	  [ .stabstr ]

Index: scripttempl/z8000.sc
===================================================================
RCS file: /cvs/src//src/ld/scripttempl/z8000.sc,v
retrieving revision 1.1.1.1
diff -p -w -r1.1.1.1 z8000.sc
*** z8000.sc	1999/05/03 07:29:08	1.1.1.1
--- z8000.sc	2000/11/03 19:43:25
*************** ENTRY(_start)
*** 5,11 ****
  
  SECTIONS 				
  { 					
! .text ${BIG+ ${RELOCATING+ 0x0000000}} : { 					
  	  *(.text) 				
  	  *(.strings)
  	  *(.rdata)
--- 5,12 ----
  
  SECTIONS 				
  { 					
! .text ${BIG+ ${RELOCATING+ 0x0000000}} :
! 	{ 
  	  *(.text) 				
  	  *(.strings)
  	  *(.rdata)
*************** SECTIONS 				
*** 13,27 ****
  
  .ctors ${BIG+ ${RELOCATING+ 0x2000000}}  : 
  	{
! 	  ${RELOCATING+ ___ctors = . ;  }
  	  *(.ctors);
! 	  ${RELOCATING+ ___ctors_end = . ; }
  	  ___dtors = . ;
  	  *(.dtors);
! 	  ${RELOCATING+ ___dtors_end = . ; }
  	} 
  
! .data ${BIG+ ${RELOCATING+ 0x3000000}} : {
  	*(.data)
  	}
  
--- 14,29 ----
  
  .ctors ${BIG+ ${RELOCATING+ 0x2000000}}  : 
  	{
! 	  ${CONSTRUCTING+ ___ctors = . ;  }
  	  *(.ctors);
! 	  ${CONSTRUCTING+ ___ctors_end = . ; }
  	  ___dtors = . ;
  	  *(.dtors);
! 	  ${CONSTRUCTING+ ___dtors_end = . ; }
  	} 
  
! .data ${BIG+ ${RELOCATING+ 0x3000000}} :
! 	{
  	   *(.data)
  	}
  
*************** SECTIONS 				
*** 33,39 ****
      ${RELOCATING+ __end_bss = . ; }
    }
  
! .heap ${BIG+ ${RELOCATING+ 0x5000000}} : {
  	${RELOCATING+ __start_heap = . ; }
  	${RELOCATING+ . = . + 20k  ; }
  	${RELOCATING+ __end_heap = . ; }
--- 35,42 ----
  	  ${RELOCATING+ __end_bss = . ; }
  	}
  
! .heap ${BIG+ ${RELOCATING+ 0x5000000}} :
! 	{
  	  ${RELOCATING+ __start_heap = . ; }
  	  ${RELOCATING+ . = . + 20k  ; }
  	  ${RELOCATING+ __end_heap = . ; }

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