mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
powerpc/boot: Allow building the zImage wrapper as a relocatable ET_DYN
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>
This commit is contained in:
committed by
Benjamin Herrenschmidt
parent
ee7a2aa3d3
commit
6975a783d7
@@ -39,6 +39,7 @@ dts=
|
||||
cacheit=
|
||||
binary=
|
||||
gzip=.gz
|
||||
pie=
|
||||
|
||||
# cross-compilation prefix
|
||||
CROSS=
|
||||
@@ -157,9 +158,10 @@ pmac|chrp)
|
||||
platformo=$object/of.o
|
||||
;;
|
||||
coff)
|
||||
platformo=$object/of.o
|
||||
platformo="$object/crt0.o $object/of.o"
|
||||
lds=$object/zImage.coff.lds
|
||||
link_address='0x500000'
|
||||
pie=
|
||||
;;
|
||||
miboot|uboot)
|
||||
# miboot and U-boot want just the bare bits, not an ELF binary
|
||||
@@ -208,6 +210,7 @@ ps3)
|
||||
ksection=.kernel:vmlinux.bin
|
||||
isection=.kernel:initrd
|
||||
link_address=''
|
||||
pie=
|
||||
;;
|
||||
ep88xc|ep405|ep8248e)
|
||||
platformo="$object/fixed-head.o $object/$platform.o"
|
||||
@@ -310,9 +313,9 @@ fi
|
||||
|
||||
if [ "$platform" != "miboot" ]; then
|
||||
if [ -n "$link_address" ] ; then
|
||||
text_start="-Ttext $link_address --defsym _start=$link_address"
|
||||
text_start="-Ttext $link_address"
|
||||
fi
|
||||
${CROSS}ld -m elf32ppc -T $lds $text_start -o "$ofile" \
|
||||
${CROSS}ld -m elf32ppc -T $lds $text_start $pie -o "$ofile" \
|
||||
$platformo $tmp $object/wrapper.a
|
||||
rm $tmp
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user