Initial Import

This commit is contained in:
Dave Murphy 2005-01-27 19:55:22 +00:00
commit 6483618f46
29 changed files with 18314 additions and 0 deletions

4
.cvsignore Normal file
View File

@ -0,0 +1,4 @@
powerpc-gekko
libogc-20050121
gcc-3.4.3
binutils-2.15

184
README.TXT Normal file
View File

@ -0,0 +1,184 @@
Devkit r11 build scripts
--------------------------
This readme will guide you through building devkitARM or devkitPPC from source using a set of scripts.
To use these scripts under minsys and MinGW you will need some additional packages over and above the base install.
The minsys developer toolkit
http://prdownloads.sf.net/mingw/msysDTK-1.0.1.exe?download
Bison, Flex and Wget from the gnuwin32 project
http://sourceforge.net/projects/gnuwin32/
Downloading the source packages
-------------------------------
When you run the build script it will ask you to choose from one of two options, one for if you have already downloaded the source packages and another for if you want it to download them for you (using wget). If you choose option one and want to get the source packages for yourself then you can find them at the urls listed below;
binutils 2.15 - http://ftp.gnu.org/gnu/binutils/binutils-2.15.tar.bz2
gcc-core 3.4.2 - ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-3.4.3/gcc-core-3.4.2.tar.bz2
gcc-g++ 3.4.2 - ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-3.4.3/gcc-g++-3.4.2.tar.bz2
newlib 1.12.0 - ftp://sources.redhat.com/pub/newlib/newlib-1.12.0.tar.gz
The top level shell script has now been unified and offers the option of devkitARM or devkitPPC.
Building devkitARM
------------------
Simply run the "build-devkit.sh" script in the same directory as this text file as shown below, then follow the prompts;
./build-devkit.sh
Once the script finds the source packages they will be decompressed and the build process will begin. When its finished you have the option to delete all temporary files, sources and their source packages.
Using devkitARM
---------------
All you need to do now to use devkitARM is make sure that your freshly built tools are in your PATH, something like this;
export PATH=$PATH:<path to devkitARM>/bin
(Obviously replace <path to devkitARM> with the full path to the devkitARM installation directory)
to use the built in crt0 and linkscript use arm-elf-gcc to link your project - use the command -specs=gba.specs for a normal cart image & -specs=gba_mb.specs for a multiboot image.
Getting started
---------------
The best thing to do next is test the compiler, so go to http://www.devkit.tk and download "libgba" from the downloads section and also "PCXview" from the sample code section.
Building devkitPPC
------------------
Simply run the "build-devkit.sh" script in the same directory as this text file as shown below, then follow the prompts;
./build-devkit.sh
Once the script finds the source packages they will be decompressed and the build process will begin. When its finished you have the option to delete all temporary files, sources and their source packages.
Using devkitPPC
---------------
All you need to do now to use devkitPPC is make sure that your freshly built tools are in your PATH, something like this;
export PATH=$PATH:<path to devkitPPC>/bin
(Obviously replace <path to devkitPPC> with the full path to the devkitPPC installation directory)
to use the built in crt0 and linkscript use powerpc-elf-gcc to link your project, using the command line switch -mgcn for a bare bones system, -mogc to use libogc and the multi-threaded microkernel.
Credits
-------
* Thanks to WinterMute for bringing us devkitARM, the website is http://www.devkit.tk
* Build scripts written by WinterMute and tied together by GreenGianT
* Thanks to Mr Spiv, Honkey Kong and JoostP for OS X testing
* libogc written and supplied by Shagkur. Additional code by WinterMute
* libgba by WinterMute
* b2fxec by Mr Spiv
* scripts made BSD compatible by o2addict
- efnet #gbadev forever!
History
-------------------------------------------------------------------------------------
planned for release 12
-------------------------------------------------------------------------------------
* update to newlib 1.13.0
* patch for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9571
* fix iwram overlay section alignment for GBA
-------------------------------------------------------------------------------------
21st January 2005 - release 11
-------------------------------------------------------------------------------------
* updated to gcc 3.4.3
* reverted msvc format errors for compatibility with dev-cpp & vham editors
* patched for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16343
-------------------------------------------------------------------------------------
28th July 2004 - release 8
-------------------------------------------------------------------------------------
* updated to gcc 3.4.1
* win32 native b2fxec added & cygwin1.dll removed
-------------------------------------------------------------------------------------
26th June 2004 - devkitPPC release 7
-------------------------------------------------------------------------------------
* libogc added to devkitPPC
* updated specs file with -mogc switch for linking
-------------------------------------------------------------------------------------
12th June 2004 - release 6a
-------------------------------------------------------------------------------------
* long calls patch added
* -save-temps fixed (again)
* binutils 2.15.0
* specs file and crt0 for e-reader
* specs file and crt0 for gamepark gp32 libraries
-------------------------------------------------------------------------------------
8th May 2004 - release 6
-------------------------------------------------------------------------------------
* updated to gcc 3.4.0
* reverted to binutils 2.14.0
-------------------------------------------------------------------------------------
12th April 2004 - release 5.
-------------------------------------------------------------------------------------
* built in crt0 and linkscript for gp32 added. Use -specs=gp32.specs when linking
* Mr Spiv's b2fxec included
* DarkFader's gbafix included
* linux build available for download
-------------------------------------------------------------------------------------
15th March 2004 - Release 4
-------------------------------------------------------------------------------------
* updated to binutils 2.15.90
* more msdev error output conversion
* -save-temps fixed
-------------------------------------------------------------------------------------
26th February 2004 - Release 3a
-------------------------------------------------------------------------------------
* updated to newlib 1.12.0
* crt0, linkscript and runtime library support added to DevkitARM
-------------------------------------------------------------------------------------
20th February 2004
-------------------------------------------------------------------------------------
DevkitARM and DevkitPPC updated - Release 3
* updated to gcc 3.3.3
-------------------------------------------------------------------------------------
14th February 2004 - Release 2
-------------------------------------------------------------------------------------
* crt0, linkscript and runtime library support added to DevkitPPC
* adjusted error output for msdev
* Fixed minor problem with include paths
-------------------------------------------------------------------------------------
16th January 2004 - release 1
-------------------------------------------------------------------------------------
* Initial build supporting arm target
* Required link script and crt0
* no built in support for runtime libraries

316
build-devkit.sh Normal file
View File

@ -0,0 +1,316 @@
#---------------------------------------------------------------------------------
# Build scripts for devkitARM/devkitPPC release 11
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
# specify some urls to download the source packages from
#---------------------------------------------------------------------------------
BINUTILS_VER=2.15
GCC_VER=3.4.3
NEWLIB_VER=1.12.0
LIBOGC_VER=20050121
BINUTILS="binutils-$BINUTILS_VER.tar.bz2"
GCC_CORE="gcc-core-$GCC_VER.tar.bz2"
GCC_GPP="gcc-g++-$GCC_VER.tar.bz2"
NEWLIB="newlib-$NEWLIB_VER.tar.gz"
LIBOGC="libogc-src-$LIBOGC_VER.tar.bz2"
BINUTILS_URL="http://ftp.gnu.org/gnu/binutils/$BINUTILS"
GCC_CORE_URL="ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-$GCC_VER/$GCC_CORE"
GCC_GPP_URL="ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-$GCC_VER/$GCC_GPP"
LIBOGC_URL="http://osdn.dl.sourceforge.net/sourceforge/devkitpro/$LIBOGC"
#---------------------------------------------------------------------------------
# Ask whether to download the source packages or not
#---------------------------------------------------------------------------------
VERSION=0
while [ $VERSION -eq 0 ]
do
echo
echo "This script will build and install your devkit. Please select the one you require"
echo
echo "1: build devkitARM (gba gp32)"
echo "2: build devkitPPC (gamecube)"
read VERSION
if [ "$VERSION" -ne 1 -a "$VERSION" -ne 2 ]
then
VERSION=0
fi
done
if [ $VERSION -eq 1 ]
then
scriptdir='./dka-scripts'
package='devkitARM'
builddir=arm-elf
target=arm-elf
else
scriptdir='./dkp-scripts'
package='devkitPPC'
builddir=powerpc-gekko
target=powerpc-gekko
fi
DOWNLOAD=0
while [ $DOWNLOAD -eq 0 ]
do
echo
echo "The installation requires binutils-$BINUTILS_VER, gcc$GCC_VER and newlib-$NEWLIB_VER. Please select an option:"
echo
echo "1: I have already downloaded the source packages"
echo "2: Download the packages for me (requires wget)"
read DOWNLOAD
if [ "$DOWNLOAD" -ne 1 -a "$DOWNLOAD" -ne 2 ]
then
DOWNLOAD=0
fi
done
#---------------------------------------------------------------------------------
# Get preferred installation directory and set paths to the sources
#---------------------------------------------------------------------------------
echo
echo "Please enter the directory where you would like '$package' to be installed:"
echo "for mingw/msys you must use <drive>:/<install path> or you will have include path problems"
read INSTALLDIR
echo
[ ! -z "$INSTALLDIR" ] && mkdir -p $INSTALLDIR && touch $INSTALLDIR/nonexistantfile && rm $INSTALLDIR/nonexistantfile || exit 1
if [ $DOWNLOAD -eq 1 ]
then
FOUND=0
while [ $FOUND -eq 0 ]
do
echo
echo "Please enter the full path to the directory that contains the source packages:"
read SRCDIR
if [ ! -f $SRCDIR/$BINUTILS ]
then
echo "Error: $BINUTILS not found in $SRCDIR"
exit
else
FOUND=1
fi
if [ ! -f $SRCDIR/$GCC_GPP ]
then
echo "Error: $GCC_GPP not found in $SRCDIR"
exit
else
FOUND=1
fi
if [ ! -f $SRCDIR/$GCC_CORE ]
then
echo "Error: $GCC_CORE not found in $SRCDIR"
exit
else
FOUND=1
fi
if [ ! -f $SRCDIR/$NEWLIB ]
then
echo "Error: $NEWLIB not found in $SRCDIR"
exit
else
FOUND=1
fi
if [ $VERSION -eq 2 ]
then
if [ ! -f $SRCDIR/$LIBOGC ]
then
echo "Error: $LIBOGC not found in $SRCDIR"
exit
else
FOUND=1
fi
fi
done
else
wget -c $BINUTILS_URL
if [ ! -f $BINUTILS ]
then
echo "Error: Failed to download "$BINUTILS
exit
fi
wget -c $GCC_CORE_URL
if [ ! -f $GCC_CORE ]
then
echo "Error: Failed to download "$GCC_CORE
exit
fi
wget -c $GCC_GPP_URL
if [ ! -f $GCC_GPP ]
then
echo "Error: Failed to download "$GCC_GPP
exit
fi
wget -c $NEWLIB_URL
if [ ! -f $NEWLIB ]
then
echo "Error: Failed to download "$NEWLIB
exit
fi
if [ $VERSION -eq 2 ]
then
wget -c $LIBOGC_URL
if [ ! -f $LIBOGC ]
then
echo "Error: Failed to download "$LIBOGC
exit
fi
fi
SRCDIR=`pwd`
fi
BINUTILS_SRCDIR="binutils-$BINUTILS_VER/"
GCC_SRCDIR="gcc-$GCC_VER/"
NEWLIB_SRCDIR="newlib-$NEWLIB_VER/"
LIBOGC_SRCDIR="libogc-$LIBOGC_VER/"
echo
echo 'Ready to install '$package' in '$INSTALLDIR
echo
echo 'press return to continue'
read dummy
#---------------------------------------------------------------------------------
# find proper make
#---------------------------------------------------------------------------------
if [ -z "$MAKE" -a -x "$(which gnumake)" ]; then MAKE=$(which gnumake); fi
if [ -z "$MAKE" -a -x "$(which gmake)" ]; then MAKE=$(which gmake); fi
if [ -z "$MAKE" -a -x "$(which make)" ]; then MAKE=$(which make); fi
if [ -z "$MAKE" ]; then
echo no make found
exit 1
fi
echo use $MAKE as make
export MAKE
#---------------------------------------------------------------------------------
# Extract source packages
#---------------------------------------------------------------------------------
BUILDSCRIPTDIR=$(pwd)
echo "Extracting $BINUTILS"
tar -xjvf $SRCDIR/$BINUTILS
echo "Extracting $GCC_CORE"
tar -xjvf $SRCDIR/$GCC_CORE
echo "Extracting $GCC_GPP"
tar -xjvf $SRCDIR/$GCC_GPP
echo "Extracting $NEWLIB"
tar -xzvf $SRCDIR/$NEWLIB
if [ $VERSION -eq 2 ]
then
echo "Extracting $LIBOGC"
mkdir -p $LIBOGC_SRCDIR
bzip2 -cd $SRCDIR/$LIBOGC | tar -xv -C $LIBOGC_SRCDIR
fi
#---------------------------------------------------------------------------------
# apply patches
#---------------------------------------------------------------------------------
patch -p1 -d $BINUTILS_SRCDIR -i $(pwd)/patches/devkit-binutils-2.15.patch
patch -p1 -d $GCC_SRCDIR -i $(pwd)/patches/devkit-gcc-3.4.3.patch
patch -p1 -d $NEWLIB_SRCDIR -i $(pwd)/patches/devkit-newlib-1.12.0.patch
#---------------------------------------------------------------------------------
# only necessary when Darwin gcc is 3.1 or earlier, to add a check for this here
#---------------------------------------------------------------------------------
#if test $(uname -s | grep Darwin)
#then
# export CFLAGS = "-O2 -pipe -no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0"
# export LDFLAGS=''
#
#else
export CFLAGS='-O2 -pipe'
export LDFLAGS='-s'
#fi
export CXXFLAGS='-O2 -pipe'
export DEBUG_FLAGS=''
#---------------------------------------------------------------------------------
# Add installed devkit to the path, adjusting path on minsys
#---------------------------------------------------------------------------------
TOOLPATH=$(echo $INSTALLDIR | sed -e 's/^\([a-zA-Z]\):/\/\1/')
export PATH=$PATH:$TOOLPATH/bin
#---------------------------------------------------------------------------------
# Build and install devkit components
#---------------------------------------------------------------------------------
if [ -f $scriptdir/build-gcc.sh ]; then . $scriptdir/build-gcc.sh ; cd $BUILDSCRIPTDIR; fi
if [ -f $scriptdir/build-crtls.sh ]; then . $scriptdir/build-crtls.sh ; cd $BUILDSCRIPTDIR; fi
if [ -f $scriptdir/build-tools.sh ]; then . $scriptdir/build-tools.sh ; cd $BUILDSCRIPTDIR; fi
#---------------------------------------------------------------------------------
# Clean up temporary files and source directories
#---------------------------------------------------------------------------------
echo
echo "Would you like to delete temporary files? [Y/n]"
read answer
if [ -z "$answer" -o "$answer" = "y" -o "$answer" = "Y" ]
then
echo "rm -fr "$builddir
rm -fr $builddir
fi
echo
echo "Would you like to delete the source directories? [Y/n]"
read answer
if [ -z "$answer" -o "$answer" = "y" -o "$answer" = "Y" ]
then
echo "rm -fr $BINUTILS_SRCDIR $GCC_SRCDIR $NEWLIB_SRCDIR $LIBOGC_SRCDIR"
rm -fr $BINUTILS_SRCDIR $GCC_SRCDIR $NEWLIB_SRCDIR $LIBOGC_SRCDIR
fi
echo
echo "Would you like to delete the source packages? [y/N]"
read answer
if [ ! -z "$answer" -o "$answer" = "y" -o "$answer" = "Y" ]
then
echo "rm -f $BINUTILS $GCC_CORE $GCC_GPP $NEWLIB"
rm -f $SRCDIR/$BINUTILS $SRCDIR/$GCC_CORE $SRCDIR/$GCC_GPP $SRCDIR/$NEWLIB
fi
echo
echo "note: Add the following to your PATH variable; $INSTALLDIR/bin"
echo

