vmlinux.lds.S 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 LOAD_OFFSET PAGE_OFFSET
  7. #include <asm/vmlinux.lds.h>
  8. #include <asm/page.h>
  9. #include <asm/cache.h>
  10. #include <asm/thread_info.h>
  11. #include <asm/set_memory.h>
  12. #include "image-vars.h"
  13. #include <linux/sizes.h>
  14. OUTPUT_ARCH(riscv)
  15. ENTRY(_start)
  16. jiffies = jiffies_64;
  17. PECOFF_SECTION_ALIGNMENT = 0x1000;
  18. PECOFF_FILE_ALIGNMENT = 0x200;
  19. SECTIONS
  20. {
  21. /* Beginning of code and text segment */
  22. . = LOAD_OFFSET;
  23. _start = .;
  24. HEAD_TEXT_SECTION
  25. . = ALIGN(PAGE_SIZE);
  26. __init_begin = .;
  27. INIT_TEXT_SECTION(PAGE_SIZE)
  28. . = ALIGN(8);
  29. __soc_early_init_table : {
  30. __soc_early_init_table_start = .;
  31. KEEP(*(__soc_early_init_table))
  32. __soc_early_init_table_end = .;
  33. }
  34. __soc_builtin_dtb_table : {
  35. __soc_builtin_dtb_table_start = .;
  36. KEEP(*(__soc_builtin_dtb_table))
  37. __soc_builtin_dtb_table_end = .;
  38. }
  39. /* we have to discard exit text and such at runtime, not link time */
  40. .exit.text :
  41. {
  42. EXIT_TEXT
  43. }
  44. .exit.data :
  45. {
  46. EXIT_DATA
  47. }
  48. PERCPU_SECTION(L1_CACHE_BYTES)
  49. __init_end = .;
  50. . = ALIGN(SECTION_ALIGN);
  51. .text : {
  52. _text = .;
  53. _stext = .;
  54. TEXT_TEXT
  55. SCHED_TEXT
  56. CPUIDLE_TEXT
  57. LOCK_TEXT
  58. KPROBES_TEXT
  59. ENTRY_TEXT
  60. IRQENTRY_TEXT
  61. SOFTIRQENTRY_TEXT
  62. *(.fixup)
  63. _etext = .;
  64. }
  65. #ifdef CONFIG_EFI
  66. . = ALIGN(PECOFF_SECTION_ALIGNMENT);
  67. __pecoff_text_end = .;
  68. #endif
  69. INIT_DATA_SECTION(16)
  70. /* Start of data section */
  71. _sdata = .;
  72. RO_DATA(SECTION_ALIGN)
  73. .srodata : {
  74. *(.srodata*)
  75. }
  76. EXCEPTION_TABLE(0x10)
  77. . = ALIGN(SECTION_ALIGN);
  78. _data = .;
  79. RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
  80. .sdata : {
  81. __global_pointer$ = . + 0x800;
  82. *(.sdata*)
  83. }
  84. #ifdef CONFIG_EFI
  85. .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
  86. __pecoff_data_raw_size = ABSOLUTE(. - __pecoff_text_end);
  87. #endif
  88. /* End of data section */
  89. _edata = .;
  90. BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
  91. .rel.dyn : {
  92. *(.rel.dyn*)
  93. }
  94. #ifdef CONFIG_EFI
  95. . = ALIGN(PECOFF_SECTION_ALIGNMENT);
  96. __pecoff_data_virt_size = ABSOLUTE(. - __pecoff_text_end);
  97. #endif
  98. _end = .;
  99. STABS_DEBUG
  100. DWARF_DEBUG
  101. ELF_DETAILS
  102. DISCARDS
  103. }