vmlinux.lds.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2012 Regents of the University of California
  4. * Copyright (C) 2017 SiFive
  5. */
  6. #define RO_EXCEPTION_TABLE_ALIGN 4
  7. #ifdef CONFIG_XIP_KERNEL
  8. #include "vmlinux-xip.lds.S"
  9. #else
  10. #include <asm/pgtable.h>
  11. #define LOAD_OFFSET KERNEL_LINK_ADDR
  12. #include <asm/vmlinux.lds.h>
  13. #include <asm/page.h>
  14. #include <asm/cache.h>
  15. #include <asm/thread_info.h>
  16. #include <asm/set_memory.h>
  17. #include "image-vars.h"
  18. #include <linux/sizes.h>
  19. OUTPUT_ARCH(riscv)
  20. ENTRY(_start)
  21. jiffies = jiffies_64;
  22. PECOFF_SECTION_ALIGNMENT = 0x1000;
  23. PECOFF_FILE_ALIGNMENT = 0x200;
  24. SECTIONS
  25. {
  26. /* Beginning of code and text segment */
  27. . = LOAD_OFFSET;
  28. _start = .;
  29. HEAD_TEXT_SECTION
  30. . = ALIGN(PAGE_SIZE);
  31. .text : {
  32. _text = .;
  33. _stext = .;
  34. TEXT_TEXT
  35. SCHED_TEXT
  36. CPUIDLE_TEXT
  37. LOCK_TEXT
  38. KPROBES_TEXT
  39. ENTRY_TEXT
  40. IRQENTRY_TEXT
  41. SOFTIRQENTRY_TEXT
  42. _etext = .;
  43. }
  44. . = ALIGN(SECTION_ALIGN);
  45. __init_begin = .;
  46. __init_text_begin = .;
  47. .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) ALIGN(SECTION_ALIGN) { \
  48. _sinittext = .; \
  49. INIT_TEXT \
  50. _einittext = .; \
  51. }
  52. . = ALIGN(8);
  53. __soc_early_init_table : {
  54. __soc_early_init_table_start = .;
  55. KEEP(*(__soc_early_init_table))
  56. __soc_early_init_table_end = .;
  57. }
  58. __soc_builtin_dtb_table : {
  59. __soc_builtin_dtb_table_start = .;
  60. KEEP(*(__soc_builtin_dtb_table))
  61. __soc_builtin_dtb_table_end = .;
  62. }
  63. /* we have to discard exit text and such at runtime, not link time */
  64. .exit.text :
  65. {
  66. EXIT_TEXT
  67. }
  68. __init_text_end = .;
  69. . = ALIGN(SECTION_ALIGN);
  70. #ifdef CONFIG_EFI
  71. . = ALIGN(PECOFF_SECTION_ALIGNMENT);
  72. __pecoff_text_end = .;
  73. #endif
  74. /* Start of init data section */
  75. __init_data_begin = .;
  76. INIT_DATA_SECTION(16)
  77. .exit.data :
  78. {
  79. EXIT_DATA
  80. }
  81. PERCPU_SECTION(L1_CACHE_BYTES)
  82. .rel.dyn : {
  83. *(.rel.dyn*)
  84. }
  85. __init_data_end = .;
  86. . = ALIGN(8);
  87. .alternative : {
  88. __alt_start = .;
  89. *(.alternative)
  90. __alt_end = .;
  91. }
  92. __init_end = .;
  93. /* Start of data section */
  94. _sdata = .;
  95. RO_DATA(SECTION_ALIGN)
  96. .srodata : {
  97. *(.srodata*)
  98. }
  99. . = ALIGN(SECTION_ALIGN);
  100. _data = .;
  101. RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN)
  102. .sdata : {
  103. __global_pointer$ = . + 0x800;
  104. *(.sdata*)
  105. }
  106. #ifdef CONFIG_EFI
  107. .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
  108. __pecoff_data_raw_size = ABSOLUTE(. - __pecoff_text_end);
  109. #endif
  110. /* End of data section */
  111. _edata = .;
  112. BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
  113. #ifdef CONFIG_EFI
  114. . = ALIGN(PECOFF_SECTION_ALIGNMENT);
  115. __pecoff_data_virt_size = ABSOLUTE(. - __pecoff_text_end);
  116. #endif
  117. _end = .;
  118. STABS_DEBUG
  119. DWARF_DEBUG
  120. ELF_DETAILS
  121. DISCARDS
  122. }
  123. #endif /* CONFIG_XIP_KERNEL */