11
dka-crtls/Makefile Normal file
View File

@ -0,0 +1,11 @@
PREFIX := arm-elf-
export CC := $(PREFIX)gcc
export CXX := $(PREFIX)g++
export AR := $(PREFIX)ar
export OBJCOPY := $(PREFIX)objcopy
all:
$(CC) -marm -c $(CRT).s -o$(CRT).o
$(CC) -marm -mthumb-interwork -c $(CRT).s -o interwork/$(CRT).o
$(CC) -mthumb -c $(CRT).s -o thumb/$(CRT).o
$(CC) -mthumb -mthumb-interwork -c $(CRT).s -o thumb/interwork/$(CRT).o

56
dka-crtls/er_crt0.s Normal file
View File

@ -0,0 +1,56 @@
@---------------------------------------------------------------------------------
@ nintendo e-reader startup code
@---------------------------------------------------------------------------------
@ author : tim schuerewegen
@ version : 1.0
@---------------------------------------------------------------------------------
.section ".init"
.global _start
.align
.arm
@---------------------------------------------------------------------------------
_start:
@---------------------------------------------------------------------------------
b start_vector
.long 0
.long 0x02000000
start_vector:
@ enter thumb mode
adr r0, _start_thumb + 1
bx r0
.thumb
_start_thumb:
@ save return address (rom)
mov r3, lr
@ clear bss section
ldr r0, =__bss_start
ldr r1, =__bss_end
mov r2, #0
_loop_bss_clear:
strb r2, [r0]
add r0, #1
cmp r0, r1
blt _loop_bss_clear
@ set return address (rom)
mov lr, r3
@ jump to main
ldr r3, =main
bx r3
.align
.pool
.end
.align
.pool
.end

8
dka-crtls/gba.specs Normal file
View File

@ -0,0 +1,8 @@
%rename link old_link
*link:
%(old_link) -T gba_cart.ld%s
*startfile:
gba_crt0%O%s crti%O%s crtbegin%O%s

293
dka-crtls/gba_cart.ld Normal file
View File

