OSDN Git Service

Add TMS320C4x support
[pf3gnuchains/pf3gnuchains3x.git] / ld / scripttempl / tic4xcoff.sc
1 # 32 interrupt vectors + 32 trap vectors each of 4 bytes
2 # The .bss and .data sections need to be contiguous for direct addressing
3 # The data page pointer gets loaded with the start of .bss
4 # TI C compiler uses .cinit to initialise variables in .bss
5
6 test -z "$ENTRY" && ENTRY=_start
7 # These are substituted in as variables in order to get '}' in a shell
8 # conditional expansion.
9 INIT='.init : { *(.init) }'
10 FINI='.fini : { *(.fini) }'
11 cat <<EOF
12 OUTPUT_FORMAT("${OUTPUT_FORMAT}")
13 OUTPUT_ARCH("${OUTPUT_ARCH}")
14 ${LIB_SEARCH_DIRS}
15
16 ENTRY(${ENTRY})
17 ${RELOCATING+ __SYSMEM_SIZE = DEFINED(__SYSMEM_SIZE) ? __SYSMEM_SIZE : 0x4000;}
18 ${RELOCATING+ __STACK_SIZE  = DEFINED(__STACK_SIZE)  ? __STACK_SIZE  : 0x1000;}
19
20 SECTIONS
21 {
22   .comms ${RELOCATING+ 64} : {
23     *(.comms)
24   } 
25   .bss ${RELOCATING+ SIZEOF(.comms) + ADDR(.comms)} : {
26     ${RELOCATING+ .bss  =  .;}  
27     *(.bss)
28     *(COMMON)
29     ${RELOCATING+  end  =  .;}
30     ${RELOCATING+  _end  =  end;}
31   }
32   .data ${RELOCATING+ SIZEOF(.bss) + ADDR(.bss)} :
33   {                             
34     ${RELOCATING+  .data  = .;}
35     *(.data)
36     ${RELOCATING+  edata  =  .;}
37   }
38   .const ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
39   {                                     
40     *(.const)
41   }
42   .cinit ${RELOCATING+ SIZEOF(.const) + ADDR(.const)} :
43   {                                     
44     ${RELOCATING+  cinit = .;}
45     *(.cinit)
46     LONG(0);
47   }
48   .text ${RELOCATING+ SIZEOF(.cinit) + ADDR(.cinit)} : {
49     ${RELOCATING+  .text =  .;}
50     ${RELOCATING+ *(.init)}
51     *(.text)
52     ${CONSTRUCTING+ ___CTOR_LIST__ = .;}
53     ${CONSTRUCTING+ LONG(___CTOR_END__ - ___CTOR_LIST__ - 2)}
54     ${CONSTRUCTING+ *(.ctors)}
55     ${CONSTRUCTING+ LONG(0);}
56     ${CONSTRUCTING+ ___CTOR_END__  = .;}
57     ${CONSTRUCTING+ ___DTOR_LIST__ = .;}
58     ${CONSTRUCTING+ LONG(___DTOR_END__ - ___DTOR_LIST__ - 2)}
59     ${CONSTRUCTING+ *(.dtors)}
60     ${CONSTRUCTING+ LONG(0)}
61     ${CONSTRUCTING+ ___DTOR_END__  = .;}
62     ${RELOCATING+ *(.fini)}
63     ${RELOCATING+  etext =  .;}
64     ${RELOCATING+  _etext =  etext;}
65   }
66   .stack ${RELOCATING+ SIZEOF(.text) + ADDR(.text)} :
67   {                                     
68     *(.stack)
69     ${RELOCATING+ .  =  . + __STACK_SIZE};              
70   }
71   .sysmem ${RELOCATING+ SIZEOF(.stack) + ADDR(.stack)} :
72   {                                     
73     *(.sysmem)
74   }
75   .heap ${RELOCATING+ SIZEOF(.sysmem) + ADDR(.sysmem)} :
76   {                                     
77     ${RELOCATING+ . += __SYSMEM_SIZE - SIZEOF(.sysmem)};
78   }
79   ${RELOCATING- ${INIT}}
80   ${RELOCATING- ${FINI}}
81   .stab  0 ${RELOCATING+(NOLOAD)} : 
82   {
83     [ .stab ]
84   }
85   .stabstr  0 ${RELOCATING+(NOLOAD)} :
86   {
87     [ .stabstr ]
88   }
89 /* The TI tools sets cinit to -1 if the ram model is used.  */
90     ${RELOCATING+  cinit = SIZEOF(.cinit) == 1 ? cinit : -1;}
91 }
92 EOF