1*3d8817e4Smiod# Linker script for MIPS systems.
2*3d8817e4Smiod# Ian Lance Taylor <ian@cygnus.com>.
3*3d8817e4Smiod# These variables may be overridden by the emulation file.  The
4*3d8817e4Smiod# defaults are appropriate for a DECstation running Ultrix.
5*3d8817e4Smiodtest -z "$ENTRY" && ENTRY=__start
6*3d8817e4Smiod
7*3d8817e4Smiodif [ -z "$EMBEDDED" ]; then
8*3d8817e4Smiod  test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000 + SIZEOF_HEADERS"
9*3d8817e4Smiodelse
10*3d8817e4Smiod  test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000"
11*3d8817e4Smiodfi
12*3d8817e4Smiodif test "x$LD_FLAG" = "xn" -o "x$LD_FLAG" = "xN"; then
13*3d8817e4Smiod  DATA_ADDR=.
14*3d8817e4Smiodelse
15*3d8817e4Smiod  test -z "$DATA_ADDR" && DATA_ADDR=0x10000000
16*3d8817e4Smiodfi
17*3d8817e4Smiodcat <<EOF
18*3d8817e4SmiodOUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
19*3d8817e4Smiod	      "${LITTLE_OUTPUT_FORMAT}")
20*3d8817e4Smiod${LIB_SEARCH_DIRS}
21*3d8817e4Smiod
22*3d8817e4SmiodENTRY(${ENTRY})
23*3d8817e4Smiod
24*3d8817e4SmiodSECTIONS
25*3d8817e4Smiod{
26*3d8817e4Smiod  ${RELOCATING+. = ${TEXT_START_ADDR};}
27*3d8817e4Smiod  .text : {
28*3d8817e4Smiod    ${RELOCATING+ _ftext = . };
29*3d8817e4Smiod    *(.init)
30*3d8817e4Smiod    ${RELOCATING+ eprol  =  .};
31*3d8817e4Smiod    *(.text)
32*3d8817e4Smiod    *(.fini)
33*3d8817e4Smiod    ${RELOCATING+ etext  =  .};
34*3d8817e4Smiod    ${RELOCATING+ _etext  =  .};
35*3d8817e4Smiod  }
36*3d8817e4Smiod  ${RELOCATING+. = ${DATA_ADDR};}
37*3d8817e4Smiod  .rdata : {
38*3d8817e4Smiod    *(.rdata)
39*3d8817e4Smiod  }
40*3d8817e4Smiod  ${RELOCATING+ _fdata = ALIGN(16);}
41*3d8817e4Smiod  .data : {
42*3d8817e4Smiod    *(.data)
43*3d8817e4Smiod    ${CONSTRUCTING+CONSTRUCTORS}
44*3d8817e4Smiod  }
45*3d8817e4Smiod  ${RELOCATING+ _gp = ALIGN(16) + 0x8000;}
46*3d8817e4Smiod  .lit8 : {
47*3d8817e4Smiod    *(.lit8)
48*3d8817e4Smiod  }
49*3d8817e4Smiod  .lit4 : {
50*3d8817e4Smiod    *(.lit4)
51*3d8817e4Smiod  }
52*3d8817e4Smiod  .sdata : {
53*3d8817e4Smiod    *(.sdata)
54*3d8817e4Smiod  }
55*3d8817e4Smiod  ${RELOCATING+ edata  =  .;}
56*3d8817e4Smiod  ${RELOCATING+ _edata  =  .;}
57*3d8817e4Smiod  ${RELOCATING+ _fbss = .;}
58*3d8817e4Smiod  .sbss : {
59*3d8817e4Smiod    *(.sbss)
60*3d8817e4Smiod    *(.scommon)
61*3d8817e4Smiod  }
62*3d8817e4Smiod  .bss : {
63*3d8817e4Smiod    *(.bss)
64*3d8817e4Smiod    *(COMMON)
65*3d8817e4Smiod  }
66*3d8817e4Smiod  ${RELOCATING+ end = .;}
67*3d8817e4Smiod  ${RELOCATING+ _end = .;}
68*3d8817e4Smiod}
69*3d8817e4SmiodEOF
70