@ -0,0 +1,293 @@
/* Linker Script Original v1.3 by Jeff Frohwein */
/* v1.0 - Original release */
/* v1.1 - Added proper .data section support */
/* v1.2 - Added support for c++ & iwram overlays */
/* - Major contributions by Jason Wilkins. */
/* v1.3 - .ewram section now can be used when */
/* compiling for MULTIBOOT mode. This fixes */
/* malloc() in DevKitAdvance which depends */
/* on __eheap_start instead of end to define*/
/* the starting location of heap space. */
/* External global variable __gba_iwram_heap*/
/* support added to allow labels end, _end, */
/* & __end__ to point to end of iwram or */
/* the end of ewram. */
/* Additions by WinterMute */
/* v1.4 - .sbss section added for unitialised */
/* data in ewram */
/* v1.5 - padding section added to stop EZF */
/* stripping important data */
/* This file is released into the public domain */
/* for commercial or non-commercial use with no */
/* restrictions placed upon it. */
/* NOTE!!!: This linker script defines the RAM & */
/* ROM start addresses. In order for it to work */
/* properly, remove -Ttext and -Tbss linker */
/* options from your makefile if they are */
/* present. */
/* You can use the following to view section */
/* addresses in your .elf file: */
/* objdump -h file.elf */
/* Please note that empty sections may incorrectly*/
/* list the lma address as the vma address for */
/* some versions of objdump. */
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
/* SEARCH_DIR(/bin/arm); */
/* By default this linker script will generate code */
/* for flash carts located at 0x8000000. */
/* The linker script function "var1 += var2;" sometimes */
/* reports incorrect values in the *.map file but the */
/* actual value it calculates is usually, if not always, */
/* correct. If you leave out the ". = ALIGN(4);" at the */
/* end of each section then the return value of SIZEOF() */
/* is sometimes incorrect and "var1 += var2;" appears to */
/* not work as well. "var1 += var2" style functions are */
/* avoided below as a result. */
/* The linker script MEMORY directive is not used here due */
/* to the fact that __text_start is not always a fixed value. */
__text_start = 0x8000000;
__eheap_end = 0x2040000;
__iwram_start = 0x3000000;
__iheap_end = 0x3008000 - 0x400;
__sp_usr = 0x3008000 - 0x100;
__sp_irq = 0x3008000 - 0x60;
__intr_vector_buf = 0x3008000 - 4;
__sp_usr_offset = __sp_usr - __iwram_start;
__intr_vect_offset = __intr_vector_buf - __sp_usr;
SECTIONS
{
. = __text_start;
.init :
{
KEEP (*(.init))
. = ALIGN(4);
} =0xff
.plt :
{
*(.plt)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
}
.text : /* ALIGN (4): */
{
*(EXCLUDE_FILE (*.iwram*) .text)
*(.text.*)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t*)
*(.glue_7)
*(.glue_7t)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0xff
__text_end = .;
.fini :
{
KEEP (*(.fini))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} =0
.rodata :
{
*(.rodata)
*all.rodata*(*)
*(.roda)
*(.rodata.*)
*(.gnu.linkonce.r*)
SORT(CONSTRUCTORS)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0xff
.ctors :
{
/* gcc uses crtbegin.o to find the start of the constructors, so
we make sure it is first. Because this is a wildcard, it
doesn't matter if the user does not actually link against
crtbegin.o; the linker won't look for a file to match a
wildcard. The wildcard also means that it doesn't matter which
directory crtbegin.o is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0
.jcr : { KEEP (*(.jcr)) }
/* laddr = ADDR(.init) + SIZEOF(.init) + SIZEOF(.text) + SIZEOF(.fini) + SIZEOF(.rodata) + SIZEOF(.ctors) + SIZEOF(.dtors);
*/
.eh_frame :
{
KEEP (*(.eh_frame))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0
.gcc_except_table :
{
*(.gcc_except_table)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0
__iwram_lma = .;
.iwram __iwram_start : AT (__iwram_lma)
{
__iwram_start = ABSOLUTE(.) ;
*(.iwram)
*iwram.*(.text)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0xff
__data_lma = __iwram_lma + SIZEOF(.iwram) ;
__iwram_end = . ;
.bss ALIGN(4) :
{
__bss_start = ABSOLUTE(.);
__bss_start__ = ABSOLUTE(.);
*(.dynbss)
*(.gnu.linkonce.b*)
*(COMMON)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
}
__bss_end = . ;
__bss_end__ = . ;
.data ALIGN(4) : AT (__data_lma)
{
__data_start = ABSOLUTE(.);
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
CONSTRUCTORS
. = ALIGN(4);
} = 0xff
__iwram_overlay_lma = __data_lma + SIZEOF(.data);
__data_end = .;
PROVIDE (edata = .);
__iwram_overlay_start = . ;
OVERLAY ALIGN(4) : NOCROSSREFS AT (__iwram_overlay_lma)
{
.iwram0 { *(.iwram0) . = ALIGN(4);}
.iwram1 { *(.iwram1) . = ALIGN(4);}
.iwram2 { *(.iwram2) . = ALIGN(4);}
.iwram3 { *(.iwram3) . = ALIGN(4);}
.iwram4 { *(.iwram4) . = ALIGN(4);}
.iwram5 { *(.iwram5) . = ALIGN(4);}
.iwram6 { *(.iwram6) . = ALIGN(4);}
.iwram7 { *(.iwram7) . = ALIGN(4);}
.iwram8 { *(.iwram8) . = ALIGN(4);}
.iwram9 { *(.iwram9) . = ALIGN(4);}
} = 0xff
__ewram_lma = LOADADDR(.iwram0) + SIZEOF(.iwram0)+SIZEOF(.iwram1)+SIZEOF(.iwram2)+SIZEOF(.iwram3)+SIZEOF(.iwram4)+SIZEOF(.iwram5)+SIZEOF(.iwram6)+SIZEOF(.iwram7)+SIZEOF(.iwram8)+SIZEOF(.iwram9);
__iwram_overlay_end = . ;
__iheap_start = . ;
__ewram_start = 0x2000000;
.ewram __ewram_start : AT (__ewram_lma)
{
*(.ewram)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0xff
__ewram_overlay_lma = __ewram_lma + SIZEOF(.ewram);
.sbss ALIGN(4):
{
*(.sbss)
. = ALIGN(4);
}
__ewram_end = . ;
__ewram_overlay_start = . ;
OVERLAY ALIGN(4): NOCROSSREFS AT (__ewram_overlay_lma)
{
.ewram0 { *(.ewram0) . = ALIGN(4);}
.ewram1 { *(.ewram1) . = ALIGN(4);}
.ewram2 { *(.ewram2) . = ALIGN(4);}
.ewram3 { *(.ewram3) . = ALIGN(4);}
.ewram4 { *(.ewram4) . = ALIGN(4);}
.ewram5 { *(.ewram5) . = ALIGN(4);}
.ewram6 { *(.ewram6) . = ALIGN(4);}
.ewram7 { *(.ewram7) . = ALIGN(4);}
.ewram8 { *(.ewram8) . = ALIGN(4);}
.ewram9 { *(.ewram9) . = ALIGN(4);}
} = 0xff
__pad_lma = LOADADDR(.ewram0) + SIZEOF(.ewram0)+SIZEOF(.ewram1)+SIZEOF(.ewram2)+SIZEOF(.ewram3)+SIZEOF(.ewram4)+SIZEOF(.ewram5)+SIZEOF(.ewram6)+SIZEOF(.ewram7)+SIZEOF(.ewram8)+SIZEOF(.ewram9);
/* EZF Advance strips trailing 0xff bytes, add a pad section so nothing important is removed */
.pad ALIGN(4) : AT (__pad_lma)
{
LONG(0x52416b64)
LONG(0x4d)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0xff
__ewram_overlay_end = . ;
__eheap_start = . ;
_end = .;
__end__ = _end ; /* v1.3 */
PROVIDE (end = _end); /* v1.3 */
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
.stack 0x80000 : { _stack = .; *(.stack) }
/* These must appear regardless of . */
}

247
dka-crtls/gba_crt0.s Normal file
View File

@ -0,0 +1,247 @@
.section ".init"
.global _start
.align
.arm
@---------------------------------------------------------------------------------
_start:
@---------------------------------------------------------------------------------
b rom_header_end
.fill 156,1,0 @ Nintendo Logo Character Data (8000004h)
.fill 16,1,0 @ Game Title
.byte 0x30,0x31 @ Maker Code (80000B0h)
.byte 0x96 @ Fixed Value (80000B2h)
.byte 0x00 @ Main Unit Code (80000B3h)
.byte 0x00 @ Device Type (80000B4h)
.fill 7,1,0 @ unused
.byte 0x00 @ Software Version No (80000BCh)
.byte 0xf0 @ Complement Check (80000BDh)
.byte 0x00,0x00 @ Checksum (80000BEh)
@---------------------------------------------------------------------------------
rom_header_end:
@---------------------------------------------------------------------------------
b start_vector @ This branch must be here for proper
@ positioning of the following header.
.GLOBAL __boot_method, __slave_number
@---------------------------------------------------------------------------------
__boot_method:
@---------------------------------------------------------------------------------
.byte 0 @ boot method (0=ROM boot, 3=Multiplay boot)
@---------------------------------------------------------------------------------
__slave_number:
@---------------------------------------------------------------------------------
.byte 0 @ slave # (1=slave#1, 2=slave#2, 3=slave#3)
.byte 0 @ reserved
.byte 0 @ reserved
.word 0 @ reserved
.word 0 @ reserved
.word 0 @ reserved
.word 0 @ reserved
.word 0 @ reserved
.word 0 @ reserved
.global start_vector
.align
@---------------------------------------------------------------------------------
start_vector:
@---------------------------------------------------------------------------------
mov r0, #0x4000000 @ REG_BASE
add r0,r0,#0x208 @ REG_IME
strh r0,[r0]
mov r0, #0x12 @ Switch to IRQ Mode
msr cpsr, r0
ldr sp,=__sp_irq @ Set IRQ stack
mov r0, #0x1f @ Switch to System Mode
msr cpsr, r0
ldr sp,=__sp_usr @ Set user stack
@---------------------------------------------------------------------------------
@ Enter Thumb mode
@---------------------------------------------------------------------------------
add r0,pc,#1
bx r0
.thumb
ldr r0,=__text_start
lsl r0,#5 @ Was code compiled at 0x08000000 or higher?
bcs DoEWRAMClear @ yes, you can not run it in external WRAM
mov r0,pc
lsl r0,#5 @ Are we running from ROM (0x8000000 or higher) ?
bcc SkipEWRAMClear @ No, so no need to do a copy.
@---------------------------------------------------------------------------------
@ We were started in ROM, silly emulators. :P
@ So we need to copy to ExWRAM.
@---------------------------------------------------------------------------------
mov r3,#0x40
lsl r3,#12 @ r3 = 0x40000
lsl r2,r3,#7 @ r2 = 0x2000000
mov r6,r2 @ r6 = 0x2000000
lsl r1,r2,#2 @ r1 = 0x8000000
bl CopyMem
bx r6 @ Jump to the code to execute
@---------------------------------------------------------------------------------
DoEWRAMClear: @ Clear External WRAM to 0x00
@---------------------------------------------------------------------------------
mov r1,#0x40
lsl r1,#12 @ r1 = 0x40000
lsl r0,r1,#7 @ r0 = 0x2000000
bl ClearMem
@---------------------------------------------------------------------------------
SkipEWRAMClear: @ Clear Internal WRAM to 0x00
@---------------------------------------------------------------------------------
mov r0,#3
lsl r0,#24 @ r0 = 0x3000000
ldr r1,=__sp_usr_offset - 16
bl ClearMem
@---------------------------------------------------------------------------------
@ Clear BSS section to 0x00
@---------------------------------------------------------------------------------
ldr r0,=__bss_start
ldr r1,=__bss_end
sub r1,r0
bl ClearMem
@---------------------------------------------------------------------------------
@ Copy initialized data (data section) from LMA to VMA (ROM to RAM)
@---------------------------------------------------------------------------------
ldr r1,=__data_lma
ldr r2,=__data_start
ldr r4,=__data_end
bl CopyMemChk
@---------------------------------------------------------------------------------
@ Copy internal work ram (iwram section) from LMA to VMA (ROM to RAM)
@---------------------------------------------------------------------------------
ldr r1,=__iwram_lma
ldr r2,=__iwram_start
ldr r4,=__iwram_end
bl CopyMemChk
@---------------------------------------------------------------------------------
@ Copy internal work ram overlay 0 (iwram0 section) from LMA to VMA (ROM to RAM)
@---------------------------------------------------------------------------------
ldr r2,=__load_stop_iwram0
ldr r1,=__load_start_iwram0
sub r3,r2,r1 @ Is there any data to copy?
beq CIW0Skip @ no
ldr r2,=__iwram_overlay_start
bl CopyMem
@---------------------------------------------------------------------------------
CIW0Skip:
@---------------------------------------------------------------------------------
@ Copy external work ram (ewram section) from LMA to VMA (ROM to RAM)
@---------------------------------------------------------------------------------
ldr r1,=__ewram_lma
ldr r2,=__ewram_start
ldr r4,=__ewram_end
bl CopyMemChk
@---------------------------------------------------------------------------------
@ Copy external work ram overlay 0 (ewram0 section) from LMA to VMA (ROM to RAM)
@---------------------------------------------------------------------------------
ldr r2,=__load_stop_ewram0
ldr r1,=__load_start_ewram0
sub r3,r2,r1 @ Is there any data to copy?
beq CEW0Skip @ no
ldr r2,=__ewram_overlay_start
bl CopyMem
@---------------------------------------------------------------------------------
CEW0Skip:
@---------------------------------------------------------------------------------
@ set heap end
@---------------------------------------------------------------------------------
ldr r1,=fake_heap_end
ldr r0,=__eheap_end
str r0,[r1]
@---------------------------------------------------------------------------------
@ global constructors
@---------------------------------------------------------------------------------
ldr r3,=_init
bl _call_via_r3
@---------------------------------------------------------------------------------
@ Jump to user code
@---------------------------------------------------------------------------------
mov r0,#0 @ int argc
mov r1,#0 @ char *argv[]
ldr r3,=main
bl _call_via_r3
@---------------------------------------------------------------------------------
@ Clear memory to 0x00 if length != 0
@---------------------------------------------------------------------------------
@ r0 = Start Address
@ r1 = Length
@---------------------------------------------------------------------------------
ClearMem:
@---------------------------------------------------------------------------------
mov r2,#3 @ These commands are used in cases where
add r1,r2 @ the length is not a multiple of 4,
bic r1,r2 @ even though it should be.
beq ClearMX @ Length is zero so exit
mov r2,#0
@---------------------------------------------------------------------------------
ClrLoop:
@---------------------------------------------------------------------------------
stmia r0!,{r2}
sub r1,#4
bne ClrLoop
@---------------------------------------------------------------------------------
ClearMX:
@---------------------------------------------------------------------------------
bx lr
@---------------------------------------------------------------------------------
@ Copy memory if length != 0
@---------------------------------------------------------------------------------
@ r1 = Source Address
@ r2 = Dest Address
@ r4 = Dest Address + Length
@---------------------------------------------------------------------------------
CopyMemChk:
@---------------------------------------------------------------------------------
sub r3,r4,r2 @ Is there any data to copy?
@---------------------------------------------------------------------------------
@ Copy memory
@---------------------------------------------------------------------------------
@ r1 = Source Address
@ r2 = Dest Address
@ r3 = Length
@---------------------------------------------------------------------------------
CopyMem:
@---------------------------------------------------------------------------------
mov r0,#3 @ These commands are used in cases where
add r3,r0 @ the length is not a multiple of 4,
bic r3,r0 @ even though it should be.
beq CIDExit @ Length is zero so exit
@---------------------------------------------------------------------------------
CIDLoop:
@---------------------------------------------------------------------------------
ldmia r1!,{r0}
stmia r2!,{r0}
sub r3,#4
bne CIDLoop
@---------------------------------------------------------------------------------
CIDExit:
@---------------------------------------------------------------------------------
bx lr
.align
.pool
.end

50
dka-crtls/gba_er.ld Normal file
View File

@ -0,0 +1,50 @@
/***********************************/
/* NINTENDO E-READER LINKER SCRIPT */
/***********************************/
/* Author : Tim Schuerewegen */
/* Version : 1.0 */
/***********************************/
OUTPUT_FORMAT( "elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH( arm)
ENTRY( _start)
SECTIONS
{
. = 0x02000000;
.init :
{
*(.init)
. = ALIGN(4);
} = 0xff
.text :
{
*(.text)
. = ALIGN(4);
} = 0xff
.rodata :
{
*(.rodata)
. = ALIGN(4);
} = 0xff
.data :
{
*(.data)
. = ALIGN(4);
} = 0xff
.bss :
{
__bss_start = .;
*(.bss)
. = ALIGN(4);
}
__bss_end = .;
__end = .;
}

8
dka-crtls/gba_er.specs Normal file
View File

@ -0,0 +1,8 @@
%rename link old_link
%rename endfile old_endfile
*link:
-T gba_er.ld%s %(old_link)
*startfile:
er_crt0%O%s

284
dka-crtls/gba_mb.ld Normal file
View File

@ -0,0 +1,284 @@
/* Linker Script Original v1.3 by Jeff Frohwein */
/* v1.0 - Original release */
/* v1.1 - Added proper .data section support */
/* v1.2 - Added support for c++ & iwram overlays */
/* - Major contributions by Jason Wilkins. */
/* v1.3 - .ewram section now can be used when */
/* compiling for MULTIBOOT mode. This fixes */
/* malloc() in DevKitAdvance which depends */
/* on __eheap_start instead of end to define*/
/* the starting location of heap space. */
/* External global variable __gba_iwram_heap*/
/* support added to allow labels end, _end, */
/* & __end__ to point to end of iwram or */
/* the end of ewram. */
/* Additions by WinterMute */
/* v1.4 - .sbss section added for unitialised */
/* data in ewram */
/* v1.5 - padding section added to stop EZF */
/* stripping important data */
/* This file is released into the public domain */
/* for commercial or non-commercial use with no */
/* restrictions placed upon it. */
/* NOTE!!!: This linker script defines the RAM & */
/* ROM start addresses. In order for it to work */
/* properly, remove -Ttext and -Tbss linker */
/* options from your makefile if they are */
/* present. */
/* You can use the following to view section */
/* addresses in your .elf file: */
/* objdump -h file.elf */
/* Please note that empty sections may incorrectly*/
/* list the lma address as the vma address for */
/* some versions of objdump. */
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
/* SEARCH_DIR(/bin/arm); */
/* By default this linker script will generate code */
/* for flash carts located at 0x8000000. */
/* The linker script function "var1 += var2;" sometimes */
/* reports incorrect values in the *.map file but the */
/* actual value it calculates is usually, if not always, */
/* correct. If you leave out the ". = ALIGN(4);" at the */
/* end of each section then the return value of SIZEOF() */
/* is sometimes incorrect and "var1 += var2;" appears to */
/* not work as well. "var1 += var2" style functions are */
/* avoided below as a result. */
__text_start = 0x2000000 ;
__eheap_end = 0x2040000;
__iwram_start = 0x3000000;
__iheap_end = 0x3008000 - 0x400;
__sp_usr = 0x3008000 - 0x100;
__sp_irq = 0x3008000 - 0x60;
__intr_vector_buf = 0x3008000 - 4;
__sp_usr_offset = __sp_usr - __iwram_start;
__intr_vect_offset = __intr_vector_buf - __sp_usr;
SECTIONS
{
. = __text_start;
.init :
{
KEEP (*(.init))
. = ALIGN(4);
} =0xff
.plt :
{
*(.plt)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
}
.text : /* ALIGN (4): */
{
*(EXCLUDE_FILE (*.iwram*) .text)
*(.text.*)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t*)
*(.glue_7)
*(.glue_7t)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0xff
__text_end = .;
.fini :
{
KEEP (*(.fini))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} =0
.rodata :
{
*(.rodata)
*all.rodata*(*)
*(.roda)
*(.rodata.*)
*(.gnu.linkonce.r*)
SORT(CONSTRUCTORS)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0xff
.ctors :
{
/* gcc uses crtbegin.o to find the start of the constructors, so
we make sure it is first. Because this is a wildcard, it
doesn't matter if the user does not actually link against
crtbegin.o; the linker won't look for a file to match a
wildcard. The wildcard also means that it doesn't matter which
directory crtbegin.o is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0
.jcr : { KEEP (*(.jcr)) }
/* laddr = ADDR(.init) + SIZEOF(.init) + SIZEOF(.text) + SIZEOF(.fini) + SIZEOF(.rodata) + SIZEOF(.ctors) + SIZEOF(.dtors);
*/
.eh_frame :
{
KEEP (*(.eh_frame))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0
.gcc_except_table :
{
*(.gcc_except_table)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0
__iwram_lma = .;
.iwram __iwram_start : AT (__iwram_lma)
{
__iwram_start = ABSOLUTE(.) ;
*(.iwram)
*iwram.*(.text)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0xff
__data_lma = __iwram_lma + SIZEOF(.iwram) ;
__iwram_end = . ;
.bss ALIGN(4) :
{
__bss_start = ABSOLUTE(.);
__bss_start__ = ABSOLUTE(.);
*(.dynbss)
*(.gnu.linkonce.b*)
*(COMMON)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
}
__bss_end = . ;
__bss_end__ = . ;
.data ALIGN(4) : AT (__data_lma)
{
__data_start = ABSOLUTE(.);
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
CONSTRUCTORS
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0xff
__iwram_overlay_lma = __data_lma + SIZEOF(.data);
__data_end = .;
PROVIDE (edata = .);
__iwram_overlay_start = . ;
OVERLAY ALIGN(4) : NOCROSSREFS AT (__iwram_overlay_lma)
{
.iwram0 { *(.iwram0) . = ALIGN(4);}
.iwram1 { *(.iwram1) . = ALIGN(4);}
.iwram2 { *(.iwram2) . = ALIGN(4);}
.iwram3 { *(.iwram3) . = ALIGN(4);}
.iwram4 { *(.iwram4) . = ALIGN(4);}
.iwram5 { *(.iwram5) . = ALIGN(4);}
.iwram6 { *(.iwram6) . = ALIGN(4);}
.iwram7 { *(.iwram7) . = ALIGN(4);}
.iwram8 { *(.iwram8) . = ALIGN(4);}
.iwram9 { *(.iwram9) . = ALIGN(4);}
} = 0xff
__ewram_lma = LOADADDR(.iwram0) + SIZEOF(.iwram0)+SIZEOF(.iwram1)+SIZEOF(.iwram2)+SIZEOF(.iwram3)+SIZEOF(.iwram4)+SIZEOF(.iwram5)+SIZEOF(.iwram6)+SIZEOF(.iwram7)+SIZEOF(.iwram8)+SIZEOF(.iwram9);
__iwram_overlay_end = . ;
__iheap_start = . ;
/* v1.3 */
__ewram_start = __ewram_lma ;
.ewram __ewram_start : AT (__ewram_lma)
{
*(.ewram)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} = 0xff
__ewram_overlay_lma = __ewram_lma + SIZEOF(.ewram);
.sbss ALIGN(4):
{
*(.sbss)
. = ALIGN(4);
}
__ewram_end = . ;
__ewram_overlay_start = . ;
OVERLAY ALIGN(4): NOCROSSREFS AT (__ewram_overlay_lma)
{
.ewram0 { *(.ewram0) . = ALIGN(4);}
.ewram1 { *(.ewram1) . = ALIGN(4);}
.ewram2 { *(.ewram2) . = ALIGN(4);}
.ewram3 { *(.ewram3) . = ALIGN(4);}
.ewram4 { *(.ewram4) . = ALIGN(4);}
.ewram5 { *(.ewram5) . = ALIGN(4);}
.ewram6 { *(.ewram6) . = ALIGN(4);}
.ewram7 { *(.ewram7) . = ALIGN(4);}
.ewram8 { *(.ewram8) . = ALIGN(4);}
.ewram9 { *(.ewram9) . = ALIGN(4);}
} = 0xff
__ewram_overlay_end = . ;
__eheap_start = . ;
_end = .;
__end__ = _end ; /* v1.3 */
PROVIDE (end = _end); /* v1.3 */
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
.stack 0x80000 : { _stack = .; *(.stack) }
/* These must appear regardless of . */
}

8
dka-crtls/gba_mb.specs Normal file
View File

@ -0,0 +1,8 @@
%rename link old_link
*link:
-T gba_mb.ld%s %(old_link)
*startfile:
gba_crt0%O%s crti%O%s crtbegin%O%s

152
dka-crtls/gp32.ld Normal file
View File

@ -0,0 +1,152 @@
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
MEMORY
{
ram : ORIGIN = 0xc000000, LENGTH = 8M
}
SECTIONS
{
.init :
{
__text_start = . ;
KEEP (*(.init))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0xff
.plt : { *(.plt) } >ram = 0xff
.text : /* ALIGN (4): */
{
*(EXCLUDE_FILE (*text.iwram*) .text)
*(.text.*)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t*)
*(.glue_7)
*(.glue_7t)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0xff
.fini :
{
KEEP (*(.fini))
} >ram =0xff
__text_end = . ;
.rodata :
{
*(.rodata)
*all.rodata*(*)
*(.roda)
*(.rodata.*)
*(.gnu.linkonce.r*)
SORT(CONSTRUCTORS)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0xff
.ctors :
{
/* gcc uses crtbegin.o to find the start of the constructors, so
we make sure it is first. Because this is a wildcard, it
doesn't matter if the user does not actually link against
crtbegin.o; the linker won't look for a file to match a
wildcard. The wildcard also means that it doesn't matter which
directory crtbegin.o is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0
.eh_frame :
{
KEEP (*(.eh_frame))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0
.gcc_except_table :
{
*(.gcc_except_table)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0
.jcr : { KEEP (*(.jcr)) } >ram = 0
.got : { *(.got.plt) *(.got) } >ram = 0
__ro_end = . ;
.data ALIGN(4) :
{
__data_start = ABSOLUTE(.);
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
CONSTRUCTORS
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0xff
__data_end = . ;
.bss ALIGN(4) :
{
__bss_start = ABSOLUTE(.);
/* __bss_start__ = ABSOLUTE(.); */
*(.dynbss)
*(.gnu.linkonce.b*)
*(COMMON)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} > ram
__bss_end = . ;
_end = . ;
__end__ = . ;
PROVIDE (end = _end);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
.stack 0x80000 : { _stack = .; *(.stack) }
/* These must appear regardless of . */
}

8
dka-crtls/gp32.specs Normal file
View File

@ -0,0 +1,8 @@
%rename link old_link
*link:
%(old_link) -T gp32.ld%s
*startfile:
gp32_crt0%O%s crti%O%s crtbegin%O%s

74
dka-crtls/gp32_crt0.s Normal file
View File

@ -0,0 +1,74 @@
.section ".init"
.code 32
.align
.global _start
@---------------------------------------------------------------------------------
_start:
@---------------------------------------------------------------------------------
b _start2
@---------------------------------------------------------------------------------
@ AXF addresses
@---------------------------------------------------------------------------------
_text_start:
.word __text_start
_ro_end:
.word __ro_end
_data_start:
.word __data_start
.word __bss_end
_bss_start:
.word __bss_start
_bss_end:
.word __bss_end
@---------------------------------------------------------------------------------
@ GamePark magic sequence
@---------------------------------------------------------------------------------
.word 0x44450011
.word 0x44450011
.word 0x01234567
.word 0x12345678
.word 0x23456789
.word 0x34567890
.word 0x45678901
.word 0x56789012
.word 0x23456789
.word 0x34567890
.word 0x45678901
.word 0x56789012
.word 0x23456789
.word 0x34567890
.word 0x45678901
.word 0x56789012
@---------------------------------------------------------------------------------
_start2:
@---------------------------------------------------------------------------------
mrs r0, CPSR
orr r0, r0, #0xC0
msr CPSR_ctl, r0
mrs r0, CPSR
bic r0, r0, #0xC0
orr r0, r0, #0x40
msr CPSR_ctl,r0
@---------------------------------------------------------------------------------
@ global constructors
@---------------------------------------------------------------------------------
ldr r3,=_call_main
mov lr,r3
ldr r3,=_init
bx r3
@---------------------------------------------------------------------------------
@ Jump to user code
@---------------------------------------------------------------------------------
_call_main:
@---------------------------------------------------------------------------------
mov lr, #0
ldr r3, =main
bx r3
.pool
.end

197
dka-crtls/gp32_gpsdk.ld Normal file
View File

@ -0,0 +1,197 @@
/* GP32 Linker Script v1.2 by Jeff F */
/* v1.0 - Original release */
/* v1.1 - Cleaned up and added MEMORY command */
/* v1.2 - DJWillis - Added propper .init and */
/* .fini for GCC 3.3.2 and above */
/* */
/* This file is released into the public domain */
/* for commercial or non-commercial use with no */
/* restrictions placed upon it. */
/* */
/* NOTE!!!: This linker script defines the RAM */
/* start addresses. In order for it to work */
/* properly, remove -Ttext and -Tbss linker */
/* options from your makefile if they are */
/* present. */
/* */
/* You can use the following to view section */
/* addresses in your .elf file: */
/* objdump -h file.elf */
/* */
/* Please note that empty sections may incorrectly*/
/* list the lma address as the vma address for */
/* some versions of objdump. */
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
/* SEARCH_DIR(/bin/arm); */
/* Then use it like this: IWRAMHEAP */
/* The linker script function "var1 += var2;" sometimes */
/* reports incorrect values in the *.map file but the */
/* actual value it calculates is usually, if not always, */
/* correct. If you leave out the ". = ALIGN(4);" at the */
/* end of each section then the return value of SIZEOF() */
/* is sometimes incorrect and "var1 += var2;" appears to */
/* not work as well. "var1 += var2" style functions are */
/* avoided below as a result. */
/* The linker script MEMORY directive is not used here due */
/* to the fact that __text_start is not always a fixed value. */
MEMORY
{
ram : ORIGIN = 0xc000000, LENGTH = 8M
}
SECTIONS
{
.text : /* ALIGN (4): */
{
__text_start = . ;
*(EXCLUDE_FILE (*text.iwram*) .text)
*(.text.*)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t*)
*(.glue_7)
*(.glue_7t)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0xff
__text_end = . ;
.init :
{
*(.init)
} > ram = 0xff
.jcr :
{
*(.jcr)
} > ram = 0xff
.fini :
{
*(.fini)
} > ram = 0xff
.rodata :
{
*(.rodata)
*all.rodata*(*)
*(.roda)
*(.rodata.*)
*(.gnu.linkonce.r*)
SORT(CONSTRUCTORS)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0xff
.ctors :
{
/* gcc uses crtbegin.o to find the start of the constructors, so
we make sure it is first. Because this is a wildcard, it
doesn't matter if the user does not actually link against
crtbegin.o; the linker won't look for a file to match a
wildcard. The wildcard also means that it doesn't matter which
directory crtbegin.o is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0
.eh_frame :
{
KEEP (*(.eh_frame))
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0
.gcc_except_table :
{
*(.gcc_except_table)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0
__ro_end = . ;
.data ALIGN(4) :
{
__data_start = ABSOLUTE(.);
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
CONSTRUCTORS
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} >ram = 0xff
__data_end = . ;
.bss ALIGN(4) :
{
__bss_start = ABSOLUTE(.);
/* __bss_start__ = ABSOLUTE(.); */
*(.dynbss)
*(.gnu.linkonce.b*)
*(COMMON)
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
} > ram
__bss_end = . ;
__eheap_start = . ; /* Needed by DevKitAdvance. Start of malloc() heap for DKA. */
_end = . ;
__end__ = . ;
PROVIDE (end = _end);
__eheap_end = . ;
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
.stack 0x80000 : { _stack = .; *(.stack) }
/* These must appear regardless of . */
}

View File

@ -0,0 +1,8 @@
%rename link old_link
*link:
%(old_link) -T gp32_gpsdk.ld%s
*startfile:
gp32_gpsdk_crt0%O%s crti%O%s crtbegin%O%s

246
dka-crtls/gp32_gpsdk_crt0.s Normal file
View File

@ -0,0 +1,246 @@
@****************************************************
@* gp32 crt0.S v1.0 by Jeff F *
@****************************************************
@ v1.0 - Original release
@
@ This file is released into the public domain for commercial
@ or non-commercial usage with no restrictions placed upon it.
.TEXT
@ Note: Normally it is the job of crt0.S to clear the BSS
@ (Zero Initialized) section to 0x00, but in the case of
@ the gp32 we do not have to do this because it is done
@ by the gp32 bios after it loads the app.
@ The official sdt dev kit uses 'Main ()' as the entry
@ point. If you would rather use 'main ()' instead then
@ comment out the next line.
@
@ You have to use 'main ()' at some point in your program
@ if you want to do c++ code. GCC will do a call to constructor
@ setup before executing 'main ()'. Using 'main ()' also increases
@ your program size by ~5500 bytes.
@ .equ __OfficialEntry, 1
@ The official sdt dev kit initializes various things in init.o
@ Crt0.S performs similar tasks for compatibility. If you don't
@ wish to use the official libs, or those that are compatible,
@ then you need to comment out the next line to prevent link errors.
.equ __OfficialInits, 1
.GLOBAL _start
_start:
.ALIGN
.CODE 32
@ Start Vector
b _GpInit
.word __text_start @ Start of text (Read Only) section
_roe: .word __ro_end @ End "
_rws: .word __data_start @ Start of data (Read/Write) section
.word __bss_end @ End of bss (this is the way sdt does it for some reason)
_zis: .word __bss_start @ Start of bss (Zero Initialized) section
_zie: .word __bss_end @ End "
.word 0x44450011
.word 0x44450011
.word 0x01234567
.word 0x12345678
.word 0x23456789
.word 0x34567890
.word 0x45678901
.word 0x56789012
.word 0x23456789
.word 0x34567890
.word 0x45678901
.word 0x56789012
.word 0x23456789
.word 0x34567890
.word 0x45678901
.word 0x56789012
_GpInit:
mrs r0,CPSR
orr r0,r0,#0xc0
msr CPSR_fsxc,r0
.ifdef __OfficialInits
@ Call function in user_init.s
@ bl asm_user_entry
@ Get pointer to GpSurfaceSet routine
mov r0,#0
swi 0xb
ldr r1,=GpSurfaceSet
ldr r2,=GpSurfaceFlip
str r0,[r1]
str r0,[r2]
@ Get time passed
mov r0,#6
swi 0xb
ldr r1,=_timepassed
str r0,[r1]
@ Get button stuff
mov r0,#0
swi 0x10
ldr r2,=_reg_io_key_a
ldr r3,=_reg_io_key_b
str r0,[r2]
str r1,[r3]
@ Set heap start location
ldr r0,_zie
ldr r1,=HEAPSTART
str r0,[r1]
@ Set heap end location
mov r0,#5
swi 0xb
ldr r1,=HEAPEND
sub r0,r0,#255
bic r0,r0,#3
str r0,[r1]
@ Set App Argument
swi 0x15
mov r10,r0
mov r11,r1 @ possibly not needed but left in anyway
mrs r0,CPSR
bic r0,r0,#192
orr r0,r0,#64
msr CPSR_fsxc,r0
mov r0,r10
mov r1,r11 @ possibly not needed but left in anyway
.endif
@ Jump to Main ()
.ifdef __OfficialEntry
ldr r3,=Main
.else
ldr r3,=main
.endif
bx r3 @ Init.o uses 'mov pc,r3' but
@ 'bx r3' is used here instead. This way
@ the main function can be ARM or Thumb.
.ifdef __OfficialInits
swi 0x12
orr r1,r1,r2
and r1,r1,r3
eor r1,r1,r4
mov r5,r1,lsr #4
add r1,r1,r7
sub r7,r7,r1
mov r8,#0
mov pc,r8
b .
b .
b .
b .
b .
b .
b .
b .
b .
b .
b .
b .
nop
nop
nop
nop
nop
nop
.GLOBAL _fw_init_for_dbg
_fw_init_for_dbg:
stmdb sp!,{r0-r12}
mov r10,lr
mov r11,sp
bic r0,r0,#31 @ 0x1f
orr r1,r0,#17 @ 0x11
orr r2,r0,#19 @ 0x13
msr cpsr_cxsf,r1
mov r12,#4
add r12,r12,pc
msr cpsr_cxsf,r2
swi 0x1ff
@ bl asm_user_entry_path
mov r0,r11
mov r1,r10
add r0,r0,#52
ldr r2,[r0]
mov lr,r1
stmdb sp!,{r2}
stmdb sp!,{r0-r12,lr}
@ Copy RW Base - ZI Base
ldr r0,=_roe @ |Image$$RO$$Limit|
ldr r3,=_zis @ |Image$$ZI$$Base|
ldr r2,=_rws @ |Image$$RW$$Base|
sub r3,r3,r2
CopyRWData:
cmp r3,#36
blt CopyRWData2
ldmia r0!,{r4-r12}
stmia r2!,{r4-r12}
sub r3,r3,#36
b CopyRWData
CopyRWData2:
cmp r3,#0
ble CopyRWData3
ldr r4,[r0],#4
str r4,[r2],#4
sub r3,r3,#4
b CopyRWData2
CopyRWData3:
@ Clear ZI section
ldr r1,=_zie @ |Image$$ZI$$Limit|
ldr r0,=_zis @ |Image$$ZI$$Base|
mov r2,#0
mov r3,r2
mov r4,r2
mov r5,r2
mov r6,r2
mov r7,r2
mov r8,r2
mov r9,r2
mov r10,r2
mov r11,r2
mov r12,r2
CopyZIData:
stmia r0!,{r2-r12}
cmp r0,r1
blt CopyZIData
ldmia sp!,{r0-r12,pc}
.endif
.ALIGN
.POOL
.END

View File

@ -0,0 +1,12 @@
DEVKITARM=$INSTALLDIR
#---------------------------------------------------------------------------------
# Install and build the gba crt
#---------------------------------------------------------------------------------
cp $(pwd)/dka-crtls/* $DEVKITARM/arm-elf/lib/
cd $DEVKITARM/arm-elf/lib/
$MAKE CRT=gba_crt0
$MAKE CRT=gp32_crt0
$MAKE CRT=er_crt0
$MAKE CRT=gp32_gpsdk_crt0

67
dka-scripts/build-gcc.sh Normal file
View File

@ -0,0 +1,67 @@
#---------------------------------------------------------------------------------
# Check Parameters
#---------------------------------------------------------------------------------
prefix=$INSTALLDIR
#---------------------------------------------------------------------------------
# build and install binutils
#---------------------------------------------------------------------------------
mkdir -p $target/binutils
cd $target/binutils
../../$BINUTILS_SRCDIR/configure \
--prefix=$prefix --target=$target --disable-nls --disable-shared --disable-debug \
--disable-threads --with-gcc --with-gnu-as --with-gnu-ld --with-stabs \
2>&1 | tee binutils_configure.log
$MAKE | tee binutils_make.log 2>&1
$MAKE install | tee binutils_install.log 2>&1
cd $BUILDSCRIPTDIR
#---------------------------------------------------------------------------------
# build and install just the c compiler
#---------------------------------------------------------------------------------
mkdir -p $target/gcc
cd $target/gcc
../../$GCC_SRCDIR/configure \
--enable-languages=c,c++ \
--with-cpu=arm7tdmi\
--enable-interwork --enable-multilib\
--with-gcc --with-gnu-ld --with-gnu-as --with-stabs \
--disable-shared --disable-threads --disable-win32-registry --disable-nls\
--target=$target \
--with-newlib \
--prefix=$prefix -v\
2>&1 | tee gcc_configure.log
$MAKE all-gcc | tee gcc_make.log 2>&1
$MAKE install-gcc | tee gcc_install.log 2>&1
#---------------------------------------------------------------------------------
# build and install newlib
#---------------------------------------------------------------------------------
cd $BUILDSCRIPTDIR
mkdir -p $target/newlib
cd $target/newlib
../../$NEWLIB_SRCDIR/configure --target=$target --prefix=$prefix | tee newlib_configure.log 2>&1
$MAKE all | tee newlib_make.log 2>&1
$MAKE install | tee newlib_install.log 2>&1
#---------------------------------------------------------------------------------
# build and install the final compiler
#---------------------------------------------------------------------------------
cd $BUILDSCRIPTDIR
cd $target/gcc
$MAKE | tee gcc_final_make.log 2>&1
$MAKE install | tee gcc_final_install.log 2>&1

View File

@ -0,0 +1,26 @@
prefix=$INSTALLDIR
gcc -O2 tools/gba/gbafix.c
if [ -f a.out ]
then
exeext=
rm a.out
else
if [ -f a.exe ]
then
exeext=.exe
rm a.exe
else
echo "Error: Failed to build tools"
exit -1
fi
fi
g++ tools/bmp2bin.cpp -o $prefix/bin/bmp2bin$exeext -static -O2 -s -D__LITTLE_ENDIAN__
gcc tools/gbafix.c -o $prefix/bin/gbafix$exeext -static -O2 -s
cd tools/b2fxec
$MAKE -C tools/gp32/b2fxec
cp b2fxec$exeext $prefix/bin/b2fxec$exeext
$MAKE -C tools/gp32/b2fxec clean

242
dkp-crtls/gcn.ld Normal file
View File

@ -0,0 +1,242 @@
/* Default linker script, for normal executables */
OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
"elf32-powerpc")
OUTPUT_ARCH(powerpc:common)
ENTRY(_start)
SEARCH_DIR("/powerpc/powerpc-eabi-elf/lib");
/* Do we need any of these for elf?
__DYNAMIC = 0; */
PROVIDE (__stack = 0x817F0000);
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = 0x80003100;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rel.init : { *(.rel.init) }
.rela.init : { *(.rela.init) }
.rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
.rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
.rel.fini : { *(.rel.fini) }
.rela.fini : { *(.rela.fini) }
.rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
.rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
.rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
.rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
.rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
.rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
.rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
.rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rela.got1 : { *(.rela.got1) }
.rela.got2 : { *(.rela.got2) }
.rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
.rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
.rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
.rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
.rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
.rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
.rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
.rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
.rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
.rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
file_start = 0x80003000;
. = file_start;
.header :
{
/* 0000-001B Text[0..7] sections File Positions */
LONG(text_file_start); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0);
/* 001C-0047 Data[0..10] sections File Positions */
LONG(0/*data_file_start*/); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0);
/* 0048-0063 Text[0..7] sections Mem Address */
LONG(text_mem_start); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0);
/* 0064-008F Data[0..10] sections Mem Address */
LONG(0/*data_mem_start*/); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0);
/* 0090-00AB Text[0..7] sections Sizes */
LONG(text_mem_size + data_mem_size); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0);
/* 00AC-00D7 Data[0..10] sections Sizes */
LONG(0/*data_mem_size*/); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0); LONG(0);
/* 00D8 BSS Mem address
* 00DC BSS Size */
LONG(bss_mem_start); LONG(bss_mem_size);
/* 00E0 Entry Point */
LONG(text_mem_start);
}
. = 0x80003100;
text_mem_start = .;
.init :
{
KEEP (*(.init))
} =0
.text :
{
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
} =0
.fini :
{
KEEP (*(.fini))
} =0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
. = ALIGN(32);
text_mem_size = . - text_mem_start;
data_mem_start = .;
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
.sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) }
.sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
.eh_frame_hdr : { *(.eh_frame_hdr) }
. = ALIGN(32);
/* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but
the linker would then create the section even if it turns out to
be empty, which isn't pretty. */
. = ALIGN(32 / 8);
PROVIDE (__preinit_array_start = .);
.preinit_array : { *(.preinit_array) }
PROVIDE (__preinit_array_end = .);
PROVIDE (__init_array_start = .);
.init_array : { *(.init_array) }
PROVIDE (__init_array_end = .);
PROVIDE (__fini_array_start = .);
.fini_array : { *(.fini_array) }
PROVIDE (__fini_array_end = .);
.data :
{
*(.data .data.* .gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
.eh_frame : { KEEP (*(.eh_frame)) }
.gcc_except_table : { *(.gcc_except_table) }
.fixup : { *(.fixup) }
.got1 : { *(.got1) }
.got2 : { *(.got2) }
.dynamic : { *(.dynamic) }
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin*.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{
KEEP (*crtbegin*.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
.jcr : { KEEP (*(.jcr)) }
.got : { *(.got.plt) *(.got) }
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
.sdata :
{
*(.sdata .sdata.* .gnu.linkonce.s.*)
}
_edata = .;
PROVIDE (edata = .);
data_mem_size = . - data_mem_start;
bss_mem_start = .;
__bss_start = .;
.sbss :
{
PROVIDE (__sbss_start = .);
PROVIDE (___sbss_start = .);
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
PROVIDE (__sbss_end = .);
PROVIDE (___sbss_end = .);
}
.plt : { *(.plt) }
.bss :
{
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(32 / 8);
}
. = ALIGN(32 / 8);
bss_mem_size = . - bss_mem_start;
text_file_start = text_mem_start - file_start;
data_file_start = data_mem_start - file_start;
_end = .;
__end = .;
PROVIDE (end = .);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
}

348
dkp-crtls/ogc.ld Normal file
View File

@ -0,0 +1,348 @@
/*
* Linkscript for GC, automatically sets up DOL structures,
* generate ELF file and use objdump, or generate binary
* directly.
*
* PSUL doesn't seem to handle separate text and data sections correctly,
* that is why the text and data sections are merged in the header.
*
* If you want to experiment, it should be quite obvious how to
* change the header to list the data separately.
*/
OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc");
OUTPUT_ARCH(powerpc:common);
EXTERN(_start);
ENTRY(_start);
SECTIONS
{
/* DOL header (from TITANIK's GC docs)
*/
file_start = 0x80003000;
. = file_start;
.header :
{
/* 0000-001B Text[0..7] sections File Positions */
LONG(text_file_start);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
/* 001C-0047 Data[0..10] sections File Positions */
LONG(data_file_start);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
/* 0048-0063 Text[0..7] sections Mem Address */
LONG(text_mem_start);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
/* 0064-008F Data[0..10] sections Mem Address */
LONG(data_mem_start);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
/* 0090-00AB Text[0..7] sections Sizes */
LONG(text_mem_size);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
/* 00AC-00D7 Data[0..10] sections Sizes */
LONG(data_mem_size);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
LONG(0);
/* 00D8 BSS Mem address
* 00DC BSS Size */
LONG(bss_mem_start);
LONG(bss_mem_size);
/* 00E0 Entry Point */
LONG(ABSOLUTE(_start));
}
/* Program
*/
. = 0x80003100;
text_mem_start = .;
.init :
{
KEEP (*crt0.o(*.init))
KEEP (*(.init))
} = 0
.plt : { *(.plt) }
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rel.init : { *(.rel.init) }
.rela.init : { *(.rela.init) }
.rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
.rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
.rel.fini : { *(.rel.fini) }
.rela.fini : { *(.rela.fini) }
.rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
.rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
.rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
.rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
.rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
.rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
.rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
.rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rela.got1 : { *(.rela.got1) }
.rela.got2 : { *(.rela.got2) }
.rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
.rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
.rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
.rela.sbss : { *(.rela.sbss .rela.sbss.* .rel.gnu.linkonce.sb.*) }
.rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
.rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
.rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
.rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
.rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
.rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.text :
{
*(.text)
*(.text.*)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t.*)
} = 0
.fini :
{
KEEP (*(.fini))
} = 0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
text_mem_size = . - text_mem_start;
data_mem_start = .;
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
.sdata2 : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) }
.sbss2 : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
/* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but
the linker would then create the section even if it turns out to
be empty, which isn't pretty. */
. = ALIGN(32 / 8);
PROVIDE (__preinit_array_start = .);
.preinit_array : { *(.preinit_array) }
PROVIDE (__preinit_array_end = .);
PROVIDE (__init_array_start = .);
.init_array : { *(.init_array) }
PROVIDE (__init_array_end = .);
PROVIDE (__fini_array_start = .);
.fini_array : { *(.fini_array) }
PROVIDE (__fini_array_end = .);
.data :
{
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
.eh_frame : { KEEP (*(.eh_frame)) }
.gcc_except_table : { *(.gcc_except_table) }
.fixup : { *(.fixup) }
.got1 : { *(.got1) }
.got2 : { *(.got2) }
.dynamic : { *(.dynamic) }
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
.jcr : { KEEP (*(.jcr)) }
.got : { *(.got.plt) *(.got) }
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
.sdata :
{
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
}
_edata = .;
PROVIDE (edata = .);
data_mem_size = . - data_mem_start;
bss_mem_start = .;
.sbss :
{
__sbss_start = .;
PROVIDE (__sbss_start = .);
PROVIDE (___sbss_start = .);
*(.dynsbss)
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
*(.scommon)
PROVIDE (__sbss_end = .);
PROVIDE (___sbss_end = .);
__sbss_end = .;
}
.bss :
{
__bss_start = .;
PROVIDE (__bss_start = .);
*(.dynbss)
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(32 / 8);
PROVIDE (__bss_end = .);
__bss_end = .;
}
. = ALIGN(32 / 8);
bss_mem_size = . - bss_mem_start;
/* calculate file addresses */
text_file_start = text_mem_start - file_start;
data_file_start = data_mem_start - file_start;
_end = .;
PROVIDE(end = .);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* These must appear regardless of . */
}
__stack_addr = (__bss_start + SIZEOF(.bss) + 0x2000 + 7) & (-8);
__stack_end = (__bss_start + SIZEOF(.bss));
__intrstack_addr = (__stack_addr + 0x2000);
__intrstack_end = (__stack_addr);
__ArenaLo = (__intrstack_addr + 31) & (-32);
__ArenaHi = (0x81700000);
__gxregs = (__ArenaHi + 31) & (-32);
/* for backward compatibility with old crt0 */
__stack = (0x81700000);
PROVIDE (text_mem_start = text_mem_start);
PROVIDE (data_mem_start = data_mem_start);
PROVIDE (bss_mem_start = bss_mem_start);
PROVIDE(__stack_addr = __stack_addr);
PROVIDE(__stack_end = __stack_end);
PROVIDE(__intrstack_addr = __intrstack_addr);
PROVIDE(__intrstack_end = __intrstack_end);
PROVIDE(__ArenaLo = __ArenaLo);
PROVIDE(__ArenaHi = __ArenaHi);
PROVIDE(__gxregs = __gxregs);

355
dkp-crtls/specs Normal file
View File

@ -0,0 +1,355 @@
*asm:
--traditional-format %(asm_cpu) %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} %{memb|msdata|msdata=eabi: -memb} %{mlittle|mlittle-endian:-mlittle; mbig|mbig-endian :-mbig; mcall-aixdesc | mcall-freebsd | mcall-netbsd | mcall-openbsd | mcall-linux | mcall-gnu :-mbig; mcall-i960-old :-mlittle}
*asm_debug:
%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}
*asm_final:
*asm_options:
%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}
*invoke_as:
%{!S:-o %|.s |
as %(asm_options) %|.s %A }
*cpp:
%{posix: -D_POSIX_SOURCE} %{mads : %(cpp_os_ads) ; myellowknife : %(cpp_os_yellowknife) ; mmvme : %(cpp_os_mvme) ; msim : %(cpp_os_sim) ; mwindiss : %(cpp_os_windiss) ; mcall-freebsd: %(cpp_os_freebsd) ; mcall-linux : %(cpp_os_linux) ; mcall-gnu : %(cpp_os_gnu) ; mcall-netbsd : %(cpp_os_netbsd) ; mcall-openbsd: %(cpp_os_openbsd) ; : %(cpp_os_default) }
*cpp_options:
%(cpp_unique_options) %1 %{m*} %{std*} %{ansi} %{W*&pedantic*} %{w} %{f*} %{g*:%{!g0:%{!fno-working-directory:-fworking-directory}}} %{O*} %{undef}
*cpp_debug_options:
%{d*}
*cpp_unique_options:
%{C|CC:%{!E:%eGCC does not support -C or -CC without -E}} %{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}} %{trigraphs} %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{E|M|MM:%W{o*}}
*trad_capable_cpp:
cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}
*cc1:
%{G*} %{mlittle|mlittle-endian: %(cc1_endian_little); mbig |mbig-endian : %(cc1_endian_big); mcall-aixdesc | mcall-freebsd | mcall-netbsd | mcall-openbsd | mcall-linux | mcall-gnu : -mbig %(cc1_endian_big); mcall-i960-old : -mlittle %(cc1_endian_little); : %(cc1_endian_default)} %{mno-sdata: -msdata=none } %{meabi: %{!mcall-*: -mcall-sysv }} %{!meabi: %{!mno-eabi: %{mrelocatable: -meabi } %{mcall-freebsd: -mno-eabi } %{mcall-i960-old: -meabi } %{mcall-linux: -mno-eabi } %{mcall-gnu: -mno-eabi } %{mcall-netbsd: -mno-eabi } %{mcall-openbsd: -mno-eabi }}} %{msdata: -msdata=default} %{mno-sdata: -msdata=none} %{profile: -p}
*cc1_options:
%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*} %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}} %{g*} %{O*} %{W*&pedantic*} %{w} %{std*} %{ansi} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{--help:--help} %{--target-help:--target-help} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*}
*cc1plus:
*link_gcc_c_sequence:
%G %L %G
*endfile:
%{mgcn : crtsavres.o%s %(endfile_gcn); mogc : crtsavres.o%s %(endfile_gcn); myellowknife : crtsavres.o%s %(endfile_yellowknife) ; mmvme : crtsavres.o%s %(endfile_mvme) ; msim : crtsavres.o%s %(endfile_sim) ; mwindiss : %(endfile_windiss) ; mcall-freebsd: crtsavres.o%s %(endfile_freebsd) ; mcall-linux : crtsavres.o%s %(endfile_linux) ; mcall-gnu : crtsavres.o%s %(endfile_gnu) ; mcall-netbsd : crtsavres.o%s %(endfile_netbsd) ; mcall-openbsd: crtsavres.o%s %(endfile_openbsd) ; : %(crtsavres_default) %(endfile_default) }
*link:
%{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} %{YP,*} %{R*} %{Qy:} %{!Qn:-Qy} %(link_shlib) %{!Wl,-T*: %{!T*: %(link_start) }} %(link_target) %(link_os)
*lib:
%{mgcn : %(lib_gcn); mogc : %(lib_ogc); myellowknife : %(lib_yellowknife) ; mmvme : %(lib_mvme) ; msim : %(lib_sim) ; mwindiss : %(lib_windiss) ; mcall-freebsd: %(lib_freebsd) ; mcall-linux : %(lib_linux) ; mcall-gnu : %(lib_gnu) ; mcall-netbsd : %(lib_netbsd) ; mcall-openbsd: %(lib_openbsd) ; : %(lib_default) }
*libgcc:
-lgcc
*startfile:
%{mgcn : %(startfile_gcn) ; mogc : %(startfile_ogc) ; myellowknife : %(startfile_yellowknife) ; mmvme : %(startfile_mvme) ; msim : %(startfile_sim) ; mwindiss : %(startfile_windiss) ; mcall-freebsd: %(startfile_freebsd) ; mcall-linux : %(startfile_linux) ; mcall-gnu : %(startfile_gnu) ; mcall-netbsd : %(startfile_netbsd) ; mcall-openbsd: %(startfile_openbsd) ; : %(startfile_default) }
*switches_need_spaces:
*cross_compile:
1
*version:
3.4.3
*multilib:
. ;
*multilib_defaults:
mbig mcall-sysv
*multilib_extra:
*multilib_matches:
*multilib_exclusions:
*multilib_options:
*linker:
collect2
*link_libgcc:
%D
*md_exec_prefix:
*md_startfile_prefix:
*md_startfile_prefix_1:
*startfile_prefix_spec:
*sysroot_suffix_spec:
*sysroot_hdrs_suffix_spec:
*cpp_default:
*asm_cpu:
%{!mcpu*: %{mpower: %{!mpower2: -mpwr}} %{mpower2: -mpwrx} %{mpowerpc*: -mppc} %{mno-power: %{!mpowerpc*: -mcom}} %{!mno-power: %{!mpower2: %(asm_default)}}} %{mcpu=common: -mcom} %{mcpu=power: -mpwr} %{mcpu=power2: -mpwrx} %{mcpu=power3: -m604} %{mcpu=power4: -mpower4} %{mcpu=powerpc: -mppc} %{mcpu=rios: -mpwr} %{mcpu=rios1: -mpwr} %{mcpu=rios2: -mpwrx} %{mcpu=rsc: -mpwr} %{mcpu=rsc1: -mpwr} %{mcpu=401: -mppc} %{mcpu=403: -m403} %{mcpu=405: -m405} %{mcpu=405fp: -m405} %{mcpu=440: -m440} %{mcpu=440fp: -m440} %{mcpu=505: -mppc} %{mcpu=601: -m601} %{mcpu=602: -mppc} %{mcpu=603: -mppc} %{mcpu=603e: -mppc} %{mcpu=ec603e: -mppc} %{mcpu=604: -mppc} %{mcpu=604e: -mppc} %{mcpu=620: -mppc} %{mcpu=630: -m604} %{mcpu=740: -mppc} %{mcpu=7400: -mppc} %{mcpu=7450: -mppc} %{mcpu=G4: -mppc} %{mcpu=750: -mppc} %{mcpu=G3: -mppc} %{mcpu=801: -mppc} %{mcpu=821: -mppc} %{mcpu=823: -mppc} %{mcpu=860: -mppc} %{mcpu=970: -mpower4} %{mcpu=G5: -mpower4} %{mcpu=8540: -me500} %{maltivec: -maltivec}
*asm_default:
-mppc
*crtsavres_default:
crtsavres.o%s
*lib_ogc:
--start-group -logcsys -lc --end-group -logc
*lib_gcn:
--start-group -lads -lc --end-group
*lib_yellowknife:
--start-group -lyk -lc --end-group
*lib_mvme:
--start-group -lmvme -lc --end-group
*lib_sim:
--start-group -lsim -lc --end-group
*lib_freebsd:
%{!shared: %{!pg: %{!pthread:-lc} %{pthread:-lc_r}} %{pg: %{!pthread:-lc_p} %{pthread:-lc_r_p}} }
*lib_gnu:
%{mnewlib: --start-group -lgnu -lc --end-group } %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } %{profile:-lc_p} %{!profile:-lc}}}
*lib_linux:
%{mnewlib: --start-group -llinux -lc --end-group } %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} %{!shared: %{profile:-lc_p} %{!profile:-lc}}}
*lib_netbsd:
%{profile:-lgmon -lc_p} %{!profile:-lc}
*lib_openbsd:
%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}
*lib_windiss:
--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group
*lib_default:
*startfile_gcn:
gcn_crt0.o%s ecrti.o%s crtbegin.o%s
*startfile_ogc:
ecrti.o%s crtbegin.o%s
*startfile_yellowknife:
ecrti.o%s crt0.o%s crtbegin.o%s
*startfile_mvme:
ecrti.o%s crt0.o%s crtbegin.o%s
*startfile_sim:
ecrti.o%s sim-crt0.o%s crtbegin.o%s
*startfile_freebsd:
%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:%{profile:gcrt1.o%s} %{!profile:crt1.o%s}}}} crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}
*startfile_gnu:
%{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} %{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}
*startfile_linux:
%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} %{mnewlib:ecrti.o%s;:crti.o%s} %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}
*startfile_netbsd:
ncrti.o%s crt0.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}
*startfile_openbsd:
%{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}
*startfile_windiss:
crt0.o%s crtbegin.o%s
*startfile_default:
*endfile_gcn:
crtend.o%s ecrtn.o%s
*endfile_yellowknife:
crtend.o%s ecrtn.o%s
*endfile_mvme:
crtend.o%s ecrtn.o%s
*endfile_sim:
crtend.o%s ecrtn.o%s
*endfile_freebsd:
%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s
*endfile_gnu:
%{!shared:crtend.o%s} %{shared:crtendS.o%s} %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}
*endfile_linux:
%{!shared:crtend.o%s} %{shared:crtendS.o%s} %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}
*endfile_netbsd:
%{!shared:crtend.o%s} %{shared:crtendS.o%s} ncrtn.o%s
*endfile_openbsd:
%{!shared:crtend.o%s} %{shared:crtendS.o%s}
*endfile_windiss:
crtend.o%s
*endfile_default:
*link_path:
*link_shlib:
%{mshlib: %(link_path) } %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} %{static: } %{shared:-G -dy -z text %(link_path) } %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }
*link_target:
%{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: %{mcall-i960-old: --oformat elf32-powerpcle} }}}}
*link_start:
%{mgcn : %(link_start_gcn); mogc : %(link_start_gcn); myellowknife : %(link_start_yellowknife) ; mmvme : %(link_start_mvme) ; msim : %(link_start_sim) ; mwindiss : %(link_start_windiss) ; mcall-freebsd: %(link_start_freebsd) ; mcall-linux : %(link_start_linux) ; mcall-gnu : %(link_start_gnu) ; mcall-netbsd : %(link_start_netbsd) ; mcall-openbsd: %(link_start_openbsd) ; : %(link_start_default) }
*link_start_gcn:
-T ogc.ld%s
*link_start_yellowknife:
-T yellowknife.ld%s
*link_start_mvme:
-Ttext 0x40000
*link_start_sim:
*link_start_freebsd:
*link_start_gnu:
*link_start_linux:
*link_start_netbsd:
*link_start_openbsd:
-Ttext 0x400074
*link_start_windiss:
*link_start_default:
*link_os:
%{mads : %(link_os_ads) ; myellowknife : %(link_os_yellowknife) ; mmvme : %(link_os_mvme) ; msim : %(link_os_sim) ; mwindiss : %(link_os_windiss) ; mcall-freebsd: %(link_os_freebsd) ; mcall-linux : %(link_os_linux) ; mcall-gnu : %(link_os_gnu) ; mcall-netbsd : %(link_os_netbsd) ; mcall-openbsd: %(link_os_openbsd) ; : %(link_os_default) }
*link_os_ads:
*link_os_yellowknife:
*link_os_mvme:
*link_os_sim:
-m elf32ppcsim
*link_os_freebsd:
%{p:%e`-p' not supported; use `-pg' and gprof(1)} %{Wl,*:%*} %{v:-V} %{assert*} %{R*} %{rpath*} %{defsym*} %{shared:-Bshareable %{h*} %{soname*}} %{!shared: %{!static: %{rdynamic: -export-dynamic} %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} %{static:-Bstatic}} %{symbolic:-Bsymbolic}
*link_os_linux:
-m elf32ppclinux %{!shared: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}
*link_os_gnu:
-m elf32ppclinux %{!shared: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}
*link_os_netbsd:
%{!shared: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}
*link_os_openbsd:
*link_os_windiss:
*link_os_default:
*cc1_endian_big:
*cc1_endian_little:
%{!mstrict-align: %{!mno-strict-align: %{!mcall-i960-old: -mstrict-align } }}
*cc1_endian_default:
%(cc1_endian_big)
*cpp_os_ads:
*cpp_os_yellowknife:
*cpp_os_mvme:
*cpp_os_sim:
*cpp_os_freebsd:
-D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ -Acpu=powerpc -Amachine=powerpc
*cpp_os_gnu:
-D__unix__ -D__gnu_hurd__ -D__GNU__ %{!undef: %{!ansi: -Dunix -D__unix}} -Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}
*cpp_os_linux:
-D__unix__ -D__gnu_linux__ -D__linux__ %{!undef: %{!ansi: %{!std=*:-Dunix -D__unix -Dlinux -D__linux} %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} -Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}
*cpp_os_netbsd:
-D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__
*cpp_os_openbsd:
%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}
*cpp_os_windiss:
-D__rtasim -D__EABI__ -D__ppc %{!msoft-float: -D__hardfp}
*cpp_os_default:
*fbsd_dynamic_linker:
/usr/libexec/ld-elf.so.1
*link_command:
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %l %{pie:-pie} %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate:-lgcov} %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}

