toaruos/kernel/link.ld
Kevin Lange cc4391d783 Initial work on modules
There's a lot here, so let's through it:
- Lots of work to include a symbol table in the kernel. We can't rely on
  our bootloader to give us our own ELF information, so we do this
  separately. This probably should be changed to output a C source
  rather than assembly, but that's a TODO.
- Makefile can now generate modules. It works basically the same way any
  other kernel object works, expect with a slightly different linking
  scheme.
- Commands have been added to the debug shell to load modules, but they
  don't work yet - still need to get through relocation and linking.
- Commands have been added to the debug shell to print the symbol list,
  as well as print symbol values (but note that printing symbol values
  is kinda dangerous if you don't know what they are, so don't just go
  printing things willy-nilly).
2014-03-09 19:36:28 -07:00

53 lines
746 B
Plaintext

/* vim: tabstop=4 shiftwidth=4 noexpandtab
* Kernel linker script for x86
*/
OUTPUT_FORMAT(elf32-i386)
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
/*
* Actual code
*/
.text phys : AT(phys) {
code = .;
*(.multiboot*)
*(.text*)
*(.rodata*)
. = ALIGN(4096);
}
/*
* Kernel data
*/
.data : AT(phys + (data - code))
{
data = .;
*(.data*)
PROVIDE(kernel_symbols_start = .);
PROVIDE(kernel_symbols_end = .);
. = ALIGN(4096);
}
/*
* Statically defined, uninitialized values
*/
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss*)
. = ALIGN(4096);
}
/*
* End of kernel.
*/
end = .;
/*
* Get rid of unnecessary GCC bits.
*/
/DISCARD/ :
{
*(.comment)
*(.eh_frame)
*(.note.gnu.build-id)
}
}