《操作系统》的实验代码。
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.

59 lines
1.3 KiB

  1. /* Simple linker script for the ucore kernel.
  2. See the GNU ld 'info' manual ("info ld") to learn the syntax. */
  3. OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
  4. OUTPUT_ARCH(i386)
  5. ENTRY(kern_entry)
  6. SECTIONS {
  7. /* Load the kernel at this address: "." means the current address */
  8. /* the phy addr of ucore (before ucore enable paging mechanism*/
  9. . = 0x0100000;
  10. .text : {
  11. *(.text .stub .text.* .gnu.linkonce.t.*)
  12. }
  13. PROVIDE(etext = .); /* Define the 'etext' symbol to this value */
  14. .rodata : {
  15. *(.rodata .rodata.* .gnu.linkonce.r.*)
  16. }
  17. /* Include debugging information in kernel memory */
  18. .stab : {
  19. PROVIDE(__STAB_BEGIN__ = .);
  20. *(.stab);
  21. PROVIDE(__STAB_END__ = .);
  22. BYTE(0) /* Force the linker to allocate space
  23. for this section */
  24. }
  25. .stabstr : {
  26. PROVIDE(__STABSTR_BEGIN__ = .);
  27. *(.stabstr);
  28. PROVIDE(__STABSTR_END__ = .);
  29. BYTE(0) /* Force the linker to allocate space
  30. for this section */
  31. }
  32. /* Adjust the address for the data segment to the next page */
  33. . = ALIGN(0x1000);
  34. /* The data segment */
  35. .data : {
  36. *(.data)
  37. }
  38. PROVIDE(edata = .);
  39. .bss : {
  40. *(.bss)
  41. }
  42. PROVIDE(end = .);
  43. /DISCARD/ : {
  44. *(.eh_frame .note.GNU-stack)
  45. }
  46. }