View File

@ -0,0 +1,17 @@
DEVKITPPC=$INSTALLDIR
#---------------------------------------------------------------------------------
# Install and build the gamecube crt and libogc
#---------------------------------------------------------------------------------
echo "installing specs ..."
cp `pwd`/dkp-crtls/gcn* $DEVKITPPC/$target/lib/
cp `pwd`/dkp-crtls/ogc.ld $DEVKITPPC/$target/lib/
cp `pwd`/dkp-crtls/specs $DEVKITPPC/lib/gcc/$target/$GCC_VER/specs
echo "building libogc ..."
cd $LIBOGC_SRCDIR
$MAKE
echo "installing libogc ..."
$MAKE install

47
dkp-scripts/build-gcc.sh Normal file
View File

@ -0,0 +1,47 @@
prefix=$INSTALLDIR
mkdir -p $target/binutils
cd $target/binutils
../../$BINUTILS_SRCDIR/configure \
--prefix=$prefix --target=$target --disable-nls --disable-shared --disable-debug \
--disable-threads --with-gcc --with-gnu-as --with-gnu-ld --with-stabs \
2>&1 | tee binutils_configure.log
$MAKE | tee binutils_make.log 2>&1
$MAKE install | tee binutils_install.log 2>&1
cd $BUILDSCRIPTDIR
mkdir -p $target/gcc
cd $target/gcc
../../$GCC_SRCDIR/configure \
--enable-languages=c,c++ \
--with-cpu=750\
--with-gcc --with-gnu-ld --with-gnu-as --with-stabs \
--disable-nls --disable-shared --disable-threads --disable-multilib\
--disable-win32-registry\
--target=$target \
--with-newlib \
--prefix=$prefix -v\
2>&1 | tee gcc_configure.log
$MAKE all-gcc | tee gcc_make.log 2>&1
$MAKE install-gcc | tee gcc_install.log 2>&1
cd $BUILDSCRIPTDIR
mkdir -p $target/newlib
cd $target/newlib
../../$NEWLIB_SRCDIR/configure --target=$target --prefix=$prefix | tee newlib_configure.log 2>&1
$MAKE all | tee newlib_make.log 2>&1
$MAKE install | tee newlib_install.log 2>&1
cd $BUILDSCRIPTDIR
cd $target/gcc
$MAKE | tee gcc_final_make.log 2>&1
$MAKE install | tee gcc_final_install.log 2>&1

