forked from Minki/linux
6975a783d7
This patch adds code, linker script and makefile support to allow building the zImage wrapper around the kernel as a position independent executable. This results in an ET_DYN instead of an ET_EXEC ELF output file, which can be loaded at any location by the firmware and will process its own relocations to work correctly at the loaded address. This is of interest particularly since the standard ePAPR image format must be an ET_DYN (although this patch alone is not sufficient to produce a fully ePAPR compliant boot image). Note for now we don't enable building with -pie for anything. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
67 lines
938 B
ArmAsm
67 lines
938 B
ArmAsm
OUTPUT_ARCH(powerpc:common)
|
|
ENTRY(_zimage_start)
|
|
EXTERN(_zimage_start)
|
|
SECTIONS
|
|
{
|
|
.text :
|
|
{
|
|
_start = .;
|
|
*(.text)
|
|
*(.fixup)
|
|
_etext = .;
|
|
}
|
|
. = ALIGN(4096);
|
|
.data :
|
|
{
|
|
*(.rodata*)
|
|
*(.data*)
|
|
*(.sdata*)
|
|
*(.got2)
|
|
}
|
|
.dynsym : { *(.dynsym) }
|
|
.dynstr : { *(.dynstr) }
|
|
.dynamic :
|
|
{
|
|
__dynamic_start = .;
|
|
*(.dynamic)
|
|
}
|
|
.hash : { *(.hash) }
|
|
.interp : { *(.interp) }
|
|
.rela.dyn : { *(.rela*) }
|
|
|
|
. = ALIGN(8);
|
|
.kernel:dtb :
|
|
{
|
|
_dtb_start = .;
|
|
*(.kernel:dtb)
|
|
_dtb_end = .;
|
|
}
|
|
|
|
. = ALIGN(4096);
|
|
.kernel:vmlinux.strip :
|
|
{
|
|
_vmlinux_start = .;
|
|
*(.kernel:vmlinux.strip)
|
|
_vmlinux_end = .;
|
|
}
|
|
|
|
. = ALIGN(4096);
|
|
.kernel:initrd :
|
|
{
|
|
_initrd_start = .;
|
|
*(.kernel:initrd)
|
|
_initrd_end = .;
|
|
}
|
|
|
|
. = ALIGN(4096);
|
|
.bss :
|
|
{
|
|
_edata = .;
|
|
__bss_start = .;
|
|
*(.sbss)
|
|
*(.bss)
|
|
*(COMMON)
|
|
_end = . ;
|
|
}
|
|
}
|