link.lds 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. OUTPUT_FORMAT("elf64-x86-64","elf64-x86-64","elf64-x86-64")
  2. OUTPUT_ARCH(i386:x86-64)
  3. ENTRY(_start)
  4. SECTIONS
  5. {
  6. KERNEL_VMA = 0xffff800000000000;
  7. //KERNEL_VMA = 0;
  8. . = 0;
  9. . = 0x100000;
  10. .boot.text :
  11. {
  12. KEEP(*(.multiboot_header))
  13. head.o(.bootstrap)
  14. head.o(.bootstrap.code64)
  15. head.o(.bootstrap.data)
  16. . = ALIGN(4096);
  17. }
  18. . += KERNEL_VMA;
  19. . = ALIGN(32768);
  20. text_start_pa = .;
  21. .text (text_start_pa): AT(text_start_pa - KERNEL_VMA)
  22. {
  23. _text = .;
  24. *(.text)
  25. _etext = .;
  26. }
  27. . = ALIGN(32768);
  28. data_start_pa = .;
  29. .data (data_start_pa): AT(data_start_pa - KERNEL_VMA)
  30. {
  31. _data = .;
  32. *(.data)
  33. _edata = .;
  34. }
  35. . = ALIGN(32768);
  36. rodata_start_pa = .;
  37. .rodata (rodata_start_pa): AT(rodata_start_pa - KERNEL_VMA)
  38. {
  39. _rodata = .;
  40. *(.rodata)
  41. _erodata = .;
  42. }
  43. . = ALIGN(32768);
  44. init_proc_union_start_pa = .;
  45. .data.init_proc_union (init_proc_union_start_pa): AT(init_proc_union_start_pa - KERNEL_VMA)
  46. { *(.data.init_proc_union) }
  47. . = ALIGN(32768);
  48. bss_start_pa = .;
  49. .bss (bss_start_pa): AT(bss_start_pa - KERNEL_VMA)
  50. {
  51. _bss = .;
  52. *(.bss)
  53. _ebss = .;
  54. }
  55. _end = .;
  56. /DISCARD/ : {
  57. *(.eh_frame)
  58. }
  59. }