vmlinux.lds.S 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * Copyright (C) 2000 Russell King
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifdef CONFIG_CPU_ENDIAN_BE8
  9. #define ZIMAGE_MAGIC(x) ( (((x) >> 24) & 0x000000ff) | \
  10. (((x) >> 8) & 0x0000ff00) | \
  11. (((x) << 8) & 0x00ff0000) | \
  12. (((x) << 24) & 0xff000000) )
  13. #else
  14. #define ZIMAGE_MAGIC(x) (x)
  15. #endif
  16. OUTPUT_ARCH(arm)
  17. ENTRY(_start)
  18. SECTIONS
  19. {
  20. /DISCARD/ : {
  21. *(.ARM.exidx*)
  22. *(.ARM.extab*)
  23. /*
  24. * Discard any r/w data - this produces a link error if we have any,
  25. * which is required for PIC decompression. Local data generates
  26. * GOTOFF relocations, which prevents it being relocated independently
  27. * of the text/got segments.
  28. */
  29. *(.data)
  30. }
  31. . = TEXT_START;
  32. _text = .;
  33. .text : {
  34. _start = .;
  35. *(.start)
  36. *(.text)
  37. *(.text.*)
  38. *(.fixup)
  39. *(.gnu.warning)
  40. *(.glue_7t)
  41. *(.glue_7)
  42. }
  43. .table : ALIGN(4) {
  44. _table_start = .;
  45. LONG(ZIMAGE_MAGIC(2))
  46. LONG(ZIMAGE_MAGIC(0x5a534c4b))
  47. LONG(ZIMAGE_MAGIC(__piggy_size_addr - _start))
  48. LONG(ZIMAGE_MAGIC(_kernel_bss_size))
  49. LONG(0)
  50. _table_end = .;
  51. }
  52. .rodata : {
  53. *(.rodata)
  54. *(.rodata.*)
  55. *(.data.rel.ro)
  56. }
  57. .piggydata : {
  58. *(.piggydata)
  59. __piggy_size_addr = . - 4;
  60. }
  61. . = ALIGN(4);
  62. _etext = .;
  63. .got.plt : { *(.got.plt) }
  64. _got_start = .;
  65. .got : { *(.got) }
  66. _got_end = .;
  67. /* ensure the zImage file size is always a multiple of 64 bits */
  68. /* (without a dummy byte, ld just ignores the empty section) */
  69. .pad : { BYTE(0); . = ALIGN(8); }
  70. #ifdef CONFIG_EFI_STUB
  71. .data : ALIGN(4096) {
  72. __pecoff_data_start = .;
  73. /*
  74. * The EFI stub always executes from RAM, and runs strictly before the
  75. * decompressor, so we can make an exception for its r/w data, and keep it
  76. */
  77. *(.data.efistub)
  78. __pecoff_data_end = .;
  79. /*
  80. * PE/COFF mandates a file size which is a multiple of 512 bytes if the
  81. * section size equals or exceeds 4 KB
  82. */
  83. . = ALIGN(512);
  84. }
  85. __pecoff_data_rawsize = . - ADDR(.data);
  86. #endif
  87. _edata = .;
  88. /*
  89. * The image_end section appears after any additional loadable sections
  90. * that the linker may decide to insert in the binary image. Having
  91. * this symbol allows further debug in the near future.
  92. */
  93. .image_end (NOLOAD) : {
  94. /*
  95. * EFI requires that the image is aligned to 512 bytes, and appended
  96. * DTB requires that we know where the end of the image is. Ensure
  97. * that both are satisfied by ensuring that there are no additional
  98. * sections emitted into the decompressor image.
  99. */
  100. _edata_real = .;
  101. }
  102. _magic_sig = ZIMAGE_MAGIC(0x016f2818);
  103. _magic_start = ZIMAGE_MAGIC(_start);
  104. _magic_end = ZIMAGE_MAGIC(_edata);
  105. _magic_table = ZIMAGE_MAGIC(_table_start - _start);
  106. . = BSS_START;
  107. __bss_start = .;
  108. .bss : { *(.bss) }
  109. _end = .;
  110. . = ALIGN(8); /* the stack must be 64-bit aligned */
  111. .stack : { *(.stack) }
  112. PROVIDE(__pecoff_data_size = ALIGN(512) - ADDR(.data));
  113. PROVIDE(__pecoff_end = ALIGN(512));
  114. .stab 0 : { *(.stab) }
  115. .stabstr 0 : { *(.stabstr) }
  116. .stab.excl 0 : { *(.stab.excl) }
  117. .stab.exclstr 0 : { *(.stab.exclstr) }
  118. .stab.index 0 : { *(.stab.index) }
  119. .stab.indexstr 0 : { *(.stab.indexstr) }
  120. .comment 0 : { *(.comment) }
  121. }
  122. ASSERT(_edata_real == _edata, "error: zImage file size is incorrect");