/*
 * Posix pager MM0 linker script.
 *
 * Copyright (C) 2007 - 2009 Bahadir Balban
 */

virtual_base = %s;
physical_base = %s;

pager_offset = virtual_base - physical_base;

ENTRY(_start)

SECTIONS
{
	. = virtual_base;

	__start_text = .;
	.text : AT (ADDR(.text) - pager_offset) {
		*(.text.head) *(.text)
	}
	__end_text = .;

	__start_rodata = .;
	.rodata : AT (ADDR(.rodata) - pager_offset) {
		*(.rodata)
	}
	.rodata1 : AT (ADDR(.rodata1) - pager_offset) {
		*(.rodata1)
	}
	__end_rodata = .;

	__start_data = .;
	.data : AT (ADDR(.data) - pager_offset) {
		*(.data)
	}
	__end_data = .;

	__start_bss = .;
	.bss : AT (ADDR(.bss) - pager_offset) {
		*(.bss)
	}
	. = ALIGN(4K);
	__end_bss = .;
	. += 0x2000;	/* BSS doesnt increment link counter??? */

	__start_stack = .;
	.stack : AT (ADDR(.stack) - pager_offset) {
		*(.stack)
	}
	. = ALIGN(4K);
	__stack = .; /* This is the preallocated boot stack */

	/* Below part is to be discarded after boot */
	__start_init = .;
	.init : AT (ADDR(.init) - pager_offset)	{
		*(.init.data)
		*(.init.bootmem)
	}
	__end_init = .;
	__end = .;
}
