1179404Sobrien# If you change this file, please also look at files which source this one:
2179404Sobrien# elf64bmip.sh elf64btsmip.sh elf32btsmipn32.sh elf32bmipn32.sh
3179404Sobrien
4179404Sobrien# This is an ELF platform.
5179404SobrienSCRIPT_NAME=elf
6179404Sobrien
7179404Sobrien# Handle both big- and little-ended 32-bit MIPS objects.
8179404SobrienARCH=mips
9179404SobrienOUTPUT_FORMAT="elf32-bigmips"
10179404SobrienBIG_OUTPUT_FORMAT="elf32-bigmips"
11179404SobrienLITTLE_OUTPUT_FORMAT="elf32-littlemips"
12179404Sobrien
13179404SobrienTEMPLATE_NAME=elf32
14218822SdimEXTRA_EM_FILE=mipself
15179404Sobrien
16179404Sobriencase "$EMULATION_NAME" in
17179404Sobrienelf32*n32*) ELFSIZE=32 ;;
18179404Sobrienelf64*) ELFSIZE=64 ;;
19179404Sobrien*) echo $0: unhandled emulation $EMULATION_NAME >&2; exit 1 ;;
20179404Sobrienesac
21179404Sobrien
22179404Sobrienif test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
23179404Sobrien  case " $EMULATION_LIBPATH " in
24179404Sobrien    *" ${EMULATION_NAME} "*)
25179404Sobrien      NATIVE=yes
26179404Sobrien      ;;
27179404Sobrien  esac
28179404Sobrienfi
29179404Sobrien
30179404Sobrien# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
31179404SobrienLIBPATH_SUFFIX=$ELFSIZE
32179404Sobrien
33179404SobrienGENERATE_SHLIB_SCRIPT=yes
34218822SdimGENERATE_PIE_SCRIPT=yes
35179404Sobrien
36179404SobrienTEXT_START_ADDR=0x10000000
37218822SdimMAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
38179404SobrienENTRY=__start
39179404Sobrien
40218822Sdim# Unlike most targets, the MIPS backend puts all dynamic relocations
41218822Sdim# in a single dynobj section, which it also calls ".rel.dyn".  It does
42218822Sdim# this so that it can easily sort all dynamic relocations before the
43218822Sdim# output section has been populated.
44218822SdimOTHER_GOT_RELOC_SECTIONS="
45218822Sdim  .rel.dyn      ${RELOCATING-0} : { *(.rel.dyn) }
46218822Sdim"
47179404Sobrien# GOT-related settings.  
48218822Sdim# If the output has a GOT section, there must be exactly 0x7ff0 bytes
49218822Sdim# between .got and _gp.  The ". = ." below stops the orphan code from
50218822Sdim# inserting other sections between the assignment to _gp and the start
51218822Sdim# of .got.
52179404SobrienOTHER_GOT_SYMBOLS='
53218822Sdim  . = .;
54179404Sobrien  _gp = ALIGN(16) + 0x7ff0;
55179404Sobrien'
56179404SobrienOTHER_SDATA_SECTIONS="
57179404Sobrien  .lit8         ${RELOCATING-0} : { *(.lit8) }
58179404Sobrien  .lit4         ${RELOCATING-0} : { *(.lit4) }
59179404Sobrien  .srdata       ${RELOCATING-0} : { *(.srdata) }
60179404Sobrien"
61179404Sobrien
62179404Sobrien# Magic symbols.
63179404SobrienTEXT_START_SYMBOLS='_ftext = . ;'
64179404SobrienDATA_START_SYMBOLS='_fdata = . ;'
65179404SobrienOTHER_BSS_SYMBOLS='_fbss = .;'
66179404Sobrien
67218822SdimINITIAL_READONLY_SECTIONS=
68218822Sdimif test -z "${CREATE_SHLIB}"; then
69218822Sdim  INITIAL_READONLY_SECTIONS=".interp       ${RELOCATING-0} : { *(.interp) }"
70218822Sdimfi
71218822SdimINITIAL_READONLY_SECTIONS="${INITIAL_READONLY_SECTIONS}
72218822Sdim  .reginfo      ${RELOCATING-0} : { *(.reginfo) }"
73179404Sobrien# Discard any .MIPS.content* or .MIPS.events* sections.  The linker
74179404Sobrien# doesn't know how to adjust them.
75179404SobrienOTHER_SECTIONS="/DISCARD/ : { *(.MIPS.content*) *(.MIPS.events*) }"
76179404Sobrien
77179404SobrienTEXT_DYNAMIC=
78