From e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb Mon Sep 17 00:00:00 2001 From: Yang Zhang Date: Fri, 28 Aug 2015 09:58:54 +0800 Subject: Add qemu 2.4.0 Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5 Signed-off-by: Yang Zhang --- qemu/roms/SLOF/tools/create_reloc_table.sh | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 qemu/roms/SLOF/tools/create_reloc_table.sh (limited to 'qemu/roms/SLOF/tools/create_reloc_table.sh') diff --git a/qemu/roms/SLOF/tools/create_reloc_table.sh b/qemu/roms/SLOF/tools/create_reloc_table.sh new file mode 100755 index 000000000..8cacb742a --- /dev/null +++ b/qemu/roms/SLOF/tools/create_reloc_table.sh @@ -0,0 +1,60 @@ +# ***************************************************************************** +# * Copyright (c) 2004, 2008 IBM Corporation +# * All rights reserved. +# * This program and the accompanying materials +# * are made available under the terms of the BSD License +# * which accompanies this distribution, and is available at +# * http://www.opensource.org/licenses/bsd-license.php +# * +# * Contributors: +# * IBM Corporation - initial implementation +# ****************************************************************************/ +#!/bin/sh + + +CROSSTMP=`grep ^CROSS $(dirname $0)/../make.rules | cut -d\ -f2` + +CROSS=${CROSS-$CROSSTMP} + +# Set defaults: +LD="${CROSS}ld" +LDFLAGS="-nostdlib" +LDSFILE="" +OBJCOPY="${CROSS}objcopy" + +DIRNAME=`dirname $0` + +# Parse parameters: +while [ $# -gt 0 ] ; do + case "$1" in + --ld) LD=$2 ; shift 2 ;; + --ldflags) LDFLAGS=$2 ; shift 2 ;; + --lds) LDSFILE=$2 ; shift 2 ;; + --objcopy) OBJCOPY=$2 ; shift 2 ;; + *.o|*.a|-l*|-L*) OBJFILES="$OBJFILES $1" ; shift ;; + *) echo "$0:" ; echo " Unsupported argument: $1"; exit -1 ;; + esac +done + +if [ -z $LDSFILE ]; then + echo "Please specifiy an lds file with the --lds option" + exit 42 +fi + +TMP1=`mktemp` +TMP2=`mktemp` + +# Now create the two object files: +$LD $LDFLAGS -T $LDSFILE -o $TMP1.o $OBJFILES || exit -1 +$LD $LDFLAGS -T $LDSFILE -o $TMP2.o $OBJFILES --section-start .text=0x4000000000000000 || exit -1 + +$OBJCOPY -O binary $TMP1.o $TMP1.bin || exit -1 +$OBJCOPY -O binary $TMP2.o $TMP2.bin || exit -1 + +# Create the relocation table with gen_reloc_table: +$DIRNAME/gen_reloc_table $TMP1.bin $TMP2.bin reloc_table.bin + +$LD -o reloc_table.o -bbinary reloc_table.bin -e0 || exit -1 +$OBJCOPY --rename-section .data=.reloc reloc_table.o reloc_table.o || exit -1 + +rm -f $TMP1.o $TMP2.o $TMP1.bin $TMP2.bin reloc_table.bin -- cgit 1.2.3-korg