├── .gitignore ├── README.TXT ├── build-devkit.sh ├── config.guess ├── config.sh.sample ├── dka64 ├── patches │ ├── binutils-2.44.patch │ ├── gcc-15.1.0.patch │ └── newlib-4.5.0.20241231.patch ├── rules │ ├── base_rules │ └── base_tools └── scripts │ ├── build-crtls.sh │ └── build-gcc.sh ├── dkarm-eabi ├── patches │ ├── gcc-15.1.0.patch │ └── newlib-4.5.0.20241231.patch └── scripts │ ├── build-crtls.sh │ └── build-gcc.sh ├── dkppc ├── crtls │ ├── gcn.ld │ ├── ogc.ld │ └── rvl.ld ├── patches │ ├── binutils-2.44.patch │ ├── gcc-15.1.0.patch │ └── newlib-4.5.0.20241231.patch └── scripts │ ├── build-crtls.sh │ └── build-gcc.sh ├── makedist.sh ├── select_toolchain.sh ├── strip_bins.sh └── strip_toolchain.sh /.gitignore: -------------------------------------------------------------------------------- 1 | config.sh 2 | .devkitARM* 3 | .devkitPPC* 4 | .devkitA64* 5 | *.xz 6 | *.gz 7 | *.bz2 8 | *~ 9 | -------------------------------------------------------------------------------- /README.TXT: -------------------------------------------------------------------------------- 1 | devkitPro build scripts 2 | -------------------------- 3 | 4 | This readme will guide you through building devkitARM, devkitPPC or devkitA64 5 | from source using a set of scripts. 6 | 7 | Please note that we can't guarantee that what you build with these scripts 8 | will function in the same way as the binaries we distribute. Where possible 9 | you should use the binary distributions. We also offer no support for any 10 | problems you may encounter with these scripts. 11 | 12 | The windows versions of the toolchains are now cross compiled on linux using 13 | mingw-w64 14 | 15 | Preparing to build 16 | -------------------------- 17 | 18 | required packages for building on debian/*buntu 19 | 20 | sudo apt-get install build-essential autoconf automake bison flex libncurses5-dev 21 | libreadline-dev texinfo pkg-config 22 | 23 | For building gcc libgmp, libmpfr and libmpc are required - these are built as 24 | static libraries to make packaging simpler. If you're building the tools for 25 | personal use then the versions packaged by your chosen distro should suffice. 26 | 27 | https://gmplib.org/ 28 | https://www.mpfr.org/ 29 | https://www.multiprecision.org/ 30 | 31 | sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev 32 | 33 | Some of the tools for devkitARM and devkitPPC also require FreeImage, zlib, 34 | expat, and libusb. Again these are built as static libraries for ease of 35 | packaging but you can probably use the versions supplied by your distro. 36 | 37 | https://freeimage.sourceforge.net/ 38 | https://www.zlib.net 39 | https://www.libusb.org 40 | https://expat.sourceforge.net/ 41 | 42 | sudo apt-get install libfreeimage-dev zlib1g-dev libusb-dev libudev-dev libexpat1-dev 43 | 44 | 45 | Building gxtexconv for cube/wii needs GL/gl.h which can be obtained with 46 | 47 | sudo apt-get install mesa-common-dev 48 | 49 | Tools for devkitA64 require liblz4. 50 | 51 | http://lz4.github.io/lz4/ 52 | 53 | sudo apt-get install liblz4-dev 54 | 55 | The liblz4 with Ubuntu 14.04 isn't new enough. Either upgrade to at least 16.04 or 56 | build this from source. 57 | 58 | For building the OSX versions we install the Xcode commandline tools and build 59 | pkg-config from source as well as static versions of the libraries listed above. 60 | This helps keep the dependencies to a minimum so end users can use the tools 61 | with only Xcode command line tools to obtain make. 62 | 63 | To avoid having to manually answer prompts during the build the script will 64 | read variables from config.sh if it exists. Copy config.sh.sample to config.sh 65 | and set the variables as appropriate for your build. 66 | 67 | The script will download the source packages it needs. These will be downloaded 68 | to the script directory by default but you can set BUILD_DKPRO_SRCDIR if you want 69 | to put them somewhere else. When its finished you have the option to delete 70 | all temporary files, sources and their source packages. 71 | 72 | 73 | Building the devkits 74 | -------------------- 75 | 76 | Simply run the "build-devkit.sh" script in the same directory as this text file 77 | as shown below, then follow the prompts; 78 | 79 | ./build-devkit.sh 80 | 81 | Several examples tarballs are provided for the platforms supported by devkitARM & 82 | devkitPPC, these include basic templates for starting your own projects. 83 | See http://wiki.devkitpro.org/index.php/Getting_Started for links. 84 | 85 | Using devkitARM 86 | --------------- 87 | 88 | to use the built in crt0 and linkscript use arm-none-eabi-gcc to link your project 89 | 90 | Several specs files are built in for the various platforms 91 | 92 | -specs=gba.specs for a normal GBA cart image. 93 | -specs=gba_mb.specs for a GBA multiboot image. 94 | -specs=gba_er for an eReader GBA binary. 95 | -specs=ds_arm9 for a DS arm9 binary. 96 | -specs=ds_arm7 for a DS arm7 binary. 97 | -specs=ds_cart for a DS arm7 binary which runs from GBA cart. 98 | -specs=gp32.specs for standard GP32 app. 99 | -specs=gp32_gpsdk.specs for official gamepark SDK GP32 app. 100 | -specs=3dsx.specs for a 3DS homebrew binary. 101 | 102 | Using devkitPPC 103 | --------------- 104 | 105 | to use the built in crt0 and linkscript use powerpc-eabi-gcc to link your project, 106 | using the command line switch -mgcn for a bare bones system, -mogc to use libogc and 107 | the multi-threaded microkernel for gamecube, -mrvl for wii, -mwup for wii u. 108 | 109 | 110 | Getting started 111 | --------------- 112 | 113 | The best thing to do next is test the compiler, so grab an examples tarball 114 | from sourceforge & run make in the top level. 115 | 116 | Credits 117 | ------- 118 | 119 | * Thanks to WinterMute for bringing us devkitPro, the website is http://www.devkitpro.org 120 | * Build scripts written by WinterMute and tied together by GreenGianT 121 | * Thanks to Mr Spiv, Honkey Kong, Raleigh and JoostP for OS X testing 122 | * libctru by Smealum, YellowS8, fincs, mtheall & WinterMute with contributions from many others. 123 | * libogc written and supplied by Shagkur. Additional code by WinterMute, Bushing, Marcan & Tybor 124 | * libgba by WinterMute 125 | * libnds by Joat, Dovoto and WinterMute with contributions from many others. 126 | * dswifi by Sgstair 127 | * libfat by Chishm 128 | * libmirko by Mr Mirko 129 | * maxmod by eKid 130 | * b2fxec by Mr Spiv 131 | * scripts made BSD compatible by o2addict 132 | 133 | - irc.blitzed.org #gbadev, #dsdev, #wiidev forever! 134 | 135 | -------------------------------------------------------------------------------- /build-devkit.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #--------------------------------------------------------------------------------- 3 | # devkitARM release 66 4 | # devkitPPC release 47 5 | # devkitA64 release 28 6 | #--------------------------------------------------------------------------------- 7 | 8 | if [ 0 -eq 1 ] ; then 9 | echo "Please use the latest release buildscripts unless advised otherwise by devkitPro staff." 10 | echo "https://github.com/devkitPro/buildscripts/releases/latest" 11 | echo 12 | echo "The scripts in the git repository may be dependent on things which currently only exist" 13 | echo "on developer machines. This is not a bug, use stable releases." 14 | exit 1 15 | fi 16 | 17 | echo "Please note, these scripts are provided as a courtesy, toolchains built with them" 18 | echo "are for personal use only and may not be distributed by entities other than devkitPro." 19 | echo "See http://devkitpro.org/wiki/Trademarks" 20 | echo 21 | echo "Users should use devkitPro pacman to maintain toolchain installations where possible" 22 | echo "See https://devkitpro.org/wiki/devkitPro_pacman" 23 | echo 24 | echo "Patches and improvements are of course welcome, please submit a PR" 25 | echo "https://github.com/devkitPro/buildscripts/pulls" 26 | echo 27 | 28 | 29 | 30 | DKARM_RULES_VER=1.6.1 31 | DKARM_CRTLS_VER=1.2.7 32 | 33 | DKPPC_RULES_VER=1.2.1 34 | 35 | DKA64_RULES_VER=1.1.1 36 | 37 | OSXMIN=${OSXMIN:-10.9} 38 | 39 | #--------------------------------------------------------------------------------- 40 | # find proper patch 41 | #--------------------------------------------------------------------------------- 42 | if [ -z "$PATCH" -a -x "$(which gpatch)" ]; then PATCH=$(which gpatch); fi 43 | if [ -z "$PATCH" -a -x "$(which patch)" ]; then PATCH=$(which patch); fi 44 | if [ -z "$PATCH" ]; then 45 | echo no patch found 46 | exit 1 47 | fi 48 | echo use $PATCH as patch 49 | export PATCH 50 | 51 | #--------------------------------------------------------------------------------- 52 | function extract_and_patch { 53 | #--------------------------------------------------------------------------------- 54 | if [ ! -f extracted-$1-$2 ]; then 55 | echo "extracting $1-$2" 56 | tar -xf "$SRCDIR/$1-$2.tar.$3" || { echo "Error extracting "$1; exit 1; } 57 | touch extracted-$1-$2 58 | fi 59 | if [[ ! -f patched-$1-$2 && -f $patchdir/$1-$2.patch ]]; then 60 | echo "patching $1-$2" 61 | $PATCH -p1 -d $1-$2 -i $patchdir/$1-$2.patch || { echo "Error patching $1"; exit 1; } 62 | touch patched-$1-$2 63 | fi 64 | } 65 | 66 | if [ ! -z "$CROSSBUILD" ] ; then 67 | if [ ! -x $(which $CROSSBUILD-gcc) ]; then 68 | echo "error $CROSSBUILD-gcc not in PATH" 69 | exit 1 70 | fi 71 | fi 72 | 73 | #--------------------------------------------------------------------------------- 74 | # Look for automated configuration file to bypass prompts 75 | #--------------------------------------------------------------------------------- 76 | 77 | echo -n "Looking for configuration file... " 78 | if [ -f ./config.sh ]; then 79 | echo "Found." 80 | . ./config.sh 81 | else 82 | echo "Not found" 83 | fi 84 | . ./select_toolchain.sh 85 | 86 | #--------------------------------------------------------------------------------- 87 | # Legacy versions of these scripts allowed the selection of a prefix which is 88 | # no longer supported. Since adopting pacman and providing precompiled binaries 89 | # of "portlibs" everything we distribute is intended to work within opt/devkitpro 90 | # 91 | # Rather than attempting to repackage our work for exotic linux distributions it 92 | # would be much better for everyone concerned if efforts were made to provide 93 | # pacman and whatever support is necessary to allow the binaries we distribute to 94 | # work as expected. 95 | # 96 | # See https://github.com/devkitPro/pacman and https://devkitpro.org/wiki/devkitPro_pacman 97 | #--------------------------------------------------------------------------------- 98 | INSTALLDIR=/opt/devkitpro 99 | 100 | [ ! -z "$INSTALLDIR" ] && mkdir -p $INSTALLDIR && touch $INSTALLDIR/nonexistantfile && rm $INSTALLDIR/nonexistantfile || exit 1; 101 | 102 | if test "`curl -V`"; then 103 | FETCH="curl -f -L -O" 104 | elif test "`wget -V`"; then 105 | FETCH=wget 106 | else 107 | echo "ERROR: Please make sure you have wget or curl installed." 108 | exit 1 109 | fi 110 | 111 | 112 | #--------------------------------------------------------------------------------- 113 | # find proper make 114 | #--------------------------------------------------------------------------------- 115 | if [ -z "$MAKE" -a -x "$(which gnumake)" ]; then MAKE=$(which gnumake); fi 116 | if [ -z "$MAKE" -a -x "$(which gmake)" ]; then MAKE=$(which gmake); fi 117 | if [ -z "$MAKE" -a -x "$(which make)" ]; then MAKE=$(which make); fi 118 | if [ -z "$MAKE" ]; then 119 | echo no make found 120 | exit 1 121 | fi 122 | echo use $MAKE as make 123 | export MAKE 124 | 125 | CROSS_PARAMS="--build=`./config.guess`" 126 | 127 | if [ ! -z $CROSSBUILD ]; then 128 | export PATH=/opt/devkitpro/$package/bin:$PATH 129 | prefix=$INSTALLDIR/$CROSSBUILD/$package 130 | CROSS_PARAMS="$CROSS_PARAMS --host=$CROSSBUILD" 131 | CROSS_GCC_PARAMS="--with-gmp=$CROSSPATH --with-mpfr=$CROSSPATH --with-mpc=$CROSSPATH --with-isl=$CROSSPATH --with-zstd=$CROSSPATH" 132 | else 133 | prefix=$INSTALLDIR/$package 134 | fi 135 | 136 | #--------------------------------------------------------------------------------- 137 | # Add installed devkit to the path, adjusting path on minsys 138 | #--------------------------------------------------------------------------------- 139 | TOOLPATH=$(echo $INSTALLDIR | sed -e 's/^\([a-zA-Z]\):/\/\1/') 140 | export PATH=$TOOLPATH/$package/bin:$PATH 141 | 142 | if [ "$BUILD_DKPRO_AUTOMATED" != "1" ] ; then 143 | 144 | echo 145 | echo 'Ready to install '$package' in '$prefix 146 | echo 147 | echo 'press return to continue' 148 | 149 | read dummy 150 | fi 151 | PLATFORM=`uname -s` 152 | 153 | case $PLATFORM in 154 | Darwin ) 155 | cppflags="-mmacosx-version-min=${OSXMIN} -I/usr/local/include" 156 | ldflags="-mmacosx-version-min=${OSXMIN} -L/usr/local/lib" 157 | if [ "x${OSXSDKPATH}x" != "xx" ]; then 158 | cppflags="$cppflags -isysroot ${OSXSDKPATH}" 159 | ldflags="$ldflags -Wl,-syslibroot,${OSXSDKPATH}" 160 | fi 161 | TESTCC=`cc -v 2>&1 | grep clang` 162 | if [ "x${TESTCC}x" != "xx" ]; then 163 | cppflags="$cppflags -fbracket-depth=512" 164 | fi 165 | ;; 166 | MINGW32* ) 167 | cppflags="-D__USE_MINGW_ACCESS -D__USE_MINGW_ANSI_STDIO=1" 168 | ;; 169 | esac 170 | 171 | if [ ! -z $CROSSBUILD ] && grep -q "mingw" <<<"$CROSSBUILD" ; then 172 | cppflags="-D__USE_MINGW_ACCESS -D__USE_MINGW_ANSI_STDIO=1" 173 | fi 174 | 175 | 176 | BUILDSCRIPTDIR=$(pwd) 177 | BUILDDIR=$(pwd)/.$package 178 | 179 | if [ ! -z $CROSSBUILD ]; then 180 | BUILDDIR=$BUILDDIR-$CROSSBUILD 181 | fi 182 | 183 | patchdir=$(pwd)/$basedir/patches 184 | scriptdir=$(pwd)/$basedir/scripts 185 | 186 | archives="binutils-${BINUTILS_VER}.tar.xz gcc-${GCC_VER}.tar.xz newlib-${NEWLIB_VER}.tar.gz" 187 | 188 | if [ $VERSION -eq 2 ]; then 189 | archives="binutils-${MN_BINUTILS_VER}.tar.bz2 $archives" 190 | fi 191 | 192 | if [ "$BUILD_DKPRO_SKIP_CRTLS" != "1" ]; then 193 | if [ $VERSION -eq 1 ]; then 194 | archives="devkitarm-rules-$DKARM_RULES_VER.tar.gz devkitarm-crtls-$DKARM_CRTLS_VER.tar.gz $archives" 195 | fi 196 | 197 | if [ $VERSION -eq 2 ]; then 198 | archives="devkitppc-rules-$DKPPC_RULES_VER.tar.gz $archives" 199 | fi 200 | 201 | if [ $VERSION -eq 3 ]; then 202 | archives="devkita64-rules-$DKA64_RULES_VER.tar.gz $archives" 203 | fi 204 | fi 205 | 206 | if [ ! -z "$BUILD_DKPRO_SRCDIR" ] ; then 207 | SRCDIR="$BUILD_DKPRO_SRCDIR" 208 | else 209 | SRCDIR=`pwd` 210 | fi 211 | 212 | cd "$SRCDIR" 213 | for archive in $archives 214 | do 215 | echo $archive 216 | if [ ! -f $archive ]; then 217 | $FETCH https://downloads.devkitpro.org/$archive || { echo "Error: Failed to download $archive"; exit 1; } 218 | fi 219 | done 220 | 221 | cd $BUILDSCRIPTDIR 222 | mkdir -p $BUILDDIR 223 | cd $BUILDDIR 224 | 225 | extract_and_patch binutils $BINUTILS_VER xz 226 | extract_and_patch gcc $GCC_VER xz 227 | extract_and_patch newlib $NEWLIB_VER gz 228 | 229 | if [ $VERSION -eq 2 ]; then extract_and_patch binutils $MN_BINUTILS_VER bz2; fi 230 | 231 | #--------------------------------------------------------------------------------- 232 | # Build and install devkit components 233 | #--------------------------------------------------------------------------------- 234 | if [ -f $scriptdir/build-gcc.sh ]; then . $scriptdir/build-gcc.sh || { echo "Error building toolchain"; exit 1; }; cd $BUILDSCRIPTDIR; fi 235 | 236 | 237 | if [ "$BUILD_DKPRO_SKIP_CRTLS" != "1" ] && [ -f $scriptdir/build-crtls.sh ]; then 238 | . $scriptdir/build-crtls.sh || { echo "Error building crtls & rules"; exit 1; }; cd $BUILDSCRIPTDIR; 239 | fi 240 | 241 | cd $BUILDSCRIPTDIR 242 | 243 | if [ "$BUILD_DKPRO_NO_STRIP_BINARIES" != "1" ]; then 244 | echo "stripping installed binaries" 245 | . ./strip_bins.sh 246 | fi 247 | 248 | #--------------------------------------------------------------------------------- 249 | # Clean up temporary files and source directories 250 | #--------------------------------------------------------------------------------- 251 | 252 | cd $BUILDSCRIPTDIR 253 | 254 | if [ "$BUILD_DKPRO_AUTOMATED" != "1" ] ; then 255 | echo 256 | echo "Would you like to delete the build folders and patched sources? [Y/n]" 257 | read answer 258 | else 259 | answer=y 260 | fi 261 | 262 | if [ "$answer" != "n" -a "$answer" != "N" ]; then 263 | 264 | echo "Removing patched sources and build directories" 265 | rm -fr $BUILDDIR 266 | fi 267 | 268 | 269 | echo 270 | echo "note: Add the following to your environment;" 271 | echo 272 | echo " DEVKITPRO=$TOOLPATH" 273 | if [ "$toolchain" != "DEVKITA64" ]; then 274 | echo " $toolchain=$TOOLPATH/$package" 275 | fi 276 | echo 277 | echo "add $TOOLPATH/tools/bin to your PATH" 278 | echo 279 | echo 280 | -------------------------------------------------------------------------------- /config.guess: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Attempt to guess a canonical system name. 3 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 4 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, 5 | # Inc. 6 | 7 | timestamp='2006-07-02' 8 | 9 | # This file is free software; you can redistribute it and/or modify it 10 | # under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, but 15 | # WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 22 | # 02110-1301, USA. 23 | # 24 | # As a special exception to the GNU General Public License, if you 25 | # distribute this file as part of a program that contains a 26 | # configuration script generated by Autoconf, you may include it under 27 | # the same distribution terms that you use for the rest of that program. 28 | 29 | 30 | # Originally written by Per Bothner . 31 | # Please send patches to . Submit a context 32 | # diff and a properly formatted ChangeLog entry. 33 | # 34 | # This script attempts to guess a canonical system name similar to 35 | # config.sub. If it succeeds, it prints the system name on stdout, and 36 | # exits with 0. Otherwise, it exits with 1. 37 | # 38 | # The plan is that this can be called by configure scripts if you 39 | # don't specify an explicit build system type. 40 | 41 | me=`echo "$0" | sed -e 's,.*/,,'` 42 | 43 | usage="\ 44 | Usage: $0 [OPTION] 45 | 46 | Output the configuration name of the system \`$me' is run on. 47 | 48 | Operation modes: 49 | -h, --help print this help, then exit 50 | -t, --time-stamp print date of last modification, then exit 51 | -v, --version print version number, then exit 52 | 53 | Report bugs and patches to ." 54 | 55 | version="\ 56 | GNU config.guess ($timestamp) 57 | 58 | Originally written by Per Bothner. 59 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 60 | Free Software Foundation, Inc. 61 | 62 | This is free software; see the source for copying conditions. There is NO 63 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 64 | 65 | help=" 66 | Try \`$me --help' for more information." 67 | 68 | # Parse command line 69 | while test $# -gt 0 ; do 70 | case $1 in 71 | --time-stamp | --time* | -t ) 72 | echo "$timestamp" ; exit ;; 73 | --version | -v ) 74 | echo "$version" ; exit ;; 75 | --help | --h* | -h ) 76 | echo "$usage"; exit ;; 77 | -- ) # Stop option processing 78 | shift; break ;; 79 | - ) # Use stdin as input. 80 | break ;; 81 | -* ) 82 | echo "$me: invalid option $1$help" >&2 83 | exit 1 ;; 84 | * ) 85 | break ;; 86 | esac 87 | done 88 | 89 | if test $# != 0; then 90 | echo "$me: too many arguments$help" >&2 91 | exit 1 92 | fi 93 | 94 | trap 'exit 1' 1 2 15 95 | 96 | # CC_FOR_BUILD -- compiler used by this script. Note that the use of a 97 | # compiler to aid in system detection is discouraged as it requires 98 | # temporary files to be created and, as you can see below, it is a 99 | # headache to deal with in a portable fashion. 100 | 101 | # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still 102 | # use `HOST_CC' if defined, but it is deprecated. 103 | 104 | # Portable tmp directory creation inspired by the Autoconf team. 105 | 106 | set_cc_for_build=' 107 | trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; 108 | trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; 109 | : ${TMPDIR=/tmp} ; 110 | { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || 111 | { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || 112 | { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || 113 | { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; 114 | dummy=$tmp/dummy ; 115 | tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; 116 | case $CC_FOR_BUILD,$HOST_CC,$CC in 117 | ,,) echo "int x;" > $dummy.c ; 118 | for c in cc gcc c89 c99 ; do 119 | if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then 120 | CC_FOR_BUILD="$c"; break ; 121 | fi ; 122 | done ; 123 | if test x"$CC_FOR_BUILD" = x ; then 124 | CC_FOR_BUILD=no_compiler_found ; 125 | fi 126 | ;; 127 | ,,*) CC_FOR_BUILD=$CC ;; 128 | ,*,*) CC_FOR_BUILD=$HOST_CC ;; 129 | esac ; set_cc_for_build= ;' 130 | 131 | # This is needed to find uname on a Pyramid OSx when run in the BSD universe. 132 | # (ghazi@noc.rutgers.edu 1994-08-24) 133 | if (test -f /.attbin/uname) >/dev/null 2>&1 ; then 134 | PATH=$PATH:/.attbin ; export PATH 135 | fi 136 | 137 | UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown 138 | UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown 139 | UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown 140 | UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown 141 | 142 | # Note: order is significant - the case branches are not exclusive. 143 | 144 | case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in 145 | *:NetBSD:*:*) 146 | # NetBSD (nbsd) targets should (where applicable) match one or 147 | # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, 148 | # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently 149 | # switched to ELF, *-*-netbsd* would select the old 150 | # object file format. This provides both forward 151 | # compatibility and a consistent mechanism for selecting the 152 | # object file format. 153 | # 154 | # Note: NetBSD doesn't particularly care about the vendor 155 | # portion of the name. We always set it to "unknown". 156 | sysctl="sysctl -n hw.machine_arch" 157 | UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ 158 | /usr/sbin/$sysctl 2>/dev/null || echo unknown)` 159 | case "${UNAME_MACHINE_ARCH}" in 160 | armeb) machine=armeb-unknown ;; 161 | arm*) machine=arm-unknown ;; 162 | sh3el) machine=shl-unknown ;; 163 | sh3eb) machine=sh-unknown ;; 164 | *) machine=${UNAME_MACHINE_ARCH}-unknown ;; 165 | esac 166 | # The Operating System including object format, if it has switched 167 | # to ELF recently, or will in the future. 168 | case "${UNAME_MACHINE_ARCH}" in 169 | arm*|i386|m68k|ns32k|sh3*|sparc|vax) 170 | eval $set_cc_for_build 171 | if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ 172 | | grep __ELF__ >/dev/null 173 | then 174 | # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). 175 | # Return netbsd for either. FIX? 176 | os=netbsd 177 | else 178 | os=netbsdelf 179 | fi 180 | ;; 181 | *) 182 | os=netbsd 183 | ;; 184 | esac 185 | # The OS release 186 | # Debian GNU/NetBSD machines have a different userland, and 187 | # thus, need a distinct triplet. However, they do not need 188 | # kernel version information, so it can be replaced with a 189 | # suitable tag, in the style of linux-gnu. 190 | case "${UNAME_VERSION}" in 191 | Debian*) 192 | release='-gnu' 193 | ;; 194 | *) 195 | release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` 196 | ;; 197 | esac 198 | # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: 199 | # contains redundant information, the shorter form: 200 | # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. 201 | echo "${machine}-${os}${release}" 202 | exit ;; 203 | *:OpenBSD:*:*) 204 | UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` 205 | echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} 206 | exit ;; 207 | *:ekkoBSD:*:*) 208 | echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} 209 | exit ;; 210 | *:SolidBSD:*:*) 211 | echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} 212 | exit ;; 213 | macppc:MirBSD:*:*) 214 | echo powerpc-unknown-mirbsd${UNAME_RELEASE} 215 | exit ;; 216 | *:MirBSD:*:*) 217 | echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} 218 | exit ;; 219 | alpha:OSF1:*:*) 220 | case $UNAME_RELEASE in 221 | *4.0) 222 | UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` 223 | ;; 224 | *5.*) 225 | UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` 226 | ;; 227 | esac 228 | # According to Compaq, /usr/sbin/psrinfo has been available on 229 | # OSF/1 and Tru64 systems produced since 1995. I hope that 230 | # covers most systems running today. This code pipes the CPU 231 | # types through head -n 1, so we only detect the type of CPU 0. 232 | ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` 233 | case "$ALPHA_CPU_TYPE" in 234 | "EV4 (21064)") 235 | UNAME_MACHINE="alpha" ;; 236 | "EV4.5 (21064)") 237 | UNAME_MACHINE="alpha" ;; 238 | "LCA4 (21066/21068)") 239 | UNAME_MACHINE="alpha" ;; 240 | "EV5 (21164)") 241 | UNAME_MACHINE="alphaev5" ;; 242 | "EV5.6 (21164A)") 243 | UNAME_MACHINE="alphaev56" ;; 244 | "EV5.6 (21164PC)") 245 | UNAME_MACHINE="alphapca56" ;; 246 | "EV5.7 (21164PC)") 247 | UNAME_MACHINE="alphapca57" ;; 248 | "EV6 (21264)") 249 | UNAME_MACHINE="alphaev6" ;; 250 | "EV6.7 (21264A)") 251 | UNAME_MACHINE="alphaev67" ;; 252 | "EV6.8CB (21264C)") 253 | UNAME_MACHINE="alphaev68" ;; 254 | "EV6.8AL (21264B)") 255 | UNAME_MACHINE="alphaev68" ;; 256 | "EV6.8CX (21264D)") 257 | UNAME_MACHINE="alphaev68" ;; 258 | "EV6.9A (21264/EV69A)") 259 | UNAME_MACHINE="alphaev69" ;; 260 | "EV7 (21364)") 261 | UNAME_MACHINE="alphaev7" ;; 262 | "EV7.9 (21364A)") 263 | UNAME_MACHINE="alphaev79" ;; 264 | esac 265 | # A Pn.n version is a patched version. 266 | # A Vn.n version is a released version. 267 | # A Tn.n version is a released field test version. 268 | # A Xn.n version is an unreleased experimental baselevel. 269 | # 1.2 uses "1.2" for uname -r. 270 | echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` 271 | exit ;; 272 | Alpha\ *:Windows_NT*:*) 273 | # How do we know it's Interix rather than the generic POSIX subsystem? 274 | # Should we change UNAME_MACHINE based on the output of uname instead 275 | # of the specific Alpha model? 276 | echo alpha-pc-interix 277 | exit ;; 278 | 21064:Windows_NT:50:3) 279 | echo alpha-dec-winnt3.5 280 | exit ;; 281 | Amiga*:UNIX_System_V:4.0:*) 282 | echo m68k-unknown-sysv4 283 | exit ;; 284 | *:[Aa]miga[Oo][Ss]:*:*) 285 | echo ${UNAME_MACHINE}-unknown-amigaos 286 | exit ;; 287 | *:[Mm]orph[Oo][Ss]:*:*) 288 | echo ${UNAME_MACHINE}-unknown-morphos 289 | exit ;; 290 | *:OS/390:*:*) 291 | echo i370-ibm-openedition 292 | exit ;; 293 | *:z/VM:*:*) 294 | echo s390-ibm-zvmoe 295 | exit ;; 296 | *:OS400:*:*) 297 | echo powerpc-ibm-os400 298 | exit ;; 299 | arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) 300 | echo arm-acorn-riscix${UNAME_RELEASE} 301 | exit ;; 302 | arm:riscos:*:*|arm:RISCOS:*:*) 303 | echo arm-unknown-riscos 304 | exit ;; 305 | SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) 306 | echo hppa1.1-hitachi-hiuxmpp 307 | exit ;; 308 | Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) 309 | # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. 310 | if test "`(/bin/universe) 2>/dev/null`" = att ; then 311 | echo pyramid-pyramid-sysv3 312 | else 313 | echo pyramid-pyramid-bsd 314 | fi 315 | exit ;; 316 | NILE*:*:*:dcosx) 317 | echo pyramid-pyramid-svr4 318 | exit ;; 319 | DRS?6000:unix:4.0:6*) 320 | echo sparc-icl-nx6 321 | exit ;; 322 | DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) 323 | case `/usr/bin/uname -p` in 324 | sparc) echo sparc-icl-nx7; exit ;; 325 | esac ;; 326 | sun4H:SunOS:5.*:*) 327 | echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 328 | exit ;; 329 | sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) 330 | echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 331 | exit ;; 332 | i86pc:SunOS:5.*:*) 333 | echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 334 | exit ;; 335 | sun4*:SunOS:6*:*) 336 | # According to config.sub, this is the proper way to canonicalize 337 | # SunOS6. Hard to guess exactly what SunOS6 will be like, but 338 | # it's likely to be more like Solaris than SunOS4. 339 | echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 340 | exit ;; 341 | sun4*:SunOS:*:*) 342 | case "`/usr/bin/arch -k`" in 343 | Series*|S4*) 344 | UNAME_RELEASE=`uname -v` 345 | ;; 346 | esac 347 | # Japanese Language versions have a version number like `4.1.3-JL'. 348 | echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` 349 | exit ;; 350 | sun3*:SunOS:*:*) 351 | echo m68k-sun-sunos${UNAME_RELEASE} 352 | exit ;; 353 | sun*:*:4.2BSD:*) 354 | UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` 355 | test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 356 | case "`/bin/arch`" in 357 | sun3) 358 | echo m68k-sun-sunos${UNAME_RELEASE} 359 | ;; 360 | sun4) 361 | echo sparc-sun-sunos${UNAME_RELEASE} 362 | ;; 363 | esac 364 | exit ;; 365 | aushp:SunOS:*:*) 366 | echo sparc-auspex-sunos${UNAME_RELEASE} 367 | exit ;; 368 | # The situation for MiNT is a little confusing. The machine name 369 | # can be virtually everything (everything which is not 370 | # "atarist" or "atariste" at least should have a processor 371 | # > m68000). The system name ranges from "MiNT" over "FreeMiNT" 372 | # to the lowercase version "mint" (or "freemint"). Finally 373 | # the system name "TOS" denotes a system which is actually not 374 | # MiNT. But MiNT is downward compatible to TOS, so this should 375 | # be no problem. 376 | atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) 377 | echo m68k-atari-mint${UNAME_RELEASE} 378 | exit ;; 379 | atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) 380 | echo m68k-atari-mint${UNAME_RELEASE} 381 | exit ;; 382 | *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) 383 | echo m68k-atari-mint${UNAME_RELEASE} 384 | exit ;; 385 | milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) 386 | echo m68k-milan-mint${UNAME_RELEASE} 387 | exit ;; 388 | hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) 389 | echo m68k-hades-mint${UNAME_RELEASE} 390 | exit ;; 391 | *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) 392 | echo m68k-unknown-mint${UNAME_RELEASE} 393 | exit ;; 394 | m68k:machten:*:*) 395 | echo m68k-apple-machten${UNAME_RELEASE} 396 | exit ;; 397 | powerpc:machten:*:*) 398 | echo powerpc-apple-machten${UNAME_RELEASE} 399 | exit ;; 400 | RISC*:Mach:*:*) 401 | echo mips-dec-mach_bsd4.3 402 | exit ;; 403 | RISC*:ULTRIX:*:*) 404 | echo mips-dec-ultrix${UNAME_RELEASE} 405 | exit ;; 406 | VAX*:ULTRIX*:*:*) 407 | echo vax-dec-ultrix${UNAME_RELEASE} 408 | exit ;; 409 | 2020:CLIX:*:* | 2430:CLIX:*:*) 410 | echo clipper-intergraph-clix${UNAME_RELEASE} 411 | exit ;; 412 | mips:*:*:UMIPS | mips:*:*:RISCos) 413 | eval $set_cc_for_build 414 | sed 's/^ //' << EOF >$dummy.c 415 | #ifdef __cplusplus 416 | #include /* for printf() prototype */ 417 | int main (int argc, char *argv[]) { 418 | #else 419 | int main (argc, argv) int argc; char *argv[]; { 420 | #endif 421 | #if defined (host_mips) && defined (MIPSEB) 422 | #if defined (SYSTYPE_SYSV) 423 | printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); 424 | #endif 425 | #if defined (SYSTYPE_SVR4) 426 | printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); 427 | #endif 428 | #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) 429 | printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); 430 | #endif 431 | #endif 432 | exit (-1); 433 | } 434 | EOF 435 | $CC_FOR_BUILD -o $dummy $dummy.c && 436 | dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && 437 | SYSTEM_NAME=`$dummy $dummyarg` && 438 | { echo "$SYSTEM_NAME"; exit; } 439 | echo mips-mips-riscos${UNAME_RELEASE} 440 | exit ;; 441 | Motorola:PowerMAX_OS:*:*) 442 | echo powerpc-motorola-powermax 443 | exit ;; 444 | Motorola:*:4.3:PL8-*) 445 | echo powerpc-harris-powermax 446 | exit ;; 447 | Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) 448 | echo powerpc-harris-powermax 449 | exit ;; 450 | Night_Hawk:Power_UNIX:*:*) 451 | echo powerpc-harris-powerunix 452 | exit ;; 453 | m88k:CX/UX:7*:*) 454 | echo m88k-harris-cxux7 455 | exit ;; 456 | m88k:*:4*:R4*) 457 | echo m88k-motorola-sysv4 458 | exit ;; 459 | m88k:*:3*:R3*) 460 | echo m88k-motorola-sysv3 461 | exit ;; 462 | AViiON:dgux:*:*) 463 | # DG/UX returns AViiON for all architectures 464 | UNAME_PROCESSOR=`/usr/bin/uname -p` 465 | if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] 466 | then 467 | if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ 468 | [ ${TARGET_BINARY_INTERFACE}x = x ] 469 | then 470 | echo m88k-dg-dgux${UNAME_RELEASE} 471 | else 472 | echo m88k-dg-dguxbcs${UNAME_RELEASE} 473 | fi 474 | else 475 | echo i586-dg-dgux${UNAME_RELEASE} 476 | fi 477 | exit ;; 478 | M88*:DolphinOS:*:*) # DolphinOS (SVR3) 479 | echo m88k-dolphin-sysv3 480 | exit ;; 481 | M88*:*:R3*:*) 482 | # Delta 88k system running SVR3 483 | echo m88k-motorola-sysv3 484 | exit ;; 485 | XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) 486 | echo m88k-tektronix-sysv3 487 | exit ;; 488 | Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) 489 | echo m68k-tektronix-bsd 490 | exit ;; 491 | *:IRIX*:*:*) 492 | echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` 493 | exit ;; 494 | ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. 495 | echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id 496 | exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' 497 | i*86:AIX:*:*) 498 | echo i386-ibm-aix 499 | exit ;; 500 | ia64:AIX:*:*) 501 | if [ -x /usr/bin/oslevel ] ; then 502 | IBM_REV=`/usr/bin/oslevel` 503 | else 504 | IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} 505 | fi 506 | echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} 507 | exit ;; 508 | *:AIX:2:3) 509 | if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then 510 | eval $set_cc_for_build 511 | sed 's/^ //' << EOF >$dummy.c 512 | #include 513 | 514 | main() 515 | { 516 | if (!__power_pc()) 517 | exit(1); 518 | puts("powerpc-ibm-aix3.2.5"); 519 | exit(0); 520 | } 521 | EOF 522 | if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` 523 | then 524 | echo "$SYSTEM_NAME" 525 | else 526 | echo rs6000-ibm-aix3.2.5 527 | fi 528 | elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then 529 | echo rs6000-ibm-aix3.2.4 530 | else 531 | echo rs6000-ibm-aix3.2 532 | fi 533 | exit ;; 534 | *:AIX:*:[45]) 535 | IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` 536 | if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then 537 | IBM_ARCH=rs6000 538 | else 539 | IBM_ARCH=powerpc 540 | fi 541 | if [ -x /usr/bin/oslevel ] ; then 542 | IBM_REV=`/usr/bin/oslevel` 543 | else 544 | IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} 545 | fi 546 | echo ${IBM_ARCH}-ibm-aix${IBM_REV} 547 | exit ;; 548 | *:AIX:*:*) 549 | echo rs6000-ibm-aix 550 | exit ;; 551 | ibmrt:4.4BSD:*|romp-ibm:BSD:*) 552 | echo romp-ibm-bsd4.4 553 | exit ;; 554 | ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and 555 | echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to 556 | exit ;; # report: romp-ibm BSD 4.3 557 | *:BOSX:*:*) 558 | echo rs6000-bull-bosx 559 | exit ;; 560 | DPX/2?00:B.O.S.:*:*) 561 | echo m68k-bull-sysv3 562 | exit ;; 563 | 9000/[34]??:4.3bsd:1.*:*) 564 | echo m68k-hp-bsd 565 | exit ;; 566 | hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) 567 | echo m68k-hp-bsd4.4 568 | exit ;; 569 | 9000/[34678]??:HP-UX:*:*) 570 | HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` 571 | case "${UNAME_MACHINE}" in 572 | 9000/31? ) HP_ARCH=m68000 ;; 573 | 9000/[34]?? ) HP_ARCH=m68k ;; 574 | 9000/[678][0-9][0-9]) 575 | if [ -x /usr/bin/getconf ]; then 576 | sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` 577 | sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` 578 | case "${sc_cpu_version}" in 579 | 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 580 | 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 581 | 532) # CPU_PA_RISC2_0 582 | case "${sc_kernel_bits}" in 583 | 32) HP_ARCH="hppa2.0n" ;; 584 | 64) HP_ARCH="hppa2.0w" ;; 585 | '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 586 | esac ;; 587 | esac 588 | fi 589 | if [ "${HP_ARCH}" = "" ]; then 590 | eval $set_cc_for_build 591 | sed 's/^ //' << EOF >$dummy.c 592 | 593 | #define _HPUX_SOURCE 594 | #include 595 | #include 596 | 597 | int main () 598 | { 599 | #if defined(_SC_KERNEL_BITS) 600 | long bits = sysconf(_SC_KERNEL_BITS); 601 | #endif 602 | long cpu = sysconf (_SC_CPU_VERSION); 603 | 604 | switch (cpu) 605 | { 606 | case CPU_PA_RISC1_0: puts ("hppa1.0"); break; 607 | case CPU_PA_RISC1_1: puts ("hppa1.1"); break; 608 | case CPU_PA_RISC2_0: 609 | #if defined(_SC_KERNEL_BITS) 610 | switch (bits) 611 | { 612 | case 64: puts ("hppa2.0w"); break; 613 | case 32: puts ("hppa2.0n"); break; 614 | default: puts ("hppa2.0"); break; 615 | } break; 616 | #else /* !defined(_SC_KERNEL_BITS) */ 617 | puts ("hppa2.0"); break; 618 | #endif 619 | default: puts ("hppa1.0"); break; 620 | } 621 | exit (0); 622 | } 623 | EOF 624 | (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` 625 | test -z "$HP_ARCH" && HP_ARCH=hppa 626 | fi ;; 627 | esac 628 | if [ ${HP_ARCH} = "hppa2.0w" ] 629 | then 630 | eval $set_cc_for_build 631 | 632 | # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating 633 | # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler 634 | # generating 64-bit code. GNU and HP use different nomenclature: 635 | # 636 | # $ CC_FOR_BUILD=cc ./config.guess 637 | # => hppa2.0w-hp-hpux11.23 638 | # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess 639 | # => hppa64-hp-hpux11.23 640 | 641 | if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | 642 | grep __LP64__ >/dev/null 643 | then 644 | HP_ARCH="hppa2.0w" 645 | else 646 | HP_ARCH="hppa64" 647 | fi 648 | fi 649 | echo ${HP_ARCH}-hp-hpux${HPUX_REV} 650 | exit ;; 651 | ia64:HP-UX:*:*) 652 | HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` 653 | echo ia64-hp-hpux${HPUX_REV} 654 | exit ;; 655 | 3050*:HI-UX:*:*) 656 | eval $set_cc_for_build 657 | sed 's/^ //' << EOF >$dummy.c 658 | #include 659 | int 660 | main () 661 | { 662 | long cpu = sysconf (_SC_CPU_VERSION); 663 | /* The order matters, because CPU_IS_HP_MC68K erroneously returns 664 | true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct 665 | results, however. */ 666 | if (CPU_IS_PA_RISC (cpu)) 667 | { 668 | switch (cpu) 669 | { 670 | case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; 671 | case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; 672 | case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; 673 | default: puts ("hppa-hitachi-hiuxwe2"); break; 674 | } 675 | } 676 | else if (CPU_IS_HP_MC68K (cpu)) 677 | puts ("m68k-hitachi-hiuxwe2"); 678 | else puts ("unknown-hitachi-hiuxwe2"); 679 | exit (0); 680 | } 681 | EOF 682 | $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && 683 | { echo "$SYSTEM_NAME"; exit; } 684 | echo unknown-hitachi-hiuxwe2 685 | exit ;; 686 | 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) 687 | echo hppa1.1-hp-bsd 688 | exit ;; 689 | 9000/8??:4.3bsd:*:*) 690 | echo hppa1.0-hp-bsd 691 | exit ;; 692 | *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) 693 | echo hppa1.0-hp-mpeix 694 | exit ;; 695 | hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) 696 | echo hppa1.1-hp-osf 697 | exit ;; 698 | hp8??:OSF1:*:*) 699 | echo hppa1.0-hp-osf 700 | exit ;; 701 | i*86:OSF1:*:*) 702 | if [ -x /usr/sbin/sysversion ] ; then 703 | echo ${UNAME_MACHINE}-unknown-osf1mk 704 | else 705 | echo ${UNAME_MACHINE}-unknown-osf1 706 | fi 707 | exit ;; 708 | parisc*:Lites*:*:*) 709 | echo hppa1.1-hp-lites 710 | exit ;; 711 | C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) 712 | echo c1-convex-bsd 713 | exit ;; 714 | C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) 715 | if getsysinfo -f scalar_acc 716 | then echo c32-convex-bsd 717 | else echo c2-convex-bsd 718 | fi 719 | exit ;; 720 | C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) 721 | echo c34-convex-bsd 722 | exit ;; 723 | C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) 724 | echo c38-convex-bsd 725 | exit ;; 726 | C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) 727 | echo c4-convex-bsd 728 | exit ;; 729 | CRAY*Y-MP:*:*:*) 730 | echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 731 | exit ;; 732 | CRAY*[A-Z]90:*:*:*) 733 | echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ 734 | | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ 735 | -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ 736 | -e 's/\.[^.]*$/.X/' 737 | exit ;; 738 | CRAY*TS:*:*:*) 739 | echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 740 | exit ;; 741 | CRAY*T3E:*:*:*) 742 | echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 743 | exit ;; 744 | CRAY*SV1:*:*:*) 745 | echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 746 | exit ;; 747 | *:UNICOS/mp:*:*) 748 | echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 749 | exit ;; 750 | F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) 751 | FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` 752 | FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` 753 | FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` 754 | echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" 755 | exit ;; 756 | 5000:UNIX_System_V:4.*:*) 757 | FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` 758 | FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` 759 | echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" 760 | exit ;; 761 | i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) 762 | echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} 763 | exit ;; 764 | sparc*:BSD/OS:*:*) 765 | echo sparc-unknown-bsdi${UNAME_RELEASE} 766 | exit ;; 767 | *:BSD/OS:*:*) 768 | echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} 769 | exit ;; 770 | *:FreeBSD:*:*) 771 | case ${UNAME_MACHINE} in 772 | pc98) 773 | echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; 774 | amd64) 775 | echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; 776 | *) 777 | echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; 778 | esac 779 | exit ;; 780 | i*:CYGWIN*:*) 781 | echo ${UNAME_MACHINE}-pc-cygwin 782 | exit ;; 783 | i*:MINGW*:*) 784 | echo ${UNAME_MACHINE}-pc-mingw32 785 | exit ;; 786 | i*:windows32*:*) 787 | # uname -m includes "-pc" on this system. 788 | echo ${UNAME_MACHINE}-mingw32 789 | exit ;; 790 | i*:PW*:*) 791 | echo ${UNAME_MACHINE}-pc-pw32 792 | exit ;; 793 | x86:Interix*:[3456]*) 794 | echo i586-pc-interix${UNAME_RELEASE} 795 | exit ;; 796 | EM64T:Interix*:[3456]*) 797 | echo x86_64-unknown-interix${UNAME_RELEASE} 798 | exit ;; 799 | [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) 800 | echo i${UNAME_MACHINE}-pc-mks 801 | exit ;; 802 | i*:Windows_NT*:* | Pentium*:Windows_NT*:*) 803 | # How do we know it's Interix rather than the generic POSIX subsystem? 804 | # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we 805 | # UNAME_MACHINE based on the output of uname instead of i386? 806 | echo i586-pc-interix 807 | exit ;; 808 | i*:UWIN*:*) 809 | echo ${UNAME_MACHINE}-pc-uwin 810 | exit ;; 811 | amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) 812 | echo x86_64-unknown-cygwin 813 | exit ;; 814 | p*:CYGWIN*:*) 815 | echo powerpcle-unknown-cygwin 816 | exit ;; 817 | prep*:SunOS:5.*:*) 818 | echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 819 | exit ;; 820 | *:GNU:*:*) 821 | # the GNU system 822 | echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` 823 | exit ;; 824 | *:GNU/*:*:*) 825 | # other systems with GNU libc and userland 826 | echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu 827 | exit ;; 828 | i*86:Minix:*:*) 829 | echo ${UNAME_MACHINE}-pc-minix 830 | exit ;; 831 | arm*:Linux:*:*) 832 | echo ${UNAME_MACHINE}-unknown-linux-gnu 833 | exit ;; 834 | avr32*:Linux:*:*) 835 | echo ${UNAME_MACHINE}-unknown-linux-gnu 836 | exit ;; 837 | cris:Linux:*:*) 838 | echo cris-axis-linux-gnu 839 | exit ;; 840 | crisv32:Linux:*:*) 841 | echo crisv32-axis-linux-gnu 842 | exit ;; 843 | frv:Linux:*:*) 844 | echo frv-unknown-linux-gnu 845 | exit ;; 846 | ia64:Linux:*:*) 847 | echo ${UNAME_MACHINE}-unknown-linux-gnu 848 | exit ;; 849 | m32r*:Linux:*:*) 850 | echo ${UNAME_MACHINE}-unknown-linux-gnu 851 | exit ;; 852 | m68*:Linux:*:*) 853 | echo ${UNAME_MACHINE}-unknown-linux-gnu 854 | exit ;; 855 | mips:Linux:*:*) 856 | eval $set_cc_for_build 857 | sed 's/^ //' << EOF >$dummy.c 858 | #undef CPU 859 | #undef mips 860 | #undef mipsel 861 | #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) 862 | CPU=mipsel 863 | #else 864 | #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) 865 | CPU=mips 866 | #else 867 | CPU= 868 | #endif 869 | #endif 870 | EOF 871 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' 872 | /^CPU/{ 873 | s: ::g 874 | p 875 | }'`" 876 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } 877 | ;; 878 | mips64:Linux:*:*) 879 | eval $set_cc_for_build 880 | sed 's/^ //' << EOF >$dummy.c 881 | #undef CPU 882 | #undef mips64 883 | #undef mips64el 884 | #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) 885 | CPU=mips64el 886 | #else 887 | #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) 888 | CPU=mips64 889 | #else 890 | CPU= 891 | #endif 892 | #endif 893 | EOF 894 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' 895 | /^CPU/{ 896 | s: ::g 897 | p 898 | }'`" 899 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } 900 | ;; 901 | or32:Linux:*:*) 902 | echo or32-unknown-linux-gnu 903 | exit ;; 904 | ppc:Linux:*:*) 905 | echo powerpc-unknown-linux-gnu 906 | exit ;; 907 | ppc64:Linux:*:*) 908 | echo powerpc64-unknown-linux-gnu 909 | exit ;; 910 | alpha:Linux:*:*) 911 | case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in 912 | EV5) UNAME_MACHINE=alphaev5 ;; 913 | EV56) UNAME_MACHINE=alphaev56 ;; 914 | PCA56) UNAME_MACHINE=alphapca56 ;; 915 | PCA57) UNAME_MACHINE=alphapca56 ;; 916 | EV6) UNAME_MACHINE=alphaev6 ;; 917 | EV67) UNAME_MACHINE=alphaev67 ;; 918 | EV68*) UNAME_MACHINE=alphaev68 ;; 919 | esac 920 | objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null 921 | if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi 922 | echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} 923 | exit ;; 924 | parisc:Linux:*:* | hppa:Linux:*:*) 925 | # Look for CPU level 926 | case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in 927 | PA7*) echo hppa1.1-unknown-linux-gnu ;; 928 | PA8*) echo hppa2.0-unknown-linux-gnu ;; 929 | *) echo hppa-unknown-linux-gnu ;; 930 | esac 931 | exit ;; 932 | parisc64:Linux:*:* | hppa64:Linux:*:*) 933 | echo hppa64-unknown-linux-gnu 934 | exit ;; 935 | s390:Linux:*:* | s390x:Linux:*:*) 936 | echo ${UNAME_MACHINE}-ibm-linux 937 | exit ;; 938 | sh64*:Linux:*:*) 939 | echo ${UNAME_MACHINE}-unknown-linux-gnu 940 | exit ;; 941 | sh*:Linux:*:*) 942 | echo ${UNAME_MACHINE}-unknown-linux-gnu 943 | exit ;; 944 | sparc:Linux:*:* | sparc64:Linux:*:*) 945 | echo ${UNAME_MACHINE}-unknown-linux-gnu 946 | exit ;; 947 | vax:Linux:*:*) 948 | echo ${UNAME_MACHINE}-dec-linux-gnu 949 | exit ;; 950 | x86_64:Linux:*:*) 951 | echo x86_64-unknown-linux-gnu 952 | exit ;; 953 | i*86:Linux:*:*) 954 | # The BFD linker knows what the default object file format is, so 955 | # first see if it will tell us. cd to the root directory to prevent 956 | # problems with other programs or directories called `ld' in the path. 957 | # Set LC_ALL=C to ensure ld outputs messages in English. 958 | ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ 959 | | sed -ne '/supported targets:/!d 960 | s/[ ][ ]*/ /g 961 | s/.*supported targets: *// 962 | s/ .*// 963 | p'` 964 | case "$ld_supported_targets" in 965 | elf32-i386) 966 | TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" 967 | ;; 968 | a.out-i386-linux) 969 | echo "${UNAME_MACHINE}-pc-linux-gnuaout" 970 | exit ;; 971 | coff-i386) 972 | echo "${UNAME_MACHINE}-pc-linux-gnucoff" 973 | exit ;; 974 | "") 975 | # Either a pre-BFD a.out linker (linux-gnuoldld) or 976 | # one that does not give us useful --help. 977 | echo "${UNAME_MACHINE}-pc-linux-gnuoldld" 978 | exit ;; 979 | esac 980 | # Determine whether the default compiler is a.out or elf 981 | eval $set_cc_for_build 982 | sed 's/^ //' << EOF >$dummy.c 983 | #include 984 | #ifdef __ELF__ 985 | # ifdef __GLIBC__ 986 | # if __GLIBC__ >= 2 987 | LIBC=gnu 988 | # else 989 | LIBC=gnulibc1 990 | # endif 991 | # else 992 | LIBC=gnulibc1 993 | # endif 994 | #else 995 | #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) 996 | LIBC=gnu 997 | #else 998 | LIBC=gnuaout 999 | #endif 1000 | #endif 1001 | #ifdef __dietlibc__ 1002 | LIBC=dietlibc 1003 | #endif 1004 | EOF 1005 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' 1006 | /^LIBC/{ 1007 | s: ::g 1008 | p 1009 | }'`" 1010 | test x"${LIBC}" != x && { 1011 | echo "${UNAME_MACHINE}-pc-linux-${LIBC}" 1012 | exit 1013 | } 1014 | test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } 1015 | ;; 1016 | i*86:DYNIX/ptx:4*:*) 1017 | # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. 1018 | # earlier versions are messed up and put the nodename in both 1019 | # sysname and nodename. 1020 | echo i386-sequent-sysv4 1021 | exit ;; 1022 | i*86:UNIX_SV:4.2MP:2.*) 1023 | # Unixware is an offshoot of SVR4, but it has its own version 1024 | # number series starting with 2... 1025 | # I am not positive that other SVR4 systems won't match this, 1026 | # I just have to hope. -- rms. 1027 | # Use sysv4.2uw... so that sysv4* matches it. 1028 | echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} 1029 | exit ;; 1030 | i*86:OS/2:*:*) 1031 | # If we were able to find `uname', then EMX Unix compatibility 1032 | # is probably installed. 1033 | echo ${UNAME_MACHINE}-pc-os2-emx 1034 | exit ;; 1035 | i*86:XTS-300:*:STOP) 1036 | echo ${UNAME_MACHINE}-unknown-stop 1037 | exit ;; 1038 | i*86:atheos:*:*) 1039 | echo ${UNAME_MACHINE}-unknown-atheos 1040 | exit ;; 1041 | i*86:syllable:*:*) 1042 | echo ${UNAME_MACHINE}-pc-syllable 1043 | exit ;; 1044 | i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) 1045 | echo i386-unknown-lynxos${UNAME_RELEASE} 1046 | exit ;; 1047 | i*86:*DOS:*:*) 1048 | echo ${UNAME_MACHINE}-pc-msdosdjgpp 1049 | exit ;; 1050 | i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) 1051 | UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` 1052 | if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then 1053 | echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} 1054 | else 1055 | echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} 1056 | fi 1057 | exit ;; 1058 | i*86:*:5:[678]*) 1059 | # UnixWare 7.x, OpenUNIX and OpenServer 6. 1060 | case `/bin/uname -X | grep "^Machine"` in 1061 | *486*) UNAME_MACHINE=i486 ;; 1062 | *Pentium) UNAME_MACHINE=i586 ;; 1063 | *Pent*|*Celeron) UNAME_MACHINE=i686 ;; 1064 | esac 1065 | echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} 1066 | exit ;; 1067 | i*86:*:3.2:*) 1068 | if test -f /usr/options/cb.name; then 1069 | UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then 1072 | UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` 1073 | (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 1074 | (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ 1075 | && UNAME_MACHINE=i586 1076 | (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ 1077 | && UNAME_MACHINE=i686 1078 | (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ 1079 | && UNAME_MACHINE=i686 1080 | echo ${UNAME_MACHINE}-pc-sco$UNAME_REL 1081 | else 1082 | echo ${UNAME_MACHINE}-pc-sysv32 1083 | fi 1084 | exit ;; 1085 | pc:*:*:*) 1086 | # Left here for compatibility: 1087 | # uname -m prints for DJGPP always 'pc', but it prints nothing about 1088 | # the processor, so we play safe by assuming i386. 1089 | echo i386-pc-msdosdjgpp 1090 | exit ;; 1091 | Intel:Mach:3*:*) 1092 | echo i386-pc-mach3 1093 | exit ;; 1094 | paragon:*:*:*) 1095 | echo i860-intel-osf1 1096 | exit ;; 1097 | i860:*:4.*:*) # i860-SVR4 1098 | if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then 1099 | echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 1100 | else # Add other i860-SVR4 vendors below as they are discovered. 1101 | echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 1102 | fi 1103 | exit ;; 1104 | mini*:CTIX:SYS*5:*) 1105 | # "miniframe" 1106 | echo m68010-convergent-sysv 1107 | exit ;; 1108 | mc68k:UNIX:SYSTEM5:3.51m) 1109 | echo m68k-convergent-sysv 1110 | exit ;; 1111 | M680?0:D-NIX:5.3:*) 1112 | echo m68k-diab-dnix 1113 | exit ;; 1114 | M68*:*:R3V[5678]*:*) 1115 | test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 1116 | 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) 1117 | OS_REL='' 1118 | test -r /etc/.relid \ 1119 | && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` 1120 | /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 1121 | && { echo i486-ncr-sysv4.3${OS_REL}; exit; } 1122 | /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ 1123 | && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 1124 | 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) 1125 | /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 1126 | && { echo i486-ncr-sysv4; exit; } ;; 1127 | m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) 1128 | echo m68k-unknown-lynxos${UNAME_RELEASE} 1129 | exit ;; 1130 | mc68030:UNIX_System_V:4.*:*) 1131 | echo m68k-atari-sysv4 1132 | exit ;; 1133 | TSUNAMI:LynxOS:2.*:*) 1134 | echo sparc-unknown-lynxos${UNAME_RELEASE} 1135 | exit ;; 1136 | rs6000:LynxOS:2.*:*) 1137 | echo rs6000-unknown-lynxos${UNAME_RELEASE} 1138 | exit ;; 1139 | PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) 1140 | echo powerpc-unknown-lynxos${UNAME_RELEASE} 1141 | exit ;; 1142 | SM[BE]S:UNIX_SV:*:*) 1143 | echo mips-dde-sysv${UNAME_RELEASE} 1144 | exit ;; 1145 | RM*:ReliantUNIX-*:*:*) 1146 | echo mips-sni-sysv4 1147 | exit ;; 1148 | RM*:SINIX-*:*:*) 1149 | echo mips-sni-sysv4 1150 | exit ;; 1151 | *:SINIX-*:*:*) 1152 | if uname -p 2>/dev/null >/dev/null ; then 1153 | UNAME_MACHINE=`(uname -p) 2>/dev/null` 1154 | echo ${UNAME_MACHINE}-sni-sysv4 1155 | else 1156 | echo ns32k-sni-sysv 1157 | fi 1158 | exit ;; 1159 | PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort 1160 | # says 1161 | echo i586-unisys-sysv4 1162 | exit ;; 1163 | *:UNIX_System_V:4*:FTX*) 1164 | # From Gerald Hewes . 1165 | # How about differentiating between stratus architectures? -djm 1166 | echo hppa1.1-stratus-sysv4 1167 | exit ;; 1168 | *:*:*:FTX*) 1169 | # From seanf@swdc.stratus.com. 1170 | echo i860-stratus-sysv4 1171 | exit ;; 1172 | i*86:VOS:*:*) 1173 | # From Paul.Green@stratus.com. 1174 | echo ${UNAME_MACHINE}-stratus-vos 1175 | exit ;; 1176 | *:VOS:*:*) 1177 | # From Paul.Green@stratus.com. 1178 | echo hppa1.1-stratus-vos 1179 | exit ;; 1180 | mc68*:A/UX:*:*) 1181 | echo m68k-apple-aux${UNAME_RELEASE} 1182 | exit ;; 1183 | news*:NEWS-OS:6*:*) 1184 | echo mips-sony-newsos6 1185 | exit ;; 1186 | R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) 1187 | if [ -d /usr/nec ]; then 1188 | echo mips-nec-sysv${UNAME_RELEASE} 1189 | else 1190 | echo mips-unknown-sysv${UNAME_RELEASE} 1191 | fi 1192 | exit ;; 1193 | BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. 1194 | echo powerpc-be-beos 1195 | exit ;; 1196 | BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. 1197 | echo powerpc-apple-beos 1198 | exit ;; 1199 | BePC:BeOS:*:*) # BeOS running on Intel PC compatible. 1200 | echo i586-pc-beos 1201 | exit ;; 1202 | SX-4:SUPER-UX:*:*) 1203 | echo sx4-nec-superux${UNAME_RELEASE} 1204 | exit ;; 1205 | SX-5:SUPER-UX:*:*) 1206 | echo sx5-nec-superux${UNAME_RELEASE} 1207 | exit ;; 1208 | SX-6:SUPER-UX:*:*) 1209 | echo sx6-nec-superux${UNAME_RELEASE} 1210 | exit ;; 1211 | Power*:Rhapsody:*:*) 1212 | echo powerpc-apple-rhapsody${UNAME_RELEASE} 1213 | exit ;; 1214 | *:Rhapsody:*:*) 1215 | echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} 1216 | exit ;; 1217 | *:Darwin:*:*) 1218 | UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown 1219 | case $UNAME_PROCESSOR in 1220 | unknown) UNAME_PROCESSOR=powerpc ;; 1221 | esac 1222 | echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} 1223 | exit ;; 1224 | *:procnto*:*:* | *:QNX:[0123456789]*:*) 1225 | UNAME_PROCESSOR=`uname -p` 1226 | if test "$UNAME_PROCESSOR" = "x86"; then 1227 | UNAME_PROCESSOR=i386 1228 | UNAME_MACHINE=pc 1229 | fi 1230 | echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} 1231 | exit ;; 1232 | *:QNX:*:4*) 1233 | echo i386-pc-qnx 1234 | exit ;; 1235 | NSE-?:NONSTOP_KERNEL:*:*) 1236 | echo nse-tandem-nsk${UNAME_RELEASE} 1237 | exit ;; 1238 | NSR-?:NONSTOP_KERNEL:*:*) 1239 | echo nsr-tandem-nsk${UNAME_RELEASE} 1240 | exit ;; 1241 | *:NonStop-UX:*:*) 1242 | echo mips-compaq-nonstopux 1243 | exit ;; 1244 | BS2000:POSIX*:*:*) 1245 | echo bs2000-siemens-sysv 1246 | exit ;; 1247 | DS/*:UNIX_System_V:*:*) 1248 | echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} 1249 | exit ;; 1250 | *:Plan9:*:*) 1251 | # "uname -m" is not consistent, so use $cputype instead. 386 1252 | # is converted to i386 for consistency with other x86 1253 | # operating systems. 1254 | if test "$cputype" = "386"; then 1255 | UNAME_MACHINE=i386 1256 | else 1257 | UNAME_MACHINE="$cputype" 1258 | fi 1259 | echo ${UNAME_MACHINE}-unknown-plan9 1260 | exit ;; 1261 | *:TOPS-10:*:*) 1262 | echo pdp10-unknown-tops10 1263 | exit ;; 1264 | *:TENEX:*:*) 1265 | echo pdp10-unknown-tenex 1266 | exit ;; 1267 | KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) 1268 | echo pdp10-dec-tops20 1269 | exit ;; 1270 | XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) 1271 | echo pdp10-xkl-tops20 1272 | exit ;; 1273 | *:TOPS-20:*:*) 1274 | echo pdp10-unknown-tops20 1275 | exit ;; 1276 | *:ITS:*:*) 1277 | echo pdp10-unknown-its 1278 | exit ;; 1279 | SEI:*:*:SEIUX) 1280 | echo mips-sei-seiux${UNAME_RELEASE} 1281 | exit ;; 1282 | *:DragonFly:*:*) 1283 | echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` 1284 | exit ;; 1285 | *:*VMS:*:*) 1286 | UNAME_MACHINE=`(uname -p) 2>/dev/null` 1287 | case "${UNAME_MACHINE}" in 1288 | A*) echo alpha-dec-vms ; exit ;; 1289 | I*) echo ia64-dec-vms ; exit ;; 1290 | V*) echo vax-dec-vms ; exit ;; 1291 | esac ;; 1292 | *:XENIX:*:SysV) 1293 | echo i386-pc-xenix 1294 | exit ;; 1295 | i*86:skyos:*:*) 1296 | echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' 1297 | exit ;; 1298 | i*86:rdos:*:*) 1299 | echo ${UNAME_MACHINE}-pc-rdos 1300 | exit ;; 1301 | esac 1302 | 1303 | #echo '(No uname command or uname output not recognized.)' 1>&2 1304 | #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 1305 | 1306 | eval $set_cc_for_build 1307 | cat >$dummy.c < 1310 | # include 1311 | #endif 1312 | main () 1313 | { 1314 | #if defined (sony) 1315 | #if defined (MIPSEB) 1316 | /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, 1317 | I don't know.... */ 1318 | printf ("mips-sony-bsd\n"); exit (0); 1319 | #else 1320 | #include 1321 | printf ("m68k-sony-newsos%s\n", 1322 | #ifdef NEWSOS4 1323 | "4" 1324 | #else 1325 | "" 1326 | #endif 1327 | ); exit (0); 1328 | #endif 1329 | #endif 1330 | 1331 | #if defined (__arm) && defined (__acorn) && defined (__unix) 1332 | printf ("arm-acorn-riscix\n"); exit (0); 1333 | #endif 1334 | 1335 | #if defined (hp300) && !defined (hpux) 1336 | printf ("m68k-hp-bsd\n"); exit (0); 1337 | #endif 1338 | 1339 | #if defined (NeXT) 1340 | #if !defined (__ARCHITECTURE__) 1341 | #define __ARCHITECTURE__ "m68k" 1342 | #endif 1343 | int version; 1344 | version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; 1345 | if (version < 4) 1346 | printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); 1347 | else 1348 | printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); 1349 | exit (0); 1350 | #endif 1351 | 1352 | #if defined (MULTIMAX) || defined (n16) 1353 | #if defined (UMAXV) 1354 | printf ("ns32k-encore-sysv\n"); exit (0); 1355 | #else 1356 | #if defined (CMU) 1357 | printf ("ns32k-encore-mach\n"); exit (0); 1358 | #else 1359 | printf ("ns32k-encore-bsd\n"); exit (0); 1360 | #endif 1361 | #endif 1362 | #endif 1363 | 1364 | #if defined (__386BSD__) 1365 | printf ("i386-pc-bsd\n"); exit (0); 1366 | #endif 1367 | 1368 | #if defined (sequent) 1369 | #if defined (i386) 1370 | printf ("i386-sequent-dynix\n"); exit (0); 1371 | #endif 1372 | #if defined (ns32000) 1373 | printf ("ns32k-sequent-dynix\n"); exit (0); 1374 | #endif 1375 | #endif 1376 | 1377 | #if defined (_SEQUENT_) 1378 | struct utsname un; 1379 | 1380 | uname(&un); 1381 | 1382 | if (strncmp(un.version, "V2", 2) == 0) { 1383 | printf ("i386-sequent-ptx2\n"); exit (0); 1384 | } 1385 | if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ 1386 | printf ("i386-sequent-ptx1\n"); exit (0); 1387 | } 1388 | printf ("i386-sequent-ptx\n"); exit (0); 1389 | 1390 | #endif 1391 | 1392 | #if defined (vax) 1393 | # if !defined (ultrix) 1394 | # include 1395 | # if defined (BSD) 1396 | # if BSD == 43 1397 | printf ("vax-dec-bsd4.3\n"); exit (0); 1398 | # else 1399 | # if BSD == 199006 1400 | printf ("vax-dec-bsd4.3reno\n"); exit (0); 1401 | # else 1402 | printf ("vax-dec-bsd\n"); exit (0); 1403 | # endif 1404 | # endif 1405 | # else 1406 | printf ("vax-dec-bsd\n"); exit (0); 1407 | # endif 1408 | # else 1409 | printf ("vax-dec-ultrix\n"); exit (0); 1410 | # endif 1411 | #endif 1412 | 1413 | #if defined (alliant) && defined (i860) 1414 | printf ("i860-alliant-bsd\n"); exit (0); 1415 | #endif 1416 | 1417 | exit (1); 1418 | } 1419 | EOF 1420 | 1421 | $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && 1422 | { echo "$SYSTEM_NAME"; exit; } 1423 | 1424 | # Apollos put the system type in the environment. 1425 | 1426 | test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } 1427 | 1428 | # Convex versions that predate uname can use getsysinfo(1) 1429 | 1430 | if [ -x /usr/convex/getsysinfo ] 1431 | then 1432 | case `getsysinfo -f cpu_type` in 1433 | c1*) 1434 | echo c1-convex-bsd 1435 | exit ;; 1436 | c2*) 1437 | if getsysinfo -f scalar_acc 1438 | then echo c32-convex-bsd 1439 | else echo c2-convex-bsd 1440 | fi 1441 | exit ;; 1442 | c34*) 1443 | echo c34-convex-bsd 1444 | exit ;; 1445 | c38*) 1446 | echo c38-convex-bsd 1447 | exit ;; 1448 | c4*) 1449 | echo c4-convex-bsd 1450 | exit ;; 1451 | esac 1452 | fi 1453 | 1454 | cat >&2 < in order to provide the needed 1468 | information to handle your system. 1469 | 1470 | config.guess timestamp = $timestamp 1471 | 1472 | uname -m = `(uname -m) 2>/dev/null || echo unknown` 1473 | uname -r = `(uname -r) 2>/dev/null || echo unknown` 1474 | uname -s = `(uname -s) 2>/dev/null || echo unknown` 1475 | uname -v = `(uname -v) 2>/dev/null || echo unknown` 1476 | 1477 | /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` 1478 | /bin/uname -X = `(/bin/uname -X) 2>/dev/null` 1479 | 1480 | hostinfo = `(hostinfo) 2>/dev/null` 1481 | /bin/universe = `(/bin/universe) 2>/dev/null` 1482 | /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` 1483 | /bin/arch = `(/bin/arch) 2>/dev/null` 1484 | /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` 1485 | /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` 1486 | 1487 | UNAME_MACHINE = ${UNAME_MACHINE} 1488 | UNAME_RELEASE = ${UNAME_RELEASE} 1489 | UNAME_SYSTEM = ${UNAME_SYSTEM} 1490 | UNAME_VERSION = ${UNAME_VERSION} 1491 | EOF 1492 | 1493 | exit 1 1494 | 1495 | # Local variables: 1496 | # eval: (add-hook 'write-file-hooks 'time-stamp) 1497 | # time-stamp-start: "timestamp='" 1498 | # time-stamp-format: "%:y-%02m-%02d" 1499 | # time-stamp-end: "'" 1500 | # End: 1501 | -------------------------------------------------------------------------------- /config.sh.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #--------------------------------------------------------------------------------- 3 | # variables for unattended script execution 4 | #--------------------------------------------------------------------------------- 5 | 6 | #--------------------------------------------------------------------------------- 7 | # Select package 8 | #--------------------------------------------------------------------------------- 9 | # 0: User selects manually 10 | # 1: devkitARM 11 | # 2: devkitPPC 12 | # 3: devkitA64 13 | #--------------------------------------------------------------------------------- 14 | BUILD_DKPRO_PACKAGE=0 15 | 16 | #--------------------------------------------------------------------------------- 17 | # Path to previously downloaded source packages, comment if not specified 18 | #--------------------------------------------------------------------------------- 19 | #BUILD_DKPRO_SRCDIR=~/projects/archives 20 | 21 | #--------------------------------------------------------------------------------- 22 | # MAKEFLAGS for building - use number of processors for jobs 23 | #--------------------------------------------------------------------------------- 24 | #numcores=`getconf _NPROCESSORS_ONLN` 25 | #export MAKEFLAGS="$MAKEFLAGS -j${numcores}" 26 | 27 | #--------------------------------------------------------------------------------- 28 | # Uncomment to skip building of crtls and rules files 29 | #--------------------------------------------------------------------------------- 30 | #BUILD_DKPRO_SKIP_CRTLS=1 31 | 32 | # Automated script execution 33 | #--------------------------------------------------------------------------------- 34 | # 0: Ask to delete build folders & patched sources 35 | # 1: Use defaults, don't pause for answers 36 | #--------------------------------------------------------------------------------- 37 | BUILD_DKPRO_AUTOMATED=0 38 | 39 | #--------------------------------------------------------------------------------- 40 | # set OSX SDK path if needed 41 | #--------------------------------------------------------------------------------- 42 | #export OSXSDKPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk 43 | 44 | -------------------------------------------------------------------------------- /dka64/patches/binutils-2.44.patch: -------------------------------------------------------------------------------- 1 | diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h 2 | index c89327fdc9c..b46689a21c1 100644 3 | --- a/bfd/elf-bfd.h 4 | +++ b/bfd/elf-bfd.h 5 | @@ -2008,6 +2008,14 @@ struct output_elf_obj_tdata 6 | asection *sec; 7 | } package_metadata; 8 | 9 | + /* Data for .nx-module-name. */ 10 | + struct 11 | + { 12 | + bool (*after_write_object_contents) (bfd *); 13 | + const char *name; 14 | + asection *sec; 15 | + } nx_module_name; 16 | + 17 | /* Records the result of `get_program_header_size'. */ 18 | bfd_size_type program_header_size; 19 | 20 | diff --git a/bfd/elf.c b/bfd/elf.c 21 | index 1f2b82bfe92..7e9964a15f4 100644 22 | --- a/bfd/elf.c 23 | +++ b/bfd/elf.c 24 | @@ -7189,6 +7189,14 @@ _bfd_elf_write_object_contents (bfd *abfd) 25 | if (!bed->s->write_shdrs_and_ehdr (abfd)) 26 | return false; 27 | 28 | + /* Write out the NX module name. */ 29 | + if (t->o->nx_module_name.after_write_object_contents != NULL) 30 | + { 31 | + failed = !(*t->o->nx_module_name.after_write_object_contents) (abfd); 32 | + if (failed) 33 | + return false; 34 | + } 35 | + 36 | /* This is last since write_shdrs_and_ehdr can touch i_shdrp[0]. */ 37 | if (t->o->build_id.after_write_object_contents != NULL 38 | && !(*t->o->build_id.after_write_object_contents) (abfd)) 39 | diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c 40 | index 65182f49070..3ba294ad940 100644 41 | --- a/bfd/elfnn-aarch64.c 42 | +++ b/bfd/elfnn-aarch64.c 43 | @@ -2441,6 +2441,12 @@ enum elf_aarch64_stub_type 44 | aarch64_stub_erratum_843419_veneer, 45 | }; 46 | 47 | +/* Is an undefined weak symbol resolved to 0 ? */ 48 | +#define UNDEFINED_WEAK_RESOLVED_TO_ZERO(INFO, EH) \ 49 | + ((EH)->root.root.type == bfd_link_hash_undefweak \ 50 | + && bfd_link_executable (INFO) \ 51 | + && !(INFO)->dynamic_undefined_weak) 52 | + 53 | struct elf_aarch64_stub_hash_entry 54 | { 55 | /* Base hash table entry structure. */ 56 | @@ -6977,11 +6983,13 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, 57 | Elf_Internal_Sym *sym; 58 | asection *sec; 59 | struct elf_link_hash_entry *h; 60 | + struct elf_aarch64_link_hash_entry *eh; 61 | bfd_vma relocation; 62 | bfd_reloc_status_type r; 63 | arelent bfd_reloc; 64 | char sym_type; 65 | bool unresolved_reloc = false; 66 | + bool resolved_to_zero = false; 67 | char *error_message = NULL; 68 | 69 | r_symndx = ELFNN_R_SYM (rel->r_info); 70 | @@ -7121,6 +7129,10 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, 71 | h, &unresolved_reloc, 72 | save_addend, &addend, sym); 73 | 74 | + eh = (struct elf_aarch64_link_hash_entry *) h; 75 | + resolved_to_zero = (eh != NULL 76 | + && UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh)); 77 | + 78 | switch (elfNN_aarch64_bfd_reloc_from_type (input_bfd, r_type)) 79 | { 80 | case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC: 81 | @@ -7144,7 +7156,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, 82 | need_relocs = 83 | (!bfd_link_executable (info) || indx != 0) && 84 | (h == NULL 85 | - || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 86 | + || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero) 87 | || h->root.type != bfd_link_hash_undefweak); 88 | 89 | BFD_ASSERT (globals->root.srelgot != NULL); 90 | @@ -7239,7 +7251,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, 91 | need_relocs = 92 | (!bfd_link_executable (info) || indx != 0) && 93 | (h == NULL 94 | - || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 95 | + || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero) 96 | || h->root.type != bfd_link_hash_undefweak); 97 | 98 | BFD_ASSERT (globals->root.srelgot != NULL); 99 | @@ -7288,7 +7300,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, 100 | bfd_vma off = symbol_tlsdesc_got_offset (input_bfd, h, r_symndx); 101 | 102 | need_relocs = (h == NULL 103 | - || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 104 | + || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero) 105 | || h->root.type != bfd_link_hash_undefweak); 106 | 107 | BFD_ASSERT (globals->root.srelgot != NULL); 108 | @@ -7614,6 +7626,23 @@ need_copy_relocation_p (struct elf_aarch64_link_hash_entry *eh) 109 | return false; 110 | } 111 | 112 | +/* Remove undefined weak symbol from the dynamic symbol table if it 113 | + is resolved to 0. */ 114 | + 115 | +static bool 116 | +elfNN_aarch64_elf_fixup_symbol (struct bfd_link_info *info, 117 | + struct elf_link_hash_entry *h) 118 | +{ 119 | + if (h->dynindx != -1 120 | + && UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, elf_aarch64_hash_entry (h))) 121 | + { 122 | + h->dynindx = -1; 123 | + _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr, 124 | + h->dynstr_index); 125 | + } 126 | + return true; 127 | +} 128 | + 129 | /* Adjust a symbol defined by a dynamic object and referenced by a 130 | regular object. The current definition is in some section of the 131 | dynamic object, but we're not including those sections. We have to 132 | @@ -8720,6 +8749,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) 133 | struct elf_aarch64_link_hash_table *htab; 134 | struct elf_aarch64_link_hash_entry *eh; 135 | struct elf_dyn_relocs *p; 136 | + bool resolved_to_zero; 137 | 138 | /* An example of a bfd_link_hash_indirect symbol is versioned 139 | symbol. For example: __gxx_personality_v0(bfd_link_hash_indirect) 140 | @@ -8739,6 +8769,10 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) 141 | info = (struct bfd_link_info *) inf; 142 | htab = elf_aarch64_hash_table (info); 143 | 144 | + eh = (struct elf_aarch64_link_hash_entry *) h; 145 | + eh->tlsdesc_got_jump_table_offset = (bfd_vma) - 1; 146 | + resolved_to_zero = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh); 147 | + 148 | /* Since STT_GNU_IFUNC symbol must go through PLT, we handle it 149 | here if it is defined and referenced in a non-shared object. */ 150 | if (h->type == STT_GNU_IFUNC 151 | @@ -8748,7 +8782,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) 152 | { 153 | /* Make sure this symbol is output as a dynamic symbol. 154 | Undefined weak syms won't yet be marked as dynamic. */ 155 | - if (h->dynindx == -1 && !h->forced_local 156 | + if (h->dynindx == -1 && !h->forced_local && !resolved_to_zero 157 | && h->root.type == bfd_link_hash_undefweak) 158 | { 159 | if (!bfd_elf_link_record_dynamic_symbol (info, h)) 160 | @@ -8782,6 +8816,11 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) 161 | of relaxing into these from the large model PLT entries. */ 162 | s->size += htab->plt_entry_size; 163 | 164 | + /* There should be no PLT relocations against resolved undefined 165 | + weak symbols in the executable. */ 166 | + if (!resolved_to_zero) 167 | + { 168 | + 169 | /* We also need to make an entry in the .got.plt section, which 170 | will be placed in the .got section by the linker script. */ 171 | htab->root.sgotplt->size += GOT_ENTRY_SIZE; 172 | @@ -8810,6 +8849,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) 173 | htab->variant_pcs = 1; 174 | 175 | } 176 | + } 177 | else 178 | { 179 | h->plt.offset = (bfd_vma) - 1; 180 | @@ -8822,9 +8862,6 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) 181 | h->needs_plt = 0; 182 | } 183 | 184 | - eh = (struct elf_aarch64_link_hash_entry *) h; 185 | - eh->tlsdesc_got_jump_table_offset = (bfd_vma) - 1; 186 | - 187 | if (h->got.refcount > 0) 188 | { 189 | bool dyn; 190 | @@ -8836,7 +8873,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) 191 | 192 | /* Make sure this symbol is output as a dynamic symbol. 193 | Undefined weak syms won't yet be marked as dynamic. */ 194 | - if (dyn && h->dynindx == -1 && !h->forced_local 195 | + if (dyn && h->dynindx == -1 && !h->forced_local && !resolved_to_zero 196 | && h->root.type == bfd_link_hash_undefweak) 197 | { 198 | if (!bfd_elf_link_record_dynamic_symbol (info, h)) 199 | @@ -8850,7 +8887,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) 200 | { 201 | h->got.offset = htab->root.sgot->size; 202 | htab->root.sgot->size += GOT_ENTRY_SIZE; 203 | - if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 204 | + if (((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero) 205 | || h->root.type != bfd_link_hash_undefweak) 206 | && (bfd_link_pic (info) 207 | || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)) 208 | @@ -8886,7 +8923,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) 209 | } 210 | 211 | indx = h && h->dynindx != -1 ? h->dynindx : 0; 212 | - if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 213 | + if (((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero) 214 | || h->root.type != bfd_link_hash_undefweak) 215 | && (!bfd_link_executable (info) 216 | || indx != 0 217 | @@ -8968,7 +9005,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) 218 | visibility. */ 219 | if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) 220 | { 221 | - if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT 222 | + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || resolved_to_zero 223 | || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) 224 | h->dyn_relocs = NULL; 225 | 226 | @@ -8988,7 +9025,9 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) 227 | symbols which turn out to need copy relocs or are not 228 | dynamic. */ 229 | 230 | - if (!h->non_got_ref 231 | + if (!(h->non_got_ref 232 | + || (h->root.type == bfd_link_hash_undefweak 233 | + && !resolved_to_zero)) 234 | && ((h->def_dynamic 235 | && !h->def_regular) 236 | || (htab->root.dynamic_sections_created 237 | @@ -8999,6 +9038,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) 238 | Undefined weak syms won't yet be marked as dynamic. */ 239 | if (h->dynindx == -1 240 | && !h->forced_local 241 | + && !resolved_to_zero 242 | && h->root.type == bfd_link_hash_undefweak 243 | && !bfd_elf_link_record_dynamic_symbol (info, h)) 244 | return false; 245 | @@ -9954,8 +9994,17 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd, 246 | Elf_Internal_Sym *sym) 247 | { 248 | struct elf_aarch64_link_hash_table *htab; 249 | + struct elf_aarch64_link_hash_entry *eh; 250 | + bool local_undefweak; 251 | htab = elf_aarch64_hash_table (info); 252 | 253 | + eh = (struct elf_aarch64_link_hash_entry *) h; 254 | + 255 | + /* We keep PLT/GOT entries without dynamic PLT/GOT relocations for 256 | + resolved undefined weak symbols in executable so that their 257 | + references have value 0 at run-time. */ 258 | + local_undefweak = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh); 259 | + 260 | if (h->plt.offset != (bfd_vma) - 1) 261 | { 262 | asection *plt, *gotplt, *relplt; 263 | @@ -9990,7 +10039,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd, 264 | abort (); 265 | 266 | elfNN_aarch64_create_small_pltn_entry (h, htab, output_bfd, info); 267 | - if (!h->def_regular) 268 | + if (!local_undefweak && !h->def_regular) 269 | { 270 | /* Mark the symbol as undefined, rather than as defined in 271 | the .plt section. */ 272 | @@ -10012,7 +10061,8 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd, 273 | && elf_aarch64_hash_entry (h)->got_type == GOT_NORMAL 274 | /* Undefined weak symbol in static PIE resolves to 0 without 275 | any dynamic relocations. */ 276 | - && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) 277 | + && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h) 278 | + && !local_undefweak) 279 | { 280 | Elf_Internal_Rela rela; 281 | bfd_byte *loc; 282 | @@ -10680,6 +10730,9 @@ const struct elf_size_info elfNN_aarch64_size_info = 283 | #define elf_backend_init_index_section \ 284 | _bfd_elf_init_2_index_sections 285 | 286 | +#define elf_backend_fixup_symbol \ 287 | + elfNN_aarch64_elf_fixup_symbol 288 | + 289 | #define elf_backend_finish_dynamic_sections \ 290 | elfNN_aarch64_finish_dynamic_sections 291 | 292 | diff --git a/ld/emulparams/aarch64elf.sh b/ld/emulparams/aarch64elf.sh 293 | index 72616b57691..42f708118fb 100644 294 | --- a/ld/emulparams/aarch64elf.sh 295 | +++ b/ld/emulparams/aarch64elf.sh 296 | @@ -1,4 +1,5 @@ 297 | source_sh ${srcdir}/emulparams/dt-relr.sh 298 | +source_sh ${srcdir}/emulparams/dynamic_undefined_weak.sh 299 | 300 | ARCH=aarch64 301 | MACHINE= 302 | diff --git a/ld/emulparams/aarch64elf32.sh b/ld/emulparams/aarch64elf32.sh 303 | index 45bf31a179a..02e0cad8699 100644 304 | --- a/ld/emulparams/aarch64elf32.sh 305 | +++ b/ld/emulparams/aarch64elf32.sh 306 | @@ -1,4 +1,5 @@ 307 | source_sh ${srcdir}/emulparams/dt-relr.sh 308 | +source_sh ${srcdir}/emulparams/dynamic_undefined_weak.sh 309 | 310 | ARCH="aarch64:ilp32" 311 | MACHINE= 312 | diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em 313 | index 7791aabf16d..a1486617099 100644 314 | --- a/ld/emultempl/aarch64elf.em 315 | +++ b/ld/emultempl/aarch64elf.em 316 | @@ -458,7 +458,7 @@ PARSE_AND_LIST_LONGOPTS=' 317 | { "no-apply-dynamic-relocs", no_argument, NULL, OPTION_NO_APPLY_DYNAMIC_RELOCS}, 318 | ' 319 | 320 | -PARSE_AND_LIST_OPTIONS=' 321 | +PARSE_AND_LIST_OPTIONS=${PARSE_AND_LIST_OPTIONS}' 322 | fprintf (file, _(" --no-enum-size-warning Don'\''t warn about objects with incompatible\n" 323 | " enum sizes\n")); 324 | fprintf (file, _(" --no-wchar-size-warning Don'\''t warn about objects with incompatible\n" 325 | diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em 326 | index 777f7204038..895f9ce59e6 100644 327 | --- a/ld/emultempl/elf.em 328 | +++ b/ld/emultempl/elf.em 329 | @@ -814,6 +814,7 @@ EOF 330 | fi 331 | fragment <o->nx_module_name.name; 387 | + asec = t->o->nx_module_name.sec; 388 | + if (bfd_is_abs_section (asec->output_section)) 389 | + { 390 | + einfo (_("%P: warning: .nx-module-name section discarded," 391 | + " --build-id ignored\n")); 392 | + return true; 393 | + } 394 | + i_shdr = &elf_section_data (asec->output_section)->this_hdr; 395 | + 396 | + if (i_shdr->contents == NULL) 397 | + { 398 | + if (asec->contents == NULL) 399 | + asec->contents = (unsigned char *) xmalloc (asec->size); 400 | + contents = asec->contents; 401 | + } 402 | + else 403 | + contents = i_shdr->contents + asec->output_offset; 404 | + 405 | + size = asec->size; 406 | + bfd_h_put_32 (abfd, 0, &contents[0]); 407 | + bfd_h_put_32 (abfd, size - 9, &contents[4]); 408 | + memcpy (&contents[8], name, size - 9); 409 | + contents[size - 1] = 0; /* ensure null termination for AMS */ 410 | + 411 | + position = i_shdr->sh_offset + asec->output_offset; 412 | + 413 | + return (bfd_seek (abfd, position, SEEK_SET) == 0 414 | + && bfd_write (contents, size, abfd) == size); 415 | +} 416 | 417 | +/* Make .nx-module-name section, and set up elf_tdata->nx_module_name. */ 418 | + 419 | +static bool 420 | +setup_nx_module_name (bfd *ibfd, bfd *obfd) 421 | +{ 422 | + asection *s; 423 | + bfd_size_type size; 424 | + flagword flags; 425 | + 426 | + if (ldelf_emit_nx_module_name[0] == '\0') 427 | + { 428 | + /* Extract the basename of the output bfd and use it as the module name. */ 429 | + char *dot_pos; 430 | + free ((char *) ldelf_emit_nx_module_name); 431 | + ldelf_emit_nx_module_name = (char *) lbasename (bfd_get_filename (obfd)); 432 | + ldelf_emit_nx_module_name = xstrdup (ldelf_emit_nx_module_name); 433 | + dot_pos = strrchr (ldelf_emit_nx_module_name, '.'); 434 | + if (dot_pos != NULL) 435 | + { 436 | + /* Remove extension. */ 437 | + *dot_pos = 0; 438 | + } 439 | + } 440 | + 441 | + size = 8 + strlen(ldelf_emit_nx_module_name) + 1; /* extra null terminator for AMS */ 442 | + flags = (SEC_ALLOC | SEC_LOAD | SEC_IN_MEMORY 443 | + | SEC_LINKER_CREATED | SEC_READONLY | SEC_DATA); 444 | + s = bfd_make_section_with_flags (ibfd, ".nx-module-name", flags); 445 | + if (s != NULL && bfd_set_section_alignment (s, 4)) 446 | + { 447 | + struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd); 448 | + t->o->nx_module_name.after_write_object_contents = &write_nx_module_name; 449 | + t->o->nx_module_name.name = ldelf_emit_nx_module_name; 450 | + t->o->nx_module_name.sec = s; 451 | + elf_section_type (s) = SHT_PROGBITS; 452 | + s->size = size; 453 | + return true; 454 | + } 455 | + 456 | + einfo (_("%P: warning: cannot create .nx-module-name section," 457 | + " --nx-module-name ignored\n")); 458 | + return false; 459 | +} 460 | + 461 | +/* This is called before calling plugin 'all symbols read' hook. */ 462 | void 463 | ldelf_before_plugin_all_symbols_read (int use_libpath, int native, 464 | int is_linux, int is_freebsd, 465 | @@ -1293,6 +1381,24 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, 466 | } 467 | } 468 | 469 | + if (ldelf_emit_nx_module_name != NULL) 470 | + { 471 | + /* Find an ELF input. */ 472 | + for (abfd = link_info.input_bfds; 473 | + abfd != (bfd *) NULL; abfd = abfd->link.next) 474 | + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour 475 | + && bfd_count_sections (abfd) != 0 476 | + && !((lang_input_statement_type *) abfd->usrdata)->flags.just_syms) 477 | + break; 478 | + 479 | + /* If there are no ELF input files do not try to create a .nx-module-name section. */ 480 | + if (abfd == NULL || !setup_nx_module_name (abfd, link_info.output_bfd)) 481 | + { 482 | + free ((char *) ldelf_emit_nx_module_name); 483 | + ldelf_emit_nx_module_name = NULL; 484 | + } 485 | + } 486 | + 487 | get_elf_backend_data (link_info.output_bfd)->setup_gnu_properties (&link_info); 488 | 489 | /* Do not allow executable files to be used as inputs to the link. */ 490 | diff --git a/ld/ldelf.h b/ld/ldelf.h 491 | index a6498cf2758..b69da549175 100644 492 | --- a/ld/ldelf.h 493 | +++ b/ld/ldelf.h 494 | @@ -20,6 +20,7 @@ 495 | 496 | extern const char *ldelf_emit_note_gnu_build_id; 497 | extern const char *ldelf_emit_note_fdo_package_metadata; 498 | +extern const char *ldelf_emit_nx_module_name; 499 | 500 | extern void ldelf_finish (void); 501 | extern void ldelf_after_parse (void); 502 | diff --git a/ld/ldlex.h b/ld/ldlex.h 503 | index b8b7d6b6829..3c9ee8d8742 100644 504 | --- a/ld/ldlex.h 505 | +++ b/ld/ldlex.h 506 | @@ -187,6 +187,7 @@ enum option_values 507 | /* Used by emultempl/elf.em, emultempl/pe.em and emultempl/pep.em. */ 508 | OPTION_BUILD_ID, 509 | OPTION_EXCLUDE_LIBS, 510 | + OPTION_NX_MODULE_NAME, 511 | /* Used by emulparams/elf32mcore.sh, emultempl/beos.em, emultempl/pe.em 512 | and emultempl/pep.em. */ 513 | OPTION_BASE_FILE, 514 | -------------------------------------------------------------------------------- /dka64/patches/gcc-15.1.0.patch: -------------------------------------------------------------------------------- 1 | diff --git a/gcc/config.gcc b/gcc/config.gcc 2 | index 40b50dc969e..debd0f3d3b2 100644 3 | --- a/gcc/config.gcc 4 | +++ b/gcc/config.gcc 5 | @@ -1192,7 +1192,14 @@ aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) 6 | tmake_file="${tmake_file} aarch64/t-aarch64" 7 | case $target in 8 | aarch64-*-elf*) 9 | + default_use_cxa_atexit=yes 10 | use_gcc_stdint=wrap 11 | + tm_file="${tm_file} devkitpro.h" 12 | + tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1" 13 | + extra_options="${extra_options} devkitpro.opt" 14 | + case ${enable_threads} in 15 | + "" | yes | posix) thread_file='posix' ;; 16 | + esac 17 | ;; 18 | aarch64-*-fuchsia*) 19 | tm_file="${tm_file} fuchsia.h" 20 | diff --git a/gcc/config/aarch64/aarch64-elf-raw.h b/gcc/config/aarch64/aarch64-elf-raw.h 21 | index 15cf1eb0389..aba0e9bbff9 100644 22 | --- a/gcc/config/aarch64/aarch64-elf-raw.h 23 | +++ b/gcc/config/aarch64/aarch64-elf-raw.h 24 | @@ -22,6 +22,7 @@ 25 | #ifndef GCC_AARCH64_ELF_RAW_H 26 | #define GCC_AARCH64_ELF_RAW_H 27 | 28 | +#define LINK_GCC_C_SEQUENCE_SPEC "--start-group %G %L %(libgloss) --end-group" 29 | #define STARTFILE_SPEC " crti%O%s crtbegin%O%s crt0%O%s" 30 | #define ENDFILE_SPEC \ 31 | " crtend%O%s crtn%O%s " \ 32 | diff --git a/gcc/config/aarch64/aarch64-opts.h b/gcc/config/aarch64/aarch64-opts.h 33 | index a6ca5cf016b..90470fd6c44 100644 34 | --- a/gcc/config/aarch64/aarch64-opts.h 35 | +++ b/gcc/config/aarch64/aarch64-opts.h 36 | @@ -91,7 +91,8 @@ enum aarch64_tp_reg { 37 | AARCH64_TPIDR_EL1 = 1, 38 | AARCH64_TPIDR_EL2 = 2, 39 | AARCH64_TPIDR_EL3 = 3, 40 | - AARCH64_TPIDRRO_EL0 = 4 41 | + AARCH64_TPIDRRO_EL0 = 4, 42 | + AARCH64_TP_SOFT = 5 43 | }; 44 | 45 | /* SVE vector register sizes. */ 46 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc 47 | index 433ec975d7e..d4c3835a15a 100644 48 | --- a/gcc/config/aarch64/aarch64.cc 49 | +++ b/gcc/config/aarch64/aarch64.cc 50 | @@ -21378,8 +21378,24 @@ aarch64_load_tp (rtx target) 51 | || !register_operand (target, Pmode)) 52 | target = gen_reg_rtx (Pmode); 53 | 54 | - /* Can return in any reg. */ 55 | - emit_insn (gen_aarch64_load_tp_hard (target)); 56 | + if (TARGET_HARD_TP) 57 | + { 58 | + /* Can return in any reg. */ 59 | + emit_insn (gen_aarch64_load_tp_hard (target)); 60 | + } 61 | + else 62 | + { 63 | + /* Always returned in r0. Immediately copy the result into a pseudo, 64 | + otherwise other uses of r0 (e.g. setting up function arguments) may 65 | + clobber the value. */ 66 | + 67 | + rtx tmp; 68 | + 69 | + emit_insn (gen_aarch64_load_tp_soft ()); 70 | + 71 | + tmp = gen_rtx_REG (DImode, R0_REGNUM); 72 | + emit_move_insn (target, tmp); 73 | + } 74 | return target; 75 | } 76 | 77 | diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h 78 | index e8bd8c73c12..4fc0d8f4ded 100644 79 | --- a/gcc/config/aarch64/aarch64.h 80 | +++ b/gcc/config/aarch64/aarch64.h 81 | @@ -1436,6 +1436,10 @@ typedef struct 82 | /* Check TLS Descriptors mechanism is selected. */ 83 | #define TARGET_TLS_DESC (aarch64_tls_dialect == TLS_DESCRIPTORS) 84 | 85 | +/* Check selected thread pointer access sequence to use. */ 86 | +#define TARGET_HARD_TP (aarch64_tpidr_reg != AARCH64_TP_SOFT) 87 | +#define TARGET_SOFT_TP (aarch64_tpidr_reg == AARCH64_TP_SOFT) 88 | + 89 | extern enum aarch64_code_model aarch64_cmodel; 90 | 91 | /* When using the tiny addressing model conditional and unconditional branches 92 | diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md 93 | index 031e621c98a..0fcf0aa703f 100644 94 | --- a/gcc/config/aarch64/aarch64.md 95 | +++ b/gcc/config/aarch64/aarch64.md 96 | @@ -7702,11 +7702,22 @@ 97 | (define_insn "aarch64_load_tp_hard" 98 | [(set (match_operand:DI 0 "register_operand" "=r") 99 | (unspec:DI [(const_int 0)] UNSPEC_TLS))] 100 | - "" 101 | + "TARGET_HARD_TP" 102 | "* return aarch64_output_load_tp (operands[0]);" 103 | [(set_attr "type" "mrs")] 104 | ) 105 | 106 | +(define_insn "aarch64_load_tp_soft" 107 | + [(set (reg:DI 0) (unspec:DI [(const_int 0)] UNSPEC_TLS)) 108 | + (clobber (reg:DI IP0_REGNUM)) 109 | + (clobber (reg:DI IP1_REGNUM)) 110 | + (clobber (reg:DI LR_REGNUM)) 111 | + (clobber (reg:CC CC_REGNUM))] 112 | + "TARGET_SOFT_TP" 113 | + "bl\\t__aarch64_read_tp\\t// aarch64_load_tp_soft" 114 | + [(set_attr "type" "branch")] 115 | +) 116 | + 117 | ;; The TLS ABI specifically requires that the compiler does not schedule 118 | ;; instructions in the TLS stubs, in order to enable linker relaxation. 119 | ;; Therefore we treat the stubs as an atomic sequence. 120 | diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt 121 | index f32d56d4ffa..7cf8d3ba3d4 100644 122 | --- a/gcc/config/aarch64/aarch64.opt 123 | +++ b/gcc/config/aarch64/aarch64.opt 124 | @@ -137,6 +137,9 @@ Enum(tp_reg) String(tpidr_el3) Value(AARCH64_TPIDR_EL3) 125 | EnumValue 126 | Enum(tp_reg) String(tpidrro_el0) Value(AARCH64_TPIDRRO_EL0) 127 | 128 | +EnumValue 129 | +Enum(tp_reg) String(soft) Value(AARCH64_TP_SOFT) 130 | + 131 | mtp= 132 | Target RejectNegative Joined Enum(tp_reg) Var(aarch64_tpidr_reg) Init(AARCH64_TPIDR_EL0) Save 133 | Specify the thread pointer register. 134 | @@ -338,7 +341,7 @@ TargetVariable 135 | long aarch64_stack_protector_guard_offset = 0 136 | 137 | moutline-atomics 138 | -Target Var(aarch64_flag_outline_atomics) Init(2) Save 139 | +Target Var(aarch64_flag_outline_atomics) Save 140 | Generate local calls to out-of-line atomic operations. 141 | 142 | -param=aarch64-vect-compare-costs= 143 | diff --git a/gcc/config/aarch64/t-aarch64 b/gcc/config/aarch64/t-aarch64 144 | index 59571948479..f50c37d8b3c 100644 145 | --- a/gcc/config/aarch64/t-aarch64 146 | +++ b/gcc/config/aarch64/t-aarch64 147 | @@ -198,8 +198,10 @@ aarch64-ldp-fusion.o: $(srcdir)/config/aarch64/aarch64-ldp-fusion.cc \ 148 | $(srcdir)/config/aarch64/aarch64-ldp-fusion.cc 149 | 150 | comma=, 151 | -MULTILIB_OPTIONS = $(subst $(comma),/, $(patsubst %, mabi=%, $(subst $(comma),$(comma)mabi=,$(TM_MULTILIB_CONFIG)))) 152 | -MULTILIB_DIRNAMES = $(subst $(comma), ,$(TM_MULTILIB_CONFIG)) 153 | +MULTILIB_OPTIONS = mcmodel=large fPIC 154 | +MULTILIB_DIRNAMES = large pic 155 | +MULTILIB_REQUIRED = mcmodel=large fPIC 156 | +MULTILIB_MATCHES = fPIC=fpic fPIC=fpie fPIC=fPIE 157 | 158 | insn-conditions.md: s-check-sve-md 159 | s-check-sve-md: $(srcdir)/config/aarch64/check-sve-md.awk \ 160 | diff --git a/gcc/config/devkitpro.h b/gcc/config/devkitpro.h 161 | new file mode 100644 162 | index 00000000000..a25459e4352 163 | --- /dev/null 164 | +++ b/gcc/config/devkitpro.h 165 | @@ -0,0 +1,32 @@ 166 | +/* Definitions for devkitPro toolchains. 167 | + Copyright (C) 2016-2018 Free Software Foundation, Inc. 168 | + 169 | + This file is part of GCC. 170 | + 171 | + GCC is free software; you can redistribute it and/or modify it 172 | + under the terms of the GNU General Public License as published 173 | + by the Free Software Foundation; either version 3, or (at your 174 | + option) any later version. 175 | + 176 | + GCC is distributed in the hope that it will be useful, but WITHOUT 177 | + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 178 | + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 179 | + License for more details. 180 | + 181 | + Under Section 7 of GPL version 3, you are granted additional 182 | + permissions described in the GCC Runtime Library Exception, version 183 | + 3.1, as published by the Free Software Foundation. 184 | + 185 | + You should have received a copy of the GNU General Public License and 186 | + a copy of the GCC Runtime Library Exception along with this program; 187 | + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 188 | + . */ 189 | + 190 | +#undef TARGET_OS_CPP_BUILTINS 191 | +#define TARGET_OS_CPP_BUILTINS() \ 192 | + do { \ 193 | + builtin_define ("__DEVKITA64__"); \ 194 | + builtin_define ("__DEVKITPRO__"); \ 195 | + } while (0) 196 | + 197 | + 198 | diff --git a/gcc/config/devkitpro.opt b/gcc/config/devkitpro.opt 199 | new file mode 100644 200 | index 00000000000..9acbbf9d27c 201 | --- /dev/null 202 | +++ b/gcc/config/devkitpro.opt 203 | @@ -0,0 +1,29 @@ 204 | +; Options for devkitPro toolchains. 205 | + 206 | +; Copyright (C) 2011-2018 Free Software Foundation, Inc. 207 | +; 208 | +; This file is part of GCC. 209 | +; 210 | +; GCC is free software; you can redistribute it and/or modify it under 211 | +; the terms of the GNU General Public License as published by the Free 212 | +; Software Foundation; either version 3, or (at your option) any later 213 | +; version. 214 | +; 215 | +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY 216 | +; WARRANTY; without even the implied warranty of MERCHANTABILITY or 217 | +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 218 | +; for more details. 219 | +; 220 | +; You should have received a copy of the GNU General Public License 221 | +; along with GCC; see the file COPYING3. If not see 222 | +; . 223 | + 224 | +; See the GCC internals manual (options.texi) for a description of 225 | +; this file's format. 226 | + 227 | +; Please try to keep this file in ASCII collating order. 228 | + 229 | +pthread 230 | +Driver 231 | + 232 | +; This comment is to ensure we retain the blank line above. 233 | diff --git a/gcc/config/devkitpro.opt.urls b/gcc/config/devkitpro.opt.urls 234 | new file mode 100644 235 | index 00000000000..ab7b466aa71 236 | --- /dev/null 237 | +++ b/gcc/config/devkitpro.opt.urls 238 | @@ -0,0 +1 @@ 239 | +; Autogenerated by regenerate-opt-urls.py from gcc/config/devkitpro.opt and generated HTML 240 | diff --git a/gcc/config/i386/host-mingw32.cc b/gcc/config/i386/host-mingw32.cc 241 | index e083f49f3da..1b81e7e88ce 100644 242 | --- a/gcc/config/i386/host-mingw32.cc 243 | +++ b/gcc/config/i386/host-mingw32.cc 244 | @@ -94,6 +94,10 @@ mingw32_gt_pch_get_address (size_t size, int) 245 | If we allocate at bottom we need to reserve the address as early 246 | as possible and at the same point in each invocation. */ 247 | 248 | +#if __MINGW64__ 249 | + size = UINT64_C(64 * 1024 * 1024 * 1024); 250 | +#endif 251 | + 252 | res = VirtualAlloc (NULL, size, 253 | MEM_RESERVE | MEM_TOP_DOWN, 254 | PAGE_NOACCESS); 255 | diff --git a/gcc/gcc.cc b/gcc/gcc.cc 256 | index 4fd87f2c4a1..6af06f7b032 100644 257 | --- a/gcc/gcc.cc 258 | +++ b/gcc/gcc.cc 259 | @@ -888,6 +888,11 @@ proper position among the other output files. */ 260 | #endif 261 | #endif 262 | 263 | +#ifndef LIBGLOSS_SPEC 264 | +# define LIBGLOSS_SPEC "-lsysbase" 265 | +#endif 266 | + 267 | + 268 | /* config.h can define STARTFILE_SPEC to override the default crt0 files. */ 269 | #ifndef STARTFILE_SPEC 270 | #define STARTFILE_SPEC \ 271 | @@ -1215,6 +1220,7 @@ static const char *link_spec = LINK_SPEC; 272 | static const char *lib_spec = LIB_SPEC; 273 | static const char *link_gomp_spec = ""; 274 | static const char *libgcc_spec = LIBGCC_SPEC; 275 | +static const char *libgloss_spec = LIBGLOSS_SPEC; 276 | static const char *endfile_spec = ENDFILE_SPEC; 277 | static const char *startfile_spec = STARTFILE_SPEC; 278 | static const char *linker_name_spec = LINKER_NAME; 279 | @@ -1727,6 +1733,7 @@ static struct spec_list static_specs[] = 280 | INIT_STATIC_SPEC ("lib", &lib_spec), 281 | INIT_STATIC_SPEC ("link_gomp", &link_gomp_spec), 282 | INIT_STATIC_SPEC ("libgcc", &libgcc_spec), 283 | + INIT_STATIC_SPEC ("libgloss", &libgloss_spec), 284 | INIT_STATIC_SPEC ("startfile", &startfile_spec), 285 | INIT_STATIC_SPEC ("cross_compile", &cross_compile), 286 | INIT_STATIC_SPEC ("version", &compiler_version), 287 | diff --git a/libcc1/configure b/libcc1/configure 288 | index ea689a353c8..98f9d9b21b7 100755 289 | --- a/libcc1/configure 290 | +++ b/libcc1/configure 291 | @@ -5119,7 +5119,7 @@ else 292 | # Adding the `sed 1q' prevents false positives on HP-UX, which says: 293 | # nm: unknown option "B" ignored 294 | case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in 295 | - *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B" 296 | + $tmp_nm*) lt_cv_path_NM="$tmp_nm -B" 297 | break 298 | ;; 299 | *) 300 | diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c 301 | index b9767cd1eee..362689c9f0b 100644 302 | --- a/libgcc/crtstuff.c 303 | +++ b/libgcc/crtstuff.c 304 | @@ -326,7 +326,7 @@ register_tm_clones (void) 305 | 306 | #ifdef OBJECT_FORMAT_ELF 307 | 308 | -#if DEFAULT_USE_CXA_ATEXIT 309 | +#if 1 /* DEFAULT_USE_CXA_ATEXIT */ 310 | /* Declare the __dso_handle variable. It should have a unique value 311 | in every shared-object; in a main program its value is zero. The 312 | object should in any case be protected. This means the instance 313 | diff --git a/libgcc/gthr.h b/libgcc/gthr.h 314 | index 557417997f4..1269ece007f 100644 315 | --- a/libgcc/gthr.h 316 | +++ b/libgcc/gthr.h 317 | @@ -136,7 +136,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 318 | /* The pe-coff weak support isn't fully compatible to ELF's weak. 319 | For static libraries it might would work, but as we need to deal 320 | with shared versions too, we disable it for mingw-targets. */ 321 | -#ifdef __MINGW32__ 322 | +#if defined(__MINGW32__) || defined(__DEVKITA64__) 323 | #undef GTHREAD_USE_WEAK 324 | #define GTHREAD_USE_WEAK 0 325 | #endif 326 | diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am 327 | index 537774c2668..76da4f35b96 100644 328 | --- a/libstdc++-v3/include/Makefile.am 329 | +++ b/libstdc++-v3/include/Makefile.am 330 | @@ -1436,6 +1436,7 @@ ${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias} 331 | -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \ 332 | -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \ 333 | -e 's/_GLIBCXX___MINGW32_GLIBCXX___/__MINGW32__/g' \ 334 | + -e 's/_GLIBCXX___DEVKITA64_GLIBCXX___/__DEVKITA64__/g' \ 335 | -e 's,^#include "\(.*\)",#include ,g' \ 336 | < $< > $@ 337 | 338 | diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in 339 | index 7b96b2207f8..817de242772 100644 340 | --- a/libstdc++-v3/include/Makefile.in 341 | +++ b/libstdc++-v3/include/Makefile.in 342 | @@ -1910,6 +1910,7 @@ ${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias} 343 | -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \ 344 | -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \ 345 | -e 's/_GLIBCXX___MINGW32_GLIBCXX___/__MINGW32__/g' \ 346 | + -e 's/_GLIBCXX___DEVKITA64_GLIBCXX___/__DEVKITA64__/g' \ 347 | -e 's,^#include "\(.*\)",#include ,g' \ 348 | < $< > $@ 349 | 350 | diff --git a/lto-plugin/configure b/lto-plugin/configure 351 | index 28f5dd79cd7..a79f318a4d6 100755 352 | --- a/lto-plugin/configure 353 | +++ b/lto-plugin/configure 354 | @@ -6469,7 +6469,7 @@ else 355 | # Adding the `sed 1q' prevents false positives on HP-UX, which says: 356 | # nm: unknown option "B" ignored 357 | case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in 358 | - *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B" 359 | + $tmp_nm*) lt_cv_path_NM="$tmp_nm -B" 360 | break 361 | ;; 362 | *) 363 | -------------------------------------------------------------------------------- /dka64/rules/base_rules: -------------------------------------------------------------------------------- 1 | include $(DEVKITPRO)/devkitA64/base_tools 2 | 3 | #--------------------------------------------------------------------------------- 4 | %.a: 5 | #--------------------------------------------------------------------------------- 6 | @echo $(notdir $@) 7 | @rm -f $@ 8 | $(AR) -rc $@ $^ 9 | 10 | 11 | #--------------------------------------------------------------------------------- 12 | %.o: %.cpp 13 | @echo $(notdir $<) 14 | $(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER) 15 | 16 | #--------------------------------------------------------------------------------- 17 | %.o: %.c 18 | @echo $(notdir $<) 19 | $(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER) 20 | 21 | #--------------------------------------------------------------------------------- 22 | %.o: %.s 23 | @echo $(notdir $<) 24 | $(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) 25 | 26 | #--------------------------------------------------------------------------------- 27 | %.o: %.S 28 | @echo $(notdir $<) 29 | $(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) 30 | 31 | #--------------------------------------------------------------------------------- 32 | # canned command sequence for binary data 33 | #--------------------------------------------------------------------------------- 34 | define bin2o 35 | bin2s $< | $(AS) -o $(@) 36 | echo "extern const u8" `(echo $( `(echo $(> `(echo $(> `(echo $(&1 | sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):/\1(\2):/g' 41 | endif 42 | -------------------------------------------------------------------------------- /dka64/scripts/build-crtls.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #--------------------------------------------------------------------------------- 4 | # set env variables 5 | #--------------------------------------------------------------------------------- 6 | export DEVKITPRO=$TOOLPATH 7 | 8 | #--------------------------------------------------------------------------------- 9 | # Install the rules files 10 | #--------------------------------------------------------------------------------- 11 | cd $BUILDDIR 12 | 13 | tar -xvf $SRCDIR/devkita64-rules-$DKA64_RULES_VER.tar.gz 14 | cd devkita64-rules-$DKA64_RULES_VER 15 | $MAKE install 16 | -------------------------------------------------------------------------------- /dka64/scripts/build-gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #--------------------------------------------------------------------------------- 3 | 4 | #--------------------------------------------------------------------------------- 5 | # build and install binutils 6 | #--------------------------------------------------------------------------------- 7 | 8 | mkdir -p $target/binutils 9 | cd $target/binutils 10 | 11 | if [ ! -f configured-binutils ] 12 | then 13 | ../../binutils-$BINUTILS_VER/configure \ 14 | --prefix=$prefix --target=$target --disable-nls --disable-werror \ 15 | --enable-lto --enable-plugins --enable-poison-system-directories \ 16 | $CROSS_PARAMS \ 17 | || { echo "Error configuring binutils"; exit 1; } 18 | touch configured-binutils 19 | fi 20 | 21 | if [ ! -f built-binutils ] 22 | then 23 | $MAKE || { echo "Error building binutils"; exit 1; } 24 | touch built-binutils 25 | fi 26 | 27 | if [ ! -f installed-binutils ] 28 | then 29 | $MAKE install || { echo "Error installing binutils"; exit 1; } 30 | touch installed-binutils 31 | fi 32 | cd $BUILDDIR 33 | 34 | #--------------------------------------------------------------------------------- 35 | # build and install just the c compiler 36 | #--------------------------------------------------------------------------------- 37 | mkdir -p $target/gcc 38 | cd $target/gcc 39 | 40 | if [ ! -f configured-gcc ] 41 | then 42 | CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \ 43 | CXXFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \ 44 | LDFLAGS_FOR_TARGET="" \ 45 | ../../gcc-$GCC_VER/configure \ 46 | --enable-languages=c,c++,objc,lto \ 47 | --with-gnu-as --with-gnu-ld --with-gcc \ 48 | --with-march=armv8\ 49 | --enable-cxx-flags='-ffunction-sections' \ 50 | --disable-libstdcxx-verbose \ 51 | --enable-poison-system-directories \ 52 | --enable-multilib \ 53 | --enable-threads --disable-win32-registry --disable-nls --disable-debug\ 54 | --disable-libmudflap --disable-libssp --disable-libgomp \ 55 | --disable-libstdcxx-pch \ 56 | --enable-libstdcxx-time \ 57 | --enable-libstdcxx-filesystem-ts \ 58 | --target=$target \ 59 | --with-newlib=yes \ 60 | --with-headers=../../newlib-$NEWLIB_VER/newlib/libc/include \ 61 | --prefix=$prefix \ 62 | --enable-lto \ 63 | --disable-tm-clone-registry \ 64 | --disable-__cxa_atexit \ 65 | --with-bugurl="https://github.com/devkitPro/buildscripts/issues" --with-pkgversion="devkitA64 release 28" \ 66 | $CROSS_PARAMS \ 67 | $CROSS_GCC_PARAMS \ 68 | $EXTRA_GCC_PARAMS \ 69 | || { echo "Error configuring gcc"; exit 1; } 70 | touch configured-gcc 71 | fi 72 | 73 | if [ ! -f built-gcc ] 74 | then 75 | $MAKE all-gcc || { echo "Error building gcc stage1"; exit 1; } 76 | touch built-gcc 77 | fi 78 | 79 | if [ ! -f installed-gcc ] 80 | then 81 | $MAKE install-gcc || { echo "Error installing gcc"; exit 1; } 82 | touch installed-gcc 83 | fi 84 | 85 | 86 | unset CFLAGS 87 | cd $BUILDDIR 88 | 89 | OLD_CC=$CC 90 | OLDCXX=$CXX 91 | unset CC 92 | unset CXX 93 | 94 | #--------------------------------------------------------------------------------- 95 | # build and install newlib 96 | #--------------------------------------------------------------------------------- 97 | mkdir -p $target/newlib 98 | cd $target/newlib 99 | 100 | if [ ! -f configured-newlib ] 101 | then 102 | CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \ 103 | ../../newlib-$NEWLIB_VER/configure \ 104 | --disable-newlib-supplied-syscalls \ 105 | --enable-newlib-mb \ 106 | --disable-newlib-wide-orient \ 107 | --target=$target \ 108 | --prefix=$prefix \ 109 | || { echo "Error configuring newlib"; exit 1; } 110 | touch configured-newlib 111 | fi 112 | 113 | if [ ! -f built-newlib ] 114 | then 115 | $MAKE || { echo "Error building newlib"; exit 1; } 116 | touch built-newlib 117 | fi 118 | 119 | 120 | if [ ! -f installed-newlib ] 121 | then 122 | $MAKE install -j1 || { echo "Error installing newlib"; exit 1; } 123 | touch installed-newlib 124 | fi 125 | 126 | export CC=$OLD_CC 127 | export CXX=$OLD_CXX 128 | 129 | #--------------------------------------------------------------------------------- 130 | # build and install the final compiler 131 | #--------------------------------------------------------------------------------- 132 | 133 | cd $BUILDDIR 134 | 135 | cd $target/gcc 136 | 137 | if [ ! -f built-stage2 ] 138 | then 139 | $MAKE all || { echo "Error building gcc stage2"; exit 1; } 140 | touch built-stage2 141 | fi 142 | 143 | if [ ! -f installed-stage2 ] 144 | then 145 | $MAKE install || { echo "Error installing gcc stage2"; exit 1; } 146 | touch installed-stage2 147 | fi 148 | 149 | rm -fr $prefix/$target/sys-include 150 | -------------------------------------------------------------------------------- /dkarm-eabi/patches/gcc-15.1.0.patch: -------------------------------------------------------------------------------- 1 | diff --git a/gcc/config.gcc b/gcc/config.gcc 2 | index 40b50dc969e..16b1224f3ec 100644 3 | --- a/gcc/config.gcc 4 | +++ b/gcc/config.gcc 5 | @@ -1508,6 +1508,11 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems* | arm*-*-fuchsia*) 6 | tm_file="$tm_file newlib-stdint.h" 7 | tmake_file="${tmake_file} arm/t-bpabi" 8 | use_gcc_stdint=wrap 9 | + tm_file="${tm_file} devkitpro.h" 10 | + extra_options="${extra_options} devkitpro.opt" 11 | + case ${enable_threads} in 12 | + "" | yes | posix) thread_file='posix' ;; 13 | + esac 14 | ;; 15 | arm*-*-fuchsia*) 16 | tm_file="${tm_file} fuchsia.h arm/fuchsia-elf.h glibc-stdint.h" 17 | diff --git a/gcc/config/arm/arm-cpus.in b/gcc/config/arm/arm-cpus.in 18 | index 1939d55b9fd..62d425cb596 100644 19 | --- a/gcc/config/arm/arm-cpus.in 20 | +++ b/gcc/config/arm/arm-cpus.in 21 | @@ -416,7 +416,7 @@ begin arch armv6k 22 | tune for mpcore 23 | tune flags CO_PROC 24 | base 6K 25 | - isa ARMv6k 26 | + isa ARMv6k VFPv2 FP_DBL 27 | option fp add VFPv2 FP_DBL 28 | optalias vfpv2 fp 29 | option nofp remove ALL_FP 30 | diff --git a/gcc/config/arm/t-arm-elf b/gcc/config/arm/t-arm-elf 31 | index fdfdf9c580b..add129f0a62 100644 32 | --- a/gcc/config/arm/t-arm-elf 33 | +++ b/gcc/config/arm/t-arm-elf 34 | @@ -16,120 +16,22 @@ 35 | # along with GCC; see the file COPYING3. If not see 36 | # . 37 | 38 | -# Build a very basic set of libraries that should cater for most cases. 39 | - 40 | -# Single-precision floating-point is NOT supported; we don't build a 41 | -# suitable library for that. Use the rm-profile config in that case. 42 | - 43 | -# PART 1 - Useful groups of options 44 | - 45 | -dp_fpus := vfp vfpv2 vfpv3 vfpv3-fp16 vfpv3-d16 vfpv3-d16-fp16 \ 46 | - neon neon-vfpv3 neon-fp16 vfpv4 neon-vfpv4 vfpv4-d16 \ 47 | - fpv5-d16 fp-armv8 neon-fp-armv8 crypto-neon-fp-armv8 \ 48 | - vfp3 49 | - 50 | -sp_fpus := vfpv3xd vfpv3xd-fp16 fpv4-sp-d16 fpv5-sp-d16 51 | - 52 | -v7a_fps := vfpv3 vfpv3-fp16 vfpv4 simd neon-fp16 neon-vfpv4 53 | -v7ve_fps := vfpv3-d16 vfpv3 vfpv3-d16-fp16 vfpv3-fp16 vfpv4 neon \ 54 | - neon-fp16 simd 55 | - 56 | -# Not all these permutations exist for all architecture variants, but 57 | -# it seems to work ok. 58 | -v8_fps := simd fp16 crypto fp16+crypto dotprod fp16fml 59 | - 60 | -v9_fps := simd fp16 crypto fp16+crypto dotprod fp16fml 61 | - 62 | -# We don't do anything special with these. Pre-v4t probably doesn't work. 63 | -all_early_nofp := armv4 armv4t armv5t 64 | - 65 | -all_early_arch := armv5tej armv6 armv6j armv6k armv6z armv6kz \ 66 | - armv6zk armv6t2 iwmmxt iwmmxt2 67 | - 68 | -all_v7_a_r := armv7-a armv7ve armv7-r 69 | - 70 | -all_v8_archs := armv8-a armv8-a+crc armv8.1-a armv8.2-a armv8.3-a armv8.4-a \ 71 | - armv8.5-a armv8.6-a 72 | - 73 | -all_v9_archs := armv9-a 74 | - 75 | -# No floating point variants, require thumb1 softfp 76 | -all_nofp_t := armv6-m armv6s-m armv8-m.base 77 | - 78 | -all_nofp_t2 := armv7-m 79 | - 80 | -all_sp_only := armv7e-m armv8-m.main 81 | - 82 | -MULTILIB_OPTIONS = 83 | -MULTILIB_DIRNAMES = 84 | +MULTILIB_OPTIONS = mthumb mbig-endian march=armv6k march=armv6s-m mfloat-abi=hard mfloat-abi=soft 85 | +MULTILIB_DIRNAMES = thumb be armv6k v6-m fpu nofp 86 | MULTILIB_EXCEPTIONS = 87 | MULTILIB_MATCHES = 88 | -MULTILIB_REUSE = 89 | - 90 | -# PART 2 - multilib build rules 91 | - 92 | -MULTILIB_OPTIONS += marm/mthumb 93 | -MULTILIB_DIRNAMES += arm thumb 94 | - 95 | -MULTILIB_OPTIONS += mfpu=auto 96 | -MULTILIB_DIRNAMES += autofp 97 | - 98 | -MULTILIB_OPTIONS += march=armv5te+fp/march=armv7+fp 99 | -MULTILIB_DIRNAMES += v5te v7 100 | - 101 | -MULTILIB_OPTIONS += mfloat-abi=hard 102 | -MULTILIB_DIRNAMES += fpu 103 | - 104 | -# Build a total of 4 library variants (base options plus the following): 105 | -MULTILIB_REQUIRED += mthumb 106 | -MULTILIB_REQUIRED += marm/mfpu=auto/march=armv5te+fp/mfloat-abi=hard 107 | -MULTILIB_REQUIRED += mthumb/mfpu=auto/march=armv7+fp/mfloat-abi=hard 108 | - 109 | -# PART 3 - Match rules 110 | - 111 | -# Map all supported FPUs onto mfpu=auto 112 | -MULTILIB_MATCHES += $(foreach FPU, $(dp_fpus), \ 113 | - mfpu?auto=mfpu?$(FPU)) 114 | - 115 | -MULTILIB_MATCHES += march?armv5te+fp=march?armv5te 116 | - 117 | -MULTILIB_MATCHES += $(foreach ARCH, $(all_early_arch), \ 118 | - march?armv5te+fp=march?$(ARCH) \ 119 | - march?armv5te+fp=march?$(ARCH)+fp) 120 | - 121 | -MULTILIB_MATCHES += march?armv7+fp=march?armv7 122 | - 123 | -MULTILIB_MATCHES += $(foreach FPARCH, $(v7a_fps), \ 124 | - march?armv7+fp=march?armv7-a+$(FPARCH)) 125 | - 126 | -MULTILIB_MATCHES += $(foreach FPARCH, $(v7ve_fps), \ 127 | - march?armv7+fp=march?armv7ve+$(FPARCH)) 128 | - 129 | -MULTILIB_MATCHES += $(foreach ARCH, $(all_v7_a_r), \ 130 | - march?armv7+fp=march?$(ARCH) \ 131 | - march?armv7+fp=march?$(ARCH)+fp) 132 | 133 | -MULTILIB_MATCHES += $(foreach ARCH, $(all_v8_archs), \ 134 | - march?armv7+fp=march?$(ARCH) \ 135 | - $(foreach FPARCH, $(v8_fps), \ 136 | - march?armv7+fp=march?$(ARCH)+$(FPARCH))) 137 | +MULTILIB_REQUIRED = mthumb mbig-endian mthumb/mbig-endian march=armv6k/mfloat-abi=hard mthumb/march=armv6s-m/mfloat-abi=soft 138 | 139 | -MULTILIB_MATCHES += $(foreach ARCH, $(all_v9_archs), \ 140 | - march?armv7+fp=march?$(ARCH) \ 141 | - $(foreach FPARCH, $(v9_fps), \ 142 | - march?armv7+fp=march?$(ARCH)+$(FPARCH))) 143 | 144 | -MULTILIB_MATCHES += $(foreach ARCH, armv7e-m armv8-m.mainline, \ 145 | - march?armv7+fp=march?$(ARCH)+fp.dp) 146 | +MULTILIB_MATCHES += march?armv6k=mtune?mpcore 147 | +MULTILIB_MATCHES += march?armv6k=mcpu?mpcore 148 | 149 | -# PART 4 - Reuse rules 150 | +MULTILIB_MATCHES += march?armv6s-m=mcpu?cortex-m0 151 | +MULTILIB_MATCHES += march?armv6s-m=mtune?cortex-m0 152 | +MULTILIB_MATCHES += march?armv6s-m=mcpu?cortex-m0plus 153 | +MULTILIB_MATCHES += march?armv6s-m=mtune?cortex-m0plus 154 | +MULTILIB_MATCHES += march?armv6s-m=mcpu?cortex-m1 155 | +MULTILIB_MATCHES += march?armv6s-m=mtune?cortex-m1 156 | 157 | -MULTILIB_REUSE += mthumb=mthumb/mfpu.auto 158 | -MULTILIB_REUSE += mthumb=mthumb/mfpu.auto/march.armv5te+fp 159 | -MULTILIB_REUSE += mthumb=mthumb/march.armv5te+fp 160 | -MULTILIB_REUSE += marm/mfpu.auto/march.armv5te+fp/mfloat-abi.hard=marm/march.armv5te+fp/mfloat-abi.hard 161 | -MULTILIB_REUSE += marm/mfpu.auto/march.armv5te+fp/mfloat-abi.hard=march.armv5te+fp/mfloat-abi.hard 162 | -MULTILIB_REUSE += marm/mfpu.auto/march.armv5te+fp/mfloat-abi.hard=mfpu.auto/march.armv5te+fp/mfloat-abi.hard 163 | -MULTILIB_REUSE += mthumb/mfpu.auto/march.armv7+fp/mfloat-abi.hard=mthumb/march.armv7+fp/mfloat-abi.hard 164 | -MULTILIB_REUSE += mthumb/mfpu.auto/march.armv7+fp/mfloat-abi.hard=mfpu.auto/march.armv7+fp/mfloat-abi.hard 165 | -MULTILIB_REUSE += mthumb/mfpu.auto/march.armv7+fp/mfloat-abi.hard=march.armv7+fp/mfloat-abi.hard 166 | +MULTILIB_REUSE = mthumb/march.armv6s-m/mfloat-abi.soft=mthumb/march.armv6s-m 167 | diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h 168 | index ab3918283d8..c14a1955cad 100644 169 | --- a/gcc/config/arm/unknown-elf.h 170 | +++ b/gcc/config/arm/unknown-elf.h 171 | @@ -29,7 +29,7 @@ 172 | #endif 173 | 174 | /* Now we define the strings used to build the spec file. */ 175 | -#define UNKNOWN_ELF_STARTFILE_SPEC " crti%O%s crtbegin%O%s crt0%O%s" 176 | +#define UNKNOWN_ELF_STARTFILE_SPEC " crti%O%s crtbegin%O%s" 177 | 178 | #undef STARTFILE_SPEC 179 | #define STARTFILE_SPEC \ 180 | @@ -93,4 +93,5 @@ 181 | udivmoddi4, which will depend on the exception unwind routines, 182 | which will depend on abort, which is defined in libc. */ 183 | #undef LINK_GCC_C_SEQUENCE_SPEC 184 | -#define LINK_GCC_C_SEQUENCE_SPEC "--start-group %G %{!nolibc:%L} --end-group" 185 | +#define LINK_GCC_C_SEQUENCE_SPEC "--start-group %G %L %(libgloss) --end-group" 186 | + 187 | diff --git a/gcc/config/devkitpro.h b/gcc/config/devkitpro.h 188 | new file mode 100644 189 | index 00000000000..180a9ea8553 190 | --- /dev/null 191 | +++ b/gcc/config/devkitpro.h 192 | @@ -0,0 +1,27 @@ 193 | +/* Definitions for devkitPro toolchains. 194 | + Copyright (C) 2016-2018 Free Software Foundation, Inc. 195 | + This file is part of GCC. 196 | + GCC is free software; you can redistribute it and/or modify it 197 | + under the terms of the GNU General Public License as published 198 | + by the Free Software Foundation; either version 3, or (at your 199 | + option) any later version. 200 | + GCC is distributed in the hope that it will be useful, but WITHOUT 201 | + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 202 | + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 203 | + License for more details. 204 | + Under Section 7 of GPL version 3, you are granted additional 205 | + permissions described in the GCC Runtime Library Exception, version 206 | + 3.1, as published by the Free Software Foundation. 207 | + You should have received a copy of the GNU General Public License and 208 | + a copy of the GCC Runtime Library Exception along with this program; 209 | + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 210 | + . */ 211 | + 212 | +#undef TARGET_OS_CPP_BUILTINS 213 | +#define TARGET_OS_CPP_BUILTINS() \ 214 | + do { \ 215 | + builtin_define ("__DEVKITPRO__"); \ 216 | + builtin_define ("__DEVKITARM__"); \ 217 | + } while (0) 218 | + 219 | + 220 | diff --git a/gcc/config/devkitpro.opt b/gcc/config/devkitpro.opt 221 | new file mode 100644 222 | index 00000000000..9acbbf9d27c 223 | --- /dev/null 224 | +++ b/gcc/config/devkitpro.opt 225 | @@ -0,0 +1,29 @@ 226 | +; Options for devkitPro toolchains. 227 | + 228 | +; Copyright (C) 2011-2018 Free Software Foundation, Inc. 229 | +; 230 | +; This file is part of GCC. 231 | +; 232 | +; GCC is free software; you can redistribute it and/or modify it under 233 | +; the terms of the GNU General Public License as published by the Free 234 | +; Software Foundation; either version 3, or (at your option) any later 235 | +; version. 236 | +; 237 | +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY 238 | +; WARRANTY; without even the implied warranty of MERCHANTABILITY or 239 | +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 240 | +; for more details. 241 | +; 242 | +; You should have received a copy of the GNU General Public License 243 | +; along with GCC; see the file COPYING3. If not see 244 | +; . 245 | + 246 | +; See the GCC internals manual (options.texi) for a description of 247 | +; this file's format. 248 | + 249 | +; Please try to keep this file in ASCII collating order. 250 | + 251 | +pthread 252 | +Driver 253 | + 254 | +; This comment is to ensure we retain the blank line above. 255 | diff --git a/gcc/config/devkitpro.opt.urls b/gcc/config/devkitpro.opt.urls 256 | new file mode 100644 257 | index 00000000000..ab7b466aa71 258 | --- /dev/null 259 | +++ b/gcc/config/devkitpro.opt.urls 260 | @@ -0,0 +1 @@ 261 | +; Autogenerated by regenerate-opt-urls.py from gcc/config/devkitpro.opt and generated HTML 262 | diff --git a/gcc/config/i386/host-mingw32.cc b/gcc/config/i386/host-mingw32.cc 263 | index e083f49f3da..1b81e7e88ce 100644 264 | --- a/gcc/config/i386/host-mingw32.cc 265 | +++ b/gcc/config/i386/host-mingw32.cc 266 | @@ -94,6 +94,10 @@ mingw32_gt_pch_get_address (size_t size, int) 267 | If we allocate at bottom we need to reserve the address as early 268 | as possible and at the same point in each invocation. */ 269 | 270 | +#if __MINGW64__ 271 | + size = UINT64_C(64 * 1024 * 1024 * 1024); 272 | +#endif 273 | + 274 | res = VirtualAlloc (NULL, size, 275 | MEM_RESERVE | MEM_TOP_DOWN, 276 | PAGE_NOACCESS); 277 | diff --git a/gcc/gcc.cc b/gcc/gcc.cc 278 | index 4fd87f2c4a1..6af06f7b032 100644 279 | --- a/gcc/gcc.cc 280 | +++ b/gcc/gcc.cc 281 | @@ -888,6 +888,11 @@ proper position among the other output files. */ 282 | #endif 283 | #endif 284 | 285 | +#ifndef LIBGLOSS_SPEC 286 | +# define LIBGLOSS_SPEC "-lsysbase" 287 | +#endif 288 | + 289 | + 290 | /* config.h can define STARTFILE_SPEC to override the default crt0 files. */ 291 | #ifndef STARTFILE_SPEC 292 | #define STARTFILE_SPEC \ 293 | @@ -1215,6 +1220,7 @@ static const char *link_spec = LINK_SPEC; 294 | static const char *lib_spec = LIB_SPEC; 295 | static const char *link_gomp_spec = ""; 296 | static const char *libgcc_spec = LIBGCC_SPEC; 297 | +static const char *libgloss_spec = LIBGLOSS_SPEC; 298 | static const char *endfile_spec = ENDFILE_SPEC; 299 | static const char *startfile_spec = STARTFILE_SPEC; 300 | static const char *linker_name_spec = LINKER_NAME; 301 | @@ -1727,6 +1733,7 @@ static struct spec_list static_specs[] = 302 | INIT_STATIC_SPEC ("lib", &lib_spec), 303 | INIT_STATIC_SPEC ("link_gomp", &link_gomp_spec), 304 | INIT_STATIC_SPEC ("libgcc", &libgcc_spec), 305 | + INIT_STATIC_SPEC ("libgloss", &libgloss_spec), 306 | INIT_STATIC_SPEC ("startfile", &startfile_spec), 307 | INIT_STATIC_SPEC ("cross_compile", &cross_compile), 308 | INIT_STATIC_SPEC ("version", &compiler_version), 309 | diff --git a/libcc1/configure b/libcc1/configure 310 | index ea689a353c8..98f9d9b21b7 100755 311 | --- a/libcc1/configure 312 | +++ b/libcc1/configure 313 | @@ -5119,7 +5119,7 @@ else 314 | # Adding the `sed 1q' prevents false positives on HP-UX, which says: 315 | # nm: unknown option "B" ignored 316 | case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in 317 | - *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B" 318 | + $tmp_nm*) lt_cv_path_NM="$tmp_nm -B" 319 | break 320 | ;; 321 | *) 322 | diff --git a/libgcc/config/arm/t-bpabi b/libgcc/config/arm/t-bpabi 323 | index dddddc7c444..c2502597953 100644 324 | --- a/libgcc/config/arm/t-bpabi 325 | +++ b/libgcc/config/arm/t-bpabi 326 | @@ -17,4 +17,4 @@ SHLIB_MAPFILES += $(srcdir)/config/arm/libgcc-bpabi.ver 327 | # On ARM, specifying -fnon-call-exceptions will needlessly pull in 328 | # the unwinder in simple programs which use 64-bit division. Omitting 329 | # the option is safe. 330 | -LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions 331 | +LIB2_DIVMOD_EXCEPTION_FLAGS := -fno-exceptions 332 | diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c 333 | index b9767cd1eee..362689c9f0b 100644 334 | --- a/libgcc/crtstuff.c 335 | +++ b/libgcc/crtstuff.c 336 | @@ -326,7 +326,7 @@ register_tm_clones (void) 337 | 338 | #ifdef OBJECT_FORMAT_ELF 339 | 340 | -#if DEFAULT_USE_CXA_ATEXIT 341 | +#if 1 /* DEFAULT_USE_CXA_ATEXIT */ 342 | /* Declare the __dso_handle variable. It should have a unique value 343 | in every shared-object; in a main program its value is zero. The 344 | object should in any case be protected. This means the instance 345 | diff --git a/libgcc/gthr.h b/libgcc/gthr.h 346 | index 557417997f4..cb223aa43fc 100644 347 | --- a/libgcc/gthr.h 348 | +++ b/libgcc/gthr.h 349 | @@ -136,7 +136,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 350 | /* The pe-coff weak support isn't fully compatible to ELF's weak. 351 | For static libraries it might would work, but as we need to deal 352 | with shared versions too, we disable it for mingw-targets. */ 353 | -#ifdef __MINGW32__ 354 | +#if defined( __MINGW32__) || defined(__DEVKITARM__) 355 | #undef GTHREAD_USE_WEAK 356 | #define GTHREAD_USE_WEAK 0 357 | #endif 358 | diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure 359 | index 819a1d82876..d81e6057c5b 100755 360 | --- a/libstdc++-v3/configure 361 | +++ b/libstdc++-v3/configure 362 | @@ -893,6 +893,7 @@ infodir 363 | docdir 364 | oldincludedir 365 | includedir 366 | +runstatedir 367 | localstatedir 368 | sharedstatedir 369 | sysconfdir 370 | @@ -1027,6 +1028,7 @@ datadir='${datarootdir}' 371 | sysconfdir='${prefix}/etc' 372 | sharedstatedir='${prefix}/com' 373 | localstatedir='${prefix}/var' 374 | +runstatedir='${localstatedir}/run' 375 | includedir='${prefix}/include' 376 | oldincludedir='/usr/include' 377 | docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' 378 | @@ -1279,6 +1281,15 @@ do 379 | | -silent | --silent | --silen | --sile | --sil) 380 | silent=yes ;; 381 | 382 | + -runstatedir | --runstatedir | --runstatedi | --runstated \ 383 | + | --runstate | --runstat | --runsta | --runst | --runs \ 384 | + | --run | --ru | --r) 385 | + ac_prev=runstatedir ;; 386 | + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ 387 | + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ 388 | + | --run=* | --ru=* | --r=*) 389 | + runstatedir=$ac_optarg ;; 390 | + 391 | -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) 392 | ac_prev=sbindir ;; 393 | -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ 394 | @@ -1416,7 +1427,7 @@ fi 395 | for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ 396 | datadir sysconfdir sharedstatedir localstatedir includedir \ 397 | oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ 398 | - libdir localedir mandir 399 | + libdir localedir mandir runstatedir 400 | do 401 | eval ac_val=\$$ac_var 402 | # Remove trailing slashes. 403 | @@ -1569,6 +1580,7 @@ Fine tuning of the installation directories: 404 | --sysconfdir=DIR read-only single-machine data [PREFIX/etc] 405 | --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] 406 | --localstatedir=DIR modifiable single-machine data [PREFIX/var] 407 | + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] 408 | --libdir=DIR object code libraries [EPREFIX/lib] 409 | --includedir=DIR C header files [PREFIX/include] 410 | --oldincludedir=DIR C header files for non-gcc [/usr/include] 411 | @@ -5080,7 +5092,7 @@ else 412 | We can't simply define LARGE_OFF_T to be 9223372036854775807, 413 | since some C++ compilers masquerading as C compilers 414 | incorrectly reject 9223372036854775807. */ 415 | -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) 416 | +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) 417 | int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 418 | && LARGE_OFF_T % 2147483647 == 1) 419 | ? 1 : -1]; 420 | @@ -5126,7 +5138,7 @@ else 421 | We can't simply define LARGE_OFF_T to be 9223372036854775807, 422 | since some C++ compilers masquerading as C compilers 423 | incorrectly reject 9223372036854775807. */ 424 | -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) 425 | +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) 426 | int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 427 | && LARGE_OFF_T % 2147483647 == 1) 428 | ? 1 : -1]; 429 | @@ -5150,7 +5162,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 430 | We can't simply define LARGE_OFF_T to be 9223372036854775807, 431 | since some C++ compilers masquerading as C compilers 432 | incorrectly reject 9223372036854775807. */ 433 | -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) 434 | +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) 435 | int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 436 | && LARGE_OFF_T % 2147483647 == 1) 437 | ? 1 : -1]; 438 | @@ -5195,7 +5207,7 @@ else 439 | We can't simply define LARGE_OFF_T to be 9223372036854775807, 440 | since some C++ compilers masquerading as C compilers 441 | incorrectly reject 9223372036854775807. */ 442 | -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) 443 | +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) 444 | int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 445 | && LARGE_OFF_T % 2147483647 == 1) 446 | ? 1 : -1]; 447 | @@ -5219,7 +5231,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 448 | We can't simply define LARGE_OFF_T to be 9223372036854775807, 449 | since some C++ compilers masquerading as C compilers 450 | incorrectly reject 9223372036854775807. */ 451 | -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) 452 | +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) 453 | int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 454 | && LARGE_OFF_T % 2147483647 == 1) 455 | ? 1 : -1]; 456 | @@ -12280,7 +12292,7 @@ else 457 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 458 | lt_status=$lt_dlunknown 459 | cat > conftest.$ac_ext <<_LT_EOF 460 | -#line 12283 "configure" 461 | +#line 12295 "configure" 462 | #include "confdefs.h" 463 | 464 | #if HAVE_DLFCN_H 465 | @@ -12386,7 +12398,7 @@ else 466 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 467 | lt_status=$lt_dlunknown 468 | cat > conftest.$ac_ext <<_LT_EOF 469 | -#line 12389 "configure" 470 | +#line 12401 "configure" 471 | #include "confdefs.h" 472 | 473 | #if HAVE_DLFCN_H 474 | @@ -16182,7 +16194,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; } 475 | # Fake what AC_TRY_COMPILE does. 476 | 477 | cat > conftest.$ac_ext << EOF 478 | -#line 16185 "configure" 479 | +#line 16197 "configure" 480 | int main() 481 | { 482 | typedef bool atomic_type; 483 | @@ -16217,7 +16229,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; } 484 | rm -f conftest* 485 | 486 | cat > conftest.$ac_ext << EOF 487 | -#line 16220 "configure" 488 | +#line 16232 "configure" 489 | int main() 490 | { 491 | typedef short atomic_type; 492 | @@ -16252,7 +16264,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; } 493 | rm -f conftest* 494 | 495 | cat > conftest.$ac_ext << EOF 496 | -#line 16255 "configure" 497 | +#line 16267 "configure" 498 | int main() 499 | { 500 | // NB: _Atomic_word not necessarily int. 501 | @@ -16288,7 +16300,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; } 502 | rm -f conftest* 503 | 504 | cat > conftest.$ac_ext << EOF 505 | -#line 16291 "configure" 506 | +#line 16303 "configure" 507 | int main() 508 | { 509 | typedef long long atomic_type; 510 | @@ -16445,7 +16457,7 @@ $as_echo "mutex" >&6; } 511 | # unnecessary for this test. 512 | 513 | cat > conftest.$ac_ext << EOF 514 | -#line 16448 "configure" 515 | +#line 16460 "configure" 516 | int main() 517 | { 518 | _Decimal32 d1; 519 | @@ -16487,7 +16499,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu 520 | # unnecessary for this test. 521 | 522 | cat > conftest.$ac_ext << EOF 523 | -#line 16490 "configure" 524 | +#line 16502 "configure" 525 | template 526 | struct same 527 | { typedef T2 type; }; 528 | @@ -28602,6 +28614,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 529 | 530 | $as_echo "#define HAVE_MEMALIGN 1" >>confdefs.h 531 | 532 | + $as_echo "#define HAVE_ALIGNED_ALLOC 1" >>confdefs.h 533 | + 534 | 535 | case "${target}" in 536 | *-rtems*) 537 | diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac 538 | index a6c01b29e94..a8fb1200c8b 100644 539 | --- a/libstdc++-v3/configure.ac 540 | +++ b/libstdc++-v3/configure.ac 541 | @@ -386,6 +386,7 @@ dnl # rather than hardcoding that information. 542 | fi 543 | 544 | AC_DEFINE(HAVE_MEMALIGN) 545 | + AC_DEFINE(HAVE_ALIGNED_ALLOC) 546 | 547 | case "${target}" in 548 | *-rtems*) 549 | diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am 550 | index 537774c2668..b15e28d2371 100644 551 | --- a/libstdc++-v3/include/Makefile.am 552 | +++ b/libstdc++-v3/include/Makefile.am 553 | @@ -1436,6 +1436,7 @@ ${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias} 554 | -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \ 555 | -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \ 556 | -e 's/_GLIBCXX___MINGW32_GLIBCXX___/__MINGW32__/g' \ 557 | + -e 's/_GLIBCXX___DEVKITARM_GLIBCXX___/__DEVKITARM__/g' \ 558 | -e 's,^#include "\(.*\)",#include ,g' \ 559 | < $< > $@ 560 | 561 | diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in 562 | index 7b96b2207f8..80f0effec92 100644 563 | --- a/libstdc++-v3/include/Makefile.in 564 | +++ b/libstdc++-v3/include/Makefile.in 565 | @@ -336,6 +336,7 @@ prefix = @prefix@ 566 | program_transform_name = @program_transform_name@ 567 | psdir = @psdir@ 568 | python_mod_dir = @python_mod_dir@ 569 | +runstatedir = @runstatedir@ 570 | sbindir = @sbindir@ 571 | sharedstatedir = @sharedstatedir@ 572 | srcdir = @srcdir@ 573 | @@ -1910,6 +1911,7 @@ ${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias} 574 | -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \ 575 | -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \ 576 | -e 's/_GLIBCXX___MINGW32_GLIBCXX___/__MINGW32__/g' \ 577 | + -e 's/_GLIBCXX___DEVKITARM_GLIBCXX___/__DEVKITARM__/g' \ 578 | -e 's,^#include "\(.*\)",#include ,g' \ 579 | < $< > $@ 580 | 581 | diff --git a/lto-plugin/configure b/lto-plugin/configure 582 | index 28f5dd79cd7..a79f318a4d6 100755 583 | --- a/lto-plugin/configure 584 | +++ b/lto-plugin/configure 585 | @@ -6469,7 +6469,7 @@ else 586 | # Adding the `sed 1q' prevents false positives on HP-UX, which says: 587 | # nm: unknown option "B" ignored 588 | case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in 589 | - *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B" 590 | + $tmp_nm*) lt_cv_path_NM="$tmp_nm -B" 591 | break 592 | ;; 593 | *) 594 | -------------------------------------------------------------------------------- /dkarm-eabi/scripts/build-crtls.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #--------------------------------------------------------------------------------- 4 | # set env variables 5 | #--------------------------------------------------------------------------------- 6 | export DEVKITPRO=$TOOLPATH 7 | export DEVKITARM=$DEVKITPRO/devkitARM 8 | 9 | #--------------------------------------------------------------------------------- 10 | # Install the rules files 11 | #--------------------------------------------------------------------------------- 12 | cd $BUILDDIR 13 | 14 | tar -xvf $SRCDIR/devkitarm-rules-$DKARM_RULES_VER.tar.gz 15 | cd devkitarm-rules-$DKARM_RULES_VER 16 | $MAKE install 17 | 18 | #--------------------------------------------------------------------------------- 19 | # Install and build the crt0 files 20 | #--------------------------------------------------------------------------------- 21 | cd $BUILDDIR 22 | 23 | tar -xvf $SRCDIR/devkitarm-crtls-$DKARM_CRTLS_VER.tar.gz 24 | cd devkitarm-crtls-$DKARM_CRTLS_VER 25 | $MAKE install 26 | 27 | -------------------------------------------------------------------------------- /dkarm-eabi/scripts/build-gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #--------------------------------------------------------------------------------- 3 | 4 | #--------------------------------------------------------------------------------- 5 | # build and install binutils 6 | #--------------------------------------------------------------------------------- 7 | 8 | mkdir -p $target/binutils 9 | cd $target/binutils 10 | 11 | if [ ! -f configured-binutils ] 12 | then 13 | CPPFLAGS="$cppflags $CPPFLAGS" LDFLAGS="$ldflags $LDFLAGS" ../../binutils-$BINUTILS_VER/configure \ 14 | --prefix=$prefix --target=$target --disable-nls --disable-werror \ 15 | --enable-lto --enable-plugins \ 16 | --enable-poison-system-directories \ 17 | $CROSS_PARAMS \ 18 | || { echo "Error configuring binutils"; exit 1; } 19 | touch configured-binutils 20 | fi 21 | 22 | if [ ! -f built-binutils ] 23 | then 24 | $MAKE || { echo "Error building binutils"; exit 1; } 25 | touch built-binutils 26 | fi 27 | 28 | if [ ! -f installed-binutils ] 29 | then 30 | $MAKE install || { echo "Error installing binutils"; exit 1; } 31 | touch installed-binutils 32 | fi 33 | cd $BUILDDIR 34 | 35 | #--------------------------------------------------------------------------------- 36 | # build and install just the c compiler 37 | #--------------------------------------------------------------------------------- 38 | mkdir -p $target/gcc 39 | cd $target/gcc 40 | 41 | if [ ! -f configured-gcc ] 42 | then 43 | CPPFLAGS="$cppflags $CPPFLAGS" \ 44 | LDFLAGS="$ldflags $LDFLAGS" \ 45 | CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \ 46 | CXXFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \ 47 | LDFLAGS_FOR_TARGET="" \ 48 | ../../gcc-$GCC_VER/configure \ 49 | --enable-languages=c,c++,objc,lto \ 50 | --with-gnu-as --with-gnu-ld --with-gcc \ 51 | --with-march=armv4t\ 52 | --enable-cxx-flags='-ffunction-sections' \ 53 | --disable-libstdcxx-verbose \ 54 | --enable-poison-system-directories \ 55 | --enable-interwork --enable-multilib \ 56 | --enable-threads --disable-win32-registry --disable-nls --disable-debug\ 57 | --disable-libmudflap --disable-libssp --disable-libgomp \ 58 | --disable-libstdcxx-pch \ 59 | --enable-libstdcxx-time=yes \ 60 | --enable-libstdcxx-filesystem-ts \ 61 | --target=$target \ 62 | --with-newlib \ 63 | --with-headers=../../newlib-$NEWLIB_VER/newlib/libc/include \ 64 | --prefix=$prefix \ 65 | --enable-lto\ 66 | --with-system-zlib \ 67 | --disable-tm-clone-registry \ 68 | --disable-__cxa_atexit \ 69 | --with-bugurl="http://wiki.devkitpro.org/index.php/Bug_Reports" --with-pkgversion="devkitARM release 66" \ 70 | $CROSS_PARAMS \ 71 | $CROSS_GCC_PARAMS \ 72 | $EXTRA_GCC_PARAMS \ 73 | || { echo "Error configuring gcc"; exit 1; } 74 | touch configured-gcc 75 | fi 76 | 77 | if [ ! -f built-gcc ] 78 | then 79 | $MAKE all-gcc || { echo "Error building gcc stage1"; exit 1; } 80 | touch built-gcc 81 | fi 82 | 83 | if [ ! -f installed-gcc ] 84 | then 85 | $MAKE install-gcc || { echo "Error installing gcc"; exit 1; } 86 | touch installed-gcc 87 | fi 88 | 89 | 90 | unset CFLAGS 91 | cd $BUILDDIR 92 | 93 | OLD_CC=$CC 94 | OLDCXX=$CXX 95 | unset CC 96 | unset CXX 97 | 98 | #--------------------------------------------------------------------------------- 99 | # build and install newlib 100 | #--------------------------------------------------------------------------------- 101 | mkdir -p $target/newlib 102 | cd $target/newlib 103 | 104 | if [ ! -f configured-newlib ] 105 | then 106 | CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \ 107 | ../../newlib-$NEWLIB_VER/configure \ 108 | --disable-newlib-supplied-syscalls \ 109 | --enable-newlib-mb \ 110 | --disable-newlib-wide-orient \ 111 | --target=$target \ 112 | --prefix=$prefix \ 113 | || { echo "Error configuring newlib"; exit 1; } 114 | touch configured-newlib 115 | fi 116 | 117 | if [ ! -f built-newlib ] 118 | then 119 | $MAKE || { echo "Error building newlib"; exit 1; } 120 | touch built-newlib 121 | fi 122 | 123 | 124 | if [ ! -f installed-newlib ] 125 | then 126 | $MAKE install -j1 || { echo "Error installing newlib"; exit 1; } 127 | touch installed-newlib 128 | fi 129 | 130 | export CC=$OLD_CC 131 | export CXX=$OLD_CXX 132 | 133 | #--------------------------------------------------------------------------------- 134 | # build and install the final compiler 135 | #--------------------------------------------------------------------------------- 136 | 137 | cd $BUILDDIR 138 | 139 | cd $target/gcc 140 | 141 | if [ ! -f built-stage2 ] 142 | then 143 | $MAKE all || { echo "Error building gcc stage2"; exit 1; } 144 | touch built-stage2 145 | fi 146 | 147 | if [ ! -f installed-stage2 ] 148 | then 149 | $MAKE install || { echo "Error installing gcc stage2"; exit 1; } 150 | touch installed-stage2 151 | fi 152 | 153 | rm -fr $prefix/$target/sys-include 154 | 155 | cd $BUILDDIR 156 | -------------------------------------------------------------------------------- /dkppc/crtls/gcn.ld: -------------------------------------------------------------------------------- 1 | /* Default linker script, for normal executables */ 2 | OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", 3 | "elf32-powerpc") 4 | OUTPUT_ARCH(powerpc:common) 5 | ENTRY(_start) 6 | SEARCH_DIR("/powerpc/powerpc-eabi-elf/lib"); 7 | /* Do we need any of these for elf? 8 | __DYNAMIC = 0; */ 9 | PROVIDE (__stack = 0x817F0000); 10 | SECTIONS 11 | { 12 | 13 | /* DOL header (from TITANIK's GC docs) 14 | */ 15 | . = 0x80003000; 16 | 17 | .header : 18 | { 19 | file_start = .; 20 | /* 0000-001B Text[0..6] sections File Positions */ 21 | LONG(text_file_start); 22 | LONG(0); 23 | LONG(0); 24 | LONG(0); 25 | LONG(0); 26 | LONG(0); 27 | LONG(0); 28 | 29 | /* 001C-0047 Data[0..10] sections File Positions */ 30 | LONG(data_file_start); 31 | LONG(0); 32 | LONG(0); 33 | LONG(0); 34 | LONG(0); 35 | LONG(0); 36 | LONG(0); 37 | LONG(0); 38 | LONG(0); 39 | LONG(0); 40 | LONG(0); 41 | 42 | /* 0048-0063 Text[0..6] sections Mem Address */ 43 | LONG(text_mem_start); 44 | LONG(0); 45 | LONG(0); 46 | LONG(0); 47 | LONG(0); 48 | LONG(0); 49 | LONG(0); 50 | 51 | /* 0064-008F Data[0..10] sections Mem Address */ 52 | LONG(data_mem_start); 53 | LONG(0); 54 | LONG(0); 55 | LONG(0); 56 | LONG(0); 57 | LONG(0); 58 | LONG(0); 59 | LONG(0); 60 | LONG(0); 61 | LONG(0); 62 | LONG(0); 63 | 64 | /* 0090-00AB Text[0..6] sections Sizes */ 65 | LONG(text_mem_size); 66 | LONG(0); 67 | LONG(0); 68 | LONG(0); 69 | LONG(0); 70 | LONG(0); 71 | LONG(0); 72 | 73 | /* 00AC-00D7 Data[0..10] sections Sizes */ 74 | LONG(data_mem_size); 75 | LONG(0); 76 | LONG(0); 77 | LONG(0); 78 | LONG(0); 79 | LONG(0); 80 | LONG(0); 81 | LONG(0); 82 | LONG(0); 83 | LONG(0); 84 | LONG(0); 85 | 86 | /* 00D8 BSS Mem address 87 | * 00DC BSS Size */ 88 | LONG(bss_mem_start); 89 | LONG(bss_mem_size); 90 | 91 | /* 00E0 Entry Point */ 92 | LONG(ABSOLUTE(_start)); 93 | } 94 | 95 | 96 | . = file_start + 0x100; 97 | 98 | text_mem_start = .; 99 | 100 | .init : 101 | { 102 | KEEP (*(.init)) 103 | } =0 104 | /* Read-only sections, merged into text segment: */ 105 | .interp : { *(.interp) } 106 | .hash : { *(.hash) } 107 | .dynsym : { *(.dynsym) } 108 | .dynstr : { *(.dynstr) } 109 | .gnu.version : { *(.gnu.version) } 110 | .gnu.version_d : { *(.gnu.version_d) } 111 | .gnu.version_r : { *(.gnu.version_r) } 112 | .rel.init : { *(.rel.init) } 113 | .rela.init : { *(.rela.init) } 114 | .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 115 | .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 116 | .rel.fini : { *(.rel.fini) } 117 | .rela.fini : { *(.rela.fini) } 118 | .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 119 | .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 120 | .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 121 | .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 122 | .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 123 | .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 124 | .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 125 | .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 126 | .rel.ctors : { *(.rel.ctors) } 127 | .rela.ctors : { *(.rela.ctors) } 128 | .rel.dtors : { *(.rel.dtors) } 129 | .rela.dtors : { *(.rela.dtors) } 130 | .rel.got : { *(.rel.got) } 131 | .rela.got : { *(.rela.got) } 132 | .rela.got1 : { *(.rela.got1) } 133 | .rela.got2 : { *(.rela.got2) } 134 | .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } 135 | .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } 136 | .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } 137 | .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } 138 | .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } 139 | .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } 140 | .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } 141 | .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } 142 | .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 143 | .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 144 | .rel.plt : { *(.rel.plt) } 145 | .rela.plt : { *(.rela.plt) } 146 | 147 | .text : 148 | { 149 | *(.text .stub .text.* .gnu.linkonce.t.*) 150 | /* .gnu.warning sections are handled specially by elf32.em. */ 151 | *(.gnu.warning) 152 | } =0 153 | .fini : 154 | { 155 | KEEP (*(.fini)) 156 | } =0 157 | PROVIDE (__etext = .); 158 | PROVIDE (_etext = .); 159 | PROVIDE (etext = .); 160 | . = ALIGN(32); 161 | text_mem_size = . - text_mem_start; 162 | data_mem_start = .; 163 | .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 164 | .rodata1 : { *(.rodata1) } 165 | .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } 166 | .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } 167 | .eh_frame_hdr : { *(.eh_frame_hdr) } 168 | . = ALIGN(32); 169 | /* Ensure the __preinit_array_start label is properly aligned. We 170 | could instead move the label definition inside the section, but 171 | the linker would then create the section even if it turns out to 172 | be empty, which isn't pretty. */ 173 | . = ALIGN(32 / 8); 174 | PROVIDE (__preinit_array_start = .); 175 | .preinit_array : { *(.preinit_array) } 176 | PROVIDE (__preinit_array_end = .); 177 | PROVIDE (__init_array_start = .); 178 | .init_array : { *(.init_array) } 179 | PROVIDE (__init_array_end = .); 180 | PROVIDE (__fini_array_start = .); 181 | .fini_array : { *(.fini_array) } 182 | PROVIDE (__fini_array_end = .); 183 | .data : 184 | { 185 | *(.data .data.* .gnu.linkonce.d.*) 186 | SORT(CONSTRUCTORS) 187 | } 188 | .data1 : { *(.data1) } 189 | .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 190 | .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 191 | .eh_frame : { KEEP (*(.eh_frame)) } 192 | .gcc_except_table : { *(.gcc_except_table) } 193 | .fixup : { *(.fixup) } 194 | .got1 : { *(.got1) } 195 | .got2 : { *(.got2) } 196 | .dynamic : { *(.dynamic) } 197 | .ctors : 198 | { 199 | /* gcc uses crtbegin.o to find the start of 200 | the constructors, so we make sure it is 201 | first. Because this is a wildcard, it 202 | doesn't matter if the user does not 203 | actually link against crtbegin.o; the 204 | linker won't look for a file to match a 205 | wildcard. The wildcard also means that it 206 | doesn't matter which directory crtbegin.o 207 | is in. */ 208 | KEEP (*crtbegin*.o(.ctors)) 209 | /* We don't want to include the .ctor section from 210 | from the crtend.o file until after the sorted ctors. 211 | The .ctor section from the crtend file contains the 212 | end of ctors marker and it must be last */ 213 | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) 214 | KEEP (*(SORT(.ctors.*))) 215 | KEEP (*(.ctors)) 216 | } 217 | .dtors : 218 | { 219 | KEEP (*crtbegin*.o(.dtors)) 220 | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) 221 | KEEP (*(SORT(.dtors.*))) 222 | KEEP (*(.dtors)) 223 | } 224 | .jcr : { KEEP (*(.jcr)) } 225 | .got : { *(.got.plt) *(.got) } 226 | /* We want the small data sections together, so single-instruction offsets 227 | can access them all, and initialized data all before uninitialized, so 228 | we can shorten the on-disk segment size. */ 229 | .sdata : 230 | { 231 | *(.sdata .sdata.* .gnu.linkonce.s.*) 232 | } 233 | _edata = .; 234 | PROVIDE (edata = .); 235 | 236 | data_mem_size = . - data_mem_start; 237 | bss_mem_start = .; 238 | 239 | __bss_start = .; 240 | .sbss : 241 | { 242 | PROVIDE (__sbss_start = .); 243 | PROVIDE (___sbss_start = .); 244 | *(.dynsbss) 245 | *(.sbss .sbss.* .gnu.linkonce.sb.*) 246 | *(.scommon) 247 | PROVIDE (__sbss_end = .); 248 | PROVIDE (___sbss_end = .); 249 | } 250 | .plt : { *(.plt) } 251 | .bss : 252 | { 253 | *(.dynbss) 254 | *(.bss .bss.* .gnu.linkonce.b.*) 255 | *(COMMON) 256 | /* Align here to ensure that the .bss section occupies space up to 257 | _end. Align after .bss to ensure correct alignment even if the 258 | .bss section disappears because there are no input sections. */ 259 | . = ALIGN(32 / 8); 260 | } 261 | . = ALIGN(32 / 8); 262 | bss_mem_size = . - bss_mem_start; 263 | text_file_start = text_mem_start - file_start; 264 | data_file_start = data_mem_start - file_start; 265 | 266 | 267 | _end = .; 268 | __end = .; 269 | PROVIDE (end = .); 270 | /* Stabs debugging sections. */ 271 | .stab 0 : { *(.stab) } 272 | .stabstr 0 : { *(.stabstr) } 273 | .stab.excl 0 : { *(.stab.excl) } 274 | .stab.exclstr 0 : { *(.stab.exclstr) } 275 | .stab.index 0 : { *(.stab.index) } 276 | .stab.indexstr 0 : { *(.stab.indexstr) } 277 | .comment 0 : { *(.comment) } 278 | /* DWARF debug sections. 279 | Symbols in the DWARF debugging sections are relative to the beginning 280 | of the section so we begin them at 0. */ 281 | /* DWARF 1 */ 282 | .debug 0 : { *(.debug) } 283 | .line 0 : { *(.line) } 284 | /* GNU DWARF 1 extensions */ 285 | .debug_srcinfo 0 : { *(.debug_srcinfo) } 286 | .debug_sfnames 0 : { *(.debug_sfnames) } 287 | /* DWARF 1.1 and DWARF 2 */ 288 | .debug_aranges 0 : { *(.debug_aranges) } 289 | .debug_pubnames 0 : { *(.debug_pubnames) } 290 | /* DWARF 2 */ 291 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 292 | .debug_abbrev 0 : { *(.debug_abbrev) } 293 | .debug_line 0 : { *(.debug_line) } 294 | .debug_frame 0 : { *(.debug_frame) } 295 | .debug_str 0 : { *(.debug_str) } 296 | .debug_loc 0 : { *(.debug_loc) } 297 | .debug_macinfo 0 : { *(.debug_macinfo) } 298 | /* SGI/MIPS DWARF 2 extensions */ 299 | .debug_weaknames 0 : { *(.debug_weaknames) } 300 | .debug_funcnames 0 : { *(.debug_funcnames) } 301 | .debug_typenames 0 : { *(.debug_typenames) } 302 | .debug_varnames 0 : { *(.debug_varnames) } 303 | } 304 | -------------------------------------------------------------------------------- /dkppc/crtls/ogc.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Linkscript for GC 3 | * 4 | */ 5 | 6 | OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc"); 7 | OUTPUT_ARCH(powerpc:common); 8 | EXTERN(_start); 9 | ENTRY(_start); 10 | 11 | PHDRS 12 | { 13 | stub PT_LOAD FLAGS(5); 14 | text PT_LOAD FLAGS(5); 15 | data PT_LOAD FLAGS(6); 16 | bss PT_LOAD; 17 | } 18 | 19 | SECTIONS 20 | { 21 | /* default base address */ 22 | /* use -Wl,--section-start,.init=0xADDRESS to change */ 23 | . = 0x80003100; 24 | 25 | /* Program */ 26 | .init : 27 | { 28 | KEEP (*crt0.o(*.init)) 29 | KEEP (*(.init)) 30 | } :text = 0 31 | .plt : { *(.plt) } 32 | .interp : { *(.interp) } 33 | .hash : { *(.hash) } 34 | .dynsym : { *(.dynsym) } 35 | .dynstr : { *(.dynstr) } 36 | .gnu.version : { *(.gnu.version) } 37 | .gnu.version_d : { *(.gnu.version_d) } 38 | .gnu.version_r : { *(.gnu.version_r) } 39 | .rel.init : { *(.rel.init) } 40 | .rela.init : { *(.rela.init) } 41 | .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 42 | .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 43 | .rel.fini : { *(.rel.fini) } 44 | .rela.fini : { *(.rela.fini) } 45 | .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 46 | .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 47 | .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 48 | .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 49 | .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 50 | .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 51 | .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 52 | .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 53 | .rel.ctors : { *(.rel.ctors) } 54 | .rela.ctors : { *(.rela.ctors) } 55 | .rel.dtors : { *(.rel.dtors) } 56 | .rela.dtors : { *(.rela.dtors) } 57 | .rel.got : { *(.rel.got) } 58 | .rela.got : { *(.rela.got) } 59 | .rela.got1 : { *(.rela.got1) } 60 | .rela.got2 : { *(.rela.got2) } 61 | .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } 62 | .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } 63 | .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } 64 | .rela.sbss : { *(.rela.sbss .rela.sbss.* .rel.gnu.linkonce.sb.*) } 65 | .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } 66 | .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } 67 | .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } 68 | .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } 69 | .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 70 | .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 71 | .rel.plt : { *(.rel.plt) } 72 | .rela.plt : { *(.rela.plt) } 73 | 74 | .text : 75 | { 76 | *(.text) 77 | *(.text.*) 78 | /* .gnu.warning sections are handled specially by elf32.em. */ 79 | *(.gnu.warning) 80 | *(.gnu.linkonce.t.*) 81 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 82 | } = 0 83 | 84 | .fini : 85 | { 86 | KEEP (*(.fini)) 87 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 88 | } = 0 89 | 90 | PROVIDE (__etext = .); 91 | PROVIDE (_etext = .); 92 | PROVIDE (etext = .); 93 | 94 | .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } :data 95 | .rodata1 : { *(.rodata1) } 96 | .sdata2 : { 97 | PROVIDE(_SDA2_BASE_ = . ); 98 | *(.sdata2) *(.sdata2.*) 99 | *(.gnu.linkonce.s2.*) 100 | } 101 | .sbss2 : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) } 102 | /* Adjust the address for the data segment. We want to adjust up to 103 | the same address within the page on the next page up. */ 104 | /* Ensure the __preinit_array_start label is properly aligned. We 105 | could instead move the label definition inside the section, but 106 | the linker would then create the section even if it turns out to 107 | be empty, which isn't pretty. */ 108 | . = ALIGN(32 / 8); 109 | PROVIDE (__preinit_array_start = .); 110 | .preinit_array : { *(.preinit_array) } 111 | PROVIDE (__preinit_array_end = .); 112 | PROVIDE (__init_array_start = .); 113 | .init_array : { *(.init_array) } 114 | PROVIDE (__init_array_end = .); 115 | PROVIDE (__fini_array_start = .); 116 | .fini_array : { *(.fini_array) } 117 | PROVIDE (__fini_array_end = .); 118 | .data : 119 | { 120 | *(.data) 121 | *(.data.*) 122 | *(.gnu.linkonce.d.*) 123 | SORT(CONSTRUCTORS) 124 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 125 | } 126 | 127 | .data1 : { *(.data1) } 128 | .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 129 | .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 130 | .eh_frame : { KEEP (*(.eh_frame)) } 131 | .gcc_except_table : { *(.gcc_except_table) } 132 | .fixup : { *(.fixup) } 133 | .got1 : { *(.got1) } 134 | .got2 : { *(.got2) } 135 | .dynamic : { *(.dynamic) } 136 | 137 | .ctors : 138 | { 139 | /* gcc uses crtbegin.o to find the start of 140 | the constructors, so we make sure it is 141 | first. Because this is a wildcard, it 142 | doesn't matter if the user does not 143 | actually link against crtbegin.o; the 144 | linker won't look for a file to match a 145 | wildcard. The wildcard also means that it 146 | doesn't matter which directory crtbegin.o 147 | is in. */ 148 | 149 | KEEP (*crtbegin.o(.ctors)) 150 | 151 | /* We don't want to include the .ctor section from 152 | from the crtend.o file until after the sorted ctors. 153 | The .ctor section from the crtend file contains the 154 | end of ctors marker and it must be last */ 155 | 156 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) 157 | KEEP (*(SORT(.ctors.*))) 158 | KEEP (*(.ctors)) 159 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 160 | } 161 | 162 | .dtors : 163 | { 164 | KEEP (*crtbegin.o(.dtors)) 165 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) 166 | KEEP (*(SORT(.dtors.*))) 167 | KEEP (*(.dtors)) 168 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 169 | } 170 | 171 | .jcr : { KEEP (*(.jcr)) } 172 | .got : { *(.got.plt) *(.got) } 173 | 174 | 175 | /* We want the small data sections together, so single-instruction offsets 176 | can access them all, and initialized data all before uninitialized, so 177 | we can shorten the on-disk segment size. */ 178 | 179 | .sdata : 180 | { 181 | PROVIDE(_SDA_BASE_ = . ); 182 | *(.sdata) 183 | *(.sdata.*) 184 | *(.gnu.linkonce.s.*) 185 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 186 | } 187 | 188 | _edata = .; 189 | PROVIDE (edata = .); 190 | 191 | .sbss : 192 | { 193 | __sbss_start = .; 194 | PROVIDE (__sbss_start = .); 195 | PROVIDE (___sbss_start = .); 196 | *(.dynsbss) 197 | *(.sbss) 198 | *(.sbss.*) 199 | *(.gnu.linkonce.sb.*) 200 | *(.scommon) 201 | PROVIDE (__sbss_end = .); 202 | PROVIDE (___sbss_end = .); 203 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 204 | __sbss_end = .; 205 | } :bss 206 | 207 | .bss : 208 | { 209 | __bss_start = .; 210 | PROVIDE (__bss_start = .); 211 | *(.dynbss) 212 | *(.bss) 213 | *(.bss.*) 214 | *(.gnu.linkonce.b.*) 215 | *(COMMON) 216 | /* Align here to ensure that the .bss section occupies space up to 217 | _end. Align after .bss to ensure correct alignment even if the 218 | .bss section disappears because there are no input sections. */ 219 | 220 | . = ALIGN(32); 221 | 222 | PROVIDE (__bss_end = .); 223 | __bss_end = .; 224 | } 225 | 226 | _end = .; 227 | PROVIDE(end = .); 228 | /* Stabs debugging sections. */ 229 | .stab 0 : { *(.stab) } 230 | .stabstr 0 : { *(.stabstr) } 231 | .stab.excl 0 : { *(.stab.excl) } 232 | .stab.exclstr 0 : { *(.stab.exclstr) } 233 | .stab.index 0 : { *(.stab.index) } 234 | .stab.indexstr 0 : { *(.stab.indexstr) } 235 | .comment 0 : { *(.comment) } 236 | /* DWARF debug sections. 237 | Symbols in the DWARF debugging sections are relative to the beginning 238 | of the section so we begin them at 0. */ 239 | /* DWARF 1 */ 240 | .debug 0 : { *(.debug) } 241 | .line 0 : { *(.line) } 242 | /* GNU DWARF 1 extensions */ 243 | .debug_srcinfo 0 : { *(.debug_srcinfo) } 244 | .debug_sfnames 0 : { *(.debug_sfnames) } 245 | /* DWARF 1.1 and DWARF 2 */ 246 | .debug_aranges 0 : { *(.debug_aranges) } 247 | .debug_pubnames 0 : { *(.debug_pubnames) } 248 | /* DWARF 2 */ 249 | .debug_info 0 : { *(.debug_info) } 250 | .debug_abbrev 0 : { *(.debug_abbrev) } 251 | .debug_line 0 : { *(.debug_line) } 252 | .debug_frame 0 : { *(.debug_frame) } 253 | .debug_str 0 : { *(.debug_str) } 254 | .debug_loc 0 : { *(.debug_loc) } 255 | .debug_macinfo 0 : { *(.debug_macinfo) } 256 | /* SGI/MIPS DWARF 2 extensions */ 257 | .debug_weaknames 0 : { *(.debug_weaknames) } 258 | .debug_funcnames 0 : { *(.debug_funcnames) } 259 | .debug_typenames 0 : { *(.debug_typenames) } 260 | .debug_varnames 0 : { *(.debug_varnames) } 261 | /* These must appear regardless of . */ 262 | } 263 | 264 | __isIPL = 0; 265 | __stack_addr = (__bss_start + SIZEOF(.bss) + 0x20000 + 7) & (-8); 266 | __stack_end = (__bss_start + SIZEOF(.bss)); 267 | __intrstack_addr = (__stack_addr + 0x4000); 268 | __intrstack_end = (__stack_addr); 269 | __Arena1Lo = (__intrstack_addr + 31) & (-32); 270 | __Arena1Hi = (0x817FEFF0); 271 | 272 | __gxregs = (__Arena1Hi + 31) & (-32); 273 | /* for backward compatibility with old crt0 */ 274 | PROVIDE (__stack = (0x817FEFF0)); 275 | 276 | PROVIDE(__isIPL = __isIPL); 277 | PROVIDE(__stack_addr = __stack_addr); 278 | PROVIDE(__stack_end = __stack_end); 279 | PROVIDE(__intrstack_addr = __intrstack_addr); 280 | PROVIDE(__intrstack_end = __intrstack_end); 281 | PROVIDE(__Arena1Lo = __Arena1Lo); 282 | PROVIDE(__Arena1Hi = __Arena1Hi); 283 | PROVIDE(__gxregs = __gxregs); 284 | -------------------------------------------------------------------------------- /dkppc/crtls/rvl.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Linkscript for Wii 3 | */ 4 | 5 | OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc"); 6 | OUTPUT_ARCH(powerpc:common); 7 | EXTERN(_start); 8 | ENTRY(_start); 9 | 10 | PHDRS 11 | { 12 | stub PT_LOAD FLAGS(5); 13 | text PT_LOAD FLAGS(5); 14 | data PT_LOAD FLAGS(6); 15 | bss1 PT_LOAD; 16 | bss2 PT_LOAD; 17 | 18 | } 19 | 20 | SECTIONS 21 | { 22 | /* stub is loaded at physical address 0x00003400 (though both 0x80003400 and 0x00003400 are equivalent for IOS) */ 23 | /* This can also be used to load an arbitrary standalone stub at an arbitrary address in memory, for any purpose */ 24 | /* Use -Wl,--section-start,.stub=0xADDRESS to change */ 25 | . = 0x00003400; 26 | 27 | .stub : 28 | { 29 | KEEP(*(.stub)) 30 | } :stub = 0 31 | 32 | /* default base address */ 33 | /* use -Wl,--section-start,.init=0xADDRESS to change */ 34 | . = 0x80004000; 35 | 36 | /* Program */ 37 | .init : 38 | { 39 | KEEP (*crt0.o(*.init)) 40 | KEEP (*(.init)) 41 | } :text = 0 42 | .plt : { *(.plt) } 43 | .interp : { *(.interp) } 44 | .hash : { *(.hash) } 45 | .dynsym : { *(.dynsym) } 46 | .dynstr : { *(.dynstr) } 47 | .gnu.version : { *(.gnu.version) } 48 | .gnu.version_d : { *(.gnu.version_d) } 49 | .gnu.version_r : { *(.gnu.version_r) } 50 | .rel.init : { *(.rel.init) } 51 | .rela.init : { *(.rela.init) } 52 | .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 53 | .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 54 | .rel.fini : { *(.rel.fini) } 55 | .rela.fini : { *(.rela.fini) } 56 | .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 57 | .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 58 | .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 59 | .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 60 | .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 61 | .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 62 | .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 63 | .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 64 | .rel.ctors : { *(.rel.ctors) } 65 | .rela.ctors : { *(.rela.ctors) } 66 | .rel.dtors : { *(.rel.dtors) } 67 | .rela.dtors : { *(.rela.dtors) } 68 | .rel.got : { *(.rel.got) } 69 | .rela.got : { *(.rela.got) } 70 | .rela.got1 : { *(.rela.got1) } 71 | .rela.got2 : { *(.rela.got2) } 72 | .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } 73 | .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } 74 | .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } 75 | .rela.sbss : { *(.rela.sbss .rela.sbss.* .rel.gnu.linkonce.sb.*) } 76 | .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } 77 | .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } 78 | .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } 79 | .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } 80 | .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 81 | .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 82 | .rel.plt : { *(.rel.plt) } 83 | .rela.plt : { *(.rela.plt) } 84 | 85 | .text : 86 | { 87 | *(.text) 88 | *(.text.*) 89 | /* .gnu.warning sections are handled specially by elf32.em. */ 90 | *(.gnu.warning) 91 | *(.gnu.linkonce.t.*) 92 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 93 | } = 0 94 | 95 | .fini : 96 | { 97 | KEEP (*(.fini)) 98 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 99 | } = 0 100 | 101 | PROVIDE (__etext = .); 102 | PROVIDE (_etext = .); 103 | PROVIDE (etext = .); 104 | 105 | .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } :data 106 | .rodata1 : { *(.rodata1) } 107 | .sdata2 : { 108 | PROVIDE(_SDA2_BASE_ = .); 109 | *(.sdata2) 110 | *(.sdata2.*) 111 | *(.gnu.linkonce.s2.*) 112 | } 113 | .sbss2 : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) } 114 | /* Adjust the address for the data segment. We want to adjust up to 115 | the same address within the page on the next page up. */ 116 | /* Ensure the __preinit_array_start label is properly aligned. We 117 | could instead move the label definition inside the section, but 118 | the linker would then create the section even if it turns out to 119 | be empty, which isn't pretty. */ 120 | . = ALIGN(32 / 8); 121 | PROVIDE (__preinit_array_start = .); 122 | .preinit_array : { *(.preinit_array) } 123 | PROVIDE (__preinit_array_end = .); 124 | PROVIDE (__init_array_start = .); 125 | .init_array : { *(.init_array) } 126 | PROVIDE (__init_array_end = .); 127 | PROVIDE (__fini_array_start = .); 128 | .fini_array : { *(.fini_array) } 129 | PROVIDE (__fini_array_end = .); 130 | .data : 131 | { 132 | *(.data) 133 | *(.data.*) 134 | *(.gnu.linkonce.d.*) 135 | SORT(CONSTRUCTORS) 136 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 137 | } 138 | 139 | .data1 : { *(.data1) } 140 | .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 141 | .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 142 | .eh_frame : { KEEP (*(.eh_frame)) } 143 | .gcc_except_table : { *(.gcc_except_table) } 144 | .fixup : { *(.fixup) } 145 | .got1 : { *(.got1) } 146 | .got2 : { *(.got2) } 147 | .dynamic : { *(.dynamic) } 148 | 149 | .ctors : 150 | { 151 | /* gcc uses crtbegin.o to find the start of 152 | the constructors, so we make sure it is 153 | first. Because this is a wildcard, it 154 | doesn't matter if the user does not 155 | actually link against crtbegin.o; the 156 | linker won't look for a file to match a 157 | wildcard. The wildcard also means that it 158 | doesn't matter which directory crtbegin.o 159 | is in. */ 160 | 161 | KEEP (*crtbegin.o(.ctors)) 162 | 163 | /* We don't want to include the .ctor section from 164 | from the crtend.o file until after the sorted ctors. 165 | The .ctor section from the crtend file contains the 166 | end of ctors marker and it must be last */ 167 | 168 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) 169 | KEEP (*(SORT(.ctors.*))) 170 | KEEP (*(.ctors)) 171 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 172 | } 173 | 174 | .dtors : 175 | { 176 | KEEP (*crtbegin.o(.dtors)) 177 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) 178 | KEEP (*(SORT(.dtors.*))) 179 | KEEP (*(.dtors)) 180 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 181 | } 182 | 183 | .jcr : { KEEP (*(.jcr)) } 184 | .got : { *(.got.plt) *(.got) } 185 | 186 | 187 | /* We want the small data sections together, so single-instruction offsets 188 | can access them all, and initialized data all before uninitialized, so 189 | we can shorten the on-disk segment size. */ 190 | 191 | .sdata : 192 | { 193 | PROVIDE(_SDA_BASE_ = .); 194 | *(.sdata) 195 | *(.sdata.*) 196 | *(.gnu.linkonce.s.*) 197 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 198 | } 199 | 200 | _edata = .; 201 | PROVIDE (edata = .); 202 | 203 | .sbss : 204 | { 205 | __sbss_start = .; 206 | PROVIDE (__sbss_start = .); 207 | PROVIDE (___sbss_start = .); 208 | *(.dynsbss) 209 | *(.sbss) 210 | *(.sbss.*) 211 | *(.gnu.linkonce.sb.*) 212 | *(.scommon) 213 | PROVIDE (__sbss_end = .); 214 | PROVIDE (___sbss_end = .); 215 | . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ 216 | __sbss_end = .; 217 | } :bss1 218 | 219 | .bss : 220 | { 221 | __bss_start = .; 222 | PROVIDE (__bss_start = .); 223 | *(.dynbss) 224 | *(.bss) 225 | *(.bss.*) 226 | *(.gnu.linkonce.b.*) 227 | *(COMMON) 228 | /* Align here to ensure that the .bss section occupies space up to 229 | _end. Align after .bss to ensure correct alignment even if the 230 | .bss section disappears because there are no input sections. */ 231 | 232 | . = ALIGN(32); 233 | 234 | PROVIDE (__bss_end = .); 235 | __bss_end = .; 236 | } :bss2 237 | 238 | _end = .; 239 | PROVIDE(end = .); 240 | /* Stabs debugging sections. */ 241 | .stab 0 : { *(.stab) } 242 | .stabstr 0 : { *(.stabstr) } 243 | .stab.excl 0 : { *(.stab.excl) } 244 | .stab.exclstr 0 : { *(.stab.exclstr) } 245 | .stab.index 0 : { *(.stab.index) } 246 | .stab.indexstr 0 : { *(.stab.indexstr) } 247 | .comment 0 : { *(.comment) } 248 | /* DWARF debug sections. 249 | Symbols in the DWARF debugging sections are relative to the beginning 250 | of the section so we begin them at 0. */ 251 | /* DWARF 1 */ 252 | .debug 0 : { *(.debug) } 253 | .line 0 : { *(.line) } 254 | /* GNU DWARF 1 extensions */ 255 | .debug_srcinfo 0 : { *(.debug_srcinfo) } 256 | .debug_sfnames 0 : { *(.debug_sfnames) } 257 | /* DWARF 1.1 and DWARF 2 */ 258 | .debug_aranges 0 : { *(.debug_aranges) } 259 | .debug_pubnames 0 : { *(.debug_pubnames) } 260 | /* DWARF 2 */ 261 | .debug_info 0 : { *(.debug_info) } 262 | .debug_abbrev 0 : { *(.debug_abbrev) } 263 | .debug_line 0 : { *(.debug_line) } 264 | .debug_frame 0 : { *(.debug_frame) } 265 | .debug_str 0 : { *(.debug_str) } 266 | .debug_loc 0 : { *(.debug_loc) } 267 | .debug_macinfo 0 : { *(.debug_macinfo) } 268 | /* SGI/MIPS DWARF 2 extensions */ 269 | .debug_weaknames 0 : { *(.debug_weaknames) } 270 | .debug_funcnames 0 : { *(.debug_funcnames) } 271 | .debug_typenames 0 : { *(.debug_typenames) } 272 | .debug_varnames 0 : { *(.debug_varnames) } 273 | /* These must appear regardless of . */ 274 | } 275 | 276 | __isIPL = 0; 277 | __stack_addr = (__bss_start + SIZEOF(.bss) + 0x20000 + 7) & (-8); 278 | __stack_end = (__bss_start + SIZEOF(.bss)); 279 | __intrstack_addr = (__stack_addr + 0x4000); 280 | __intrstack_end = (__stack_addr); 281 | __Arena1Lo = (__intrstack_addr + 31) & (-32); 282 | __Arena1Hi = (0x817FEFF0); 283 | __Arena2Lo = (0x90002000); 284 | __Arena2Hi = (0x933E0000); 285 | 286 | __gxregs = (__Arena1Hi + 31) & (-32); 287 | __ipcbufferLo = (0x933e0000); 288 | __ipcbufferHi = (0x93400000); 289 | 290 | /* for backward compatibility with old crt0 */ 291 | PROVIDE (__stack = (0x817FEFF0)); 292 | 293 | PROVIDE(__isIPL = __isIPL); 294 | PROVIDE(__stack_addr = __stack_addr); 295 | PROVIDE(__stack_end = __stack_end); 296 | PROVIDE(__intrstack_addr = __intrstack_addr); 297 | PROVIDE(__intrstack_end = __intrstack_end); 298 | PROVIDE(__Arena1Lo = __Arena1Lo); 299 | PROVIDE(__Arena1Hi = __Arena1Hi); 300 | PROVIDE(__Arena2Lo = __Arena2Lo); 301 | PROVIDE(__Arena2Hi = __Arena2Hi); 302 | PROVIDE(__ipcbufferLo = __ipcbufferLo); 303 | PROVIDE(__ipcbufferHi = __ipcbufferHi); 304 | PROVIDE(__gxregs = __gxregs); 305 | -------------------------------------------------------------------------------- /dkppc/patches/binutils-2.44.patch: -------------------------------------------------------------------------------- 1 | diff --git a/ld/emulparams/elf32ppccommon.sh b/ld/emulparams/elf32ppccommon.sh 2 | index da892988f5d..6b8efb9bbdb 100644 3 | --- a/ld/emulparams/elf32ppccommon.sh 4 | +++ b/ld/emulparams/elf32ppccommon.sh 5 | @@ -23,7 +23,7 @@ else 6 | unset SBSS_START_SYMBOLS 7 | unset SBSS_END_SYMBOLS 8 | fi 9 | -OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end = .${CREATE_SHLIB+)};" 10 | +OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end = .${CREATE_SHLIB+)};${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};" 11 | OTHER_RELRO_SECTIONS=" 12 | .fixup ${RELOCATING-0} : { *(.fixup) } 13 | .got1 ${RELOCATING-0} : { *(.got1) } 14 | diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c 15 | index e55bfe846cd..f160e290bce 100644 16 | --- a/opcodes/ppc-opc.c 17 | +++ b/opcodes/ppc-opc.c 18 | @@ -4988,7 +4988,7 @@ const unsigned int num_powerpc_operands = ARRAY_SIZE (powerpc_operands); 19 | #define MFDEC2 (PPC_OPCODE_PPC | PPC_OPCODE_601 | PPC_OPCODE_BOOKE \ 20 | | PPC_OPCODE_TITAN) 21 | #define BOOKE PPC_OPCODE_BOOKE 22 | -#define NO371 PPC_OPCODE_BOOKE | PPC_OPCODE_PPCPS | PPC_OPCODE_EFS 23 | +#define NO371 PPC_OPCODE_BOOKE | PPC_OPCODE_EFS 24 | #define PPCE300 PPC_OPCODE_E300 25 | #define PPCSPE PPC_OPCODE_SPE 26 | #define PPCSPE2 PPC_OPCODE_SPE2 27 | -------------------------------------------------------------------------------- /dkppc/scripts/build-crtls.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #--------------------------------------------------------------------------------- 4 | # set env variables 5 | #--------------------------------------------------------------------------------- 6 | export DEVKITPRO=$TOOLPATH 7 | export DEVKITPPC=$DEVKITPRO/devkitPPC 8 | 9 | #--------------------------------------------------------------------------------- 10 | # Install the rules files 11 | #--------------------------------------------------------------------------------- 12 | cd $BUILDDIR 13 | 14 | tar -xvf $SRCDIR/devkitppc-rules-$DKPPC_RULES_VER.tar.gz 15 | cd devkitppc-rules-$DKPPC_RULES_VER 16 | $MAKE install 17 | -------------------------------------------------------------------------------- /dkppc/scripts/build-gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #--------------------------------------------------------------------------------- 3 | # Check Parameters 4 | #--------------------------------------------------------------------------------- 5 | 6 | #--------------------------------------------------------------------------------- 7 | # build and install ppc binutils 8 | #--------------------------------------------------------------------------------- 9 | 10 | mkdir -p $target/binutils 11 | cd $target/binutils 12 | 13 | if [ ! -f configured-binutils ] 14 | then 15 | ../../binutils-$BINUTILS_VER/configure \ 16 | --prefix=$prefix --target=$target --disable-nls --disable-shared --disable-debug \ 17 | --disable-werror \ 18 | --enable-poison-system-directories \ 19 | --enable-plugins --enable-lto \ 20 | --disable-werror $CROSS_PARAMS \ 21 | || { echo "Error configuing ppc binutils"; exit 1; } 22 | touch configured-binutils 23 | fi 24 | 25 | if [ ! -f built-binutils ] 26 | then 27 | $MAKE || { echo "Error building ppc binutils"; exit 1; } 28 | touch built-binutils 29 | fi 30 | 31 | if [ ! -f installed-binutils ] 32 | then 33 | $MAKE install || { echo "Error installing ppc binutils"; exit 1; } 34 | touch installed-binutils 35 | fi 36 | cd $BUILDDIR 37 | 38 | 39 | #--------------------------------------------------------------------------------- 40 | # build and install mn10200 binutils 41 | #--------------------------------------------------------------------------------- 42 | 43 | # Use modern config.sub for aarch64 host 44 | cp binutils-$BINUTILS_VER/config.sub binutils-$MN_BINUTILS_VER/config.sub 45 | 46 | mkdir -p mn10200/binutils 47 | cd mn10200/binutils 48 | 49 | if [ ! -f configured-binutils ] 50 | then 51 | ../../binutils-$MN_BINUTILS_VER/configure \ 52 | --prefix=$prefix --target=mn10200 --disable-nls --disable-debug \ 53 | --disable-multilib \ 54 | --disable-werror $CROSS_PARAMS \ 55 | || { echo "Error configuing mn10200 binutils"; exit 1; } 56 | touch configured-binutils 57 | fi 58 | 59 | if [ ! -f built-binutils ] 60 | then 61 | $MAKE || { echo "Error building mn10200 binutils"; exit 1; } 62 | touch built-binutils 63 | fi 64 | 65 | if [ ! -f installed-binutils ] 66 | then 67 | $MAKE install || { echo "Error installing mn10200 binutils"; exit 1; } 68 | touch installed-binutils 69 | fi 70 | 71 | cd $BUILDDIR 72 | 73 | #--------------------------------------------------------------------------------- 74 | # build and install just the c compiler 75 | #--------------------------------------------------------------------------------- 76 | mkdir -p $target/gcc 77 | cd $target/gcc 78 | 79 | export gcc_cv_libc_provides_ssp=yes 80 | 81 | if [ ! -f configured-gcc ] 82 | then 83 | CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \ 84 | CXXFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \ 85 | LDFLAGS_FOR_TARGET="" \ 86 | ../../gcc-$GCC_VER/configure \ 87 | --enable-languages=c,c++,objc,lto \ 88 | --enable-lto \ 89 | --with-cpu=750 \ 90 | --disable-nls --disable-shared --enable-threads=dkp --disable-multilib \ 91 | --disable-win32-registry \ 92 | --disable-libstdcxx-pch \ 93 | --disable-libstdcxx-verbose \ 94 | --enable-libstdcxx-time=yes \ 95 | --enable-libstdcxx-filesystem-ts \ 96 | --disable-tm-clone-registry \ 97 | --disable-__cxa_atexit \ 98 | --disable-libssp \ 99 | --enable-cxx-flags='-ffunction-sections -fdata-sections' \ 100 | --target=$target \ 101 | --with-newlib \ 102 | --with-headers=../../newlib-$NEWLIB_VER/newlib/libc/include \ 103 | --prefix=$prefix \ 104 | --with-bugurl="https://github.com/devkitpro/buildscripts/issues" --with-pkgversion="devkitPPC release 47" \ 105 | $CROSS_PARAMS \ 106 | $CROSS_GCC_PARAMS \ 107 | $EXTRA_GCC_PARAMS \ 108 | CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \ 109 | || { echo "Error configuring gcc stage 1"; exit 1; } 110 | touch configured-gcc 111 | fi 112 | 113 | if [ ! -f built-gcc-stage1 ] 114 | then 115 | $MAKE all-gcc || { echo "Error building gcc stage1"; exit 1; } 116 | touch built-gcc-stage1 117 | fi 118 | 119 | if [ ! -f installed-gcc-stage1 ] 120 | then 121 | $MAKE install-gcc || { echo "Error installing gcc stage1"; exit 1; } 122 | touch installed-gcc-stage1 123 | fi 124 | 125 | #--------------------------------------------------------------------------------- 126 | # build and install newlib 127 | #--------------------------------------------------------------------------------- 128 | cd $BUILDDIR 129 | mkdir -p $target/newlib 130 | cd $target/newlib 131 | 132 | unset CFLAGS 133 | unset LDFLAGS 134 | 135 | OLD_CC=$CC 136 | OLD_CXX=$CXX 137 | unset CC 138 | unset CXX 139 | 140 | if [ ! -f configured-newlib ] 141 | then 142 | CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections -DCUSTOM_MALLOC_LOCK" \ 143 | ../../newlib-$NEWLIB_VER/configure \ 144 | --target=$target \ 145 | --prefix=$prefix \ 146 | --enable-newlib-mb \ 147 | --enable-newlib-register-fini \ 148 | || { echo "Error configuring newlib"; exit 1; } 149 | touch configured-newlib 150 | fi 151 | 152 | if [ ! -f built-newlib ] 153 | then 154 | $MAKE || { echo "Error building newlib"; exit 1; } 155 | touch built-newlib 156 | fi 157 | if [ ! -f installed-newlib ] 158 | then 159 | $MAKE install -j1 || { echo "Error installing newlib"; exit 1; } 160 | touch installed-newlib 161 | fi 162 | 163 | export CC=$OLD_CC 164 | export CXX=$OLD_CXX 165 | 166 | #--------------------------------------------------------------------------------- 167 | # build and install the final compiler 168 | #--------------------------------------------------------------------------------- 169 | 170 | cd $BUILDDIR 171 | 172 | cd $target/gcc 173 | 174 | if [ ! -f built-stage2 ] 175 | then 176 | $MAKE all || { echo "Error building gcc stage2"; exit 1; } 177 | touch built-stage2 178 | fi 179 | 180 | if [ ! -f installed-stage2 ] 181 | then 182 | $MAKE install || { echo "Error installing gcc stage2"; exit 1; } 183 | touch installed-stage2 184 | fi 185 | 186 | rm -fr $prefix/$target/sys-include 187 | 188 | #--------------------------------------------------------------------------------- 189 | # Install and build the gamecube crt and libogc 190 | #--------------------------------------------------------------------------------- 191 | 192 | echo "installing linkscripts ..." 193 | cp $BUILDSCRIPTDIR/dkppc/crtls/*.ld $prefix/$target/lib/ 194 | 195 | cd $BUILDDIR 196 | -------------------------------------------------------------------------------- /makedist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | DATESTRING=$(date +%Y)$(date +%m)$(date +%d) 3 | cd .. && tar --exclude=*CVS* --exclude=.svn --exclude=.git --exclude=*.log --exclude=*.bz2 \ 4 | --exclude=*.gz --exclude=config.sh --exclude=.devkitARM* --exclude=.devkitPPC* \ 5 | --exclude=.devkitA64* --exclude=.gitignore \ 6 | -cvjf buildscripts-$DATESTRING.tar.bz2 buildscripts 7 | -------------------------------------------------------------------------------- /select_toolchain.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | VERSION=0 3 | case "$BUILD_DKPRO_PACKAGE" in 4 | "1" ) 5 | VERSION=1 6 | ;; 7 | "2" ) 8 | VERSION=2 9 | ;; 10 | "3" ) 11 | VERSION=3 12 | ;; 13 | esac 14 | 15 | while [ $VERSION -eq 0 ] 16 | do 17 | echo 18 | echo "Please select the toolchain you require" 19 | echo 20 | echo "1: devkitARM (gba gp32 ds 3ds)" 21 | echo "2: devkitPPC (gamecube wii wii-u)" 22 | echo "3: devkitA64 (switch)" 23 | read VERSION 24 | 25 | if [ "$VERSION" -ne 1 -a "$VERSION" -ne 2 -a "$VERSION" -ne 3 ] 26 | then 27 | VERSION=0 28 | fi 29 | done 30 | 31 | case "$VERSION" in 32 | "1" ) 33 | GCC_VER=15.1.0 34 | BINUTILS_VER=2.44 35 | NEWLIB_VER=4.5.0.20241231 36 | basedir='dkarm-eabi' 37 | package=devkitARM 38 | target=arm-none-eabi 39 | toolchain=DEVKITARM 40 | ;; 41 | "2" ) 42 | GCC_VER=15.1.0 43 | BINUTILS_VER=2.44 44 | MN_BINUTILS_VER=2.24 45 | NEWLIB_VER=4.5.0.20241231 46 | basedir='dkppc' 47 | package=devkitPPC 48 | target=powerpc-eabi 49 | toolchain=DEVKITPPC 50 | ;; 51 | "3" ) 52 | GCC_VER=15.1.0 53 | BINUTILS_VER=2.44 54 | NEWLIB_VER=4.5.0.20241231 55 | basedir='dka64' 56 | package=devkitA64 57 | target=aarch64-none-elf 58 | toolchain=DEVKITA64 59 | ;; 60 | esac 61 | -------------------------------------------------------------------------------- /strip_bins.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #--------------------------------------------------------------------------------- 3 | # strip binaries 4 | # strip has trouble using wildcards so do it this way instead 5 | #--------------------------------------------------------------------------------- 6 | 7 | if [ ! -z $CROSSBUILD ]; then 8 | HOST_STRIP=$CROSSBUILD-strip 9 | else 10 | HOST_STRIP=strip 11 | fi 12 | 13 | for f in $prefix/bin/* \ 14 | $prefix/$target/bin/* \ 15 | $prefix/libexec/gcc/$target/$GCC_VER/* 16 | do 17 | # exclude dll for windows, so for linux/osx, directories .la files, embedspu script & the gccbug text file 18 | if ! [[ "$f" == *.dll || "$f" == *.so || -d $f || "$f" == *.la || "$f" == *-embedspu || "$f" == *-gccbug ]] 19 | then 20 | $HOST_STRIP $f 21 | fi 22 | if [[ "$f" == *.dll ]] 23 | then 24 | $HOST_STRIP -d $f 25 | fi 26 | done 27 | 28 | if [ $VERSION -eq 2 ]; then 29 | for f in $prefix/mn10200/bin/* 30 | do 31 | $HOST_STRIP $f 32 | done 33 | fi 34 | 35 | 36 | #--------------------------------------------------------------------------------- 37 | # strip debug info from libraries 38 | #--------------------------------------------------------------------------------- 39 | find $prefix/lib/gcc/$target -name *.a -exec $target-strip -d {} \; 40 | find $prefix/$target -name *.a -exec $target-strip -d {} \; 41 | 42 | -------------------------------------------------------------------------------- /strip_toolchain.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo -n "Looking for configuration file... " 4 | if [ -f ./config.sh ]; then 5 | echo "Found." 6 | . ./config.sh 7 | else 8 | echo "Not found" 9 | fi 10 | 11 | if [ ! -z "$BUILD_DKPRO_PACKAGE" ] ; then 12 | VERSION="$BUILD_DKPRO_PACKAGE" 13 | fi 14 | 15 | . ./select_toolchain.sh 16 | 17 | if [ ! -z "$BUILD_DKPRO_INSTALLDIR" ] ; then 18 | INSTALLDIR="$BUILD_DKPRO_INSTALLDIR" 19 | elif [ ! -z "$DEVKITPRO" ]; then 20 | INSTALLDIR="$DEVKITPRO" 21 | else 22 | echo "please set install dir in config.sh or set $DEVKITPRO" 23 | fi 24 | 25 | #--------------------------------------------------------------------------------- 26 | # Add installed devkit to the path, adjusting path on minsys 27 | #--------------------------------------------------------------------------------- 28 | TOOLPATH=$(echo $INSTALLDIR | sed -e 's/^\([a-zA-Z]\):/\/\1/') 29 | export PATH=$PATH:$TOOLPATH/$package/bin 30 | export prefix=$INSTALLDIR/$CROSSBUILD/$package 31 | . ./strip_bins.sh 32 | --------------------------------------------------------------------------------