x15.lds.S 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #ifdef __LP64__
  2. OUTPUT_FORMAT("elf64-x86-64")
  3. OUTPUT_ARCH(i386:x86-64)
  4. #else
  5. OUTPUT_FORMAT("elf32-i386")
  6. OUTPUT_ARCH(i386)
  7. #endif /* __LP64__ */
  8. ENTRY(boot_start)
  9. #include <kern/init.h>
  10. #include <machine/boot.h>
  11. #include <machine/cpu.h>
  12. #include <machine/page.h>
  13. #include <machine/pmap.h>
  14. PHDRS
  15. {
  16. /* Flags are actually similar to classic Unix permissions */
  17. boot PT_LOAD FLAGS(7);
  18. init PT_LOAD FLAGS(7);
  19. percpu PT_LOAD FLAGS(6);
  20. text PT_LOAD FLAGS(5);
  21. rodata PT_LOAD FLAGS(4);
  22. data PT_LOAD FLAGS(6);
  23. #ifdef CONFIG_SYMTAB
  24. symbol PT_LOAD FLAGS(6);
  25. #endif
  26. }
  27. SECTIONS
  28. {
  29. . = BOOT_OFFSET;
  30. _boot = .;
  31. .boot ALIGN(PAGE_SIZE) : {
  32. *(.boot.hdr)
  33. *(.boot.text)
  34. *(.boot.data)
  35. } : boot
  36. . = ALIGN(PAGE_SIZE);
  37. _boot_end = .;
  38. . += PMAP_KERNEL_OFFSET;
  39. _init = .;
  40. .init ALIGN(PAGE_SIZE) : AT(BOOT_VTOP(ADDR(.init))) {
  41. *(.init.text)
  42. *(.init.data)
  43. . = ALIGN(INIT_OP_ALIGN);
  44. _init_ops = .;
  45. *(.init.ops)
  46. _init_ops_end = .;
  47. } : init
  48. . = ALIGN(PAGE_SIZE);
  49. _init_end = .;
  50. _percpu = .;
  51. .percpu 0 : AT(BOOT_VTOP(_percpu)) {
  52. *(.percpu*)
  53. } : percpu
  54. . = _percpu + SIZEOF(.percpu);
  55. . = ALIGN(PAGE_SIZE);
  56. _percpu_end = .;
  57. _text = .;
  58. .text ALIGN(PAGE_SIZE) : AT(BOOT_VTOP(ADDR(.text))) {
  59. *(.text*)
  60. } : text
  61. . = ALIGN(PAGE_SIZE);
  62. _rodata = .;
  63. .rodata ALIGN(PAGE_SIZE) : AT(BOOT_VTOP(ADDR(.rodata))) {
  64. *(.rodata*)
  65. } : rodata
  66. . = ALIGN(PAGE_SIZE);
  67. _data = .;
  68. .data ALIGN(PAGE_SIZE) : AT(BOOT_VTOP(ADDR(.data))) {
  69. . = ALIGN(CPU_L1_SIZE);
  70. *(.data.read_mostly)
  71. . = ALIGN(CPU_L1_SIZE);
  72. *(.data*)
  73. } : data
  74. .bss ALIGN(CPU_DATA_ALIGN) : AT(BOOT_VTOP(ADDR(.bss))) {
  75. *(.bss*)
  76. } : data
  77. #ifdef CONFIG_SYMTAB
  78. /*
  79. * Including the embedded symbol table last should reliably prevent
  80. * the second link from changing the addresses of the kernel symbols.
  81. *
  82. * In addition, use a program header different from data to make
  83. * sure the linker doesn't include the .bss section in the output file.
  84. */
  85. .symbol ALIGN(PAGE_SIZE) : AT(BOOT_VTOP(ADDR(.symbol))) {
  86. *(.symbol*)
  87. } : symbol
  88. #endif /* CONFIG_SYMTAB */
  89. . = ALIGN(PAGE_SIZE);
  90. _end = .;
  91. /DISCARD/ : {
  92. *(.eh_frame*)
  93. *(.note*)
  94. }
  95. }