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

71 lines
1.8 KiB

  1. /* Simple linker script for ucore user-level programs.
  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(_start)
  6. SECTIONS {
  7. /* Load programs at this address: "." means the current address */
  8. . = 0x800020;
  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. /* Adjust the address for the data segment to the next page */
  17. . = ALIGN(0x1000);
  18. .data : {
  19. *(.data)
  20. }
  21. PROVIDE(edata = .);
  22. .bss : {
  23. *(.bss)
  24. }
  25. PROVIDE(end = .);
  26. /* Place debugging symbols so that they can be found by
  27. * the kernel debugger.
  28. * Specifically, the four words at 0x200000 mark the beginning of
  29. * the stabs, the end of the stabs, the beginning of the stabs
  30. * string table, and the end of the stabs string table, respectively.
  31. */
  32. .stab_info 0x200000 : {
  33. LONG(__STAB_BEGIN__);
  34. LONG(__STAB_END__);
  35. LONG(__STABSTR_BEGIN__);
  36. LONG(__STABSTR_END__);
  37. }
  38. .stab : {
  39. __STAB_BEGIN__ = DEFINED(__STAB_BEGIN__) ? __STAB_BEGIN__ : .;
  40. *(.stab);
  41. __STAB_END__ = DEFINED(__STAB_END__) ? __STAB_END__ : .;
  42. BYTE(0) /* Force the linker to allocate space
  43. for this section */
  44. }
  45. .stabstr : {
  46. __STABSTR_BEGIN__ = DEFINED(__STABSTR_BEGIN__) ? __STABSTR_BEGIN__ : .;
  47. *(.stabstr);
  48. __STABSTR_END__ = DEFINED(__STABSTR_END__) ? __STABSTR_END__ : .;
  49. BYTE(0) /* Force the linker to allocate space
  50. for this section */
  51. }
  52. /DISCARD/ : {
  53. *(.eh_frame .note.GNU-stack .comment)
  54. }
  55. }