vmlinux.lds.S 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * ld script to make ARM Linux kernel
  3. * taken from the i386 version by Russell King
  4. * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
  5. */
  6. #include <asm-generic/vmlinux.lds.h>
  7. #include <asm/thread_info.h>
  8. #include <asm/memory.h>
  9. #include <asm/page.h>
  10. #include "image.h"
  11. #define ARM_EXIT_KEEP(x) x
  12. #define ARM_EXIT_DISCARD(x)
  13. OUTPUT_ARCH(aarch64)
  14. ENTRY(_text)
  15. jiffies = jiffies_64;
  16. #define HYPERVISOR_TEXT \
  17. /* \
  18. * Force the alignment to be compatible with \
  19. * the vectors requirements \
  20. */ \
  21. . = ALIGN(2048); \
  22. VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
  23. *(.hyp.idmap.text) \
  24. VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; \
  25. VMLINUX_SYMBOL(__hyp_text_start) = .; \
  26. *(.hyp.text) \
  27. VMLINUX_SYMBOL(__hyp_text_end) = .;
  28. SECTIONS
  29. {
  30. /*
  31. * XXX: The linker does not define how output sections are
  32. * assigned to input sections when there are multiple statements
  33. * matching the same input section name. There is no documented
  34. * order of matching.
  35. */
  36. /DISCARD/ : {
  37. ARM_EXIT_DISCARD(EXIT_TEXT)
  38. ARM_EXIT_DISCARD(EXIT_DATA)
  39. EXIT_CALL
  40. *(.discard)
  41. *(.discard.*)
  42. }
  43. . = PAGE_OFFSET + TEXT_OFFSET;
  44. .head.text : {
  45. _text = .;
  46. HEAD_TEXT
  47. }
  48. #ifdef CONFIG_MTK_AEE_MRDUMP
  49. .mrdump ALIGN (0x400): {
  50. }
  51. #endif
  52. .text : { /* Real text segment */
  53. _stext = .; /* Text and read-only data */
  54. __exception_text_start = .;
  55. *(.exception.text)
  56. __exception_text_end = .;
  57. IRQENTRY_TEXT
  58. TEXT_TEXT
  59. SCHED_TEXT
  60. LOCK_TEXT
  61. HYPERVISOR_TEXT
  62. *(.fixup)
  63. *(.gnu.warning)
  64. . = ALIGN(16);
  65. *(.got) /* Global offset table */
  66. }
  67. RO_DATA(PAGE_SIZE)
  68. EXCEPTION_TABLE(8)
  69. NOTES
  70. _etext = .; /* End of text and rodata section */
  71. . = ALIGN(PAGE_SIZE);
  72. __init_begin = .;
  73. INIT_TEXT_SECTION(8)
  74. .exit.text : {
  75. ARM_EXIT_KEEP(EXIT_TEXT)
  76. }
  77. . = ALIGN(16);
  78. .init.data : {
  79. INIT_DATA
  80. INIT_SETUP(16)
  81. INIT_CALLS
  82. CON_INITCALL
  83. SECURITY_INITCALL
  84. INIT_RAM_FS
  85. }
  86. .exit.data : {
  87. ARM_EXIT_KEEP(EXIT_DATA)
  88. }
  89. PERCPU_SECTION(64)
  90. . = ALIGN(PAGE_SIZE);
  91. __init_end = .;
  92. . = ALIGN(4);
  93. .altinstructions : {
  94. __alt_instructions = .;
  95. *(.altinstructions)
  96. __alt_instructions_end = .;
  97. }
  98. .altinstr_replacement : {
  99. *(.altinstr_replacement)
  100. }
  101. . = ALIGN(PAGE_SIZE);
  102. _data = .;
  103. _sdata = .;
  104. RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
  105. _edata = .;
  106. BSS_SECTION(0, 0, 0)
  107. . = ALIGN(PAGE_SIZE);
  108. idmap_pg_dir = .;
  109. . += IDMAP_DIR_SIZE;
  110. swapper_pg_dir = .;
  111. . += SWAPPER_DIR_SIZE;
  112. _end = .;
  113. STABS_DEBUG
  114. HEAD_SYMBOLS
  115. }
  116. /*
  117. * The HYP init code can't be more than a page long.
  118. */
  119. ASSERT(((__hyp_idmap_text_start + PAGE_SIZE) > __hyp_idmap_text_end),
  120. "HYP init code too big")
  121. /*
  122. * If padding is applied before .head.text, virt<->phys conversions will fail.
  123. */
  124. ASSERT(_text == (PAGE_OFFSET + TEXT_OFFSET), "HEAD is misaligned")