160484Sobrien# Linker script for ARM COFF.
260484Sobrien# Based on i386coff.sc by Ian Taylor <ian@cygnus.com>.
360484Sobrientest -z "$ENTRY" && ENTRY=_start
460484Sobrienif test -z "${DATA_ADDR}"; then
560484Sobrien  if test "$LD_FLAG" = "N" || test "$LD_FLAG" = "n"; then
660484Sobrien    DATA_ADDR=.
760484Sobrien  fi
860484Sobrienfi
989857Sobrien
1089857Sobrien# These are substituted in as variables in order to get '}' in a shell
1189857Sobrien# conditional expansion.
1289857SobrienCTOR='.ctor : {
1389857Sobrien    *(SORT(.ctors.*))
1489857Sobrien    *(.ctor)
1589857Sobrien  }'
1689857SobrienDTOR='.dtor : {
1789857Sobrien    *(SORT(.dtors.*))
1889857Sobrien    *(.dtor)
1989857Sobrien  }'
2089857Sobrien
2160484Sobriencat <<EOF
2260484SobrienOUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", "${LITTLE_OUTPUT_FORMAT}")
2360484Sobrien${LIB_SEARCH_DIRS}
2460484Sobrien
2560484SobrienENTRY(${ENTRY})
2660484Sobrien
2760484SobrienSECTIONS
2860484Sobrien{
2960484Sobrien  /* We start at 0x8000 because gdb assumes it (see FRAME_CHAIN).
3060484Sobrien     This is an artifact of the ARM Demon monitor using the bottom 32k
3160484Sobrien     as workspace (shared with the FP instruction emulator if
3260484Sobrien     present): */
3360484Sobrien  .text ${RELOCATING+ 0x8000} : {
3460484Sobrien    *(.init)
3589857Sobrien    *(.text*)
3660484Sobrien    *(.glue_7t)
3760484Sobrien    *(.glue_7)
3860484Sobrien    *(.rdata)
3960484Sobrien    ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 
4060484Sobrien			LONG (-1); *(.ctors); *(.ctor); LONG (0); }
4160484Sobrien    ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 
4260484Sobrien			LONG (-1); *(.dtors); *(.dtor);  LONG (0); }
4360484Sobrien    *(.fini)
4460484Sobrien    ${RELOCATING+ etext  =  .;}
4589857Sobrien    ${RELOCATING+ _etext =  .;}
4660484Sobrien  }
47130561Sobrien  .data ${RELOCATING+${DATA_ADDR-0x40000 + (ALIGN(0x8) & 0xfffc0fff)}} : {
4860484Sobrien    ${RELOCATING+  __data_start__ = . ;}
4989857Sobrien    *(.data*)
5089857Sobrien        
5189857Sobrien    ${RELOCATING+*(.gcc_exc*)}
5289857Sobrien    ${RELOCATING+___EH_FRAME_BEGIN__ = . ;}
5389857Sobrien    ${RELOCATING+*(.eh_fram*)}
5489857Sobrien    ${RELOCATING+___EH_FRAME_END__ = . ;}
5589857Sobrien    ${RELOCATING+LONG(0);}
5689857Sobrien    
5760484Sobrien    ${RELOCATING+ __data_end__ = . ;}
5860484Sobrien    ${RELOCATING+ edata  =  .;}
5960484Sobrien    ${RELOCATING+ _edata  =  .;}
6060484Sobrien  }
6189857Sobrien  ${CONSTRUCTING+${RELOCATING-$CTOR}}
6289857Sobrien  ${CONSTRUCTING+${RELOCATING-$DTOR}}
63130561Sobrien  .bss ${RELOCATING+ ALIGN(0x8)} :
6460484Sobrien  { 					
6560484Sobrien    ${RELOCATING+ __bss_start__ = . ;}
6660484Sobrien    *(.bss)
6760484Sobrien    *(COMMON)
6860484Sobrien    ${RELOCATING+ __bss_end__ = . ;}
6960484Sobrien  }
7060484Sobrien
7160484Sobrien  ${RELOCATING+ end = .;}
7260484Sobrien  ${RELOCATING+ _end = .;}
7360484Sobrien  ${RELOCATING+ __end__ = .;}
7460484Sobrien
7560484Sobrien  .stab  0 ${RELOCATING+(NOLOAD)} : 
7660484Sobrien  {
7760484Sobrien    [ .stab ]
7860484Sobrien  }
7960484Sobrien  .stabstr  0 ${RELOCATING+(NOLOAD)} :
8060484Sobrien  {
8160484Sobrien    [ .stabstr ]
8260484Sobrien  }
8360484Sobrien}
8460484SobrienEOF
85