Skip to content

Commit

Permalink
Fix littleosbook#10: link.ld isn't a valid linker script
Browse files Browse the repository at this point in the history
  • Loading branch information
helino committed Jan 12, 2015
1 parent 586ad66 commit 7c56a4a
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions environment_and_booting.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,30 +166,32 @@ and memory-mapped I/O. Therefore, the following linker script is needed
(written for GNU LD [@gnubinutils]):

~~~
ENTRY(loader) /* the name of the entry label */
ENTRY(loader) /* the name of the entry label */
. = 0x00100000 /* the code should be loaded at 1 MB */
SECTIONS {
. = 0x00100000; /* the code should be loaded at 1 MB */
.text ALIGN (0x1000) /* align at 4 KB */
.text ALIGN (0x1000) : /* align at 4 KB */
{
*(.text) /* all text sections from all files */
*(.text) /* all text sections from all files */
}
.rodata ALIGN (0x1000) /* align at 4 KB */
.rodata ALIGN (0x1000) : /* align at 4 KB */
{
*(.rodata*) /* all read-only data sections from all files */
*(.rodata*) /* all read-only data sections from all files */
}
.data ALIGN (0x1000) /* align at 4 KB */
.data ALIGN (0x1000) : /* align at 4 KB */
{
*(.data) /* all data sections from all files */
*(.data) /* all data sections from all files */
}
.bss ALIGN (0x1000) /* align at 4 KB */
.bss ALIGN (0x1000) : /* align at 4 KB */
{
*(COMMON) /* all COMMON sections from all files */
*(.bss) /* all bss sections from all files */
*(COMMON) /* all COMMON sections from all files */
*(.bss) /* all bss sections from all files */
}
}
~~~

Save the linker script into a file called `link.ld`. The executable can now be
Expand Down

0 comments on commit 7c56a4a

Please sign in to comment.