image.ld 1.4 KB

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