u-boot.lds 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * (C) Copyright 2003
  3. * Wolfgang Denk Engineering, <wd@denx.de>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #if defined(CONFIG_64BIT)
  8. #define PTR_COUNT_SHIFT 3
  9. #else
  10. #define PTR_COUNT_SHIFT 2
  11. #endif
  12. OUTPUT_ARCH(mips)
  13. ENTRY(_start)
  14. SECTIONS
  15. {
  16. . = 0x00000000;
  17. . = ALIGN(4);
  18. .text : {
  19. *(.text*)
  20. }
  21. . = ALIGN(4);
  22. .rodata : {
  23. *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
  24. }
  25. . = ALIGN(4);
  26. .data : {
  27. *(.data*)
  28. }
  29. . = .;
  30. _gp = ALIGN(16) + 0x7ff0;
  31. .got : {
  32. *(.got)
  33. }
  34. num_got_entries = SIZEOF(.got) >> PTR_COUNT_SHIFT;
  35. . = ALIGN(4);
  36. .sdata : {
  37. *(.sdata*)
  38. }
  39. . = ALIGN(4);
  40. .u_boot_list : {
  41. KEEP(*(SORT(.u_boot_list*)));
  42. }
  43. . = ALIGN(4);
  44. __image_copy_end = .;
  45. .rel.dyn : {
  46. __rel_dyn_start = .;
  47. *(.rel.dyn)
  48. __rel_dyn_end = .;
  49. }
  50. .deadcode : {
  51. /*
  52. * Workaround for a binutils feature (or bug?).
  53. *
  54. * The GNU ld from binutils puts the dynamic relocation
  55. * entries into the .rel.dyn section. Sometimes it
  56. * allocates more dynamic relocation entries than it needs
  57. * and the unused slots are set to R_MIPS_NONE entries.
  58. *
  59. * However the size of the .rel.dyn section in the ELF
  60. * section header does not cover the unused entries, so
  61. * objcopy removes those during stripping.
  62. *
  63. * Create a small section here to avoid that.
  64. */
  65. LONG(0xffffffff);
  66. }
  67. .dynsym : {
  68. *(.dynsym)
  69. }
  70. .bss __rel_dyn_start (OVERLAY) : {
  71. __bss_start = .;
  72. *(.sbss.*)
  73. *(.bss.*)
  74. *(COMMON)
  75. . = ALIGN(4);
  76. __bss_end = .;
  77. }
  78. /DISCARD/ : {
  79. *(.dynbss)
  80. *(.dynstr)
  81. *(.dynamic)
  82. *(.interp)
  83. *(.hash)
  84. *(.gnu.*)
  85. *(.plt)
  86. *(.got.plt)
  87. *(.rel.plt)
  88. }
  89. }