118334Speter# Linker script for ARM COFF.
252284Sobrien# Based on i386coff.sc by Ian Taylor <ian@cygnus.com>.
318334Spetertest -z "$ENTRY" && ENTRY=_start
418334Speterif test -z "${DATA_ADDR}"; then
518334Speter  if test "$LD_FLAG" = "N" || test "$LD_FLAG" = "n"; then
618334Speter    DATA_ADDR=.
718334Speter  fi
818334Speterfi
918334Speter
1018334Speter# These are substituted in as variables in order to get '}' in a shell
1118334Speter# conditional expansion.
1218334SpeterCTOR='.ctor : {
1318334Speter    *(SORT(.ctors.*))
1418334Speter    *(.ctor)
1518334Speter  }'
1618334SpeterDTOR='.dtor : {
1718334Speter    *(SORT(.dtors.*))
1818334Speter    *(.dtor)
1918334Speter  }'
2018334Speter
2118334Spetercat <<EOF
2218334SpeterOUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", "${LITTLE_OUTPUT_FORMAT}")
2318334Speter${LIB_SEARCH_DIRS}
2418334Speter
2518334SpeterENTRY(${ENTRY})
2618334Speter
2718334SpeterSECTIONS
2818334Speter{
2918334Speter  /* We start at 0x8000 because gdb assumes it (see FRAME_CHAIN).
3018334Speter     This is an artifact of the ARM Demon monitor using the bottom 32k
3118334Speter     as workspace (shared with the FP instruction emulator if
3218334Speter     present): */
3318334Speter  .text ${RELOCATING+ 0x8000} : {
3418334Speter    *(.init)
3518334Speter    *(.text*)
3618334Speter    *(.glue_7t)
3718334Speter    *(.glue_7)
3818334Speter    *(.rdata)
3918334Speter    ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 
4018334Speter			LONG (-1); *(.ctors); *(.ctor); LONG (0); }
4118334Speter    ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 
4218334Speter			LONG (-1); *(.dtors); *(.dtor);  LONG (0); }
4318334Speter    *(.fini)
4418334Speter    ${RELOCATING+ etext  =  .;}
4518334Speter    ${RELOCATING+ _etext =  .;}
4618334Speter  }
4718334Speter  .data ${RELOCATING+${DATA_ADDR-0x40000 + (ALIGN(0x8) & 0xfffc0fff)}} : {
4818334Speter    ${RELOCATING+  __data_start__ = . ;}
4918334Speter    *(.data*)
5050397Sobrien        
5118334Speter    ${RELOCATING+*(.gcc_exc*)}
5218334Speter    ${RELOCATING+___EH_FRAME_BEGIN__ = . ;}
5318334Speter    ${RELOCATING+*(.eh_fram*)}
5452284Sobrien    ${RELOCATING+___EH_FRAME_END__ = . ;}
5552284Sobrien    ${RELOCATING+LONG(0);}
5652284Sobrien    
5718334Speter    ${RELOCATING+ __data_end__ = . ;}
5818334Speter    ${RELOCATING+ edata  =  .;}
5918334Speter    ${RELOCATING+ _edata  =  .;}
6018334Speter  }
6118334Speter  ${CONSTRUCTING+${RELOCATING-$CTOR}}
6218334Speter  ${CONSTRUCTING+${RELOCATING-$DTOR}}
6352284Sobrien  .bss ${RELOCATING+ ALIGN(0x8)} :
6450397Sobrien  { 					
6552284Sobrien    ${RELOCATING+ __bss_start__ = . ;}
6618334Speter    *(.bss)
6718334Speter    *(COMMON)
6818334Speter    ${RELOCATING+ __bss_end__ = . ;}
6918334Speter  }
7018334Speter
7118334Speter  ${RELOCATING+ end = .;}
7218334Speter  ${RELOCATING+ _end = .;}
7318334Speter  ${RELOCATING+ __end__ = .;}
7418334Speter
7518334Speter  .stab  0 ${RELOCATING+(NOLOAD)} : 
7618334Speter  {
7718334Speter    [ .stab ]
7818334Speter  }
7918334Speter  .stabstr  0 ${RELOCATING+(NOLOAD)} :
8018334Speter  {
8118334Speter    [ .stabstr ]
8218334Speter  }
8318334Speter}
8418334SpeterEOF
8518334Speter