* same with xv6
[mascara-docs.git] / i386 / MIT / course / src / src.lab / user / user.ld
blob1902ae3bebd6f27218d57ef2747be4aaf9065db6
1 /* Simple linker script for JOS user-level programs.
2    See the GNU ld 'info' manual ("info ld") to learn the syntax. */
4 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
5 OUTPUT_ARCH(i386)
6 ENTRY(_start)
8 SECTIONS
10         /* Load programs at this address: "." means the current address */
11         . = 0x800020;
13         .text : {
14                 *(.text .stub .text.* .gnu.linkonce.t.*)
15         }
17         PROVIDE(etext = .);     /* Define the 'etext' symbol to this value */
19         .rodata : {
20                 *(.rodata .rodata.* .gnu.linkonce.r.*)
21         }
23         /* Adjust the address for the data segment to the next page */
24         . = ALIGN(0x1000);
26         .data : {
27                 *(.data)
28         }
30         PROVIDE(edata = .);
32         .bss : {
33                 *(.bss)
34         }
36         PROVIDE(end = .);
39         /* Place debugging symbols so that they can be found by
40          * the kernel debugger.
41          * Specifically, the four words at 0x200000 mark the beginning of
42          * the stabs, the end of the stabs, the beginning of the stabs
43          * string table, and the end of the stabs string table, respectively.
44          */
46         .stab_info 0x200000 : {
47                 LONG(__STAB_BEGIN__);
48                 LONG(__STAB_END__);
49                 LONG(__STABSTR_BEGIN__);
50                 LONG(__STABSTR_END__);
51         }
53         .stab : {
54                 __STAB_BEGIN__ = DEFINED(__STAB_BEGIN__) ? __STAB_BEGIN__ : .;
55                 *(.stab);
56                 __STAB_END__ = DEFINED(__STAB_END__) ? __STAB_END__ : .;
57                 BYTE(0)         /* Force the linker to allocate space
58                                    for this section */
59         }
61         .stabstr : {
62                 __STABSTR_BEGIN__ = DEFINED(__STABSTR_BEGIN__) ? __STABSTR_BEGIN__ : .;
63                 *(.stabstr);
64                 __STABSTR_END__ = DEFINED(__STABSTR_END__) ? __STABSTR_END__ : .;
65                 BYTE(0)         /* Force the linker to allocate space
66                                    for this section */
67         }
69         /DISCARD/ : {
70                 *(.eh_frame .note.GNU-stack .comment)
71         }