elf32bmipn32-defs.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # If you change this file, please also look at files which source this one:
  2. # elf64bmip.sh elf64btsmip.sh elf32btsmipn32.sh elf32bmipn32.sh
  3. # This is an ELF platform.
  4. SCRIPT_NAME=elf
  5. # Handle both big- and little-ended 32-bit MIPS objects.
  6. ARCH=mips
  7. OUTPUT_FORMAT="elf32-bigmips"
  8. BIG_OUTPUT_FORMAT="elf32-bigmips"
  9. LITTLE_OUTPUT_FORMAT="elf32-littlemips"
  10. TEMPLATE_NAME=elf
  11. EXTRA_EM_FILE=mipself
  12. # Note: use "x$var" not x"$var" in case directive in order to work around bug in bash 4.2
  13. case "x$EMULATION_NAME" in
  14. xelf32*n32*) ELFSIZE=32 ;;
  15. xelf64*) ELFSIZE=64 ;;
  16. x) ;;
  17. *) echo $0: unhandled emulation $EMULATION_NAME >&2; exit 1 ;;
  18. esac
  19. if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
  20. case " $EMULATION_LIBPATH " in
  21. *" ${EMULATION_NAME} "*)
  22. NATIVE=yes
  23. ;;
  24. esac
  25. fi
  26. # Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
  27. LIBPATH_SUFFIX=$ELFSIZE
  28. GENERATE_SHLIB_SCRIPT=yes
  29. GENERATE_PIE_SCRIPT=yes
  30. TEXT_START_ADDR=0x10000000
  31. MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
  32. ENTRY=__start
  33. # Unlike most targets, the MIPS backend puts all dynamic relocations
  34. # in a single dynobj section, which it also calls ".rel.dyn". It does
  35. # this so that it can easily sort all dynamic relocations before the
  36. # output section has been populated.
  37. OTHER_GOT_RELOC_SECTIONS="
  38. .rel.dyn ${RELOCATING-0} : { *(.rel.dyn) }
  39. "
  40. # GOT-related settings.
  41. # If the output has a GOT section, there must be exactly 0x7ff0 bytes
  42. # between .got and _gp.
  43. OTHER_GOT_SYMBOLS='HIDDEN (_gp = ALIGN (16) + 0x7ff0);'
  44. # .got.plt is only used for the PLT psABI extension. It should not be
  45. # included in the .sdata block with .got, as there is no need to access
  46. # the section from _gp. Note that the traditional:
  47. #
  48. # . = .
  49. # _gp = ALIGN (16) + 0x7ff0;
  50. # .got : { *(.got.plt) *(.got) }
  51. #
  52. # would set _gp to the wrong value; _gp - 0x7ff0 must point to the start
  53. # of *(.got).
  54. GOT=".got ${RELOCATING-0} : { *(.got) }"
  55. unset OTHER_READWRITE_SECTIONS
  56. unset OTHER_RELRO_SECTIONS
  57. if test -n "$RELRO_NOW"; then
  58. OTHER_RELRO_SECTIONS=".got.plt ${RELOCATING-0} : { *(.got.plt) }"
  59. else
  60. OTHER_READWRITE_SECTIONS=".got.plt ${RELOCATING-0} : { *(.got.plt) }"
  61. fi
  62. OTHER_SDATA_SECTIONS="
  63. .lit8 ${RELOCATING-0} : { *(.lit8) }
  64. .lit4 ${RELOCATING-0} : { *(.lit4) }
  65. .srdata ${RELOCATING-0} : { *(.srdata) }
  66. "
  67. # Magic symbols.
  68. TEXT_START_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_ftext = .${CREATE_SHLIB+)};"
  69. DATA_START_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_fdata = .${CREATE_SHLIB+)};"
  70. OTHER_BSS_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_fbss = .${CREATE_SHLIB+)};"
  71. INITIAL_READONLY_SECTIONS=
  72. if test -z "${CREATE_SHLIB}"; then
  73. INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
  74. fi
  75. INITIAL_READONLY_SECTIONS="${INITIAL_READONLY_SECTIONS}
  76. .MIPS.abiflags ${RELOCATING-0} : { *(.MIPS.abiflags) }
  77. .MIPS.xhash ${RELOCATING-0} : { *(.MIPS.xhash) }
  78. .reginfo ${RELOCATING-0} : { *(.reginfo) }"
  79. # Discard any .MIPS.content* or .MIPS.events* sections. The linker
  80. # doesn't know how to adjust them.
  81. OTHER_SECTIONS="/DISCARD/ : { *(.MIPS.content*) *(.MIPS.events*) }"
  82. TEXT_DYNAMIC=