elf32bmipn32-defs.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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=elf32
  11. EXTRA_EM_FILE=mipself
  12. case x"$EMULATION_NAME" in
  13. xelf32*n32*) ELFSIZE=32 ;;
  14. xelf64*) ELFSIZE=64 ;;
  15. x) ;;
  16. *) echo $0: unhandled emulation $EMULATION_NAME >&2; exit 1 ;;
  17. esac
  18. if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
  19. case " $EMULATION_LIBPATH " in
  20. *" ${EMULATION_NAME} "*)
  21. NATIVE=yes
  22. ;;
  23. esac
  24. fi
  25. # Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
  26. LIBPATH_SUFFIX=$ELFSIZE
  27. GENERATE_SHLIB_SCRIPT=yes
  28. GENERATE_PIE_SCRIPT=yes
  29. TEXT_START_ADDR=0x10000000
  30. MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
  31. ENTRY=__start
  32. # Unlike most targets, the MIPS backend puts all dynamic relocations
  33. # in a single dynobj section, which it also calls ".rel.dyn". It does
  34. # this so that it can easily sort all dynamic relocations before the
  35. # output section has been populated.
  36. OTHER_GOT_RELOC_SECTIONS="
  37. .rel.dyn ${RELOCATING-0} : { *(.rel.dyn) }
  38. "
  39. # GOT-related settings.
  40. # If the output has a GOT section, there must be exactly 0x7ff0 bytes
  41. # between .got and _gp. The ". = ." below stops the orphan code from
  42. # inserting other sections between the assignment to _gp and the start
  43. # of .got.
  44. OTHER_GOT_SYMBOLS='
  45. . = .;
  46. HIDDEN (_gp = ALIGN (16) + 0x7ff0);
  47. '
  48. # .got.plt is only used for the PLT psABI extension. It should not be
  49. # included in the .sdata block with .got, as there is no need to access
  50. # the section from _gp. Note that the traditional:
  51. #
  52. # . = .
  53. # _gp = ALIGN (16) + 0x7ff0;
  54. # .got : { *(.got.plt) *(.got) }
  55. #
  56. # would set _gp to the wrong value; _gp - 0x7ff0 must point to the start
  57. # of *(.got).
  58. GOT=".got ${RELOCATING-0} : { *(.got) }"
  59. unset OTHER_READWRITE_SECTIONS
  60. unset OTHER_RELRO_SECTIONS
  61. if test -n "$RELRO_NOW"; then
  62. OTHER_RELRO_SECTIONS=".got.plt ${RELOCATING-0} : { *(.got.plt) }"
  63. else
  64. OTHER_READWRITE_SECTIONS=".got.plt ${RELOCATING-0} : { *(.got.plt) }"
  65. fi
  66. OTHER_SDATA_SECTIONS="
  67. .lit8 ${RELOCATING-0} : { *(.lit8) }
  68. .lit4 ${RELOCATING-0} : { *(.lit4) }
  69. .srdata ${RELOCATING-0} : { *(.srdata) }
  70. "
  71. # Magic symbols.
  72. TEXT_START_SYMBOLS='_ftext = . ;'
  73. DATA_START_SYMBOLS='_fdata = . ;'
  74. OTHER_BSS_SYMBOLS='_fbss = .;'
  75. INITIAL_READONLY_SECTIONS=
  76. if test -z "${CREATE_SHLIB}"; then
  77. INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
  78. fi
  79. INITIAL_READONLY_SECTIONS="${INITIAL_READONLY_SECTIONS}
  80. .MIPS.abiflags ${RELOCATING-0} : { *(.MIPS.abiflags) }
  81. .reginfo ${RELOCATING-0} : { *(.reginfo) }"
  82. # Discard any .MIPS.content* or .MIPS.events* sections. The linker
  83. # doesn't know how to adjust them.
  84. OTHER_SECTIONS="/DISCARD/ : { *(.MIPS.content*) *(.MIPS.events*) }"
  85. TEXT_DYNAMIC=