image.ld 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Code will start running at this symbol which is placed at the start of the
  3. * image.
  4. */
  5. ENTRY(entry)
  6. MEMORY
  7. {
  8. image : ORIGIN = 0x40000000, LENGTH = 2M
  9. }
  10. SECTIONS
  11. {
  12. /*
  13. * Collect together the code.
  14. */
  15. .init : ALIGN(4096) {
  16. text_begin = .;
  17. *(.init.entry)
  18. *(.init.*)
  19. } >image
  20. .text : {
  21. *(.text.*)
  22. } >image
  23. text_end = .;
  24. /*
  25. * Collect together read-only data.
  26. */
  27. .rodata : ALIGN(4096) {
  28. rodata_begin = .;
  29. *(.rodata.*)
  30. } >image
  31. .got : {
  32. *(.got)
  33. } >image
  34. rodata_end = .;
  35. /*
  36. * Collect together the read-write data including .bss at the end which
  37. * will be zero'd by the entry code.
  38. */
  39. .data : ALIGN(4096) {
  40. data_begin = .;
  41. *(.data.*)
  42. /*
  43. * The entry point code assumes that .data is a multiple of 32
  44. * bytes long.
  45. */
  46. . = ALIGN(32);
  47. data_end = .;
  48. } >image
  49. /* Everything beyond this point will not be included in the binary. */
  50. bin_end = .;
  51. /* The entry point code assumes that .bss is 16-byte aligned. */
  52. .bss : ALIGN(16) {
  53. bss_begin = .;
  54. *(.bss.*)
  55. *(COMMON)
  56. . = ALIGN(16);
  57. bss_end = .;
  58. } >image
  59. .stack (NOLOAD) : ALIGN(4096) {
  60. boot_stack_begin = .;
  61. . += 40 * 4096;
  62. . = ALIGN(4096);
  63. boot_stack_end = .;
  64. } >image
  65. /*
  66. * Remove unused sections from the image.
  67. */
  68. /DISCARD/ : {
  69. /* The image loads itself so doesn't need these sections. */
  70. *(.gnu.hash)
  71. *(.hash)
  72. *(.interp)
  73. *(.eh_frame_hdr)
  74. *(.eh_frame)
  75. *(.note.gnu.build-id)
  76. }
  77. }