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