image.ld 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. /*
  63. * Remove unused sections from the image.
  64. */
  65. /DISCARD/ : {
  66. /* The image loads itself so doesn't need these sections. */
  67. *(.gnu.hash)
  68. *(.hash)
  69. *(.interp)
  70. *(.eh_frame_hdr)
  71. *(.eh_frame)
  72. *(.note.gnu.build-id)
  73. }
  74. }