1# Linker script for MIPS systems.
2# Ian Lance Taylor <ian@cygnus.com>.
3#
4# Copyright (C) 2014-2017 Free Software Foundation, Inc.
5# 
6# Copying and distribution of this file, with or without modification,
7# are permitted in any medium without royalty provided the copyright
8# notice and this notice are preserved.
9#
10# These variables may be overridden by the emulation file.  The
11# defaults are appropriate for a DECstation running Ultrix.
12
13test -z "$ENTRY" && ENTRY=__start
14
15if [ -z "$EMBEDDED" ]; then
16  test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000 + SIZEOF_HEADERS"
17else
18  test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000"
19fi
20if test "x$LD_FLAG" = "xn" -o "x$LD_FLAG" = "xN"; then
21  DATA_ADDR=.
22else
23  test -z "$DATA_ADDR" && DATA_ADDR=0x10000000
24fi
25
26cat <<EOF
27/* Copyright (C) 2014-2017 Free Software Foundation, Inc.
28
29   Copying and distribution of this script, with or without modification,
30   are permitted in any medium without royalty provided the copyright
31   notice and this notice are preserved.  */
32
33OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
34	      "${LITTLE_OUTPUT_FORMAT}")
35${LIB_SEARCH_DIRS}
36
37${RELOCATING+ENTRY (${ENTRY})}
38
39SECTIONS
40{
41  ${RELOCATING+. = ${TEXT_START_ADDR};}
42  .text : {
43    ${RELOCATING+ _ftext = . };
44    *(.init)
45    ${RELOCATING+ eprol  =  .};
46    *(.text)
47    *(.fini)
48    ${RELOCATING+ etext  =  .};
49    ${RELOCATING+ _etext  =  .};
50  }
51  ${RELOCATING+. = ${DATA_ADDR};}
52  .rdata : {
53    *(.rdata)
54  }
55  ${RELOCATING+ _fdata = ALIGN(16);}
56  .data : {
57    *(.data)
58    ${CONSTRUCTING+CONSTRUCTORS}
59  }
60  ${RELOCATING+ HIDDEN (_gp = ALIGN (16) + 0x8000);}
61  .lit8 : {
62    *(.lit8)
63  }
64  .lit4 : {
65    *(.lit4)
66  }
67  .sdata : {
68    *(.sdata)
69  }
70  ${RELOCATING+ edata  =  .;}
71  ${RELOCATING+ _edata  =  .;}
72  ${RELOCATING+ _fbss = .;}
73  .sbss : {
74    *(.sbss)
75    *(.scommon)
76  }
77  .bss : {
78    *(.bss)
79    *(COMMON)
80  }
81  ${RELOCATING+ end = .;}
82  ${RELOCATING+ _end = .;}
83}
84EOF
85