xref: /netbsd-src/external/gpl3/binutils.old/dist/ld/scripttempl/mips.sc (revision e992f068c547fd6e84b3f104dc2340adcc955732)
116dce513Schristos# Linker script for MIPS systems.
216dce513Schristos# Ian Lance Taylor <ian@cygnus.com>.
316dce513Schristos#
4*e992f068Schristos# Copyright (C) 2014-2022 Free Software Foundation, Inc.
516dce513Schristos#
616dce513Schristos# Copying and distribution of this file, with or without modification,
716dce513Schristos# are permitted in any medium without royalty provided the copyright
816dce513Schristos# notice and this notice are preserved.
916dce513Schristos#
1016dce513Schristos# These variables may be overridden by the emulation file.  The
1116dce513Schristos# defaults are appropriate for a DECstation running Ultrix.
1216dce513Schristos
1316dce513Schristostest -z "$ENTRY" && ENTRY=__start
1416dce513Schristos
1516dce513Schristosif [ -z "$EMBEDDED" ]; then
1616dce513Schristos  test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000 + SIZEOF_HEADERS"
1716dce513Schristoselse
1816dce513Schristos  test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000"
1916dce513Schristosfi
2016dce513Schristosif test "x$LD_FLAG" = "xn" -o "x$LD_FLAG" = "xN"; then
2116dce513Schristos  DATA_ADDR=.
2216dce513Schristoselse
2316dce513Schristos  test -z "$DATA_ADDR" && DATA_ADDR=0x10000000
2416dce513Schristosfi
2516dce513Schristos
2616dce513Schristoscat <<EOF
27*e992f068Schristos/* Copyright (C) 2014-2022 Free Software Foundation, Inc.
2816dce513Schristos
2916dce513Schristos   Copying and distribution of this script, with or without modification,
3016dce513Schristos   are permitted in any medium without royalty provided the copyright
3116dce513Schristos   notice and this notice are preserved.  */
3216dce513Schristos
3316dce513SchristosOUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
3416dce513Schristos	      "${LITTLE_OUTPUT_FORMAT}")
3516dce513Schristos${LIB_SEARCH_DIRS}
3616dce513Schristos
3716dce513Schristos${RELOCATING+ENTRY (${ENTRY})}
3816dce513Schristos
3916dce513SchristosSECTIONS
4016dce513Schristos{
4116dce513Schristos  ${RELOCATING+. = ${TEXT_START_ADDR};}
4216dce513Schristos  .text : {
43012573ebSchristos    ${RELOCATING+_ftext = .;
44012573ebSchristos    KEEP (*(SORT_NONE(.init)))
45012573ebSchristos    eprol  =  .;}
4616dce513Schristos    *(.text)
47012573ebSchristos    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))
48012573ebSchristos    etext  =  .;
49012573ebSchristos    _etext  =  .;}
5016dce513Schristos  }
5116dce513Schristos  ${RELOCATING+. = ${DATA_ADDR};}
5216dce513Schristos  .rdata : {
5316dce513Schristos    *(.rdata)
5416dce513Schristos  }
5516dce513Schristos  ${RELOCATING+ _fdata = ALIGN(16);}
5616dce513Schristos  .data : {
5716dce513Schristos    *(.data)
5816dce513Schristos    ${CONSTRUCTING+CONSTRUCTORS}
5916dce513Schristos  }
6016dce513Schristos  ${RELOCATING+ HIDDEN (_gp = ALIGN (16) + 0x8000);}
6116dce513Schristos  .lit8 : {
6216dce513Schristos    *(.lit8)
6316dce513Schristos  }
6416dce513Schristos  .lit4 : {
6516dce513Schristos    *(.lit4)
6616dce513Schristos  }
6716dce513Schristos  .sdata : {
6816dce513Schristos    *(.sdata)
6916dce513Schristos  }
7016dce513Schristos  ${RELOCATING+ edata  =  .;}
7116dce513Schristos  ${RELOCATING+ _edata  =  .;}
7216dce513Schristos  ${RELOCATING+ _fbss = .;}
7316dce513Schristos  .sbss : {
7416dce513Schristos    *(.sbss)
7516dce513Schristos    *(.scommon)
7616dce513Schristos  }
7716dce513Schristos  .bss : {
7816dce513Schristos    *(.bss)
7916dce513Schristos    *(COMMON)
8016dce513Schristos  }
8116dce513Schristos  ${RELOCATING+ end = .;}
8216dce513Schristos  ${RELOCATING+ _end = .;}
8316dce513Schristos}
8416dce513SchristosEOF
85