《操作系统》的实验代码。

58 line
1.3 KiB

12 年之前
  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. . = 0xC0100000;
  9. .text : {
  10. *(.text .stub .text.* .gnu.linkonce.t.*)
  11. }
  12. PROVIDE(etext = .); /* Define the 'etext' symbol to this value */
  13. .rodata : {
  14. *(.rodata .rodata.* .gnu.linkonce.r.*)
  15. }
  16. /* Include debugging information in kernel memory */
  17. .stab : {
  18. PROVIDE(__STAB_BEGIN__ = .);
  19. *(.stab);
  20. PROVIDE(__STAB_END__ = .);
  21. BYTE(0) /* Force the linker to allocate space
  22. for this section */
  23. }
  24. .stabstr : {
  25. PROVIDE(__STABSTR_BEGIN__ = .);
  26. *(.stabstr);
  27. PROVIDE(__STABSTR_END__ = .);
  28. BYTE(0) /* Force the linker to allocate space
  29. for this section */
  30. }
  31. /* Adjust the address for the data segment to the next page */
  32. . = ALIGN(0x1000);
  33. /* The data segment */
  34. .data : {
  35. *(.data)
  36. }
  37. PROVIDE(edata = .);
  38. .bss : {
  39. *(.bss)
  40. }
  41. PROVIDE(end = .);
  42. /DISCARD/ : {
  43. *(.eh_frame .note.GNU-stack)
  44. }
  45. }