You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

linux.lds 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* -*- sh -*- */
  2. /*
  3. * Linker script for x86_64 Linux images
  4. *
  5. */
  6. OUTPUT_FORMAT ( "elf64-x86-64", "elf64-x86-64", "elf64-x86-64" )
  7. OUTPUT_ARCH ( i386:x86-64 )
  8. SECTIONS {
  9. _max_align = 32;
  10. . = 0x400000;
  11. /*
  12. * The text section
  13. *
  14. */
  15. . = ALIGN ( _max_align );
  16. .text : {
  17. _text = .;
  18. *(.text)
  19. *(.text.*)
  20. _etext = .;
  21. }
  22. /*
  23. * The rodata section
  24. *
  25. */
  26. . = ALIGN ( _max_align );
  27. .rodata : {
  28. _rodata = .;
  29. *(.rodata)
  30. *(.rodata.*)
  31. _erodata = .;
  32. }
  33. /*
  34. * The data section
  35. *
  36. * Adjust the address for the data segment. We want to adjust up to
  37. * the same address within the page on the next page up.
  38. */
  39. . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1));
  40. . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
  41. .data : {
  42. _data = .;
  43. *(.data)
  44. *(.data.*)
  45. KEEP(*(SORT(.tbl.*)))
  46. KEEP(*(.provided))
  47. KEEP(*(.provided.*))
  48. _edata = .;
  49. }
  50. /*
  51. * The bss section
  52. *
  53. */
  54. . = ALIGN ( _max_align );
  55. .bss : {
  56. _bss = .;
  57. *(.bss)
  58. *(.bss.*)
  59. *(COMMON)
  60. _ebss = .;
  61. }
  62. /*
  63. * Weak symbols that need zero values if not otherwise defined
  64. *
  65. */
  66. .weak 0x0 : {
  67. _weak = .;
  68. *(.weak)
  69. *(.weak.*)
  70. _eweak = .;
  71. }
  72. _assert = ASSERT ( ( _weak == _eweak ), ".weak is non-zero length" );
  73. /*
  74. * Dispose of the comment and note sections to make the link map
  75. * easier to read
  76. *
  77. */
  78. /DISCARD/ : {
  79. *(.comment)
  80. *(.comment.*)
  81. *(.note)
  82. *(.note.*)
  83. *(.rel)
  84. *(.rel.*)
  85. *(.discard)
  86. *(.discard.*)
  87. }
  88. }