vmlinux.lds.S 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. }
  56. .piggydata : {
  57. *(.piggydata)
  58. __piggy_size_addr = . - 4;
  59. }
  60. . = ALIGN(4);
  61. _etext = .;
  62. .got.plt : { *(.got.plt) }
  63. _got_start = .;
  64. .got : { *(.got) }
  65. _got_end = .;
  66. /* ensure the zImage file size is always a multiple of 64 bits */
  67. /* (without a dummy byte, ld just ignores the empty section) */
  68. .pad : { BYTE(0); . = ALIGN(8); }
  69. #ifdef CONFIG_EFI_STUB
  70. .data : ALIGN(4096) {
  71. __pecoff_data_start = .;
  72. /*
  73. * The EFI stub always executes from RAM, and runs strictly before the
  74. * decompressor, so we can make an exception for its r/w data, and keep it
  75. */
  76. *(.data.efistub)
  77. __pecoff_data_end = .;
  78. /*
  79. * PE/COFF mandates a file size which is a multiple of 512 bytes if the
  80. * section size equals or exceeds 4 KB
  81. */
  82. . = ALIGN(512);
  83. }
  84. __pecoff_data_rawsize = . - ADDR(.data);
  85. #endif
  86. _edata = .;
  87. /*
  88. * The image_end section appears after any additional loadable sections
  89. * that the linker may decide to insert in the binary image. Having
  90. * this symbol allows further debug in the near future.
  91. */
  92. .image_end (NOLOAD) : {
  93. _edata_real = .;
  94. }
  95. _magic_sig = ZIMAGE_MAGIC(0x016f2818);
  96. _magic_start = ZIMAGE_MAGIC(_start);
  97. _magic_end = ZIMAGE_MAGIC(_edata);
  98. _magic_table = ZIMAGE_MAGIC(_table_start - _start);
  99. . = BSS_START;
  100. __bss_start = .;
  101. .bss : { *(.bss) }
  102. _end = .;
  103. . = ALIGN(8); /* the stack must be 64-bit aligned */
  104. .stack : { *(.stack) }
  105. PROVIDE(__pecoff_data_size = ALIGN(512) - ADDR(.data));
  106. PROVIDE(__pecoff_end = ALIGN(512));
  107. .stab 0 : { *(.stab) }
  108. .stabstr 0 : { *(.stabstr) }
  109. .stab.excl 0 : { *(.stab.excl) }
  110. .stab.exclstr 0 : { *(.stab.exclstr) }
  111. .stab.index 0 : { *(.stab.index) }
  112. .stab.indexstr 0 : { *(.stab.indexstr) }
  113. .comment 0 : { *(.comment) }
  114. }