vmlinux.lds.S 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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)
  12. #define ARM_EXIT_DISCARD(x) 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. .text : { /* Real text segment */
  49. _stext = .; /* Text and read-only data */
  50. __exception_text_start = .;
  51. *(.exception.text)
  52. __exception_text_end = .;
  53. IRQENTRY_TEXT
  54. TEXT_TEXT
  55. SCHED_TEXT
  56. LOCK_TEXT
  57. HYPERVISOR_TEXT
  58. *(.fixup)
  59. *(.gnu.warning)
  60. . = ALIGN(16);
  61. *(.got) /* Global offset table */
  62. }
  63. RO_DATA(PAGE_SIZE)
  64. EXCEPTION_TABLE(8)
  65. NOTES
  66. _etext = .; /* End of text and rodata section */
  67. . = ALIGN(PAGE_SIZE);
  68. __init_begin = .;
  69. INIT_TEXT_SECTION(8)
  70. .exit.text : {
  71. ARM_EXIT_KEEP(EXIT_TEXT)
  72. }
  73. . = ALIGN(16);
  74. .init.data : {
  75. INIT_DATA
  76. INIT_SETUP(16)
  77. INIT_CALLS
  78. CON_INITCALL
  79. SECURITY_INITCALL
  80. INIT_RAM_FS
  81. }
  82. .exit.data : {
  83. ARM_EXIT_KEEP(EXIT_DATA)
  84. }
  85. PERCPU_SECTION(64)
  86. . = ALIGN(PAGE_SIZE);
  87. __init_end = .;
  88. _data = .;
  89. _sdata = .;
  90. RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
  91. _edata = .;
  92. BSS_SECTION(0, 0, 0)
  93. . = ALIGN(PAGE_SIZE);
  94. idmap_pg_dir = .;
  95. . += IDMAP_DIR_SIZE;
  96. swapper_pg_dir = .;
  97. . += SWAPPER_DIR_SIZE;
  98. _end = .;
  99. STABS_DEBUG
  100. HEAD_SYMBOLS
  101. }
  102. /*
  103. * The HYP init code can't be more than a page long.
  104. */
  105. ASSERT(((__hyp_idmap_text_start + PAGE_SIZE) > __hyp_idmap_text_end),
  106. "HYP init code too big")
  107. /*
  108. * If padding is applied before .head.text, virt<->phys conversions will fail.
  109. */
  110. ASSERT(_text == (PAGE_OFFSET + TEXT_OFFSET), "HEAD is misaligned")