vmlinux.lds.S 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #include <asm-generic/vmlinux.lds.h>
  3. OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT)
  4. #undef i386
  5. #include <asm/cache.h>
  6. #include <asm/page_types.h>
  7. #ifdef CONFIG_X86_64
  8. OUTPUT_ARCH(i386:x86-64)
  9. ENTRY(startup_64)
  10. #else
  11. OUTPUT_ARCH(i386)
  12. ENTRY(startup_32)
  13. #endif
  14. SECTIONS
  15. {
  16. /* Be careful parts of head_64.S assume startup_32 is at
  17. * address 0.
  18. */
  19. . = 0;
  20. .head.text : {
  21. _head = . ;
  22. HEAD_TEXT
  23. _ehead = . ;
  24. }
  25. .rodata..compressed : {
  26. *(.rodata..compressed)
  27. }
  28. .text : {
  29. _text = .; /* Text */
  30. *(.text)
  31. *(.text.*)
  32. *(.noinstr.text)
  33. _etext = . ;
  34. }
  35. .rodata : {
  36. _rodata = . ;
  37. *(.rodata) /* read-only data */
  38. *(.rodata.*)
  39. _erodata = . ;
  40. }
  41. .data : ALIGN(0x1000) {
  42. _data = . ;
  43. *(.data)
  44. *(.data.*)
  45. /* Add 4 bytes of extra space for a CRC-32 checksum */
  46. . = ALIGN(. + 4, 0x200);
  47. _edata = . ;
  48. }
  49. . = ALIGN(L1_CACHE_BYTES);
  50. .bss : {
  51. _bss = . ;
  52. *(.bss)
  53. *(.bss.*)
  54. *(COMMON)
  55. . = ALIGN(8); /* For convenience during zeroing */
  56. _ebss = .;
  57. }
  58. #ifdef CONFIG_X86_64
  59. . = ALIGN(PAGE_SIZE);
  60. .pgtable : {
  61. _pgtable = . ;
  62. *(.pgtable)
  63. _epgtable = . ;
  64. }
  65. #endif
  66. . = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */
  67. _end = .;
  68. STABS_DEBUG
  69. DWARF_DEBUG
  70. ELF_DETAILS
  71. DISCARDS
  72. /DISCARD/ : {
  73. *(.dynamic) *(.dynsym) *(.dynstr) *(.dynbss)
  74. *(.hash) *(.gnu.hash)
  75. *(.note.*)
  76. }
  77. .got.plt (INFO) : {
  78. *(.got.plt)
  79. }
  80. ASSERT(SIZEOF(.got.plt) == 0 ||
  81. #ifdef CONFIG_X86_64
  82. SIZEOF(.got.plt) == 0x18,
  83. #else
  84. SIZEOF(.got.plt) == 0xc,
  85. #endif
  86. "Unexpected GOT/PLT entries detected!")
  87. /*
  88. * Sections that should stay zero sized, which is safer to
  89. * explicitly check instead of blindly discarding.
  90. */
  91. .got : {
  92. *(.got)
  93. }
  94. ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!")
  95. .plt : {
  96. *(.plt) *(.plt.*)
  97. }
  98. ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!")
  99. .rel.dyn : {
  100. *(.rel.*) *(.rel_*)
  101. }
  102. ASSERT(SIZEOF(.rel.dyn) == 0, "Unexpected run-time relocations (.rel) detected!")
  103. .rela.dyn : {
  104. *(.rela.*) *(.rela_*)
  105. }
  106. ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!")
  107. }