link.lds 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. text_start_pa = .;
  20. .text (text_start_pa): AT(text_start_pa - KERNEL_VMA)
  21. {
  22. _text = .;
  23. *(.text)
  24. _etext = .;
  25. }
  26. . = ALIGN(8);
  27. data_start_pa = .;
  28. .data (data_start_pa): AT(data_start_pa - KERNEL_VMA)
  29. {
  30. _data = .;
  31. *(.data)
  32. _edata = .;
  33. }
  34. rodata_start_pa = .;
  35. .rodata (rodata_start_pa): AT(rodata_start_pa - KERNEL_VMA)
  36. {
  37. _rodata = .;
  38. *(.rodata)
  39. _erodata = .;
  40. }
  41. . = ALIGN(32768);
  42. init_proc_union_start_pa = .;
  43. .data.init_proc_union (init_proc_union_start_pa): AT(init_proc_union_start_pa - KERNEL_VMA)
  44. { *(.data.init_proc_union) }
  45. bss_start_pa = .;
  46. .bss (bss_start_pa): AT(bss_start_pa - KERNEL_VMA)
  47. {
  48. _bss = .;
  49. *(.bss)
  50. _ebss = .;
  51. }
  52. _end = .;
  53. /DISCARD/ : {
  54. *(.eh_frame)
  55. }
  56. }