View File

@ -0,0 +1,390 @@
diff -Nbaur binutils-2.15/config.sub binutils-2.15-gekko/config.sub
--- binutils-2.15/config.sub Mon Jun 2 21:35:44 2003
+++ binutils-2.15-gekko/config.sub Thu Jan 20 09:03:26 2005
@@ -218,6 +218,10 @@
basic_machine=m68k-atari
os=-mint
;;
+ -gekko)
+ basic_machine=powerpc-eabi
+ os=-elf
+ ;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
diff -Nbaur binutils-2.15/bfd/doc/chew.c binutils-2.15-new/bfd/doc/chew.c
--- binutils-2.15/bfd/doc/chew.c Sun Jun 29 11:06:40 2003
+++ binutils-2.15-new/bfd/doc/chew.c Thu Jan 20 20:16:18 2005
@@ -91,6 +91,12 @@
#define DEF_SIZE 5000
#define STACK 50
+#ifdef __MINGW32__
+/* Prevent \r\n\ line endings */
+#include <fcntl.h>
+unsigned int _CRT_fmode = _O_BINARY;
+#endif
+
int internal_wanted;
int internal_mode;
diff -Nbaur binutils-2.15/gas/config/tc-ppc.c binutils-2.15-new/gas/config/tc-ppc.c
--- binutils-2.15/gas/config/tc-ppc.c Mon May 17 20:36:12 2004
+++ binutils-2.15-new/gas/config/tc-ppc.c Fri Jan 21 00:28:36 2005
@@ -310,6 +310,7 @@
sdr1 has the value 25
srr0 has the value 26
srr1 has the value 27
+ gqr0..7 has the value 912..919
The table is sorted. Suitable for searching by a binary search. */
@@ -407,6 +408,15 @@
{ "fpscr", 0 },
+ { "gqr0", 912},
+ { "gqr1", 913},
+ { "gqr2", 914},
+ { "gqr3", 915},
+ { "gqr4", 916},
+ { "gqr5", 917},
+ { "gqr6", 918},
+ { "gqr7", 919},
+
{ "lr", 8 }, /* Link Register */
{ "pmr", 0 },
@@ -906,6 +916,9 @@
ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC
| PPC_OPCODE_64 | PPC_OPCODE_POWER4);
}
+ else if (strcmp (arg, "gekko") == 0)
+ ppc_cpu = PPC_OPCODE_CLASSIC | PPC_OPCODE_PPC | PPC_OPCODE_32 | PPC_OPCODE_GEKKO;
+
/* -mcom means assemble for the common intersection between Power
and PowerPC. At present, we just allow the union, rather
than the intersection. */
@@ -1107,7 +1120,9 @@
-me500, -me500x2 generate code for Motorola e500 core complex\n\
-mspe generate code for Motorola SPE instructions\n\
-mregnames Allow symbolic names for registers\n\
--mno-regnames Do not allow symbolic names for registers\n"));
+-mno-regnames Do not allow symbolic names for registers\n\
+-mspe generate code for Motorola SPE instructions\n\
+-mgekko generate code for PowerPC Gekko\n"));
#ifdef OBJ_ELF
fprintf (stream, _("\
-mrelocatable support for GCC's -mrelocatble option\n\
@@ -1150,6 +1165,8 @@
else
ppc_cpu |= PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_32;
}
+ else if (strcmp(default_cpu, "gekko") == 0)
+ ppc_cpu = PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_32 | PPC_OPCODE_GEKKO;
else
as_fatal (_("Unknown default cpu = %s, os = %s"),
default_cpu, default_os);
@@ -2570,6 +2587,26 @@
{
endc = ')';
need_paren = 0;
+ if (opindex_ptr[1])
+ {
+ /* do check here if we have further opcodes */
+ if (*str != endc && (endc != ',' || *str != '\0'))
+ {
+ as_bad(_("syntax error; found `%c' but expected `%c'"),*str,endc);
+ break;
+ }
+ /* we have to move over whitespace ourselves */
+ if (*str != '\0')
+ {
+ ++str;
+ while (ISSPACE(*str))
+ {
+ ++str;
+ }
+ }
+ /* now we're looking for the comma */
+ endc = ',';
+ }
}
else if ((operand->flags & PPC_OPERAND_PARENS) != 0)
{
@@ -2588,6 +2625,8 @@
break;
}
+ /* The call to expression should have advanced str past any
+ whitespace. */
if (*str != '\0')
++str;
}
diff -Nbaur binutils-2.15/include/opcode/ppc.h binutils-2.15-new/include/opcode/ppc.h
--- binutils-2.15/include/opcode/ppc.h Mon May 17 20:36:06 2004
+++ binutils-2.15-new/include/opcode/ppc.h Thu Jan 20 19:54:34 2005
@@ -134,6 +134,9 @@
/* Opcode is supported by machine check APU. */
#define PPC_OPCODE_RFMCI 0x800000
+/* Opcode is only supported by the PowerPC Gekko processor. */
+#define PPC_OPCODE_GEKKO (040000000)
+
/* A macro to extract the major opcode from an instruction. */
#define PPC_OP(i) (((i) >> 26) & 0x3f)
@@ -281,6 +284,10 @@
/* This operand is for the DQ field in a DQ form instruction. */
#define PPC_OPERAND_DQ (0100000)
+/* This operand names a quantization register. The disassembler
+ prints these with a leading 'gqr'. */
+#define PPC_OPERAND_GQR (040000)
+
/* The POWER and PowerPC assemblers use a few macros. We keep them
with the operands table for simplicity. The macro table is an
array of struct powerpc_macro. */
diff -Nbaur binutils-2.15/opcodes/ppc-dis.c binutils-2.15-new/opcodes/ppc-dis.c
--- binutils-2.15/opcodes/ppc-dis.c Mon May 17 20:35:56 2004
+++ binutils-2.15-new/opcodes/ppc-dis.c Thu Jan 20 19:54:34 2005
@@ -72,6 +72,13 @@
dialect &= ~PPC_OPCODE_ALTIVEC;
}
else
+ if (info->disassembler_options
+ && (strstr (info->disassembler_options, "gekko") == 0))
+ {
+ dialect |= PPC_OPCODE_GEKKO;
+ dialect &= ~PPC_OPCODE_ALTIVEC;
+ }
+ else
dialect |= (PPC_OPCODE_403 | PPC_OPCODE_601 | PPC_OPCODE_CLASSIC
| PPC_OPCODE_COMMON);
@@ -247,6 +254,8 @@
(*info->print_address_func) (memaddr + value, info);
else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0)
(*info->print_address_func) ((bfd_vma) value & 0xffffffff, info);
+ else if ((operand->flags & PPC_OPERAND_GQR) != 0)
+ (*info->fprintf_func) (info->stream, "gqr%ld", value);
else if ((operand->flags & PPC_OPERAND_CR) == 0
|| (dialect & PPC_OPCODE_PPC) == 0)
(*info->fprintf_func) (info->stream, "%ld", value);
@@ -312,4 +321,5 @@
fprintf (stream, " power4 Disassemble the Power4 instructions\n");
fprintf (stream, " 32 Do not disassemble 64-bit instructions\n");
fprintf (stream, " 64 Allow disassembly of 64-bit instructions\n");
+ fprintf (stream, " gekko Disassemble the Gamecube Gekko instructions\n");
}
diff -Nbaur binutils-2.15/opcodes/ppc-opc.c binutils-2.15-new/opcodes/ppc-opc.c
--- binutils-2.15/opcodes/ppc-opc.c Mon May 17 20:35:56 2004
+++ binutils-2.15-new/opcodes/ppc-opc.c Fri Jan 21 00:29:46 2005
@@ -93,6 +93,13 @@
static unsigned long insert_ev8 (unsigned long, long, int, const char **);
static long extract_ev8 (unsigned long, int, int *);
+static unsigned long insert_psq_gd (unsigned long, long, int, const char **);
+static long extract_psq_gd (unsigned long, int, int *);
+static unsigned long insert_psq_gx (unsigned long, long, int, const char **);
+static long extract_psq_gx (unsigned long, int, int *);
+
+
+
/* The operands table.
The fields are bits, shift, insert, extract, flags.
@@ -554,6 +561,25 @@
#define MTMSRD_L WS + 1
{ 1, 16, 0, 0, PPC_OPERAND_OPTIONAL },
+ /* I Field in psq_ instructions */
+#define PSQ_DD MTMSRD_L + 1
+ { 12, 0, 0, 0, PPC_OPERAND_PARENS|PPC_OPERAND_SIGNED },
+
+ /* W Field in psq_ instructions */
+#define PSQ_WD PSQ_DD + 1
+ { 1, 15, 0, 0, 0 },
+
+ /* d Field in psq_ instructions */
+#define PSQ_GD PSQ_WD + 1
+ { 10, 12, insert_psq_gd, extract_psq_gd, PPC_OPERAND_GQR },
+
+ /* I Field in psq_ instructions A*/
+#define PSQ_WX PSQ_GD + 1
+ { 1, 10, 0, 0, 0 },
+
+ /* W Field in psq_ instructions */
+#define PSQ_GX PSQ_WX + 1
+ { 10, 7, insert_psq_gx, extract_psq_gx, PPC_OPERAND_GQR },
};
/* The functions used to insert and extract complicated operands. */
@@ -1417,6 +1443,48 @@
return ret;
}
+static unsigned long
+insert_psq_gd (unsigned long insn,
+ long value,
+ int dialect ATTRIBUTE_UNUSED,
+ const char **errmsg)
+{
+ if (value >= 912 && value <= 919)
+ value -= 912;
+ if (value < 0 || value > 7)
+ *errmsg = _("invalid quantization register");
+ return insn | ((value & 7) << 12);
+}
+
+static long
+extract_psq_gd (unsigned long insn,
+ int dialect ATTRIBUTE_UNUSED,
+ int *invalid ATTRIBUTE_UNUSED)
+{
+ return ((insn & 0x7000) >> 12);
+}
+
+static unsigned long
+insert_psq_gx (unsigned long insn,
+ long value,
+ int dialect ATTRIBUTE_UNUSED,
+ const char **errmsg)
+{
+ if (value >= 912 && value <= 919)
+ value -= 912;
+ if (value < 0 || value > 7)
+ *errmsg = _("invalid quantization register");
+ return insn | ((value & 7) << 7);
+}
+
+static long
+extract_psq_gx (unsigned long insn,
+ int dialect ATTRIBUTE_UNUSED,
+ int *invalid ATTRIBUTE_UNUSED)
+{
+ return ((insn & 0x380) >> 7);
+}
+
/* Macros used to form opcodes. */
/* The main opcode. */
@@ -1696,6 +1764,10 @@
#define XUC(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x1f))
#define XUC_MASK XUC(0x3f, 0x1f)
+/* A PSQ style load/store indexed */
+#define PSQX(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x7f))
+#define PSQX_MASK PSQX(0x3f,0x7f)
+
/* The BO encodings used in extended conditional branch mnemonics. */
#define BODNZF (0x0)
#define BODNZFP (0x1)
@@ -1786,6 +1858,7 @@
#define PPCCHLK PPC_OPCODE_CACHELCK
#define PPCCHLK64 PPC_OPCODE_CACHELCK | PPC_OPCODE_BOOKE64
#define PPCRFMCI PPC_OPCODE_RFMCI
+#define PPCGEKKO PPC_OPCODE_GEKKO
/* The opcode table.
@@ -4558,6 +4631,99 @@
{ "fcfid", XRC(63,846,0), XRA_MASK, PPC64, { FRT, FRB } },
{ "fcfid.", XRC(63,846,1), XRA_MASK, PPC64, { FRT, FRB } },
+
+/* GEKKO specific stuff */
+{ "dcbz_l", X(4,1014), XRT_MASK, PPCGEKKO, { RA, RB }},
+
+{ "ps_abs", XRC(4,264,0), XRA_MASK, PPCGEKKO, { FRT,FRB }},
+{ "ps_abs.", XRC(4,264,1), XRA_MASK, PPCGEKKO, { FRT,FRB }},
+
+{ "ps_add", A(4,21,0), AFRC_MASK, PPCGEKKO, { FRT, FRA, FRB }},
+{ "ps_add.", A(4,21,1), AFRC_MASK, PPCGEKKO, { FRT, FRA, FRB }},
+
+{ "ps_cmpo0", X(4,32), X_MASK|(3<<21), PPCGEKKO, { BF, FRA, FRB }},
+{ "ps_cmpo1", X(4,96), X_MASK|(3<<21), PPCGEKKO, { BF, FRA, FRB }},
+
+{ "ps_cmpu0", X(4,0), X_MASK|(3<<21), PPCGEKKO, { BF, FRA, FRB }},
+{ "ps_cmpu1", X(4,64), X_MASK|(3<<21), PPCGEKKO, { BF, FRA, FRB }},
+
+{ "ps_div", A(4,18,0), AFRC_MASK, PPCGEKKO, { FRT, FRA, FRB }},
+{ "ps_div.", A(4,18,1), AFRC_MASK, PPCGEKKO, { FRT, FRA, FRB }},
+
+{ "ps_madd", A(4,29,0), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+{ "ps_madd.", A(4,29,1), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+
+{ "ps_madds0", A(4,14,0), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+{ "ps_madds0.", A(4,14,1), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+
+{ "ps_madds1", A(4,15,0), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+{ "ps_madds1.", A(4,15,1), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+
+{ "ps_merge00", XRC(4,528,0), X_MASK, PPCGEKKO, { FRT,FRA,FRB }},
+{ "ps_merge00.", XRC(4,528,1), X_MASK, PPCGEKKO, { FRT,FRA,FRB }},
+
+{ "ps_merge01", XRC(4,560,0), X_MASK, PPCGEKKO, { FRT,FRA,FRB }},
+{ "ps_merge01.", XRC(4,560,1), X_MASK, PPCGEKKO, { FRT,FRA,FRB }},
+
+{ "ps_merge10", XRC(4,592,0), X_MASK, PPCGEKKO, { FRT,FRA,FRB }},
+{ "ps_merge10.", XRC(4,592,1), X_MASK, PPCGEKKO, { FRT,FRA,FRB }},
+
+{ "ps_merge11", XRC(4,624,0), X_MASK, PPCGEKKO, { FRT,FRA,FRB }},
+{ "ps_merge11.", XRC(4,624,1), X_MASK, PPCGEKKO, { FRT,FRA,FRB }},
+
+{ "ps_mr", XRC(4,72,0), XRA_MASK, PPCGEKKO, { FRT, FRB }},
+{ "ps_mr.", XRC(4,72,1), XRA_MASK, PPCGEKKO, { FRT, FRB }},
+
+{ "ps_msub", A(4,28,0), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+{ "ps_msub.", A(4,28,1), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+
+{ "ps_mul", A(4,25,0), AFRB_MASK, PPCGEKKO, { FRT,FRA,FRC }},
+{ "ps_mul.", A(4,25,1), AFRB_MASK, PPCGEKKO, { FRT,FRA,FRC }},
+
+{ "ps_muls0", A(4,12,0), AFRB_MASK, PPCGEKKO, { FRT,FRA,FRC }},
+{ "ps_muls0.", A(4,12,1), AFRB_MASK, PPCGEKKO, { FRT,FRA,FRC }},
+
+{ "ps_muls1", A(4,13,0), AFRB_MASK, PPCGEKKO, { FRT,FRA,FRC }},
+{ "ps_muls1.", A(4,13,1), AFRB_MASK, PPCGEKKO, { FRT,FRA,FRC }},
+
+{ "ps_nabs", XRC(4,136,0), XRA_MASK, PPCGEKKO, { FRT, FRB }},
+{ "ps_nabs.", XRC(4,136,1), XRA_MASK, PPCGEKKO, { FRT, FRB }},
+
+{ "ps_neg", XRC(4,40,0), XRA_MASK, PPCGEKKO, { FRT, FRB }},
+{ "ps_neg.", XRC(4,40,1), XRA_MASK, PPCGEKKO, { FRT, FRB }},
+
+{ "ps_nmadd", A(4,31,0), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+{ "ps_nmadd.", A(4,31,1), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+
+{ "ps_nmsub", A(4,30,0), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+{ "ps_nmsub.", A(4,30,1), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+
+{ "ps_res", A(4,13,0), AFRAFRC_MASK, PPCGEKKO, { FRT,FRB }},
+{ "ps_res.", A(4,13,1), AFRAFRC_MASK, PPCGEKKO, { FRT,FRB }},
+
+{ "ps_rsqrte", A(4,26,0), AFRAFRC_MASK, PPCGEKKO, { FRT,FRB }},
+{ "ps_rsqrte.", A(4,26,1), AFRAFRC_MASK, PPCGEKKO, { FRT,FRB }},
+
+{ "ps_sel", A(4,23,0), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+{ "ps_sel.", A(4,23,1), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+
+{ "ps_sub", A(4,20,0), AFRC_MASK, PPCGEKKO, { FRT, FRA, FRB }},
+{ "ps_sub.", A(4,20,1), AFRC_MASK, PPCGEKKO, { FRT, FRA, FRB }},
+
+{ "ps_sum0", A(4,10,0), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+{ "ps_sum0.", A(4,10,1), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+
+{ "ps_sum1", A(4,11,0), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+{ "ps_sum1.", A(4,11,1), A_MASK, PPCGEKKO, { FRT,FRA,FRC,FRB }},
+
+{ "psq_l", OP(56), OP_MASK, PPCGEKKO, { FRT,PSQ_DD,RA,PSQ_WD,PSQ_GD }},
+{ "psq_lu", OP(57), OP_MASK, PPCGEKKO, { FRT,PSQ_DD,RA,PSQ_WD,PSQ_GD }},
+{ "psq_lux", PSQX(4,76),PSQX_MASK, PPCGEKKO, { FRT,RA,RB,PSQ_WX,PSQ_GX }},
+{ "psq_lx", PSQX(4,12),PSQX_MASK, PPCGEKKO, { FRT,RA,RB,PSQ_WX,PSQ_GX }},
+{ "psq_st", OP(60), OP_MASK, PPCGEKKO, { FRT,PSQ_DD,RA,PSQ_WD,PSQ_GD }},
+{ "psq_stu", OP(61), OP_MASK, PPCGEKKO, { FRT,PSQ_DD,RA,PSQ_WD,PSQ_GD }},
+{ "psq_stux", PSQX(4,78), PSQX_MASK, PPCGEKKO, { FRT,RA,RB,PSQ_WX,PSQ_GX }},
+{ "psq_stx", PSQX(4,14), PSQX_MASK, PPCGEKKO, { FRT,RA,RB,PSQ_WX,PSQ_GX }},
};

11772
patches/devkit-gcc-3.4.3.patch Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff