diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/config/picflag.m4 gcc-4.8.3-or1k-rtems/config/picflag.m4 --- gcc-4.8.3/config/picflag.m4 2012-01-23 08:25:28.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/config/picflag.m4 2014-07-29 10:33:53.901097306 +0200 @@ -39,6 +39,9 @@ mips-sgi-irix6*) # PIC is the default. ;; + or1k-*-*) + $1=-fPIC + ;; rs6000-ibm-aix* | powerpc-ibm-aix*) # All AIX code is PICo ;; diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/config.guess gcc-4.8.3-or1k-rtems/config.guess --- gcc-4.8.3/config.guess 2014-04-04 15:48:08.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/config.guess 2014-07-29 10:38:05.875613317 +0200 @@ -972,9 +972,6 @@ or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/config.guess.orig gcc-4.8.3-or1k-rtems/config.guess.orig --- gcc-4.8.3/config.guess.orig 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/config.guess.orig 2014-07-29 10:33:53.901097306 +0200 @@ -0,0 +1,1558 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2013 Free Software Foundation, Inc. + +timestamp='2013-06-10' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches@gnu.org. + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2013 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + ;; + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-${LIBC} + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-${LIBC} + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-${LIBC} + exit ;; + x86_64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 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) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; +esac + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/config.sub gcc-4.8.3-or1k-rtems/config.sub --- gcc-4.8.3/config.sub 2014-04-04 15:48:08.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/config.sub 2014-07-29 10:33:53.902097324 +0200 @@ -920,9 +920,12 @@ basic_machine=hppa1.1-oki os=-proelf ;; - openrisc | openrisc-*) - basic_machine=or32-unknown + or1k | or1k-*) + basic_machine=or1k-unknown ;; + or1knd | or1knd-*) + basic_machine=or1knd-unknown + ;; os400) basic_machine=powerpc-ibm os=-os400 @@ -1597,7 +1600,10 @@ or1k-*) os=-elf ;; - or32-*) + or1k-*) + os=-coff + ;; + or1knd-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/config.sub.orig gcc-4.8.3-or1k-rtems/config.sub.orig --- gcc-4.8.3/config.sub.orig 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/config.sub.orig 2014-04-04 15:48:08.000000000 +0200 @@ -0,0 +1,1793 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2013 Free Software Foundation, Inc. + +timestamp='2013-10-01' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2013 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ + | bfin \ + | c4x | c8051 | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | epiphany \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ + | ns16k | ns32k \ + | open8 \ + | or1k | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | we32k \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; + mingw32) + basic_machine=i686-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i686-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or1k-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/common/config/or1k/or1k-common.c gcc-4.8.3-or1k-rtems/gcc/common/config/or1k/or1k-common.c --- gcc-4.8.3/gcc/common/config/or1k/or1k-common.c 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/common/config/or1k/or1k-common.c 2014-07-29 10:33:53.902097324 +0200 @@ -0,0 +1,61 @@ +/* Common hooks for OR1K. + Copyright (C) 2011 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "common/common-target.h" +#include "common/common-target-def.h" +#include "opts.h" +#include "flags.h" + +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options or1k_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + +/* Implement TARGET_EXCEPT_UNWIND_INFO. */ +static enum unwind_info_type +or1k_except_unwind_info (struct gcc_options *opts) +{ + /* Honor the --enable-sjlj-exceptions configure switch. */ +#ifdef CONFIG_SJLJ_EXCEPTIONS + if (CONFIG_SJLJ_EXCEPTIONS) + return UI_SJLJ; +#endif + + if (DWARF2_UNWIND_INFO) + return UI_DWARF2; + + return UI_SJLJ; +} + +#undef TARGET_EXCEPT_UNWIND_INFO +#define TARGET_EXCEPT_UNWIND_INFO or1k_except_unwind_info + +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE or1k_option_optimization_table + +#undef TARGET_DEFAULT_TARGET_FLAGS +#define TARGET_DEFAULT_TARGET_FLAGS (MASK_HARD_MUL) + +struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/constraints.md gcc-4.8.3-or1k-rtems/gcc/config/or1k/constraints.md --- gcc-4.8.3/gcc/config/or1k/constraints.md 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/constraints.md 2014-07-29 10:33:53.902097324 +0200 @@ -0,0 +1,59 @@ +;; Copyright (C) 2010 Embecosm Limited +;; +;; Contributed by Joern Rennecke in 2010 +;; +;; This file is part of GCC. +;; +;; GCC is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. +;; +;; GCC is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GCC; see the file COPYING3. If not see +;; . + +(define_constraint "I" + "" + (and (match_code "const_int") + (match_test "ival >= -32768 && ival <= 32767"))) + +(define_constraint "J" + "" + (and (match_code "const_int") + (match_test "ival == 0"))) + +(define_constraint "K" + "" + (and (match_code "const_int") + (match_test "ival >= 0 && ival <= 65535"))) + +(define_constraint "L" + "" + (and (match_code "const_int") + (match_test "ival >= 0 && ival <= 31"))) + +(define_constraint "M" + "" + (and (match_code "const_int") + (match_test "(ival & 0xffff) == 0"))) + +(define_constraint "N" + "" + (and (match_code "const_int") + (match_test "ival >= -33554432 && ival <= 33554431"))) + +(define_constraint "O" + "" + (and (match_code "const_int") + (match_test "ival == 0"))) + +(define_constraint "C" + "" + (match_code "const_double")) + diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/elf.h gcc-4.8.3-or1k-rtems/gcc/config/or1k/elf.h --- gcc-4.8.3/gcc/config/or1k/elf.h 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/elf.h 2014-07-29 10:33:53.903097342 +0200 @@ -0,0 +1,31 @@ +/* Definitions for rtems targeting an OpenRisc OR1K using COFF + ??? this is for OR1K, but the rest of the above seems bogus. + Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. + Contributed by Joel Sherrill (joel@OARcorp.com). + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Use ELF */ +#undef OBJECT_FORMAT_ELF +#define OBJECT_FORMAT_ELF + +/* or1k debug info support is controlled by tm.h header files we include: + dbxelf.h enables optional stabs debug info. + elfos.h sets PREFERRED_DEBUGGING_TYPE to DWARF2_DEBUG . */ + +#define DRIVER_SELF_SPECS "%{!mno-newlib:-mnewlib}" diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/elf.h.rej gcc-4.8.3-or1k-rtems/gcc/config/or1k/elf.h.rej --- gcc-4.8.3/gcc/config/or1k/elf.h.rej 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/elf.h.rej 2014-07-29 10:33:53.903097342 +0200 @@ -0,0 +1,34 @@ +--- gcc/config/or1k/elf.h 2014-04-28 10:45:18.320114849 -0500 ++++ gcc/config/or1k/elf.h 1969-12-31 18:00:00.000000000 -0600 +@@ -1,31 +0,0 @@ +-/* Definitions for rtems targeting an OpenRisc OR1K using COFF +- ??? this is for OR1K, but the rest of the above seems bogus. +- Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. +- Contributed by Joel Sherrill (joel@OARcorp.com). +- +-This file is part of GNU CC. +- +-GNU CC is free software; you can redistribute it and/or modify +-it under the terms of the GNU General Public License as published by +-the Free Software Foundation; either version 2, or (at your option) +-any later version. +- +-GNU CC is distributed in the hope that it will be useful, +-but WITHOUT ANY WARRANTY; without even the implied warranty of +-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-GNU General Public License for more details. +- +-You should have received a copy of the GNU General Public License +-along with GNU CC; see the file COPYING. If not, write to +-the Free Software Foundation, 59 Temple Place - Suite 330, +-Boston, MA 02111-1307, USA. */ +- +-/* Use ELF */ +-#undef OBJECT_FORMAT_ELF +-#define OBJECT_FORMAT_ELF +- +-/* or1k debug info support is controlled by tm.h header files we include: +- dbxelf.h enables optional stabs debug info. +- elfos.h sets PREFERRED_DEBUGGING_TYPE to DWARF2_DEBUG . */ +- +-#define DRIVER_SELF_SPECS "%{!mno-newlib:-mnewlib}" diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/linux-elf.h gcc-4.8.3-or1k-rtems/gcc/config/or1k/linux-elf.h --- gcc-4.8.3/gcc/config/or1k/linux-elf.h 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/linux-elf.h 2014-07-29 10:33:53.903097342 +0200 @@ -0,0 +1,97 @@ +/* Definitions for or1k running Linux-based GNU systems using ELF + Copyright (C) 2002, 2005 + Free Software Foundation, Inc. + Contributed by Marko Mlinar + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* elfos.h should have already been included. Now just override + any conflicting definitions and add any extras. */ + +/* Do not assume anything about header files. */ +#define NO_IMPLICIT_EXTERN_C + +/* This is how we tell the assembler that two symbols have the same value. */ +#define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \ + do \ + { \ + assemble_name (FILE, NAME1); \ + fputs (" = ", FILE); \ + assemble_name (FILE, NAME2); \ + fputc ('\n', FILE); \ + } \ + while (0) + + +#if 0 +/* Node: Label Output */ + +#define SET_ASM_OP "\t.set\t" + +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ + (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0)) + +#define ASM_WEAKEN_LABEL(FILE, NAME) \ + do \ + { \ + fputs ("\t.weak\t", (FILE)); \ + assemble_name ((FILE), (NAME)); \ + fputc ('\n', (FILE)); \ + } \ + while (0) + +#endif + +/* The GNU C++ standard library requires that these macros be defined. */ +#undef CPLUSPLUS_CPP_SPEC +#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" + +#undef DRIVER_SELF_SPECS +#define DRIVER_SELF_SPECS "" + +#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" + +/* Define a set of Linux builtins. This is copied from linux.h. We can't + include the whole file for now, because that causes configure to require ld + to support --eh-frame-header, which it currently doesn't */ +#define LINUX_TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define ("__gnu_linux__"); \ + builtin_define_std ("linux"); \ + builtin_define_std ("unix"); \ + builtin_assert ("system=linux"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=posix"); \ + } while (0) + +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + LINUX_TARGET_OS_CPP_BUILTINS(); \ + if (OPTION_UCLIBC) \ + builtin_define ("__UCLIBC__"); \ + /* The GNU C++ standard library requires this. */ \ + if (c_dialect_cxx ()) \ + builtin_define ("_GNU_SOURCE"); \ + } while (0) + +#undef LINK_SPEC +#define LINK_SPEC "%{mnewlib:-entry 0x100} \ + -dynamic-linker " GNU_USER_DYNAMIC_LINKER " \ + %{static:-static} \ + %{shared:-shared}" + diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/linux-gas.h gcc-4.8.3-or1k-rtems/gcc/config/or1k/linux-gas.h --- gcc-4.8.3/gcc/config/or1k/linux-gas.h 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/linux-gas.h 2014-07-29 10:33:53.903097342 +0200 @@ -0,0 +1,37 @@ +/* Definitions of target machine for GNU compiler. + Or32 Linux-based GNU systems version. + Copyright (C) 2002, 2005 Free Software Foundation, Inc. + Contributed by Marko Mlinar + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Unsigned chars produces much better code than signed. */ +#undef DEFAULT_SIGNED_CHAR +#define DEFAULT_SIGNED_CHAR 1 + +/* Make gcc agree with */ + +#define SIZE_TYPE "unsigned int" +#define PTRDIFF_TYPE "int" +#define WCHAR_TYPE "unsigned int" +#define WCHAR_TYPE_SIZE 32 + + +/* Clear the instruction cache from `beg' to `end'. This makes an + inline system call to SYS_cacheflush. */ +#define CLEAR_INSN_CACHE(BEG, END) /* Do something here !!! */ diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/or1k.c gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k.c --- gcc-4.8.3/gcc/config/or1k/or1k.c 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k.c 2014-07-29 10:33:53.904097360 +0200 @@ -0,0 +1,2263 @@ +/* Subroutines for insn-output.c for GNU compiler. OpenRISC 1000 version. + Copyright (C) 1987, 1992, 1997, 1999, 2000, 2001, 2002, 2003, 2004, + 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc + Copyright (C) 2010 Embecosm Limited + + Contributed by Damjan Lampret in 1999. + Major optimizations by Matjaz Breskvar in 2005. + Updated for GCC 4.5 by Jeremy Bennett + and Joern Rennecke in 2010. + + This file is part of GNU CC. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see . */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "rtl.h" +#include "tree.h" +#include "obstack.h" +#include "regs.h" +#include "hard-reg-set.h" +#include "real.h" +#include "insn-config.h" +#include "conditions.h" +#include "output.h" +#include "insn-attr.h" +#include "flags.h" +#include "reload.h" +#include "function.h" +#include "expr.h" +#include "toplev.h" +#include "recog.h" +#include "ggc.h" +#include "except.h" +#include "tm_p.h" +#include "target.h" +#include "target-def.h" +#include "debug.h" +#include "langhooks.h" +#include "df.h" +#include "dwarf2.h" +#include "ansidecl.h" + +/* ========================================================================== */ +/* Local macros */ + +/* Construct a l.movhi instruction for the given reg and value */ +#define OR1K_MOVHI(rd, k) \ + ((0x6 << 26) | ((rd) << 21) | (k)) + +/* Construct a l.ori instruction for the given two regs and value */ +#define OR1K_ORI(rd, ra, k) \ + ((0x2a << 26) | ((rd) << 21) | ((ra) << 16) | (k)) + +/* Construct a l.lwz instruction for the given two registers and offset */ +#define OR1K_LWZ(rd, ra, i) \ + ((0x21 << 26) | ((rd) << 21) | ((ra) << 16) | (i)) + +/* Construct a l.jr instruction for the given register */ +#define OR1K_JR(rb) \ + ((0x11 << 26) | ((rb) << 11)) + +#define OR1K_NOP \ + (0x15 << 24) + +/* ========================================================================== */ +/* Static variables (i.e. global to this file only. */ + + +/*!Stack layout we use for pushing and poping saved registers */ +static struct +{ + bool save_lr_p; + int lr_save_offset; + bool save_fp_p; + int fp_save_offset; + int gpr_size; + int gpr_offset; + int total_size; + int vars_size; + int args_size; + int gpr_frame; + int late_frame; + HOST_WIDE_INT mask; +} frame_info; + + +/* ========================================================================== */ +/* Local (i.e. static) utility functions */ + +/* -------------------------------------------------------------------------- */ +/*!Must the current function save a register? + + @param[in] regno The register to consider. + + @return Non-zero (TRUE) if current function must save "regno", zero + (FALSE) otherwise. */ +/* -------------------------------------------------------------------------- */ +static bool +or1k_save_reg_p (int regno) +{ + /* No need to save the faked cc0 register. */ + if (regno == OR1K_FLAGS_REG) + return false; + + /* Check call-saved registers. */ + if (df_regs_ever_live_p(regno) && !call_used_regs[regno]) + return true; + + /* We need to save the old frame pointer before setting up a new + one. */ + if (regno == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed) + return true; + + /* Save the stack pointer for DWARF2 for now. + * AFAIK, DWARF should be able to unwind using only the current stack + * register and the CFA offset, but I never got that to work. */ + if (regno == STACK_POINTER_REGNUM && !frame_pointer_needed) + return true; + + /* We need to save the incoming return address if it is ever clobbered + within the function. */ + if (regno == LINK_REGNUM + && (df_regs_ever_live_p(regno) || crtl->uses_pic_offset_table + || cfun->machine->force_lr_save)) + return true; + + if(crtl->calls_eh_return) + { + unsigned int i; + for (i = 0; EH_RETURN_DATA_REGNO (i) != INVALID_REGNUM; i++) + { + if ((unsigned int)regno == EH_RETURN_DATA_REGNO (i)) + return true; + } + } + + return false; + +} /* or1k_save_reg_p () */ + +bool +or1k_save_reg_p_cached (int regno) +{ + return (frame_info.mask & ((HOST_WIDE_INT) 1 << regno)) != 0; +} + +/* N.B. contrary to the ISA documentation, the stack includes the outgoing + arguments. */ +/* -------------------------------------------------------------------------- */ +/*!Compute full frame size and layout. + + Store information in "frame_info". + + @param[in] size The size of the function's local variables. + + @return Total size of stack frame. */ +/* -------------------------------------------------------------------------- */ +static HOST_WIDE_INT +or1k_compute_frame_size (HOST_WIDE_INT size) +{ + HOST_WIDE_INT args_size; + HOST_WIDE_INT vars_size; + HOST_WIDE_INT stack_offset; + HOST_WIDE_INT save_size; + bool interrupt_p = false; + int regno; + + args_size = crtl->outgoing_args_size; + vars_size = OR1K_ALIGN (size, 4); + + frame_info.args_size = args_size; + frame_info.vars_size = vars_size; + frame_info.gpr_frame = interrupt_p ? or1k_redzone : 0; + + /* If the function has local variables, we're committed to + allocating it anyway. Otherwise reclaim it here. */ + /* FIXME: Verify this. Got if from the MIPS port. */ + if (vars_size == 0 && crtl->is_leaf) + args_size = 0; + + stack_offset = 0; + + /* Save link register right at the bottom. */ + if (or1k_save_reg_p (LINK_REGNUM)) + { + stack_offset = stack_offset - UNITS_PER_WORD; + frame_info.lr_save_offset = stack_offset; + frame_info.save_lr_p = true; + } + else + frame_info.save_lr_p = false; + + /* HACK: In PIC mode we need to save the PIC reg and the link reg in + in case the function is doing references through the got or plt, + but this information is not necessarily available when the initial + elimination offset is calculated, so we always reserve the space even + if it is not used... */ + if (!frame_info.save_lr_p && flag_pic) + stack_offset = stack_offset - UNITS_PER_WORD; + + /* Save frame pointer right after possible link register. */ + if (frame_pointer_needed) + { + stack_offset = stack_offset - UNITS_PER_WORD; + frame_info.fp_save_offset = stack_offset; + frame_info.save_fp_p = true; + } + else + frame_info.save_fp_p = false; + + frame_info.gpr_size = 0; + frame_info.mask = 0; + + for (regno = 0; regno <= OR1K_LAST_ACTUAL_REG; regno++) + { + if (regno == LINK_REGNUM + || (frame_pointer_needed && regno == HARD_FRAME_POINTER_REGNUM)) + /* These have already been saved if so needed. */ + continue; + + if (or1k_save_reg_p (regno)) + { + frame_info.gpr_size += UNITS_PER_WORD; + frame_info.mask |= ((HOST_WIDE_INT) 1 << regno); + } + } + + if (!or1k_save_reg_p (PIC_OFFSET_TABLE_REGNUM) + && (crtl->uses_pic_offset_table || (flag_pic && frame_info.save_lr_p))) + { + frame_info.gpr_size += UNITS_PER_WORD; + frame_info.mask |= ((HOST_WIDE_INT) 1 << PIC_OFFSET_TABLE_REGNUM); + } + else if (flag_pic && !or1k_save_reg_p (PIC_OFFSET_TABLE_REGNUM)) + frame_info.gpr_size += UNITS_PER_WORD; + + save_size = (frame_info.gpr_size + + (frame_info.save_fp_p ? UNITS_PER_WORD : 0) + + (frame_info.save_lr_p || flag_pic ? UNITS_PER_WORD : 0)); + frame_info.total_size = save_size + vars_size + args_size; + gcc_assert (PROLOGUE_TMP != STATIC_CHAIN_REGNUM); + if (frame_info.total_size > 32767 && interrupt_p) + { + int n_extra + = (!!(~frame_info.mask && 1 << PROLOGUE_TMP) + + !!(~frame_info.mask & 1 << EPILOGUE_TMP)) * UNITS_PER_WORD; + + save_size += n_extra; + frame_info.gpr_size += n_extra; + frame_info.total_size += n_extra; + frame_info.mask |= (1 << PROLOGUE_TMP) | (1 << EPILOGUE_TMP); + } + + stack_offset -= frame_info.gpr_size; + frame_info.gpr_offset = stack_offset; + frame_info.late_frame = frame_info.total_size; + + if (save_size > or1k_redzone + || (frame_info.gpr_frame + && (frame_info.gpr_frame + frame_info.late_frame <= 32767))) + { + if (frame_info.gpr_frame + frame_info.late_frame <= 32767) + save_size = frame_info.total_size; + frame_info.gpr_frame += save_size; + frame_info.lr_save_offset += save_size; + frame_info.fp_save_offset += save_size; + frame_info.gpr_offset += save_size; + frame_info.late_frame -= save_size; + /* FIXME: check in TARGET_OVERRIDE_OPTIONS for invalid or1k_redzone. */ + gcc_assert (frame_info.gpr_frame <= 32767); + gcc_assert ((frame_info.gpr_frame & 3) == 0); + } + + return frame_info.total_size; + +} /* or1k_compute_frame_size () */ + + +/* -------------------------------------------------------------------------- */ +/*!Emit a frame related insn. + + Same as emit_insn, but sets RTX_FRAME_RELATED_P to one. Getting this right + will matter for DWARF 2 output, if prologues are handled via the "prologue" + pattern rather than target hooks. + + @param[in] insn The insn to emit. + + @return The RTX for the emitted insn. */ +/* -------------------------------------------------------------------------- */ +static rtx +emit_frame_insn (rtx insn) +{ + insn = emit_insn (insn); + RTX_FRAME_RELATED_P (insn) = 1; + return (insn); + +} /* emit_frame_insn () */ + + +/* -------------------------------------------------------------------------- */ +/* Generate a RTX for the indexed memory address based on stack_pointer_rtx + and a displacement + + @param[in] disp The displacement + + @return The RTX for the generated address. */ +/* -------------------------------------------------------------------------- */ +static rtx +stack_disp_mem (HOST_WIDE_INT disp) +{ + return gen_frame_mem (Pmode, plus_constant (Pmode, stack_pointer_rtx, disp)); +} + +enum machine_mode +or1k_select_cc_mode (enum rtx_code op) +{ + switch (op) { + case EQ: return CCEQmode; + case NE: return CCNEmode; + case GEU: return CCGEUmode; + case GTU: return CCGTUmode; + case LTU: return CCLTUmode; + case LEU: return CCLEUmode; + case GE: return CCGEmode; + case LT: return CCLTmode; + case GT: return CCGTmode; + case LE: return CCLEmode; + default: gcc_unreachable (); + } +} + +/* -------------------------------------------------------------------------- */ +/*!Generate insn patterns to do an integer compare of operands. + + @param[in] code RTX for the condition code. + @param[in] op0 RTX for the first operand. + @param[in] op1 RTX for the second operand. + + @return RTX for the comparison. */ +/* -------------------------------------------------------------------------- */ +static rtx +or1k_expand_int_compare (enum rtx_code code, + rtx op0, + rtx op1) +{ + enum machine_mode cmpmode; + rtx tmp, flags; + + cmpmode = or1k_select_cc_mode (code); + flags = gen_rtx_REG (cmpmode, OR1K_FLAGS_REG); + + /* This is very simple, but making the interface the same as in the + FP case makes the rest of the code easier. */ + tmp = gen_rtx_COMPARE (cmpmode, op0, op1); + emit_insn (gen_rtx_SET (VOIDmode, flags, tmp)); + + /* Return the test that should be put into the flags user, i.e. + the bcc, scc, or cmov instruction. */ + return gen_rtx_fmt_ee (code, VOIDmode, flags, const0_rtx); + +} /* or1k_expand_int_compare () */ + + +/* -------------------------------------------------------------------------- */ +/*!Generate insn patterns to do an integer compare of operands. + + We only deal with the case where the comparison is an integer + comparison. This wrapper function potentially allows reuse for non-integer + comparison in the future. + + @param[in] code RTX for the condition code. + @param[in] op0 RTX for the first operand. + @param[in] op1 RTX for the second operand. + + @return RTX for the comparison. */ +/* -------------------------------------------------------------------------- */ +static rtx +or1k_expand_compare (enum rtx_code code, rtx op0, rtx op1) +{ + return or1k_expand_int_compare (code, op0, op1); + +} /* or1k_expand_compare () */ + + +/* -------------------------------------------------------------------------- */ +/*!Emit insns to use the l.cmov instruction + + Emit a compare and then cmov. Only works for integer first operand. + + @param[in] dest RTX for the destination operand. + @param[in] op RTX for the comparison operation + @param[in] true_cond RTX to move to dest if condition is TRUE. + @param[in] false_cond RTX to move to dest if condition is FALSE. + + @return Non-zero (TRUE) if insns were emitted, zero (FALSE) otherwise. */ +/* -------------------------------------------------------------------------- */ +static int +or1k_emit_int_cmove (rtx dest, + rtx op, + rtx true_cond, + rtx false_cond) +{ + rtx condition_rtx, cr; + rtx op0 = XEXP (op, 0); + rtx op1 = XEXP (op, 1); + + if ((GET_MODE (op0) != SImode) && + (GET_MODE (op0) != HImode) && + (GET_MODE (op0) != QImode)) + { + return 0; + } + + /* We still have to do the compare, because cmov doesn't do a compare, it + just looks at the FLAG bit set by a previous compare instruction. */ + condition_rtx = or1k_expand_compare (GET_CODE (op), op0, op1); + + cr = XEXP (condition_rtx, 0); + + emit_insn (gen_cmov (dest, condition_rtx, true_cond, false_cond, cr)); + + return 1; + +} /* or1k_emit_int_cmove () */ + + +static void +or1k_print_operand_address (FILE *stream, rtx addr) +{ + rtx offset; + + switch (GET_CODE (addr)) + { + case MEM: + if (GET_CODE (XEXP (addr, 0)) == REG) + fprintf (stream, "%s", reg_names[REGNO (addr)]); + else + abort (); + break; + + case REG: + fprintf (stream, "0(%s)", reg_names[REGNO (addr)]); + break; + + case PLUS: + offset = 0; + + if (GET_CODE (XEXP (addr, 0)) == REG) + { + offset = XEXP (addr, 1); + addr = XEXP (addr, 0); + } + else if (GET_CODE (XEXP (addr, 1)) == REG) + { + offset = XEXP (addr, 0); + addr = XEXP (addr, 1); + } + output_address (offset); + fprintf (stream, "(%s)", reg_names[REGNO (addr)]); + break; + + case SYMBOL_REF: + if (SYMBOL_REF_DECL (addr)) + assemble_external (SYMBOL_REF_DECL (addr)); + + if (XSTR (addr, 0)[0] == '*') + fputs (&XSTR (addr, 0)[1], stream); + else + { + asm_fprintf (stream, "%U%s", XSTR (addr, 0)); + } + break; + + default: + output_addr_const (stream, addr); + } +} + +/* -------------------------------------------------------------------------- */ +/*!Is this a value suitable for an OR1K address displacement? + + Must be an integer (signed) which fits into 16-bits. If the result is a + double word, we had better also check that we can also get at the second + word. + + @param[in] mode Mode of the result for which this displacement will be + used. + @param[in] x RTX for an expression. + + @return Non-zero (TRUE) if this is a valid 16-bit offset, zero (FALSE) + otherwise. */ +/* -------------------------------------------------------------------------- */ +static int +or1k_legitimate_displacement_p (enum machine_mode mode, + rtx x) +{ + if (CONST_INT == GET_CODE(x)) + { + HOST_WIDE_INT disp = INTVAL (x); + + /* Allow for a second access 4 bytes further on if double. */ + if ((DFmode == mode) || (DImode == mode)) + { + return (-32768 < disp) && (disp <= 32763); + } + else + { + return (-32768 < disp) && (disp <= 32767); + } + } + else + { + return 0; + } +} /* or1k_legitimate_displacement_p () */ + + +/* -------------------------------------------------------------------------- */ +/*!Can this register be used as a base register? + + We need a strict version, for which the register must either be a hard + register, or already renumbered to a hard register. + + For the non-strict version, any register (other than the flag register will + do). + + @todo The code from the old port does not allow r0 as a base when strict, + and does when non-strict. Surely it is always a valid register? + + @param[in] regno The register to test + @param[in] strict Non-zero (TRUE) if this is a strict check, zero (FALSE) + otherwise. + + @return Non-zero (TRUE) if this register can be used as a base register, + zero (FALSE) otherwise. */ +/* -------------------------------------------------------------------------- */ +static bool +or1k_regnum_ok_for_base_p (HOST_WIDE_INT num, + bool strict) +{ + if (strict) + { + return (num < FIRST_PSEUDO_REGISTER) + ? (num > 0) && (num <= OR1K_LAST_INT_REG) + : (reg_renumber[num] > 0) && (reg_renumber[num] <= OR1K_LAST_INT_REG); + } + else + { + return (num <= OR1K_LAST_INT_REG) || (num >= FIRST_PSEUDO_REGISTER); + } +} /* or1k_regnum_ok_for_base_p () */ + +int +or1k_legitimate_pic_operand_p (rtx x) +{ + if (GET_CODE (x) == CONST + && GET_CODE (XEXP (x, 0)) == PLUS + && ((GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF + && (!SYMBOL_REF_LOCAL_P (XEXP (XEXP (x, 0), 0)) + || SYMBOL_REF_WEAK (XEXP (XEXP (x, 0), 0)))) + || GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF) + && CONST_INT_P (XEXP (XEXP (x, 0), 1))) + return or1k_legitimate_displacement_p (SImode, XEXP (XEXP (x, 0), 1)); + + return 1; +} + +static bool +or1k_expand_pic_symbol_ref (enum machine_mode mode ATTRIBUTE_UNUSED, + rtx operands[]) +{ + if (GET_CODE (operands[1]) == LABEL_REF + || (GET_CODE (operands[1]) == SYMBOL_REF + && SYMBOL_REF_LOCAL_P (operands[1]) + && !SYMBOL_REF_WEAK (operands[1]))) + { + crtl->uses_pic_offset_table = 1; + emit_insn (gen_movsi_gotoffhi (operands[0], operands[1])); + emit_insn (gen_movsi_gotofflo (operands[0], operands[0], + operands[1])); + emit_insn (gen_add3_insn(operands[0], operands[0], + pic_offset_table_rtx)); + return true; + } + else if (GET_CODE (operands[1]) == SYMBOL_REF) + { + crtl->uses_pic_offset_table = 1; + emit_insn (gen_movsi_got (operands[0], operands[1])); + return true; + } + else if (GET_CODE (operands[1]) == CONST + && GET_CODE (XEXP (operands[1], 0)) == PLUS + && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF + && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT) + { + rtx symbolref = XEXP (XEXP (operands[1], 0), 0); + crtl->uses_pic_offset_table = 1; + + if (SYMBOL_REF_LOCAL_P (symbolref) + && !SYMBOL_REF_WEAK (symbolref)) + { + emit_insn (gen_movsi_gotoffhi (operands[0], operands[1])); + emit_insn (gen_movsi_gotofflo (operands[0], operands[0], + operands[1])); + emit_insn (gen_add3_insn(operands[0], operands[0], + pic_offset_table_rtx)); + } + else + { + rtx const_int = XEXP (XEXP (operands[1], 0), 1); + + /* Expand the constant into a register if it doesn't + fit directly as an 16-bit immediate in the add below. + Note that the reg allocation is allowed here since + we are guarded by LEGITIMATE_PIC_OPERAND_P. */ + if (!or1k_legitimate_displacement_p (mode, const_int)) + { + rtx scratch = gen_reg_rtx (mode); + + or1k_emit_set_const32 (scratch, const_int); + const_int = scratch; + } + + emit_insn (gen_movsi_got (operands[0], symbolref)); + emit_insn (gen_add3_insn(operands[0], operands[0], const_int)); + } + return true; + } + return false; +} + +/* Return the TLS type for TLS symbols, 0 otherwise. */ +enum tls_model +or1k_tls_symbolic_operand (rtx op) +{ + if (GET_CODE (op) == CONST) + { + rtx sym, addend; + split_const (op, &sym, &addend); + if (GET_CODE (sym) == SYMBOL_REF) + return SYMBOL_REF_TLS_MODEL (sym); + } + else if (GET_CODE (op) == SYMBOL_REF) + return SYMBOL_REF_TLS_MODEL (op); + + return TLS_MODEL_NONE; +} + +static GTY(()) rtx gen_tls_tga; + +/* Get reference to the '__tls_get_addr' symbol */ +static rtx +gen_tls_get_addr (void) +{ + if (!gen_tls_tga) + gen_tls_tga = init_one_libfunc ("__tls_get_addr"); + return gen_tls_tga; +} + +/* Emit call to '__tls_get_addr' */ +static void +or1k_tls_call (rtx arg) +{ + emit_library_call_value (gen_tls_get_addr(), arg, + LCT_CONST, Pmode, 1, arg, Pmode); +} + +bool +or1k_expand_symbol_ref(enum machine_mode mode, rtx operands[]) +{ + if (mode == Pmode) + { + rtx op0, op1; + enum tls_model tls_kind; + + op0 = operands[0]; + op1 = operands[1]; + + if ((tls_kind = or1k_tls_symbolic_operand (op1)) != TLS_MODEL_NONE) + { + rtx tp; + tp = gen_rtx_REG(Pmode, THREAD_PTR_REGNUM); + switch (tls_kind) + { + case TLS_MODEL_GLOBAL_DYNAMIC: + case TLS_MODEL_LOCAL_DYNAMIC: + /* TODO: For now, treat LD as GD */ + crtl->uses_pic_offset_table = 1; + emit_insn (gen_movsi_tlsgdhi (op0, op1)); + emit_insn (gen_movsi_tlsgdlo (op0, op0, op1)); + emit_insn (gen_add3_insn (op0, op0, pic_offset_table_rtx)); + or1k_tls_call (op0); + break; + + case TLS_MODEL_INITIAL_EXEC: + crtl->uses_pic_offset_table = 1; + emit_insn (gen_movsi_gottpoffhi (op0, op1)); + emit_insn (gen_movsi_gottpofflo (op0, op0, op1)); + emit_insn (gen_add3_insn (op0, op0, pic_offset_table_rtx)); + emit_insn (gen_load_gottpoff (op0, op0)); + emit_insn (gen_add3_insn (op0, op0, tp)); + break; + + case TLS_MODEL_LOCAL_EXEC: + emit_insn (gen_movsi_tpoffhi (op0, op1)); + emit_insn (gen_movsi_tpofflo (op0, op0, op1)); + emit_insn (gen_add3_insn (op0, op0, tp)); + break; + + default: + gcc_unreachable (); + } + + return true; + } + } + + if (flag_pic && or1k_expand_pic_symbol_ref(mode, operands)) + return true; + + return false; +} + +bool +or1k_expand_move (enum machine_mode mode, rtx operands[]) +{ + if (can_create_pseudo_p ()) + { + if (GET_CODE (operands[0]) == MEM + || (GET_CODE (operands[0]) == SUBREG + && GET_CODE (SUBREG_REG (operands[0])) == MEM)) + { + /* Source operand for store must be in a register. */ + operands[1] = force_reg (SImode, operands[1]); + } + } + + if (or1k_expand_symbol_ref (mode, operands)) + return true; + + /* Working with CONST_INTs is easier, so convert + a double if needed. */ + + if (GET_CODE (operands[1]) == CONST_DOUBLE) { + operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1])); + } + + /* Handle sets of MEM first. */ + if (GET_CODE (operands[0]) == MEM) + { + if (register_operand(operands[1], SImode) + || (operands[1] == const0_rtx)) + goto movsi_is_ok; + + if (! reload_in_progress) + { + operands[0] = validize_mem (operands[0]); + operands[1] = force_reg (SImode, operands[1]); + } + } + + /* This makes sure we will not get rematched due to splittage. */ + if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode)) + ; + else if (CONSTANT_P (operands[1]) + && GET_CODE (operands[1]) != HIGH + && GET_CODE (operands[1]) != LO_SUM) + { + or1k_emit_set_const32 (operands[0], operands[1]); + return true; + } + movsi_is_ok: + ; + + return false; +} + +/* -------------------------------------------------------------------------- */ +/*!Emit a move from SRC to DEST. + + Assume that the move expanders can handle all moves if !can_create_pseudo_p + (). The distinction is important because, unlike emit_move_insn, the move + expanders know how to force Pmode objects into the constant pool even when + the constant pool address is not itself legitimate. + + @param[in] dest Destination of the move. + @param[in] src Source for the move. + + @return RTX for the move. */ +/* -------------------------------------------------------------------------- */ +static rtx +or1k_emit_move (rtx dest, rtx src) +{ + return (can_create_pseudo_p () + ? emit_move_insn (dest, src) + : emit_move_insn_1 (dest, src)); + +} /* or1k_emit_move () */ + + +/* -------------------------------------------------------------------------- */ +/*!Emit an instruction of the form (set TARGET (CODE OP0 OP1)). + + @param[in] code The code for the operation. + @param[in] target Destination for the set operation. + @param[in] op0 First operand. + @param[in] op1 Second operand. */ +/* -------------------------------------------------------------------------- */ +static void +or1k_emit_binary (enum rtx_code code, + rtx target, + rtx op0, + rtx op1) +{ + emit_insn (gen_rtx_SET (VOIDmode, target, + gen_rtx_fmt_ee (code, GET_MODE (target), op0, op1))); + +} /* or1k_emit_binary () */ + + +/* -------------------------------------------------------------------------- */ +/*!Compute the result of an operation into a new register. + + Compute ("code" "op0" "op1") and store the result in a new register of mode + "mode". + + @param[in] mode Mode of the result + @parma[in] code RTX for the operation to perform + @param[in] op0 RTX for the first operand + @param[in] op1 RTX for the second operand + + @return The RTX for the new register. */ +/* -------------------------------------------------------------------------- */ +static rtx +or1k_force_binary (enum machine_mode mode, + enum rtx_code code, + rtx op0, + rtx op1) +{ + rtx reg; + + reg = gen_reg_rtx (mode); + or1k_emit_binary (code, reg, op0, op1); + + return reg; + +} /* or1k_force_binary () */ + + +/* ========================================================================== */ +/* Global support functions */ + +static int +or1k_trampoline_code_words (void) +{ + int words = 5; + + /* need one more word in TARGET_DELAY_COMPAT mode to hold l.nop in delay slot */ + if (TARGET_DELAY_COMPAT) + words++; + + return words; +} + +/* -------------------------------------------------------------------------- */ +/* Return the size in bytes of the trampoline code. + + Padded to TRAMPOLINE_ALIGNMENT bits. The code sequence is documented in + or1k_trampoline_init (). + + This is just the code size. the static chain pointer and target function + address immediately follow. + + @return The size of the trampoline code in bytes. */ +/* -------------------------------------------------------------------------- */ +int +or1k_trampoline_code_size (void) +{ + const int TRAMP_BYTE_ALIGN = TRAMPOLINE_ALIGNMENT / 8; + + return (or1k_trampoline_code_words() * 4 + TRAMP_BYTE_ALIGN - 1) / TRAMP_BYTE_ALIGN * TRAMP_BYTE_ALIGN; + +} /* or1k_trampoline_code_size () */ + + +/* ========================================================================== */ +/* Functions to support the Machine Description */ + + +/* -------------------------------------------------------------------------- */ +/*!Expand a prologue pattern. + + Called after register allocation to add any instructions needed for the + prologue. Using a prologue insn is favored compared to putting all of the + instructions in output_function_prologue(), since it allows the scheduler + to intermix instructions with the saves of the caller saved registers. In + some cases, it might be necessary to emit a barrier instruction as the last + insn to prevent such scheduling. */ +/* -------------------------------------------------------------------------- */ +void +or1k_expand_prologue (void) +{ + int total_size = or1k_compute_frame_size (get_frame_size ()); + rtx insn; + + if (!total_size) + /* No frame needed. */ + return; + + gcc_assert (!frame_info.save_lr_p || !frame_info.save_fp_p + || frame_info.lr_save_offset != frame_info.fp_save_offset); + + if (frame_info.gpr_frame) + emit_frame_insn (gen_add2_insn (stack_pointer_rtx, + GEN_INT (-frame_info.gpr_frame))); + if (frame_info.save_fp_p) + { + emit_frame_insn (gen_rtx_SET (Pmode, + stack_disp_mem (frame_info.fp_save_offset), + hard_frame_pointer_rtx)); + + emit_frame_insn + (gen_add3_insn (hard_frame_pointer_rtx, stack_pointer_rtx, const0_rtx)); + } + if (frame_info.save_lr_p) + { + emit_frame_insn + (gen_rtx_SET (Pmode, stack_disp_mem (frame_info.lr_save_offset), + gen_rtx_REG (Pmode, LINK_REGNUM))); + } + if (frame_info.gpr_size) + { + int offset = 0; + int regno; + + for (regno = 0; regno <= OR1K_LAST_ACTUAL_REG; regno++) + { + if (!(frame_info.mask & ((HOST_WIDE_INT) 1 << regno))) + continue; + + /* Check that the offsets aren't stepping on lr/fp slots */ + gcc_assert (!frame_info.save_lr_p + || ((frame_info.gpr_offset + offset) + != frame_info.lr_save_offset)); + gcc_assert (!frame_info.save_fp_p + || ((frame_info.gpr_offset + offset) + != frame_info.fp_save_offset)); + + emit_frame_insn + (gen_rtx_SET (Pmode, + stack_disp_mem (frame_info.gpr_offset + offset), + gen_rtx_REG (Pmode, regno))); + offset = offset + UNITS_PER_WORD; + } + } + + /* Update the stack pointer to reflect frame size. */ + total_size = frame_info.late_frame; + insn = gen_add2_insn (stack_pointer_rtx, GEN_INT (-total_size)); + if (total_size > 32768) + { + rtx note = insn; + rtx value_rtx = gen_rtx_REG (Pmode, PROLOGUE_TMP); + + or1k_emit_set_const32 (value_rtx, GEN_INT (-total_size)); + if (frame_info.save_fp_p) + insn = gen_frame_alloc_fp (value_rtx); + else + insn = gen_add2_insn (stack_pointer_rtx, value_rtx); + insn = emit_frame_insn (insn); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, note); + } + else if (total_size) + { + if (frame_info.save_fp_p) + emit_frame_insn (gen_frame_alloc_fp (GEN_INT (-total_size))); + else + emit_frame_insn (insn); + } + /* Emit got pointer acquiring if there are any got references or + this function has calls */ + if (crtl->uses_pic_offset_table || (flag_pic && frame_info.save_lr_p)) + { + SET_REGNO (pic_offset_table_rtx, PIC_OFFSET_TABLE_REGNUM); + emit_insn (gen_set_got (pic_offset_table_rtx)); + } + +} /* or1k_expand_prologue () */ + + +/* -------------------------------------------------------------------------- */ +/*!Expand an epilogue pattern. + + Called after register allocation to add any instructions needed for the + epilogue. Using an epilogue insn is favored compared to putting all of the + instructions in output_function_epilogue(), since it allows the scheduler + to intermix instructions with the restores of the caller saved registers. + In some cases, it might be necessary to emit a barrier instruction as the + first insn to prevent such scheduling. */ +/* -------------------------------------------------------------------------- */ +void +or1k_expand_epilogue (void) +{ + int total_size = or1k_compute_frame_size (get_frame_size ()); + + if (frame_info.save_fp_p) + { + emit_insn (gen_frame_dealloc_fp ()); + emit_insn + (gen_rtx_SET (Pmode, hard_frame_pointer_rtx, + stack_disp_mem (frame_info.fp_save_offset))); + } + else + { + rtx value_rtx; + + total_size = frame_info.late_frame; + if (total_size > 32767) + { + value_rtx = gen_rtx_REG (Pmode, EPILOGUE_TMP); + or1k_emit_set_const32 (value_rtx, GEN_INT (total_size)); + } + else if (frame_info.late_frame) + value_rtx = GEN_INT (total_size); + if (total_size) + emit_insn (gen_frame_dealloc_sp (value_rtx)); + } + + /* eh_return sets the LR, do not overwrite it */ + if (frame_info.save_lr_p && !crtl->calls_eh_return) + { + emit_insn + (gen_rtx_SET (Pmode, gen_rtx_REG (Pmode, LINK_REGNUM), + stack_disp_mem (frame_info.lr_save_offset))); + } + + if (frame_info.gpr_size) + { + int offset = 0; + int regno; + + for (regno = 0; regno <= OR1K_LAST_ACTUAL_REG; regno++) + { + if (!(frame_info.mask & ((HOST_WIDE_INT) 1 << regno))) + continue; + + if (regno != FIRST_PSEUDO_REGISTER) + emit_insn + (gen_rtx_SET (Pmode, gen_rtx_REG (Pmode, regno), + stack_disp_mem (frame_info.gpr_offset + offset))); + offset = offset + UNITS_PER_WORD; + } + } + + if (crtl->calls_eh_return) + emit_insn (gen_add2_insn (stack_pointer_rtx, EH_RETURN_STACKADJ_RTX)); + + if (frame_info.gpr_frame) + emit_insn (gen_add2_insn (stack_pointer_rtx, + GEN_INT (frame_info.gpr_frame))); + emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, 9))); + +} /* or1k_expand_epilogue () */ + + + +/* -------------------------------------------------------------------------- */ +/*!Generate assembler code for a movdi/movdf pattern + + @param[in] operands Operands to the movdx pattern. + + @return The assembler string to output (always "", since we've done the + output here). */ +/* -------------------------------------------------------------------------- */ +const char * +or1k_output_move_double (rtx *operands) +{ + rtx xoperands[3]; + + switch (GET_CODE (operands[0])) + { + case REG: + if (GET_CODE (operands[1]) == REG) + { + if (REGNO (operands[0]) == REGNO (operands[1]) + 1) + { + output_asm_insn ("\tl.or \t%H0, %H1, r0", operands); + output_asm_insn ("\tl.or \t%0, %1, r0", operands); + return ""; + } + else + { + output_asm_insn ("\tl.or \t%0, %1, r0", operands); + output_asm_insn ("\tl.or \t%H0, %H1, r0", operands); + return ""; + } + } + else if (GET_CODE (operands[1]) == MEM) + { + xoperands[1] = XEXP (operands[1], 0); + if (GET_CODE (xoperands[1]) == REG) + { + xoperands[0] = operands[0]; + if (REGNO (xoperands[0]) == REGNO (xoperands[1])) + { + output_asm_insn ("\tl.lwz \t%H0, 4(%1)", xoperands); + output_asm_insn ("\tl.lwz \t%0, 0(%1)", xoperands); + return ""; + } + else + { + output_asm_insn ("\tl.lwz \t%0, 0(%1)", xoperands); + output_asm_insn ("\tl.lwz \t%H0, 4(%1)", xoperands); + return ""; + } + } + else if (GET_CODE (xoperands[1]) == PLUS) + { + if (GET_CODE (xoperands[2] = XEXP (xoperands[1], 1)) == REG) + { + xoperands[0] = operands[0]; + xoperands[1] = XEXP (xoperands[1], 0); + if (REGNO (xoperands[0]) == REGNO (xoperands[2])) + { + output_asm_insn ("\tl.lwz \t%H0, %1+4(%2)", + xoperands); + output_asm_insn ("\tl.lwz \t%0, %1(%2)", xoperands); + return ""; + } + else + { + output_asm_insn ("\tl.lwz \t%0, %1(%2)", xoperands); + output_asm_insn ("\tl.lwz \t%H0, %1+4(%2)", + xoperands); + return ""; + } + } + else if (GET_CODE (xoperands[2] = XEXP (xoperands[1], 0)) == + REG) + { + xoperands[0] = operands[0]; + xoperands[1] = XEXP (xoperands[1], 1); + if (REGNO (xoperands[0]) == REGNO (xoperands[2])) + { + output_asm_insn ("\tl.lwz \t%H0, %1+4(%2)", + xoperands); + output_asm_insn ("\tl.lwz \t%0, %1(%2)", xoperands); + return ""; + } + else + { + output_asm_insn ("\tl.lwz \t%0, %1(%2)", xoperands); + output_asm_insn ("\tl.lwz \t%H0, %1+4(%2)", + xoperands); + return ""; + } + } + else + abort (); + } + else + abort (); + } + else + abort (); + case MEM: + xoperands[0] = XEXP (operands[0], 0); + if (GET_CODE (xoperands[0]) == REG) + { + xoperands[1] = operands[1]; + output_asm_insn ("\tl.sw \t0(%0), %1", xoperands); + output_asm_insn ("\tl.sw \t4(%0), %H1", xoperands); + return ""; + } + else if (GET_CODE (xoperands[0]) == PLUS) + { + if (GET_CODE (xoperands[1] = XEXP (xoperands[0], 1)) == REG) + { + xoperands[0] = XEXP (xoperands[0], 0); + xoperands[2] = operands[1]; + output_asm_insn ("\tl.sw \t%0(%1), %2", xoperands); + output_asm_insn ("\tl.sw \t%0+4(%1), %H2", xoperands); + return ""; + } + else if (GET_CODE (xoperands[1] = XEXP (xoperands[0], 0)) == REG) + { + xoperands[0] = XEXP (xoperands[0], 1); + xoperands[2] = operands[1]; + output_asm_insn ("\tl.sw \t%0(%1), %2", xoperands); + output_asm_insn ("\tl.sw \t%0+4(%1), %H2", xoperands); + return ""; + } + else + abort (); + } + else + { + fprintf (stderr, " O/p error %s\n", + GET_RTX_NAME (GET_CODE (xoperands[0]))); + return ""; + /* abort (); */ + } + default: + abort (); + } +} /* or1k_output_move_double () */ + + +/* -------------------------------------------------------------------------- */ +/*!Expand a conditional branch + + @param[in] operands Operands to the branch. + @param[in] mode Mode of the comparison. */ +/* -------------------------------------------------------------------------- */ +void +or1k_expand_conditional_branch (rtx *operands, + enum machine_mode mode) +{ + rtx tmp; + enum rtx_code test_code = GET_CODE(operands[0]); + + switch (mode) + { + case SImode: + tmp = or1k_expand_compare (test_code, operands[1], operands[2]); + tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, + tmp, + gen_rtx_LABEL_REF (VOIDmode, operands[3]), + pc_rtx); + emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp)); + return; + + case SFmode: + tmp = or1k_expand_compare (test_code, operands[1], operands[2]); + tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, + tmp, + gen_rtx_LABEL_REF (VOIDmode, operands[3]), + pc_rtx); + emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp)); + return; + + default: + abort (); + } + +} /* or1k_expand_conditional_branch () */ + + +/* -------------------------------------------------------------------------- */ +/*!Emit a conditional move + + move "true_cond" to "dest" if "op" of the operands of the last comparison + is nonzero/true, "false_cond" if it is zero/false. + + @param[in] dest RTX for the destination operand. + @param[in] op RTX for the comparison operation + @param[in] true_cond RTX to move to dest if condition is TRUE. + @param[in] false_cond RTX to move to dest if condition is FALSE. + + @return Non-zero (TRUE) if the hardware supports such an operation, zero + (FALSE) otherwise. */ +/* -------------------------------------------------------------------------- */ +int +or1k_emit_cmove (rtx dest, + rtx op, + rtx true_cond, + rtx false_cond) +{ + enum machine_mode result_mode = GET_MODE (dest); + + if (GET_MODE (true_cond) != result_mode) + return 0; + + if (GET_MODE (false_cond) != result_mode) + return 0; + + /* First, work out if the hardware can do this at all */ + return or1k_emit_int_cmove (dest, op, true_cond, false_cond); + +} /* or1k_emit_cmove () */ + + +/* -------------------------------------------------------------------------- */ +/*!Output the assembler for a branch on flag instruction. + + @param[in] operands Operands to the branch. + + @return The assembler string to use. */ +/* -------------------------------------------------------------------------- */ +const char * +or1k_output_bf (rtx * operands) +{ + enum rtx_code code; + enum machine_mode mode_calc, mode_got; + + code = GET_CODE (operands[1]); + mode_calc = or1k_select_cc_mode (code); + mode_got = GET_MODE (operands[2]); + + if (mode_calc != mode_got) + return "l.bnf\t%l0%("; + else + return "l.bf\t%l0%("; +} /* or1k_output_bf () */ + + +/* -------------------------------------------------------------------------- */ +/*!Output the assembler for a conditional move instruction. + + @param[in] operands Operands to the conditional move. + + @return The assembler string to use. */ +/* -------------------------------------------------------------------------- */ +const char * +or1k_output_cmov (rtx * operands) +{ + enum rtx_code code; + enum machine_mode mode_calc, mode_got; + + code = GET_CODE (operands[1]); + mode_calc = or1k_select_cc_mode (code); + mode_got = GET_MODE (operands[4]); + + if (mode_calc != mode_got) + return "l.cmov\t%0,%3,%2"; /* reversed */ + else + return "l.cmov\t%0,%2,%3"; + +} /* or1k_output_cmov () */ + +/* -------------------------------------------------------------------------- */ +/*!Load a 32-bit constant. + + We know it can't be done in one insn when we get here, the movsi expander + guarantees this. + + @param[in] op0 RTX for the destination. + @param[in] op1 RTX for the (constant) source. */ +/* -------------------------------------------------------------------------- */ +void +or1k_emit_set_const32 (rtx op0, + rtx op1) +{ + enum machine_mode mode = GET_MODE (op0); + rtx temp; + + /* Sanity check that we really can't do it in one instruction. I.e that we + don't have a 16-bit constant. */ + if (GET_CODE (op1) == CONST_INT) + { + HOST_WIDE_INT val = INTVAL (op1) & GET_MODE_MASK (mode); + + if ((-32768 <= val) && (val <= 32767)) + { + abort (); + } + } + + /* Full 2-insn decomposition is needed. */ + if (reload_in_progress || reload_completed) + temp = op0; + else + temp = gen_reg_rtx (mode); + + if (GET_CODE (op1) == CONST_INT) + { + /* Emit them as real moves instead of a HIGH/LO_SUM, + this way CSE can see everything and reuse intermediate + values if it wants. */ + emit_insn (gen_rtx_SET (VOIDmode, temp, + GEN_INT (INTVAL (op1) + & ~(HOST_WIDE_INT) 0xffff))); + + emit_insn (gen_rtx_SET (VOIDmode, + op0, + gen_rtx_IOR (mode, temp, + GEN_INT (INTVAL (op1) & 0xffff)))); + } + else + { + /* since or1k bfd can not deal with relocs that are not of type + OR1K_CONSTH_RELOC + OR1K_CONST_RELOC (ie move high must be + followed by exactly one lo_sum) + */ + emit_insn (gen_movsi_insn_big (op0, op1)); + } +} /* or1k_emit_set_const32 () */ + + +/* ========================================================================== */ +/* Target hook functions. + + These are initialized at the end of this file, to avoid having to + predeclare all the functions. They are only needed here, so are static. */ + + + + +/* -------------------------------------------------------------------------- */ +/*!Define where a function returns values. + + Define this to return an RTX representing the place where a function + returns or receives a value of data type ret type, a tree node representing + a data type. "func" is a tree node representing FUNCTION_DECL or + FUNCTION_TYPE of a function being called. If "outgoing" is false, the hook + should compute the register in which the caller will see the return + value. Otherwise, the hook should return an RTX representing the place + where a function returns a value. + + On many machines, only TYPE_MODE ("ret_type") is relevant. (Actually, on + most machines, scalar values are returned in the same place regardless of + mode.) The value of the expression is usually a reg RTX for the hard + register where the return value is stored. The value can also be a parallel + RTX, if the return value is in multiple places. See FUNCTION_ARG for an + explanation of the parallel form. Note that the callee will populate every + location specified in the parallel, but if the first element of the + parallel contains the whole return value, callers will use that element as + the canonical location and ignore the others. The m68k port uses this type + of parallel to return pointers in both ‘%a0’ (the canonical location) and + ‘%d0’. + + If TARGET_PROMOTE_FUNCTION_RETURN returns true, you must apply the same + promotion rules specified in PROMOTE_MODE if valtype is a scalar type. + + If the precise function being called is known, "func" is a tree node + (FUNCTION_DECL) for it; otherwise, "func" is a null pointer. This makes it + possible to use a different value-returning convention for specific + functions when all their calls are known. + + Some target machines have "register windows" so that the register in which + a function returns its value is not the same as the one in which the caller + sees the value. For such machines, you should return different RTX + depending on outgoing. + + TARGET_FUNCTION_VALUE is not used for return values with aggregate data + types, because these are returned in another way. See + TARGET_STRUCT_VALUE_RTX and related macros. + + For the OR1K, we can just use the result of LIBCALL_VALUE, since all + functions return their result in the same place (register rv = r11). + + JPB 30-Aug-10: What about 64-bit scalar returns (long long int, double), + which also use rvh (=r12)? + + @param[in] ret_type The return type of the function. + @param[in] func Tree representing function being called. + @param[in] outgoing Non-zero (TRUE) if the result represents where the + function places the results, zero (FALSE) if the + result represents where the caller sees the result. + + @return A RTX representing where the result can be found. */ +/* -------------------------------------------------------------------------- */ +static rtx +or1k_function_value (const_tree ret_type, + const_tree func ATTRIBUTE_UNUSED, + bool outgoing ATTRIBUTE_UNUSED) +{ + return LIBCALL_VALUE (TYPE_MODE(ret_type)); + +} /* or1k_function_value () */ + + +/* -------------------------------------------------------------------------- */ +/*!Check if a function is suitable for tail call optimization. + + True if it is OK to do sibling call optimization for the specified call + expression "exp". "decl" will be the called function, or NULL if this is an + indirect call. + + It is not uncommon for limitations of calling conventions to prevent tail + calls to functions outside the current unit of translation, or during PIC + compilation. The hook is used to enforce these restrictions, as the sibcall + md pattern can not fail, or fall over to a “normal” call. The criteria for + successful sibling call optimization may vary greatly between different + architectures. + + For the OR1K, we currently don't allow sibcalls. + + @param[in] decl The function for which we may optimize + @param[in] exp The call expression which is candidate for optimization. + + @return Non-zero (TRUE) if sibcall optimization is permitted, zero (FALSE) + otherwise. */ +/* -------------------------------------------------------------------------- */ +static bool +or1k_function_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED, + tree exp ATTRIBUTE_UNUSED) +{ + return 0; +} /* or1k_function_ok_for_sibcall () */ + + +/* -------------------------------------------------------------------------- */ +/*!Should an argument be passed by reference. + + This target hook should return true if an argument at the position + indicated by "cum" should be passed by reference. This predicate is queried + after target independent reasons for being passed by reference, such as + TREE_ADDRESSABLE ("type"). + + If the hook returns TRUE, a copy of that argument is made in memory and a + pointer to the argument is passed instead of the argument itself. The + pointer is passed in whatever way is appropriate for passing a pointer to + that type. + + For the OR1K, all aggregates and arguments greater than 8 bytes are passed + this way. + + @param[in] cum Position of argument under consideration. + @param[in[ mode Not sure what this relates to. + @param[in] type Type of the argument. + @param[in] named Not sure what this relates to. + + @return Non-zero (TRUE) if the argument should be passed by reference, + zero (FALSE) otherwise. */ +/* -------------------------------------------------------------------------- */ +static bool +or1k_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED, + const_tree type, + bool named ATTRIBUTE_UNUSED) +{ + return (type && (AGGREGATE_TYPE_P (type) || int_size_in_bytes (type) > 8)); + +} /* or1k_pass_by_reference () */ + + +int +or1k_initial_elimination_offset(int from, int to) +{ + or1k_compute_frame_size (get_frame_size ()); + return ((from == FRAME_POINTER_REGNUM + ? frame_info.gpr_offset : frame_info.gpr_frame) + + (to == STACK_POINTER_REGNUM ? frame_info.late_frame : 0)); +} + + +/* -------------------------------------------------------------------------- */ +/*!How many bytes at the beginning of an argument must be put into registers. + + This target hook returns the number of bytes at the beginning of an + argument that must be put in registers. The value must be zero for + arguments that are passed entirely in registers or that are entirely pushed + on the stack. + + On some machines, certain arguments must be passed partially in registers + and partially in memory. On these machines, typically the first few words + of arguments a re passed in registers, and the rest on the stack. If a + multi-word argument (a double or a structure) crosses that boundary, its + first few words must be passed in registers and the rest must be + pushed. This macro tells the compiler when this occurs, and how many bytes + should go in registers. + + FUNCTION_ARG for these arguments should return the first register to be + used by the caller for this argument; likewise FUNCTION_INCOMING_ARG, for + the called function. + + On the OR1K we never split argumetns between registers and memory. + + JPB 30-Aug-10: Is this correct? Surely we should allow this. The ABI spec + is incomplete on this point. + + @param[in] cum Position of argument under consideration. + @param[in[ mode Not sure what this relates to. + @param[in] type Type of the argument. + @param[in] named Not sure what this relates to. + + @return The number of bytes of the argument to go into registers */ +/* -------------------------------------------------------------------------- */ +static int +or1k_arg_partial_bytes (cumulative_args_t cum ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED, + tree type ATTRIBUTE_UNUSED, + bool named ATTRIBUTE_UNUSED) +{ + return 0; + +} /* or1k_arg_partial_bytes () */ + + +/* -------------------------------------------------------------------------- */ +/*!Promote the mode of a function's arguments/return value. + + Like PROMOTE_MODE, but it is applied to outgoing function arguments or + function return values. The target hook should return the new mode and + possibly change "*punsignedp" if the promotion should change + signedness. This function is called only for scalar or pointer types. + + "for_return" allows to distinguish the promotion of arguments and return + values. If it is 1, a return value is being promoted and + TARGET_FUNCTION_VALUE must perform the same promotions done here. If it is + 2, the returned mode should be that of the register in which an incoming + parameter is copied, or the outgoing result is computed; then the hook + should return the same mode as PROMOTE_MODE, though the signedness may be + different. + + The default is to not promote arguments and return values. You can also + define the hook to "default_promote_function_mode_always_promote" if you + would like to apply the same rules given by PROMOTE_MODE. + + For the OR1K, if the size of the mode is integral and less than 4, we + promote to SImode, otherwise we return the mode we are supplied. + + @param[in] type Not sure. Type of the argument? + @param[in] mode The mode of argument/return value to consider. + @param[out] punsignedp Signedness of the value. + @param[in] fntype Not sure. Type of the function? + @param[in] for_return 1 if a return value, 2 if an incoming value. + + @return The new mode. */ +/* -------------------------------------------------------------------------- */ +static enum machine_mode +or1k_promote_function_mode (const_tree type ATTRIBUTE_UNUSED, + enum machine_mode mode, + int *punsignedp ATTRIBUTE_UNUSED, + const_tree fntype ATTRIBUTE_UNUSED, + int for_return ATTRIBUTE_UNUSED) +{ + return ( (GET_MODE_CLASS (mode) == MODE_INT) + && (GET_MODE_SIZE (mode) < 4)) ? SImode : mode; + +} /* or1k_promote_function_mode () */ + + +/* -------------------------------------------------------------------------- */ +/*!Is this a legitimate address? + + A function that returns whether x (an RTX) is a legitimate memory address on + the target machine for a memory operand of mode mode. + + Legitimate addresses are defined in two variants: a strict variant and a + non-strict one. The strict parameter chooses which variant is desired by + the caller. + + The strict variant is used in the reload pass. It must be defined so that + any pseudo- register that has not been allocated a hard register is + considered a memory reference. This is because in contexts where some kind + of register is required, a pseudo-register with no hard register must be + rejected. For non-hard registers, the strict variant should look up the + reg_renumber array; it should then proceed using the hard register number in + the array, or treat the pseudo as a memory reference if the array holds -1. + + The non-strict variant is used in other passes. It must be defined to accept + all pseudo-registers in every context where some kind of register is + required. + + Normally, constant addresses which are the sum of a symbol_ref and an + integer are stored inside a const RTX to mark them as constant. Therefore, + there is no need to recognize such sums specifically as legitimate + addresses. Normally you would simply recognize any const as legitimate. + + Usually PRINT_OPERAND_ADDRESS is not prepared to handle constant sums that + are not marked with const. It assumes that a naked plus indicates + indexing. If so, then you must reject such naked constant sums as + illegitimate addresses, so that none of them will be given to + PRINT_OPERAND_ADDRESS. + + On some machines, whether a symbolic address is legitimate depends on the + section that the address refers to. On these machines, define the target + hook TARGET_ENCODE_ SECTION_INFO to store the information into the + symbol_ref, and then check for it here. When you see a const, you will have + to look inside it to find the symbol_ref in order to determine the + section. See the internals manual section on "Assembler Format" for more + info. + + Some ports are still using a deprecated legacy substitute for this hook, the + GO_IF_LEGITIMATE_ADDRESS macro. This macro has this syntax: + + #define GO_IF_LEGITIMATE_ADDRESS (mode, x, label ) + + and should goto label if the address x is a valid address on the target + machine for a memory operand of mode mode. Whether the strict or non-strict + variants are desired is defined by the REG_OK_STRICT macro introduced + earlier in this section. Using the hook is usually simpler because it limits + the number of files that are recompiled when changes are made. + + The OR1K only has a single addressing mode, which is a base register with + 16-bit displacement. We can accept just 16-bit constants as addresses (they + can use r0 as base address, and we can accept plain registers as addresses + (they can use a displacement of zero). + + @param[in] mode The mode of the address + @param[in] x The address (RTX) + @param[in] strict Non-zero (TRUE) if we are in "strict" mode, zero (FALSE) + otherwise. + + @return Non-zero (TRUE) if this is a legitimate address, zero (FALSE) + otherwise. */ +/* -------------------------------------------------------------------------- */ +static bool +or1k_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, + rtx x, + bool strict) +{ + /* You might think 16-bit constants are suitable. They can be built into + addresses using r0 as the base. However this seems to lead to defective + code. So for now this is a placeholder, and this code is not used. + + if (or1k_legitimate_displacement_p (mode, x)) + { + return 1; + } + */ + /* Addresses consisting of a register and 16-bit displacement are also + suitable. We need the mode, since for double words, we had better be + able to address the full 8 bytes. */ + if (GET_CODE(x) == PLUS) + { + rtx reg = XEXP(x,0); + + /* If valid register... */ + if ((GET_CODE(reg) == REG) + && or1k_regnum_ok_for_base_p (REGNO (reg), strict)) + { + rtx offset = XEXP(x,1); + + /* ...and valid offset */ + if (or1k_legitimate_displacement_p (mode, offset)) + { + return 1; + } + } + } + + /* Addresses consisting of just a register are OK. They can be built into + addresses using an offset of zero (and an offset of four if double + word). */ + if (GET_CODE(x) == REG + && or1k_regnum_ok_for_base_p(REGNO(x),strict)) { + return 1; + } + + return 0; +} + +/* -------------------------------------------------------------------------- */ +/*!Initialize a trampoline for nested functions. + + A nested function is defined by *two* pieces of information, the address of + the function (like any other function) and a pointer to the frame of the + enclosing function. The latter is required to allow the nested function to + access local variables in the enclosing function's frame. + + This represents a problem, since a function in C is represented as an + address that can be held in a single variable as a pointer. Requiring two + pointers will not fit. + + The solution is documented in "Lexical Closures for C++" by Thomas + M. Breuel (USENIX C++ Conference Proceedings, October 17-21, 1988). The + nested function is represented by a small block of code and data on the + enclosing function's stack frame, which sets up a pointer to the enclosing + function's stack frame (the static chain pointer) in a register defined by + the ABI, and then jumps to the code of the function proper. + + The function can be represented as a single pointer to this block of code, + known as a trampoline, which when called generates both pointers + needed. The nested function (which knows it is a nested function at compile + time) can then generate code to access the enclosing frame via the static + chain register. + + There is a catch that the trampoline is set up as data, but executed as + instructions. The former will be via the data cache, the latter via the + instruction cache. There is a risk that a later trampoline will not be seen + by the instruction cache, so the wrong code will be executed. So the + instruction cache should be flushed for the trampoline address range. + + This hook is called to initialize a trampoline. "m_tramp" is an RTX for the + memory block for the trampoline; "fndecl" is the FUNCTION_DECL for the + nested function; "static_chain" is an RTX for the static chain value that + should be passed to the function when it is called. + + If the target defines TARGET_ASM_TRAMPOLINE_TEMPLATE, then the first thing + this hook should do is emit a block move into "m_tramp" from the memory + block returned by assemble_trampoline_template. Note that the block move + need only cover the constant parts of the trampoline. If the target + isolates the variable parts of the trampoline to the end, not all + TRAMPOLINE_SIZE bytes need be copied. + + If the target requires any other actions, such as flushing caches or + enabling stack execution, these actions should be performed after + initializing the trampoline proper. + + For the OR1K, no static chain register is used. We choose to use the return + value (rv) register. The code is based on that for MIPS. + The trampoline code is: + + l.movhi r11,hi(end_addr) + l.ori r11,lo(end_addr) + l.lwz r13,4(r11) + l.jr r13 + l.lwz r11,0(r11) + end_addr: + .word + .word + + @note For the OR1K we need to flush the instruction cache, which is a + privileged operation. Needs fixing. + + @param[in] m_tramp The lowest address of the trampoline on the stack. + @param[in] fndecl Declaration of the enclosing function. + @param[in] chain_value Static chain pointer to pass to the nested + function. */ +/* -------------------------------------------------------------------------- */ +static void +or1k_trampoline_init (rtx m_tramp, + tree fndecl, + rtx chain_value) +{ + rtx addr; /* Start address of the trampoline */ + rtx end_addr; /* End address of the code block */ + + rtx high; /* RTX for the high part of end_addr */ + rtx low; /* RTX for the low part of end_addr */ + rtx opcode; /* RTX for generated opcodes */ + rtx mem; /* RTX for trampoline memory */ + + rtx *trampoline; /* The trampoline code */ + + unsigned int i; /* Index into trampoline */ + unsigned int j; /* General counter */ + + HOST_WIDE_INT end_addr_offset; /* Offset to end of code */ + HOST_WIDE_INT static_chain_offset; /* Offset to stack chain word */ + HOST_WIDE_INT target_function_offset; /* Offset to func address word */ + + /* Work out the offsets of the pointers from the start of the trampoline + code. */ + trampoline = (rtx*) alloca (or1k_trampoline_code_words() * sizeof(rtx)); + end_addr_offset = or1k_trampoline_code_size (); + static_chain_offset = end_addr_offset; + target_function_offset = static_chain_offset + GET_MODE_SIZE (ptr_mode); + + /* Get pointers in registers to the beginning and end of the code block. */ + addr = force_reg (Pmode, XEXP (m_tramp, 0)); + end_addr = or1k_force_binary (Pmode, PLUS, addr, GEN_INT (end_addr_offset)); + + /* Build up the code in TRAMPOLINE. + + l.movhi r11,hi(end_addr) + l.ori r11,lo(end_addr) + l.lwz r13,4(r11) + l.jr r13 + l.lwz r11,0(r11) + end_addr: + */ + + i = 0; + + /* Break out the high and low parts of the end_addr */ + high = expand_simple_binop (SImode, LSHIFTRT, end_addr, GEN_INT (16), + NULL, false, OPTAB_WIDEN); + low = convert_to_mode (SImode, gen_lowpart (HImode, end_addr), true); + + /* Emit the l.movhi, adding an operation to OR in the high bits from the + RTX. */ + opcode = gen_int_mode (OR1K_MOVHI (11, 0), SImode); + trampoline[i++] = expand_simple_binop (SImode, IOR, opcode, high, NULL, + false, OPTAB_WIDEN); + + /* Emit the l.ori, adding an operations to OR in the low bits from the + RTX. */ + opcode = gen_int_mode (OR1K_ORI (11, 11, 0), SImode); + trampoline[i++] = expand_simple_binop (SImode, IOR, opcode, low, NULL, + false, OPTAB_WIDEN); + + /* Emit the l.lwz of the function address. No bits to OR in here, so we can + do the opcode directly. */ + trampoline[i++] = + gen_int_mode (OR1K_LWZ (13, 11, target_function_offset - end_addr_offset), + SImode); + + if (TARGET_DELAY_ON) { + /* Emit the l.jr of the function. No bits to OR in here, so we can do the + opcode directly. */ + trampoline[i++] = gen_int_mode (OR1K_JR (13), SImode); + + /* Emit the l.lwz of the static chain. No bits to OR in here, so we can + do the opcode directly. */ + trampoline[i++] = + gen_int_mode (OR1K_LWZ (STATIC_CHAIN_REGNUM, 11, + static_chain_offset - end_addr_offset), SImode); + } else { + trampoline[i++] = + gen_int_mode (OR1K_LWZ (STATIC_CHAIN_REGNUM, 11, + static_chain_offset - end_addr_offset), SImode); + trampoline[i++] = gen_int_mode (OR1K_JR (13), SImode); + if (TARGET_DELAY_COMPAT) + trampoline[i++] = gen_int_mode (OR1K_NOP, SImode); + } + + /* Copy the trampoline code. Leave any padding uninitialized. */ + for (j = 0; j < i; j++) + { + mem = adjust_address (m_tramp, SImode, j * GET_MODE_SIZE (SImode)); + or1k_emit_move (mem, trampoline[j]); + } + + /* Set up the static chain pointer field. */ + mem = adjust_address (m_tramp, ptr_mode, static_chain_offset); + or1k_emit_move (mem, chain_value); + + /* Set up the target function field. */ + mem = adjust_address (m_tramp, ptr_mode, target_function_offset); + or1k_emit_move (mem, XEXP (DECL_RTL (fndecl), 0)); + + /* Flushing the trampoline from the instruction cache needs to be done + here. */ + +} /* or1k_trampoline_init () */ + + +/* -------------------------------------------------------------------------- */ +/*!Provide support for DW_AT_calling_convention + + Define this to enable the dwarf attribute DW_AT_calling_convention to be + emitted for each function. Instead of an integer return the enum value for + the DW_CC_ tag. + + To support optional call frame debugging information, you must also define + INCOMING_RETURN_ADDR_RTX and either set RTX_FRAME_RELATED_P on the prologue + insns if you use RTL for the prologue, or call "dwarf2out_def_cfa" and + "dwarf2out_reg_save" as appropriate from TARGET_ASM_FUNCTION_PROLOGUE if + you don’t. + + For the OR1K, it should be sufficient to return DW_CC_normal in all cases. + + @param[in] function The function requiring debug information + + @return The enum of the DW_CC tag. */ +/* -------------------------------------------------------------------------- */ +static int +or1k_dwarf_calling_convention (const_tree function ATTRIBUTE_UNUSED) +{ + return DW_CC_normal; + +} /* or1k_dwarf_calling_convention () */ + +/* ========================================================================== */ +/* Target hook initialization. + + In most cases these use the static functions declared above. They have + defaults, so must be undefined first, before being redefined. + + The description of what they do is found with the function above, unless it + is a standard function or a constant, in which case it is defined here (as + with TARGET_ASM_NAMED_SECTION). + + The final declaration is of the global "targetm" structure. */ + +/* Output assembly directives to switch to section name. The section should + have attributes as specified by flags, which is a bit mask of the SECTION_* + flags defined in ‘output.h’. If decl is non-NULL, it is the VAR_DECL or + FUNCTION_DECL with which this section is associated. + + For OR1K, we use the default ELF sectioning. */ +#undef TARGET_ASM_NAMED_SECTION +#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section + +#undef TARGET_FUNCTION_VALUE +#define TARGET_FUNCTION_VALUE or1k_function_value + +#undef TARGET_FUNCTION_OK_FOR_SIBCALL +#define TARGET_FUNCTION_OK_FOR_SIBCALL or1k_function_ok_for_sibcall + +#undef TARGET_PASS_BY_REFERENCE +#define TARGET_PASS_BY_REFERENCE or1k_pass_by_reference + +#undef TARGET_ARG_PARTIAL_BYTES +#define TARGET_ARG_PARTIAL_BYTES or1k_arg_partial_bytes + +#undef TARGET_OPTION_OVERRIDE +#define TARGET_OPTION_OVERRIDE or1k_option_override + +#undef TARGET_ASM_FILE_START +#define TARGET_ASM_FILE_START or1k_asm_file_start + +/* This target hook returns TRUE if an argument declared in a prototype as an + integral type smaller than int should actually be passed as an int. In + addition to avoiding errors in certain cases of mismatch, it also makes for + better code on certain machines. + + The default is to not promote prototypes. + + For the OR1K we do require this, so use a utility hook, which always + returns TRUE. */ +#undef TARGET_PROMOTE_PROTOTYPES +#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true + +#undef TARGET_PROMOTE_FUNCTION_MODE +#define TARGET_PROMOTE_FUNCTION_MODE or1k_promote_function_mode + +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P or1k_legitimate_address_p + +#undef TARGET_TRAMPOLINE_INIT +#define TARGET_TRAMPOLINE_INIT or1k_trampoline_init + +#undef TARGET_DWARF_CALLING_CONVENTION +#define TARGET_DWARF_CALLING_CONVENTION or1k_dwarf_calling_convention + +/* uClibc has some instances where (non-coforming to ISO C) a non-varargs + prototype is in scope when calling that function which is implemented + as varargs. We want this to work at least where none of the anonymous + arguments are used. I.e. we want the last named argument to be known + as named so it can be passed in a register, varars funtion or not. */ +#undef TARGET_STRICT_ARGUMENT_NAMING +#define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_true + +/* Is this suitable for an immediate operand. + + JPB 1-Sep-10: Is this correct. We can only do 16-bit immediates directly. */ +static bool +or1k_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x) +{ + return GET_CODE(x) != CONST_DOUBLE || (GET_MODE (x) == VOIDmode && !flag_pic); +} +#undef TARGET_LEGITIMATE_CONSTANT_P +#define TARGET_LEGITIMATE_CONSTANT_P or1k_legitimate_constant_p + +/* On the OR1K, no functions pop their arguments. + JPB 29-Aug-10: Is this really correct? */ +static int +or1k_return_pops_args (tree ARG_UNUSED(fundecl), tree ARG_UNUSED(funtype), int ARG_UNUSED(size)) +{ + return 0; +} +#undef TARGET_RETURN_POPS_ARGS +#define TARGET_RETURN_POPS_ARGS or1k_return_pops_args + +/* Determine where to put an argument to a function. Value is zero to push + the argument on the stack, or a hard register in which to store the + argument. + + "mode" is the argument's machine mode. + + "type" is the data type of the argument (as a tree). This is null for + libcalls where that information may not be available. + + "cum" is a variable of type CUMULATIVE_ARGS which gives info about the + preceding args and about the function being called. + + "named" is nonzero if this argument is a named parameter (otherwise it is + an extra parameter matching an ellipsis). + + On the ARC the first MAX_ARC_PARM_REGS args are normally in registers and + the rest are pushed. */ +static rtx +or1k_function_arg (cumulative_args_t cum, enum machine_mode mode, + const_tree type, bool named) +{ + CUMULATIVE_ARGS *cum_pnt = get_cumulative_args (cum); + + if (OR1K_PASS_IN_REG_P (*cum_pnt, mode, type, named)) + return gen_rtx_REG (mode, OR1K_ROUND_ADVANCE_CUM (*cum_pnt, mode, type) + + GP_ARG_MIN_REG); + else + return 0; +} +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG or1k_function_arg +/* Update the data in "cum" to advance over an argument of mode "mode" and + data type "type". ("type" is null for libcalls where that information may + not be available.) */ +static void +or1k_function_arg_advance (cumulative_args_t cum, enum machine_mode mode, + const_tree type, bool ARG_UNUSED(named)) +{ + CUMULATIVE_ARGS *cum_pnt = get_cumulative_args (cum); + + *cum_pnt = OR1K_ROUND_ADVANCE_CUM (*cum_pnt, mode, type) + + OR1K_ROUND_ADVANCE_ARG (mode, type); +} + +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE or1k_function_arg_advance + +#undef TARGET_PRINT_OPERAND_ADDRESS +#define TARGET_PRINT_OPERAND_ADDRESS or1k_print_operand_address + +/* Trampoline stubs are yet to be written. */ +/* #define TARGET_ASM_TRAMPOLINE_TEMPLATE */ +/* #define TARGET_TRAMPOLINE_INIT */ + +/* Lay out structs with increased alignment so that they can be accessed + more efficiently. But don't increase the size of one or two byte + structs. */ +int +or1k_struct_alignment (tree t) +{ + unsigned HOST_WIDE_INT total = 0; + int default_align_fields = 0; + int special_align_fields = 0; + tree field; + unsigned max_align + = maximum_field_alignment ? maximum_field_alignment : BIGGEST_ALIGNMENT; + bool struct_p; + + switch (TREE_CODE (t)) + { + case RECORD_TYPE: + struct_p = true; break; + case UNION_TYPE: case QUAL_UNION_TYPE: + struct_p = false; break; + default: gcc_unreachable (); + } + /* Skip all non field decls */ + for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field)) + { + unsigned HOST_WIDE_INT field_size; + + if (TREE_CODE (field) != FIELD_DECL || + TREE_TYPE (field) == error_mark_node) + continue; + /* If this is a field in a non-qualified union, or the sole field in + a struct, and the alignment was set by the user, don't change the + alignment. + If the field is a struct/union in a non-qualified union, we already + had sufficient opportunity to pad it - if we didn't, that'd be + because the alignment was set as above. + Likewise if the field is a struct/union and the sole field in a + struct. */ + if (DECL_USER_ALIGN (field) + || TYPE_USER_ALIGN (TREE_TYPE (field)) + || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (field)) == QUAL_UNION_TYPE + || TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE) + { + if (TREE_CODE (t) == UNION_TYPE) + return 0; + special_align_fields++; + } + else if (DECL_PACKED (field)) + special_align_fields++; + else + default_align_fields++; + if (!host_integerp (DECL_SIZE (field), 1)) + field_size = max_align; + else + field_size = tree_low_cst (DECL_SIZE (field), 1); + if (field_size >= BIGGEST_ALIGNMENT) + total = max_align; + if (struct_p) + total += field_size; + else + total = MAX (total, field_size); + } + + if (!default_align_fields + && (TREE_CODE (t) != RECORD_TYPE || special_align_fields <= 1)) + return 0; + return total < max_align ? (1U << ceil_log2 (total)) : max_align; +} + +/* Increase the alignment of objects so that they are easier to copy. + Note that this can cause more struct copies to be inlined, so code + size might increase, but so should perfromance. */ +int +or1k_data_alignment (tree t, int align) +{ + if (align < FASTEST_ALIGNMENT && TREE_CODE (t) == ARRAY_TYPE) + { + int size = int_size_in_bytes (t); + + return (size > 0 && size < FASTEST_ALIGNMENT / BITS_PER_UNIT + ? (1 << floor_log2 (size)) * BITS_PER_UNIT + : FASTEST_ALIGNMENT); + } + return align; +} + +static void +or1k_option_override (void) +{ + if (!TARGET_DELAY_ON) + flag_delayed_branch = FALSE; +} + +static void +or1k_asm_file_start(void) +{ + default_file_start(); + + if (TARGET_DELAY_OFF) { + fprintf(asm_out_file, "\t.nodelay\n"); + } +} + +/* Implement EH_RETURN_HANDLER_RTX. + * Make eh_return use the link register. Epilogue LR restore + * is suppressed for eh_return. */ +rtx +or1k_eh_return_handler_rtx (void) +{ + return INCOMING_RETURN_ADDR_RTX; +} + +/* Implement RETURN_ADDR_RTX. + * We do not support moving back to a previous frame. */ +rtx +or1k_return_addr_rtx (int count, rtx frame ATTRIBUTE_UNUSED) +{ + if (count != 0) + return const0_rtx; + + /* We don't know if LR is going to be saved or if we're going to + * be clobbering it with the GOT instruction. + * Therefore the safest bet is to force a save of LR and use that. + * Assume it's going to be first in the stack. */ + + cfun->machine->force_lr_save = true; + return gen_rtx_MEM (Pmode, plus_constant (Pmode, arg_pointer_rtx, + -UNITS_PER_WORD)); +} + +/* Implement TARGET_FRAME_POINTER_REQUIRED. + * We want frame pointer in eh_return and when alloca is used */ +static bool +or1k_frame_pointer_required (void) +{ + return crtl->calls_eh_return || cfun->calls_alloca; +} + +/* Functions to save and restore machine-specific function data. */ +static struct machine_function * +or1k_init_machine_status (void) +{ + return ggc_alloc_cleared_machine_function (); +} + +void +or1k_init_expanders (void) +{ + /* Arrange to initialize and mark the machine per-function + * status. */ + init_machine_status = or1k_init_machine_status; + + if (cfun && cfun->machine) + { + cfun->machine->force_lr_save = false; + } +} + +#undef TARGET_FRAME_POINTER_REQUIRED +#define TARGET_FRAME_POINTER_REQUIRED or1k_frame_pointer_required + +/* Initialize the GCC target structure. */ +struct gcc_target targetm = TARGET_INITIALIZER; + +#include "gt-or1k.h" diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/or1k.h gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k.h --- gcc-4.8.3/gcc/config/or1k/or1k.h 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k.h 2014-07-29 10:33:53.905097377 +0200 @@ -0,0 +1,1210 @@ +/* Definitions of target machine for GNU compiler. OpenRISC 1000 version. + Copyright (C) 1987, 1988, 1992, 1995, 1996, 1999, 2000, 2001, 2002, + 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2010 Embecosm Limited + Contributed by Damjan Lampret in 1999. + Major optimizations by Matjaz Breskvar in 2005. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 1, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#ifndef _OR1K_H_ +#define _OR1K_H_ + +#include "config/or1k/or1k-opts.h" + +/* Target CPU builtins */ +#define TARGET_CPU_CPP_BUILTINS() \ + do \ + { \ + if (TARGET_DELAY_OFF) { \ + builtin_define ("__OR1KND__"); \ + builtin_define ("__or1knd__"); \ + builtin_assert ("cpu=or1knd"); \ + builtin_assert ("machine=or1knd"); \ + } else { \ + builtin_define ("__OR1K__"); \ + builtin_define ("__or1k__"); \ + builtin_assert ("cpu=or1k"); \ + builtin_assert ("machine=or1k"); \ + } \ + if (TARGET_DELAY_ON) { \ + builtin_define ("__OR1K_DELAY__"); \ + } else if (TARGET_DELAY_OFF) { \ + builtin_define ("__OR1K_NODELAY__"); \ + } else if (TARGET_DELAY_COMPAT) { \ + builtin_define ("__OR1K_DELAY_COMPAT__"); \ + } \ + } \ + while (0) + +#undef CPP_SPEC +#define CPP_SPEC \ + "%{!mnewlib:%{pthread:-D_XOPEN_SOURCE=700}}" + +/* Make sure we pick up the crti.o, crtbegin.o, crtend.o and crtn.o files. */ +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + "%{!shared:%{pie:Scrt0.o%s;:crt0.o%s}} crti.o%s \ + %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" + +#undef LINK_SPEC +#define LINK_SPEC "%{mnewlib:-entry 0x100} %{static:-static} %{shared:-shared}" + +/* Override previous definitions (linux.h). Newlib doesn't have a profiling + version of the library, but it does have a debugging version (libg.a) */ +#undef LIB_SPEC +#define LIB_SPEC "%{!mnewlib:%{pthread:-lpthread} \ + %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}" \ + "%{mnewlib:%{!g:-lc} %{g:-lg} -lor1k \ + %{mboard=*:-lboard-%*} %{!mboard=*:-lboard-or1ksim} \ + %{!g:-lc} %{g:-lg} \ + }" + +/* Target machine storage layout */ + +/* Define this if most significant bit is lowest numbered + in instructions that operate on numbered bit-fields. + This is not true on the or1k. */ +#define BITS_BIG_ENDIAN 0 + +/* Define this if most significant byte of a word is the lowest numbered. */ +#define BYTES_BIG_ENDIAN 1 + +/* Define this if most significant word of a multiword number is numbered. */ +#define WORDS_BIG_ENDIAN 1 + +/* Number of bits in an addressable storage unit */ +#define BITS_PER_UNIT 8 + +#define BITS_PER_WORD 32 +#define SHORT_TYPE_SIZE 16 +#define INT_TYPE_SIZE 32 +#define LONG_TYPE_SIZE 32 +#define LONG_LONG_TYPE_SIZE 64 +#define FLOAT_TYPE_SIZE 32 +#define DOUBLE_TYPE_SIZE 64 +#define LONG_DOUBLE_TYPE_SIZE 64 + +/* Width of a word, in units (bytes). */ +#define UNITS_PER_WORD 4 + +/* Width in bits of a pointer. + See also the macro `Pmode' defined below. */ +#define POINTER_SIZE 32 + +/* Allocation boundary (in *bits*) for storing pointers in memory. */ +#define POINTER_BOUNDARY 32 + +/* Allocation boundary (in *bits*) for storing arguments in argument list. */ +#define PARM_BOUNDARY 32 + +/* Boundary (in *bits*) on which stack pointer should be aligned. */ +#define STACK_BOUNDARY 32 + +/* Allocation boundary (in *bits*) for the code of a function. */ +#define FUNCTION_BOUNDARY 32 + +/* Alignment of field after `int : 0' in a structure. */ +#define EMPTY_FIELD_BOUNDARY 8 + +/* Every structure's size must be a multiple of this. */ +#define STRUCTURE_SIZE_BOUNDARY (TARGET_PADSTRUCT ? 32 : 8) + +/* A bitfield declared as `int' forces `int' alignment for the struct. */ +#define PCC_BITFIELD_TYPE_MATTERS 1 + +/* No data type wants to be aligned rounder than this. */ +#define BIGGEST_ALIGNMENT 32 + +/* The best alignment to use in cases where we have a choice. */ +#define FASTEST_ALIGNMENT 32 + +#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ + ((TREE_CODE (STRUCT) == RECORD_TYPE \ + || TREE_CODE (STRUCT) == UNION_TYPE \ + || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ + && !TYPE_PACKED (STRUCT) \ + && TYPE_FIELDS (STRUCT) != 0 \ + ? MAX (MAX ((COMPUTED), (SPECIFIED)), or1k_struct_alignment (STRUCT)) \ + : MAX ((COMPUTED), (SPECIFIED))) \ + +/* Make strings word-aligned so strcpy from constants will be faster. */ +/* +#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ + ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \ + && (ALIGN) < FASTEST_ALIGNMENT \ + ? FASTEST_ALIGNMENT : (ALIGN)) +*/ + +/* One use of this macro is to increase alignment of medium-size + data to make it all fit in fewer cache lines. Another is to + cause character arrays to be word-aligned so that `strcpy' calls + that copy constants to character arrays can be done inline. */ +/* +#define DATA_ALIGNMENT(TYPE, ALIGN) \ + ((((ALIGN) < FASTEST_ALIGNMENT) \ + && (TREE_CODE (TYPE) == ARRAY_TYPE \ + || TREE_CODE (TYPE) == UNION_TYPE \ + || TREE_CODE (TYPE) == RECORD_TYPE)) ? FASTEST_ALIGNMENT : (ALIGN)) +*/ /* CHECK - btw code gets bigger with this one */ +#define DATA_ALIGNMENT(TYPE, ALIGN) \ + ((ALIGN) < FASTEST_ALIGNMENT \ + ? or1k_data_alignment ((TYPE), (ALIGN)) : (ALIGN)) + +#define LOCAL_ALIGNMENT(TYPE, ALIGN) \ + ((ALIGN) < FASTEST_ALIGNMENT \ + ? or1k_data_alignment ((TYPE), (ALIGN)) : (ALIGN)) + +/* Define this if move instructions will actually fail to work + when given unaligned data. */ +#define STRICT_ALIGNMENT 1 /* CHECK */ + +/* Align an address */ +#define OR1K_ALIGN(n,a) (((n) + (a) - 1) & ~((a) - 1)) + +/* Define if operations between registers always perform the operation + on the full register even if a narrower mode is specified. */ +#define WORD_REGISTER_OPERATIONS /* CHECK */ + + +/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD + will either zero-extend or sign-extend. The value of this macro should + be the code that says which one of the two operations is implicitly + done, NIL if none. */ +#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND + +/* Define this macro if it is advisable to hold scalars in registers + in a wider mode than that declared by the program. In such cases, + the value is constrained to be within the bounds of the declared + type, but kept valid in the wider mode. The signedness of the + extension may differ from that of the type. */ +#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ + if (GET_MODE_CLASS (MODE) == MODE_INT \ + && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \ + (MODE) = SImode; + /* CHECK */ + + +/* + * brings 0.4% improvment in static size for linux + * +#define PROMOTE_FOR_CALL_ONLY +*/ + +/* Define this macro if it is as good or better to call a constant + function address than to call an address kept in a register. */ +#define NO_FUNCTION_CSE 1 /* check */ + +/* Standard register usage. */ + +/* Number of actual hardware registers. + The hardware registers are assigned numbers for the compiler + from 0 to just below FIRST_PSEUDO_REGISTER. + All registers that the compiler knows about must be given numbers, + even those that are not normally considered general registers. */ + +#define OR1K_LAST_ACTUAL_REG 31 +#define ARG_POINTER_REGNUM (OR1K_LAST_ACTUAL_REG + 1) +#define FRAME_POINTER_REGNUM (ARG_POINTER_REGNUM + 1) +#define OR1K_LAST_INT_REG FRAME_POINTER_REGNUM +#define OR1K_FLAGS_REG (OR1K_LAST_INT_REG + 1) +#define FIRST_PSEUDO_REGISTER (OR1K_FLAGS_REG + 1) + +/* 1 for registers that have pervasive standard uses + and are not available for the register allocator. + On the or1k, these are r1 as stack pointer and + r2 as frame/arg pointer. r9 is link register, r0 + is zero, r10 is linux thread and r16 is got pointer */ +#define FIXED_REGISTERS { \ + 1, 1, 0, 0, 0, 0, 0, 0, \ + 0, 1, 1, 0, 0, 0, 0, 0, \ + 1, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1 } +/* 1 for registers not available across function calls. + These must include the FIXED_REGISTERS and also any + registers that can be used without being saved. + The latter must include the registers where values are returned + and the register where structure-value addresses are passed. + Aside from that, you can include as many other registers as you like. */ +#define CALL_USED_REGISTERS { \ + 1, 1, 0, 1, 1, 1, 1, 1, \ + 1, 1, 1, 1, 1, 1, 0, 1, \ + 1, 1, 0, 1, 0, 1, 0, 1, \ + 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1} + +/* stack pointer: must be FIXED and CALL_USED */ +/* hard frame pointer: must be call saved. */ +/* soft frame pointer / arg pointer: must be FIXED and CALL_USED */ + +/* Return number of consecutive hard regs needed starting at reg REGNO + to hold something of mode MODE. + This is ordinarily the length in words of a value of mode MODE + but can be less for certain modes in special long registers. + On the or1k, all registers are one word long. */ +#define HARD_REGNO_NREGS(REGNO, MODE) \ + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) + +/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */ +#define HARD_REGNO_MODE_OK(REGNO, MODE) 1 + +/* Value is 1 if it is a good idea to tie two pseudo registers + when one has mode MODE1 and one has mode MODE2. + If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, + for any hard reg, then this must be 0 for correct output. */ +#define MODES_TIEABLE_P(MODE1, MODE2) 1 + +/* A C expression for the cost of moving data of mode mode from a register in + class "from" to one in class "to". The classes are expressed using the + enumeration values such as GENERAL_REGS. A value of 2 is the default; other + values are interpreted relative to that. + + It is not required that the cost always equal 2 when "from" is the same as + "to"; on some machines it is expensive to move between registers if they are + not general registers. + + If reload sees an insn consisting of a single set between two hard + registers, and if REGISTER_MOVE_COST applied to their classes returns a + value of 2, reload does not check to ensure that the constraints of the + insn are met. Setting a cost of other than 2 will allow reload to verify + that the constraints are met. You should do this if the "movm" pattern's + constraints do not allow such copying. + + JPB 31-Aug-10: This is just the default. */ +#define REGISTER_MOVE_COST(mode, from, to) 2 + +/* A C expression for the cost of moving data of mode mode between a register + of class "class" and memory; "in" is zero if the value is to be written to + memory, nonzero if it is to be read in. This cost is relative to those in + REGISTER_MOVE_COST. If moving between registers and memory is more + expensive than between two registers, you should define this macro to + express the relative cost. + + If you do not define this macro, GCC uses a default cost of 4 plus the cost + of copying via a secondary reload register, if one is needed. If your + machine requires a secondary reload register to copy between memory and a + register of class but the reload mechanism is more complex than copying via + an intermediate, define this macro to reflect the actual cost of the move. + + GCC defines the function "memory_move_secondary_cost" if secondary reloads + are needed. It computes the costs due to copying via a secondary + register. If your machine copies from memory using a secondary register in + the conventional way but the default base value of 4 is not correct for + your machine, define this macro to add some other value to the result of + that function. The arguments to that function are the same as to this + macro. + + JPB 31-Aug-10. Is this really correct? I suppose the OR1K only takes one + cycle, notionally, to access memory, but surely that will + often stall the pipeline. Needs more investigation. */ +#define MEMORY_MOVE_COST(mode, class, in) 2 + +/* A C expression for the cost of a branch instruction. A value of 1 is the + default; other values are interpreted relative to that. Parameter "speed_p" + is TRUE when the branch in question should be optimized for speed. When it + is FALSE, BRANCH_COST should be returning value optimal for code size + rather then performance considerations. "predictable_p" is true for well + predictable branches. On many architectures the BRANCH_COST can be reduced + then. + + JPB 31-Aug-10. The original code had the comment that "... this should + specify the cost of a branch insn; roughly the number of + extra insns that should be added to avoid a branch. + + Set this to 3 on the or1k since that is roughly the average + cost of an unscheduled conditional branch. + + Cost of 2 and 3 give equal and ~0.7% bigger binaries + respectively." + + This seems ad-hoc. Probably we need some experiments. */ +#define BRANCH_COST(speed_p, predictable_p) 2 + +/* Specify the registers used for certain standard purposes. + The values of these macros are register numbers. */ + +/* Register to use for pushing function arguments. */ +#define STACK_POINTER_REGNUM 1 + +/* Base register for access to local variables of the function. */ +#define HARD_FRAME_POINTER_REGNUM 2 + +/* Link register. */ +#define LINK_REGNUM 9 + +/* Register in which static-chain is passed to a function. */ + +#define STATIC_CHAIN_REGNUM 11 + +#define PROLOGUE_TMP 13 +#define EPILOGUE_TMP 3 + +/* Register in which address to store a structure value + is passed to a function. */ +/*#define STRUCT_VALUE_REGNUM 0*/ + +/* Pass address of result struct to callee as "invisible" first argument */ +#define STRUCT_VALUE 0 + +/* -----------------------[ PHX start ]-------------------------------- */ + +/* Define the classes of registers for register constraints in the + machine description. Also define ranges of constants. + + One of the classes must always be named ALL_REGS and include all hard regs. + If there is more than one class, another class must be named NO_REGS + and contain no registers. + + The name GENERAL_REGS must be the name of a class (or an alias for + another name such as ALL_REGS). This is the class of registers + that is allowed by "g" or "r" in a register constraint. + Also, registers outside this class are allocated only when + instructions express preferences for them. + + GENERAL_REGS and BASE_REGS classess are the same on or1k. + + The classes must be numbered in nondecreasing order; that is, + a larger-numbered class must never be contained completely + in a smaller-numbered class. + + For any two classes, it is very desirable that there be another + class that represents their union. */ + +/* The or1k has only one kind of registers, so NO_REGS, GENERAL_REGS + and ALL_REGS are the only classes. */ +/* JPB 26-Aug-10: Based on note from Mikhael (mirekez@gmail.com), we don't + need CR_REGS and it is in the wrong place for later things! */ +enum reg_class +{ + NO_REGS, + GENERAL_REGS, + ALL_REGS, + LIM_REG_CLASSES +}; + +#define N_REG_CLASSES (int) LIM_REG_CLASSES + +/* Give names of register classes as strings for dump file. */ +#define REG_CLASS_NAMES \ +{ \ + "NO_REGS", \ + "GENERAL_REGS", \ + "ALL_REGS" \ +} + +/* Define which registers fit in which classes. This is an initializer for a + vector of HARD_REG_SET of length N_REG_CLASSES. + + An initializer containing the contents of the register classes, as integers + which are bit masks. The Nth integer specifies the contents of class N. + The way the integer MASK is interpreted is that register R is in the class + if `MASK & (1 << R)' is 1. + + When the machine has more than 32 registers, an integer does not suffice. + Then the integers are replaced by sub-initializers, braced groupings + containing several integers. Each sub-initializer must be suitable as an + initializer for the type `HARD_REG_SET' which is defined in + `hard-reg-set.h'. + + For the OR1K we have the minimal set. GENERAL_REGS is all except r0, which + it permanently zero. */ +#define REG_CLASS_CONTENTS \ + { \ + { 0x00000000, 0x00000000 }, /* NO_REGS */ \ + { 0xffffffff, 0x00000003 }, /* GENERAL_REGS */ \ + { 0xffffffff, 0x00000007 } /* ALL_REGS */ \ + } + +/* The same information, inverted: + + Return the class number of the smallest class containing reg number REGNO. + This could be a conditional expression or could index an array. + + ??? 0 is not really a register, but a constant. */ +#define REGNO_REG_CLASS(regno) \ + ((0 == regno) ? ALL_REGS : ((1 <= regno) && (regno <= OR1K_LAST_INT_REG)) \ + ? GENERAL_REGS : NO_REGS) + +/* The class value for index registers, and the one for base regs. */ +#define INDEX_REG_CLASS GENERAL_REGS +#define BASE_REG_CLASS GENERAL_REGS + +/* Given an rtx X being reloaded into a reg required to be in class CLASS, + return the class of reg to actually use. In general this is just CLASS; + but on some machines in some cases it is preferable to use a more + restrictive class. */ +#define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS) + +/* Return the maximum number of consecutive registers needed to represent mode + MODE in a register of class CLASS. + + On the or1k, this is always the size of MODE in words, since all registers + are the same size. */ +#define CLASS_MAX_NREGS(CLASS, MODE) \ + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) + + +/* -------------------------------------------------------------------------- */ +/* Stack layout; function entry, exit and calling. */ + +/* Define this if pushing a word on the stack makes the stack pointer a + smaller address. */ +#define STACK_GROWS_DOWNWARD 1 + +/* Define this if the nominal address of the stack frame is at the + high-address end of the local variables; that is, each additional local + variable allocated goes at a more negative offset in the frame. */ +#define FRAME_GROWS_DOWNWARD 1 + +/* Offset within stack frame to start allocating local variables at. If + FRAME_GROWS_DOWNWARD, this is the offset to the END of the first local + allocated. Otherwise, it is the offset to the BEGINNING of the first local + allocated. */ +#define STARTING_FRAME_OFFSET 0 + +/* Offset of first parameter from the argument pointer register value. */ +#define FIRST_PARM_OFFSET(FNDECL) 0 + +/* Define this if stack space is still allocated for a parameter passed + in a register. The value is the number of bytes allocated to this + area. + + No such allocation for OR1K. */ +/* #define REG_PARM_STACK_SPACE(FNDECL) (UNITS_PER_WORD * GP_ARG_NUM_REG) */ + +/* Define this if the above stack space is to be considered part of the + space allocated by the caller. + + N/a for OR1K. */ +/* #define OUTGOING_REG_PARM_STACK_SPACE */ + +/* Define this macro if `REG_PARM_STACK_SPACE' is defined, but the + stack parameters don't skip the area specified by it. + + N/a for OR1K. */ +/* #define STACK_PARMS_IN_REG_PARM_AREA */ + +/* If nonzero, the maximum amount of space required for outgoing arguments + will be computed and placed into the variable + current_function_outgoing_args_size. No space will be pushed onto the stack + for each call; instead, the function prologue should increase the stack + frame size by this amount. + + Setting both PUSH_ARGS and ACCUMULATE_OUTGOING_ARGS is not proper. + + This is the approached used by OR1K. */ +#define ACCUMULATE_OUTGOING_ARGS 1 + +#define ELIMINABLE_REGS \ +{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ + { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ + { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ + { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} + +#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ + (OFFSET) = or1k_initial_elimination_offset ((FROM), (TO)) + +/* Minimum and maximum general purpose registers used to hold arguments. */ +#define GP_ARG_MIN_REG 3 +#define GP_ARG_MAX_REG 8 +#define GP_ARG_NUM_REG (GP_ARG_MAX_REG - GP_ARG_MIN_REG + 1) + +/* Return register */ +#define GP_ARG_RETURN 11 +#define GP_ARG_RETURNH 12 + +/* TLS thread pointer register */ +#define THREAD_PTR_REGNUM 10 + +/* Position Independent Code. */ + +#define PIC_OFFSET_TABLE_REGNUM 16 + +/* A C expression that is nonzero if X is a legitimate immediate + operand on the target machine when generating position independent code. + You can assume that X satisfies CONSTANT_P, so you need not + check this. You can also assume `flag_pic' is true, so you need not + check it either. You need not define this macro if all constants + (including SYMBOL_REF) can be immediate operands when generating + position independent code. */ +#define LEGITIMATE_PIC_OPERAND_P(X) or1k_legitimate_pic_operand_p (X) + +/* A C expression to create an RTX representing the place where a library + function returns a value of mode mode. + + Note that “library function” in this context means a compiler support + routine, used to perform arithmetic, whose name is known specially by the + compiler and was not mentioned in the C code being compiled. + + For the OR1K, return value is in R11 (GP_ARG_RETURN). */ +#define LIBCALL_VALUE(mode) \ + gen_rtx_REG( \ + ((GET_MODE_CLASS (mode) != MODE_INT \ + || GET_MODE_SIZE (mode) >= 4) \ + ? (mode) \ + : SImode), \ + GP_ARG_RETURN) + +/* Define this if PCC uses the nonreentrant convention for returning + structure and union values. + + Not needed for OR1K. */ +/*#define PCC_STATIC_STRUCT_RETURN */ + +/* A C expression that is nonzero if regno is the number of a hard register in + which the values of called function may come back. + + A register whose use for returning values is limited to serving as the + second of a pair (for a value of type double, say) need not be recognized + by this macro. So for most machines, this definition suffices: + + #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0) + + If the machine has register windows, so that the caller and the called + function use different registers for the return value, this macro should + recognize only the caller's register numbers. + + For OR1K, we must check if we have the return register. + + From GCC 4.6, this will be replaced by TARGET_FUNCION_VALUE_REGNO_P target + hook function. */ +#define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_ARG_RETURN) + +/* 1 if N is a possible register number for function argument passing. */ +#define FUNCTION_ARG_REGNO_P(N) \ + ((N) >= GP_ARG_MIN_REG && (N) <= GP_ARG_MAX_REG) + +/* A code distinguishing the floating point format of the target + machine. There are three defined values: IEEE_FLOAT_FORMAT, + VAX_FLOAT_FORMAT, and UNKNOWN_FLOAT_FORMAT. */ +#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT +#define FLOAT_WORDS_BIG_ENDIAN 1 + +/* A C type for declaring a variable that is used as the first argument of + FUNCTION_ARG and other related values. For some target machines, the type + int suffices and can hold the number of bytes of argument so far. + + There is no need to record in CUMULATIVE_ARGS anything about the arguments + that have been passed on the stack. The compiler has other variables to + keep track of that. For target machines on which all arguments are passed + on the stack, there is no need to store anything in CUMULATIVE_ARGS; + however, the data structure must exist and should not be empty, so use + int. */ +#define CUMULATIVE_ARGS int + +/* A C statement (sans semicolon) for initializing the variable "cum" for the + state at the beginning of the argument list. The variable has type + CUMULATIVE_ARGS. The value of "fntype" is the tree node for the data type + of the function which will receive the args, or 0 if the args are to a + compiler support library function. For direct calls that are not libcalls, + "fndecl" contain the declaration node of the function. "fndecl" is also set + when INIT_CUMULATIVE_ARGS is used to find arguments for the function being + compiled. "n_named_args" is set to the number of named arguments, + including a structure return address if it is passed as a parameter, when + making a call. When processing incoming arguments, "n_named_args" is set to + −1. + + When processing a call to a compiler support library function, "libname" + identifies which one. It is a symbol_ref rtx which contains the name of the + function, as a string. "libname" is 0 when an ordinary C function call is + being processed. Thus, each time this macro is called, either "libname" or + "fntype" is nonzero, but never both of them at once. + + For the OR1K, we set "cum" to zero each time. + JPB 29-Aug-10: Is this correct? */ +#define INIT_CUMULATIVE_ARGS(cum, fntype, libname, fndecl, n_named_args) \ + (cum = 0) + +/* -------------------------------------------------------------------------- */ +/* Define intermediate macro to compute the size (in registers) of an argument + for the or1k. + + The OR1K_ROUND_ADVANCE* macros are local to this file. */ + +/* Round "size" up to a word boundary. */ +#define OR1K_ROUND_ADVANCE(size) \ + (((size) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) + +/* Round arg "mode"/"type" up to the next word boundary. */ +#define OR1K_ROUND_ADVANCE_ARG(mode, type) \ + ((mode) == BLKmode \ + ? OR1K_ROUND_ADVANCE (int_size_in_bytes (type)) \ + : OR1K_ROUND_ADVANCE (GET_MODE_SIZE (mode))) + +/* The ABI says that no rounding to even or odd words takes place. */ +#define OR1K_ROUND_ADVANCE_CUM(cum, mode, type) (cum) + +/* Return boolean indicating if arg of type "type" and mode "mode" will be + passed in a reg. This includes arguments that have to be passed by + reference as the pointer to them is passed in a reg if one is available + (and that is what we're given). + + When passing arguments "named" is always 1. When receiving arguments + "named" is 1 for each argument except the last in a stdarg/varargs + function. In a stdarg function we want to treat the last named arg as + named. In a varargs function we want to treat the last named arg (which is + `__builtin_va_alist') as unnamed. + + This macro is only used in this file. */ +#define OR1K_PASS_IN_REG_P(cum, mode, type, named) \ + ((named) \ + && ((OR1K_ROUND_ADVANCE_CUM ((cum), (mode), (type)) \ + + OR1K_ROUND_ADVANCE_ARG ((mode), (type)) \ + <= GP_ARG_NUM_REG))) + +/* Output assembler code to FILE to increment profiler label # LABELNO + for profiling a function entry. */ +#define FUNCTION_PROFILER(FILE, LABELNO) + +/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, the + stack pointer does not matter. The value is tested only in functions that + have frame pointers. No definition is equivalent to always zero. + + The default suffices for OR1K. */ +#define EXIT_IGNORE_STACK 0 + +/* A C expression whose value is RTL representing the location of the + incoming return address at the beginning of any function, before the + prologue. This RTL is either a REG, indicating that the return + value is saved in REG, or a MEM representing a location in + the stack. */ +#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, LINK_REGNUM) + +#define RETURN_ADDR_RTX or1k_return_addr_rtx + +/* Addressing modes, and classification of registers for them. */ + +/* #define HAVE_POST_INCREMENT */ +/* #define HAVE_POST_DECREMENT */ + +/* #define HAVE_PRE_DECREMENT */ +/* #define HAVE_PRE_INCREMENT */ + +/* Macros to check register numbers against specific register classes. */ +#define MAX_REGS_PER_ADDRESS 1 + +/* True if X is an rtx for a constant that is a valid address. + + JPB 29-Aug-10: Why is the default implementation not OK? */ +#define CONSTANT_ADDRESS_P(X) \ + (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ + || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \ + || GET_CODE (X) == HIGH) + +/* A C expression which is nonzero if register number num is suitable for use + as a base register in operand addresses. Like TARGET_LEGITIMATE_ADDRESS_P, + this macro should also define a strict and a non-strict variant. Both + variants behave the same for hard register; for pseudos, the strict variant + will pass only those that have been allocated to a valid hard registers, + while the non-strict variant will pass all pseudos. + + Compiler source files that want to use the strict variant of this and other + macros define the macro REG_OK_STRICT. You should use an #ifdef + REG_OK_STRICT conditional to define the strict variant in that case and the + non-strict variant otherwise. + + JPB 29-Aug-10: This has been conflated with the old REG_OK_FOR_BASE_P + function, which is no longer part of GCC. + + I'm not sure this is right. r0 can be a base register, just + it can't get set by the user. */ +#ifdef REG_OK_STRICT +#define REGNO_OK_FOR_BASE_P(num) \ + ( ((0 < (num)) && ((num) <= OR1K_LAST_INT_REG)) \ + || ((0 < reg_renumber[num]) && (reg_renumber[num] <= OR1K_LAST_INT_REG))) + +#else +/* Accept an int register or a pseudo reg. + + JPB 1-Sep-10: Should this allow r0, if the strict version does not? */ +#define REGNO_OK_FOR_BASE_P(num) ((num) <= OR1K_LAST_INT_REG || \ + (num) >= FIRST_PSEUDO_REGISTER) +#endif + +/* OR1K doesn't have any indexed addressing. */ +#define REG_OK_FOR_INDEX_P(X) 0 +#define REGNO_OK_FOR_INDEX_P(X) 0 + + +/* Specify the machine mode that this machine uses for the index in the + tablejump instruction. */ +#define CASE_VECTOR_MODE SImode + +/* Define as C expression which evaluates to nonzero if the tablejump + instruction expects the table to contain offsets from the address of the + table. + + Do not define this if the table should contain absolute addresses. */ +/* #define CASE_VECTOR_PC_RELATIVE 1 */ + +/* Define this as 1 if `char' should by default be signed; else as 0. */ +#define DEFAULT_SIGNED_CHAR 1 + +/* The maximum number of bytes that a single instruction can move quickly + between memory and registers or between two memory locations. */ +#define MOVE_MAX 4 + +/* Define this if zero-extension is slow (more than one real instruction). */ +/* #define SLOW_ZERO_EXTEND */ + +/* Nonzero if access to memory by bytes is slow and undesirable. + For RISC chips, it means that access to memory by bytes is no + better than access by words when possible, so grab a whole word + and maybe make use of that. */ +#define SLOW_BYTE_ACCESS 1 + +/* Define if shifts truncate the shift count + which implies one can omit a sign-extension or zero-extension + of a shift count. */ +/* #define SHIFT_COUNT_TRUNCATED */ + +/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits + is done just by pretending it is already truncated. */ +#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 + +/* Specify the machine mode that pointers have. + After generation of rtl, the compiler makes no further distinction + between pointers and any other objects of this machine mode. */ +#define Pmode SImode + +/* A function address in a call instruction + is a byte address (for indexing purposes) + so give the MEM rtx a byte's mode. */ +#define FUNCTION_MODE SImode + + +/* -------------------------------------------------------------------------- */ +/* Condition code stuff */ + +/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, + return the mode to be used for the comparison. */ +#define SELECT_CC_MODE(op, x, y) or1k_select_cc_mode(op) + +/* Can the condition code MODE be safely reversed? This is safe in + all cases on this port, because at present it doesn't use the + trapping FP comparisons (fcmpo). */ +#define REVERSIBLE_CC_MODE(mode) 1 + +/* Given a condition code and a mode, return the inverse condition. + + JPB 31-Aug-10: This seems like the default. Do we even need this? */ +#define REVERSE_CONDITION(code, mode) reverse_condition (code) + + +/* -------------------------------------------------------------------------- */ +/* Control the assembler format that we output. */ + +/* A C string constant describing how to begin a comment in the target + assembler language. The compiler assumes that the comment will end at + the end of the line. */ +#define ASM_COMMENT_START "#" + +/* Output to assembler file text saying following lines may contain character + constants, extra white space, comments, etc. + + JPB 29-Aug-10: Default would seem to be OK here. */ +#define ASM_APP_ON "#APP\n" + +/* Output to assembler file text saying following lines no longer contain + unusual constructs. + + JPB 29-Aug-10: Default would seem to be OK here. */ +#define ASM_APP_OFF "#NO_APP\n" + +/* Switch to the text or data segment. */ + +/* Output before read-only data. */ +#define TEXT_SECTION_ASM_OP "\t.section .text" + +/* Output before writable data. */ +#define DATA_SECTION_ASM_OP "\t.section .data" + +/* Output before uninitialized data. */ +#define BSS_SECTION_ASM_OP "\t.section .bss" + +/* How to refer to registers in assembler output. This sequence is indexed by + compiler's hard-register-number (see above). */ +#define REGISTER_NAMES \ + {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \ + "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \ + "argp", "frame", "cc-flag"} + + +/* -------------------------------------------------------------------------- */ +/* Debug things for DBX (STABS) */ +/* */ +/* Note. Our config.gcc includes dbxelf.h, which sets up appropriate */ +/* defaults. Choice of which debug format to use is in our elf.h */ +/* -------------------------------------------------------------------------- */ + +/* Don't try to use the type-cross-reference character in DBX data. + Also has the consequence of putting each struct, union or enum + into a separate .stabs, containing only cross-refs to the others. */ +/* JPB 24-Aug-10: Is this really correct. Can't GDB use this info? */ +#define DBX_NO_XREFS + +/* -------------------------------------------------------------------------- */ +/* Debug things for DWARF2 */ +/* */ +/* Note. Choice of which debug format to use is in our elf.h */ +/* -------------------------------------------------------------------------- */ + +/* We support frame unwind info including for exceptions handling. This needs + INCOMING_RETURN_ADDR_RTX to be set and OBJECT_FORMAT_ELF to be defined (in + elfos.h). Override any default value. */ +#undef DWARF2_UNWIND_INFO +#define DWARF2_UNWIND_INFO 1 + +/* We want frame info produced. Note that this is superfluous if + DWARF2_UNWIND_INFO is non-zero, but we set so this so, we can produce frame + info even when it is zero. Override any default value. */ +#undef DWARF2_FRAME_INFO +#define DWARF2_FRAME_INFO 1 + +/* Macro specifying which register holds the return address */ +#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (LINK_REGNUM) + +/* Where is the start of our stack frame in relation to the end of the + previous stack frame at the start of a function, before the prologue */ +#define INCOMING_FRAME_SP_OFFSET 0 + +/* Use compact debug tables. Generates .file/.loc directives. */ +#undef DWARF2_ASM_LINE_DEBUG_INFO +#define DWARF2_ASM_LINE_DEBUG_INFO 1 + +/* We don't need an alternative return address for now. */ +/* DWARF_ALT_FRAME_RETURN_COLUMN */ + +/* We always save registers in the prologue with word alignment, so don't + need this. */ +/* DWARF_CIE_DATA_ALIGNMENT */ + +/* This specifies the maximum number of registers we can save in a frame. We + could note that only SP, FP, LR, arg regs and callee saved regs come into + this category. However this is only an efficiency thing, so for now we + don't use it. */ +/* DWARF_FRAME_REGISTERS */ + +/* This specifies a mapping from register numbers in .dwarf_frame to + .eh_frame. However for us they are the same, so we don't need it. */ +/* DWARF_FRAME_REGNUM */ + +/* Defined if the DWARF column numbers do not match register numbers. For us + they do, so this is not needed. */ +/* DWARF_REG_TO_UNWIND_COLUMN */ + +/* Can be used to define a register guaranteed to be zero. Only useful if zero + is used to terminate backtraces, and not recommended for new ports, so we + don't use it. */ +/* DWARF_ZERO_REG */ + +/* This is the inverse function for DWARF_FRAME_REGNUM. Again not needed. */ +/* DWARF2_FRAME_REG_OUT */ + + +/* -------------------------------------------------------------------------- */ +/* Node: Label Output */ + +/* Globalizing directive for a label. */ +#define GLOBAL_ASM_OP "\t.global " + +#define SUPPORTS_WEAK 1 + +/* This is how to output the definition of a user-level label named NAME, + such as the label on a static function or variable NAME. */ +#define ASM_OUTPUT_LABEL(FILE,NAME) \ + { assemble_name (FILE, NAME); fputs (":\n", FILE); } + +/* We use -fleading-underscore to add it, when necessary. + JPB: No prefix for global symbols */ +#define USER_LABEL_PREFIX "" + +/* Remove any previous definition (elfos.h). */ +#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ + sprintf (LABEL, "*%s%d", PREFIX, NUM) + +/* This is how to output an assembler line defining an int constant. */ +#define ASM_OUTPUT_INT(stream, value) \ + { \ + fprintf (stream, "\t.word\t"); \ + output_addr_const (stream, (value)); \ + fprintf (stream, "\n")} + +/* This is how to output an assembler line defining a float constant. */ +#define ASM_OUTPUT_FLOAT(stream, value) \ + { long l; \ + REAL_VALUE_TO_TARGET_SINGLE (value,l); \ + fprintf(stream,"\t.word\t0x%08x\t\t# float %26.7e\n", l, value); } + +/* This is how to output an assembler line defining a double constant. */ +#define ASM_OUTPUT_DOUBLE(stream, value) \ + { long l[2]; \ + REAL_VALUE_TO_TARGET_DOUBLE (value,&l[0]); \ + fprintf(stream,"\t.word\t0x%08x,0x%08x\t# float %26.16le\n", \ + l[0],l[1],value); } + +/* This is how to output an assembler line defining a long double constant. + + JPB 29-Aug-10: Do we really mean this. I thought long double on OR1K was + the same as double. */ +#define ASM_OUTPUT_LONG_DOUBLE(stream, value) \ + { long l[4]; \ + REAL_VALUE_TO_TARGET_DOUBLE (value,&l[0]); \ + fprintf (stream, \ + "\t.word\t0x%08x,0x%08x,0x%08x,0x%08x\t# float %26.18lle\n", \ + l[0],l[1],l[2],l[3],value); } + +/* This is how to output an assembler line defining a short constant. */ +#define ASM_OUTPUT_SHORT(stream, value) \ + { fprintf (stream, "\t.half\t"); \ + output_addr_const (stream, (value)); \ + fprintf (stream, "\n"); } + +/* This is how to output an assembler line defining a char constant. */ +#define ASM_OUTPUT_CHAR(stream, value) \ + { fprintf (stream, "\t.byte\t"); \ + output_addr_const (stream, (value)); \ + fprintf (stream, "\n")} + +/* This is how to output an assembler line for a numeric constant byte. */ +#define ASM_OUTPUT_BYTE(stream, value) \ + fprintf (stream, "\t.byte\t0x%02x\n", (value)) + +/* This is how to output an insn to push a register on the stack. + It need not be very fast code. + + JPB 29-Aug-10: This was using l.sub (since we don't have l.subi), so it + was potty code. Replaced by adding immediate -1. */ +#define ASM_OUTPUT_REG_PUSH(stream, regno) \ + { fprintf (stream, "\tl.addi\tr1,r1,-4\n"); \ + fprintf (stream, "\tl.sw\t0(r1),%s\n", reg_names[regno]); } + +/* This is how to output an insn to pop a register from the stack. + It need not be very fast code. */ +#define ASM_OUTPUT_REG_POP(stream,REGNO) \ + { fprintf (stream, "\tl.lwz\t%s,0(r1)\n", reg_names[REGNO]); \ + fprintf (stream, "\tl.addi\tr1,r1,4\n"); } + +/* This is how to output an element of a case-vector that is absolute. + (The Vax does not use such vectors, + but we must define this macro anyway.) */ +#define ASM_OUTPUT_ADDR_VEC_ELT(stream, value) \ + fprintf (stream, "\t.word\t.L%d\n", value) + +/* This is how to output an element of a case-vector that is relative. */ +#define ASM_OUTPUT_ADDR_DIFF_ELT(stream, body, value, rel) \ + fprintf (stream, "\t.word\t.L%d-.L%d\n", value, rel) + +#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) +/* ??? If we were serious about PIC, we should also use l.jal to get + the table start address. */ + +/* This is how to output an assembler line that says to advance the location + counter to a multiple of 2**log bytes. */ +#define ASM_OUTPUT_ALIGN(stream, log) \ + if ((log) != 0) \ + { \ + fprintf (stream, "\t.align\t%d\n", 1 << (log)); \ + } + +/* This is how to output an assembler line that says to advance the location + counter by "size" bytes. */ +#define ASM_OUTPUT_SKIP(stream, size) \ + fprintf (stream, "\t.space %d\n", (size)) + +/* Need to split up .ascii directives to avoid breaking + the linker. */ + +/* This is how to output a string. */ +#define ASM_OUTPUT_ASCII(stream, ptr, len) \ + output_ascii_pseudo_op (stream, (const unsigned char *) (ptr), len) + +/* Invoked just before function output. */ +#define ASM_OUTPUT_FUNCTION_PREFIX(stream, fnname) \ + { fputs (".proc\t", stream); assemble_name (stream, fnname); \ + fputs ("\n", stream); } + +/* This says how to output an assembler line to define a global common + symbol. */ +#define ASM_OUTPUT_COMMON(stream,name,size,rounded) \ + { data_section (); \ + fputs ("\t.global\t", stream); \ + assemble_name(stream, name); \ + fputs ("\n", stream); \ + assemble_name (stream, name); \ + fputs (":\n", stream); \ + fprintf (stream, "\t.space\t%d\n", rounded); } + +/* This says how to output an assembler line to define a local common + symbol. + + JPB 29-Aug-10: I'm sure this doesn't work - we don't have a .bss directive + like this. */ +#define ASM_OUTPUT_LOCAL(stream, name, size, rounded) \ + { fputs ("\t.bss\t", (stream)); \ + assemble_name ((stream), (name)); \ + fprintf ((stream), ",%d,%d\n", (size), (rounded)); } + +/* This says how to output an assembler line to define a global common symbol + with size "size" (in bytes) and alignment "align" (in bits). */ +#define ASM_OUTPUT_ALIGNED_COMMON(stream, name, size, align) \ + { data_section(); \ + if ((ALIGN) > 8) \ + { \ + fprintf(stream, "\t.align %d\n", ((align) / BITS_PER_UNIT)); \ + } \ + fputs("\t.global\t", stream); assemble_name(stream, name); \ + fputs("\n", stream); \ + assemble_name(stream, name); \ + fputs (":\n", stream); \ + fprintf(stream, "\t.space\t%d\n", size); } + +/* This says how to output an assembler line to define a local common symbol + with size "size" (in bytes) and alignment "align" (in bits). */ +#define ASM_OUTPUT_ALIGNED_LOCAL(stream, name, size, align) \ + { data_section(); \ + if ((align) > 8) \ + { \ + fprintf(stream, "\t.align %d\n", ((align) / BITS_PER_UNIT)); \ + } \ + assemble_name(stream, name); \ + fputs (":\n", stream); \ + fprintf(stream, "\t.space %d\n", size); } + +/* Store in "output" a string (made with alloca) containing an assembler-name + for a local static variable named "name". "labelno" is an integer which is + different for each call. */ +#define ASM_FORMAT_PRIVATE_NAME(output, name, labelno) \ + { (output) = (char *) alloca (strlen ((name)) + 10); \ + sprintf ((output), "%s.%lu", (name), (unsigned long int) (labelno)); } + +/* Macro for %code validation. Returns nonzero if valid. + + The acceptance of '(' is an idea taken from SPARC; output nop for %( if not + optimizing or the slot is not filled. */ +#define PRINT_OPERAND_PUNCT_VALID_P(code) (('(' == code) || ('%' == code)) + +/* Print an instruction operand "x" on file "stream". "code" is the code from + the %-spec that requested printing this operand; if `%z3' was used to print + operand 3, then CODE is 'z'. */ +#define PRINT_OPERAND(stream, x, code) \ +{ \ + if (code == 'r' \ + && GET_CODE (x) == MEM \ + && GET_CODE (XEXP (x, 0)) == REG) \ + { \ + fprintf (stream, "%s", reg_names[REGNO (XEXP (x, 0))]); \ + } \ + else if (code == '(') \ + { \ + if (TARGET_DELAY_ON && dbr_sequence_length ()) \ + fprintf (stream, "\t# delay slot filled"); \ + else if (!TARGET_DELAY_OFF) \ + fprintf (stream, "\n\tl.nop\t\t\t# nop delay slot"); \ + } \ + else if (code == 'C') \ + { \ + switch (GET_CODE (x)) \ + { \ + case EQ: \ + fputs ("eq", stream); \ + break; \ + case NE: \ + fputs ("ne", stream); \ + break; \ + case GT: \ + fputs ("gts", stream); \ + break; \ + case GE: \ + fputs ("ges", stream); \ + break; \ + case LT: \ + fputs ("lts", stream); \ + break; \ + case LE: \ + fputs ("les", stream); \ + break; \ + case GTU: \ + fputs ("gtu", stream); \ + break; \ + case GEU: \ + fputs ("geu", stream); \ + break; \ + case LTU: \ + fputs ("ltu", stream); \ + break; \ + case LEU: \ + fputs ("leu", stream); \ + break; \ + default: \ + abort (); \ + } \ + } \ + else if (code == 'H') \ + { \ + if (GET_CODE (x) == REG) \ + fprintf (stream, "%s", reg_names[REGNO (x) + 1]); \ + else \ + abort (); \ + } \ + else if (GET_CODE (x) == REG) \ + fprintf (stream, "%s", reg_names[REGNO (x)]); \ + else if (GET_CODE (x) == MEM) \ + output_address (XEXP (x, 0)); \ + else \ + output_addr_const (stream, x); \ +} + +/* The size of the trampoline in bytes. This is a block of code followed by + two words specifying the function address and static chain pointer. */ +#define TRAMPOLINE_SIZE \ + (or1k_trampoline_code_size () + GET_MODE_SIZE (ptr_mode) * 2) + +/* Alignment required for trampolines, in bits. + + For the OR1K, there is no need for anything other than word alignment. */ +#define TRAMPOLINE_ALIGNMENT 32 + +/* Assume that if the assembler supports thread local storage + * the system supports it. */ +#if !defined(TARGET_HAVE_TLS) && defined(HAVE_AS_TLS) +#define TARGET_HAVE_TLS true +#endif + +/* Describe how we implement __builtin_eh_return. */ +#define EH_RETURN_REGNUM 23 +/* Use r25, r27, r29 and r31 (clobber regs) for exception data */ +#define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (25 + ((N)<<1)) : INVALID_REGNUM) +#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, EH_RETURN_REGNUM) +#define EH_RETURN_HANDLER_RTX or1k_eh_return_handler_rtx () + +#define INIT_EXPANDERS or1k_init_expanders () + +/* A C structure for machine-specific, per-function data. This is + * added to the cfun structure. */ +typedef struct GTY(()) machine_function +{ + /* Force stack save of LR. Used in RETURN_ADDR_RTX. */ + int force_lr_save; +} machine_function; + +#endif /* _OR1K_H_ */ diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/or1k.md gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k.md --- gcc-4.8.3/gcc/config/or1k/or1k.md 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k.md 2014-07-29 10:33:53.906097395 +0200 @@ -0,0 +1,1426 @@ +;; Machine description for GNU compiler, OpenRISC 1000 family, OR32 ISA +;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +;; 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2010 Embecosm Limited + +;; Contributed by Damjan Lampret in 1999. +;; Major optimizations by Matjaz Breskvar in 2005. +;; Floating point additions by Jungsook Yang +;; Julius Baxter in 2010 +;; Updated for GCC 4.5 by Jeremy Bennett +;; and Joern Rennecke in 2010 + +;; This file is part of GNU CC. + +;; This program is free software; you can redistribute it and/or modify it +;; under the terms of the GNU General Public License as published by the Free +;; Software Foundation; either version 3 of the License, or (at your option) +;; any later version. +;; +;; This program is distributed in the hope that it will be useful, but WITHOUT +;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +;; more details. +;; +;; You should have received a copy of the GNU General Public License along +;; with this program. If not, see . */ + +(define_constants [ + (SP_REG 1) + (FP_REG 2) ; hard frame pointer + (CC_REG 34) + + ;; unspec values + (UNSPEC_FRAME 0) + (UNSPEC_GOT 1) + (UNSPEC_GOTOFFHI 2) + (UNSPEC_GOTOFFLO 3) + (UNSPEC_TPOFFLO 4) + (UNSPEC_TPOFFHI 5) + (UNSPEC_GOTTPOFFLO 6) + (UNSPEC_GOTTPOFFHI 7) + (UNSPEC_GOTTPOFFLD 8) + (UNSPEC_TLSGDLO 9) + (UNSPEC_TLSGDHI 10) + (UNSPEC_SET_GOT 101) +]) + +(include "predicates.md") + +(include "constraints.md") + +(define_attr "type" + "unknown,load,store,move,extend,logic,add,mul,shift,compare,branch,jump,fp,jump_restore" + (const_string "unknown")) + +;; Number of machine instructions required to implement an insn. +(define_attr "length" "" (const_int 1)) + +;; Single delay slot after branch or jump instructions, wich may contain any +;; instruction but another branch or jump. +;; If TARGET_DELAY_OFF is not true, then never use delay slots. +;; If TARGET_DELAY_ON is not true, no instruction will be allowed to +;; fill the slot, and so it will be filled by a nop instead. +(define_delay (and (match_test "!TARGET_DELAY_OFF") (eq_attr "type" "branch,jump")) + [(and (match_test "TARGET_DELAY_ON") + (eq_attr "type" "!branch,jump") + (eq_attr "length" "1")) (nil) (nil)]) + +;; ALU is modelled as a single functional unit, which is reserved for varying +;; numbers of slots. +;; +;; I think this is all incorrect for the OR1K. The latency says when the +;; result will be ready, not how long the pipeline takes to execute. +(define_cpu_unit "or1k_alu") +(define_insn_reservation "bit_unit" 3 (eq_attr "type" "shift") "or1k_alu") +(define_insn_reservation "lsu_load" 3 (eq_attr "type" "load") "or1k_alu*3") +(define_insn_reservation "lsu_store" 2 (eq_attr "type" "store") "or1k_alu") +(define_insn_reservation "alu_unit" 2 + (eq_attr "type" "add,logic,extend,move,compare") + "or1k_alu") +(define_insn_reservation "mul_unit" 16 (eq_attr "type" "mul") "or1k_alu*16") + + +;; Called after register allocation to add any instructions needed for the +;; prologue. Using a prologue insn is favored compared to putting all of the +;; instructions in output_function_prologue(), since it allows the scheduler +;; to intermix instructions with the saves of the caller saved registers. In +;; some cases, it might be necessary to emit a barrier instruction as the last +;; insn to prevent such scheduling. + +(define_expand "prologue" + [(use (const_int 1))] + "" +{ + or1k_expand_prologue (); + DONE; +}) + +;; Called after register allocation to add any instructions needed for the +;; epilogue. Using an epilogue insn is favored compared to putting all of the +;; instructions in output_function_epilogue(), since it allows the scheduler +;; to intermix instructions with the restores of the caller saved registers. +;; In some cases, it might be necessary to emit a barrier instruction as the +;; first insn to prevent such scheduling. +(define_expand "epilogue" + [(use (const_int 2))] + "" +{ + or1k_expand_epilogue (); + DONE; +}) + +(define_insn "frame_alloc_fp" + [(set (reg:SI SP_REG) + (plus:SI (reg:SI SP_REG) + (match_operand:SI 0 "nonmemory_operand" "r,I"))) + (clobber (mem:QI (plus:SI (reg:SI FP_REG) + (unspec:SI [(const_int FP_REG)] UNSPEC_FRAME))))] + "" + "@ + l.add\tr1,r1,%0\t# allocate frame + l.addi\tr1,r1,%0\t# allocate frame" + [(set_attr "type" "add") + (set_attr "length" "1")]) + +(define_insn "frame_dealloc_fp" + [(set (reg:SI SP_REG) (reg:SI FP_REG)) + (clobber (mem:QI (plus:SI (reg:SI FP_REG) + (unspec:SI [(const_int FP_REG)] UNSPEC_FRAME))))] + "" + "l.ori\tr1,r2,0\t# deallocate frame" + [(set_attr "type" "logic") + (set_attr "length" "1")]) + +(define_insn "frame_dealloc_sp" + [(set (reg:SI SP_REG) + (plus:SI (reg:SI SP_REG) + (match_operand:SI 0 "nonmemory_operand" "r,I"))) + (clobber (mem:QI (plus:SI (reg:SI SP_REG) + (unspec:SI [(const_int SP_REG)] UNSPEC_FRAME))))] + "" + "@ + l.add\tr1,r1,%0 + l.addi\tr1,r1,%0" + [(set_attr "type" "add") + (set_attr "length" "1")]) + +(define_insn "return_internal" + [(return) + (use (match_operand 0 "pmode_register_operand" ""))] + "" + "l.jr \t%0\t# return_internal%(" + [(set_attr "type" "jump") + (set_attr "length" "1")]) + + + +;; +;; movQI +;; + +(define_expand "movqi" + [(set (match_operand:QI 0 "general_operand" "") + (match_operand:QI 1 "general_operand" ""))] + "" + " + if (can_create_pseudo_p()) + { + if (GET_CODE (operands[1]) == CONST_INT) + { + rtx reg = gen_reg_rtx (SImode); + + emit_insn (gen_movsi (reg, operands[1])); + operands[1] = gen_lowpart (QImode, reg); + } + if (GET_CODE (operands[1]) == MEM && optimize > 0) + { + rtx reg = gen_reg_rtx (SImode); + + emit_insn (gen_rtx_SET (SImode, reg, + gen_rtx_ZERO_EXTEND (SImode, + operands[1]))); + + operands[1] = gen_lowpart (QImode, reg); + } + if (GET_CODE (operands[0]) != REG) + operands[1] = force_reg (QImode, operands[1]); + } +") + +(define_insn "*movqi_internal" + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,r,r,r,r") + (match_operand:QI 1 "general_operand" "r,r,I,K,m"))] + "" + "@ + l.sb \t%0,%1\t # movqi + l.ori \t%0,%1,0\t # movqi: move reg to reg + l.addi \t%0,r0,%1\t # movqi: move immediate + l.ori \t%0,r0,%1\t # movqi: move immediate + l.lbz \t%0,%1\t # movqi" + [(set_attr "type" "store,add,add,logic,load")]) + + +;; +;; movHI +;; + +(define_expand "movhi" + [(set (match_operand:HI 0 "general_operand" "") + (match_operand:HI 1 "general_operand" ""))] + "" + " + if (can_create_pseudo_p()) + { + if (GET_CODE (operands[1]) == CONST_INT) + { + rtx reg = gen_reg_rtx (SImode); + + emit_insn (gen_movsi (reg, operands[1])); + operands[1] = gen_lowpart (HImode, reg); + } + else if (GET_CODE (operands[1]) == MEM && optimize > 0) + { + rtx reg = gen_reg_rtx (SImode); + + emit_insn (gen_rtx_SET (SImode, reg, + gen_rtx_ZERO_EXTEND (SImode, + operands[1]))); + operands[1] = gen_lowpart (HImode, reg); + } + if (GET_CODE (operands[0]) != REG) + operands[1] = force_reg (HImode, operands[1]); + } +") + +(define_insn "*movhi_internal" + [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r,r,r,r") + (match_operand:HI 1 "general_operand" "r,r,I,K,m"))] + "" + "@ + l.sh \t%0,%1\t # movhi + l.ori \t%0,%1,0\t # movhi: move reg to reg + l.addi \t%0,r0,%1\t # movhi: move immediate + l.ori \t%0,r0,%1\t # movhi: move immediate + l.lhz \t%0,%1\t # movhi" + [(set_attr "type" "store,add,add,logic,load")]) + +(define_expand "movsi" + [(set (match_operand:SI 0 "general_operand" "") + (match_operand:SI 1 "general_operand" ""))] + "" +{ + if (or1k_expand_move (SImode, operands)) DONE; +}) + +;; +;; movSI +;; + +(define_insn "*movsi_insn" + [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m") + (match_operand:SI 1 "input_operand" "I,K,M,r,m,r"))] + "(register_operand (operands[0], SImode) + || (register_operand (operands[1], SImode)) + || (operands[1] == const0_rtx))" + "@ + l.addi \t%0,r0,%1\t # move immediate I + l.ori \t%0,r0,%1\t # move immediate K + l.movhi \t%0,hi(%1)\t # move immediate M + l.ori \t%0,%1,0\t # move reg to reg + l.lwz \t%0,%1\t # SI load + l.sw \t%0,%1\t # SI store" + [(set_attr "type" "add,load,store,add,logic,move") + (set_attr "length" "1,1,1,1,1,1")]) + +(define_insn "movsi_lo_sum" + [(set (match_operand:SI 0 "register_operand" "=r") + (lo_sum:SI (match_operand:SI 1 "register_operand" "r") + (match_operand:SI 2 "immediate_operand" "i")))] + "" + "l.ori \t%0,%1,lo(%2) # movsi_lo_sum" + [(set_attr "type" "logic") + (set_attr "length" "1")]) + +(define_insn "movsi_high" + [(set (match_operand:SI 0 "register_operand" "=r") + (high:SI (match_operand:SI 1 "immediate_operand" "i")))] + "" + "l.movhi \t%0,hi(%1) # movsi_high" +[(set_attr "type" "move") + (set_attr "length" "1")]) + +(define_insn "movsi_gotofflo" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(lo_sum:SI (match_operand:SI 1 "register_operand" "r") + (match_operand 2 "" ""))] UNSPEC_GOTOFFLO))] + "flag_pic" + "l.ori \t%0,%1,gotofflo(%2) # movsi_gotofflo" + [(set_attr "type" "logic") + (set_attr "length" "1")]) + +(define_insn "movsi_gotoffhi" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(match_operand 1 "" "")] UNSPEC_GOTOFFHI))] + "flag_pic" + "l.movhi \t%0,gotoffhi(%1) # movsi_gotoffhi" + [(set_attr "type" "move") + (set_attr "length" "1")]) + +(define_insn "movsi_got" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(match_operand 1 "" "")] UNSPEC_GOT)) + (use (reg:SI 16))] + "flag_pic" + "l.lwz \t%0, got(%1)(r16)" + [(set_attr "type" "load")] +) + +(define_insn "movsi_tlsgdlo" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(lo_sum:SI (match_operand:SI 1 "register_operand" "r") + (match_operand:SI 2 "immediate_operand" "i"))] UNSPEC_TLSGDLO))] + "" + "l.ori \t%0,%1,tlsgdlo(%2) # movsi_tlsgdlo" + [(set_attr "type" "logic") + (set_attr "length" "1")]) + +(define_insn "movsi_tlsgdhi" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(match_operand:SI 1 "immediate_operand" "i")] UNSPEC_TLSGDHI))] + "" + "l.movhi \t%0,tlsgdhi(%1) # movsi_tlsgdhi" +[(set_attr "type" "move") + (set_attr "length" "1")]) + +(define_insn "movsi_gottpofflo" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(lo_sum:SI (match_operand:SI 1 "register_operand" "r") + (match_operand:SI 2 "immediate_operand" "i"))] UNSPEC_GOTTPOFFLO))] + "" + "l.ori \t%0,%1,gottpofflo(%2) # movsi_gottpofflo" + [(set_attr "type" "logic") + (set_attr "length" "1")]) + +(define_insn "movsi_gottpoffhi" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(match_operand:SI 1 "immediate_operand" "i")] UNSPEC_GOTTPOFFHI))] + "" + "l.movhi \t%0,gottpoffhi(%1) # movsi_gottpoffhi" +[(set_attr "type" "move") + (set_attr "length" "1")]) + +(define_insn "load_gottpoff" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_GOTTPOFFLD))] + "" + "l.lwz \t%0,0(%1) # load_gottpoff" +[(set_attr "type" "load") + (set_attr "length" "1")]) + +(define_insn "movsi_tpofflo" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(lo_sum:SI (match_operand:SI 1 "register_operand" "r") + (match_operand:SI 2 "immediate_operand" "i"))] UNSPEC_TPOFFLO))] + "" + "l.ori \t%0,%1,tpofflo(%2) # movsi_tpofflo" + [(set_attr "type" "logic") + (set_attr "length" "1")]) + +(define_insn "movsi_tpoffhi" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(match_operand:SI 1 "immediate_operand" "i")] UNSPEC_TPOFFHI))] + "" + "l.movhi \t%0,tpoffhi(%1) # movsi_tpoffhi" +[(set_attr "type" "move") + (set_attr "length" "1")]) + + +(define_insn_and_split "movsi_insn_big" + [(set (match_operand:SI 0 "register_operand" "=r") + (match_operand:SI 1 "immediate_operand" "i"))] + "GET_CODE (operands[1]) != CONST_INT" + ;; the switch of or1k bfd to Rela allows us to schedule insns separately. + "l.movhi \t%0,hi(%1)\;l.ori \t%0,%0,lo(%1)" + "(GET_CODE (operands[1]) != CONST_INT + || ! (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[1]), 'I', \"I\") + || CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[1]), 'K', \"K\") + || CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[1]), 'M', \"M\"))) + && reload_completed + && GET_CODE (operands[1]) != HIGH && GET_CODE (operands[1]) != LO_SUM" + [(pc)] +{ + if (!or1k_expand_symbol_ref(SImode, operands)) + { + emit_insn (gen_movsi_high (operands[0], operands[1])); + emit_insn (gen_movsi_lo_sum (operands[0], operands[0], operands[1])); + } + DONE; +} + [(set_attr "type" "move") + (set_attr "length" "2")]) + + +;; +;; Conditional Branches & Moves +;; + +(define_expand "addsicc" + [(match_operand:SI 0 "register_operand" "") + (match_operand 1 "comparison_operator" "") + (match_operand:SI 2 "register_operand" "") + (match_operand:SI 3 "register_operand" "")] + "" + "FAIL;") + +(define_expand "addhicc" + [(match_operand:HI 0 "register_operand" "") + (match_operand 1 "comparison_operator" "") + (match_operand:HI 2 "register_operand" "") + (match_operand:HI 3 "register_operand" "")] + "" + "FAIL;") + +(define_expand "addqicc" + [(match_operand:QI 0 "register_operand" "") + (match_operand 1 "comparison_operator" "") + (match_operand:QI 2 "register_operand" "") + (match_operand:QI 3 "register_operand" "")] + "" + "FAIL;") + + +;; +;; conditional moves +;; + +(define_expand "movsicc" + [(set (match_operand:SI 0 "register_operand" "") + (if_then_else:SI (match_operand 1 "comparison_operator" "") + (match_operand:SI 2 "register_operand" "") + (match_operand:SI 3 "register_operand" "")))] + "TARGET_MASK_CMOV" + " +{ + if (or1k_emit_cmove (operands[0], operands[1], operands[2], operands[3])) + DONE; +}") + +(define_expand "movhicc" + [(set (match_operand:HI 0 "register_operand" "") + (if_then_else:SI (match_operand 1 "comparison_operator" "") + (match_operand:HI 2 "register_operand" "") + (match_operand:HI 3 "register_operand" "")))] + "" + " +{ + FAIL; +}") + +(define_expand "movqicc" + [(set (match_operand:QI 0 "register_operand" "") + (if_then_else:SI (match_operand 1 "comparison_operator" "") + (match_operand:QI 2 "register_operand" "") + (match_operand:QI 3 "register_operand" "")))] + "" + " +{ + FAIL; +}") + + +;; We use the BASE_REGS for the cmov input operands because, if rA is +;; 0, the value of 0 is placed in rD upon truth. Similarly for rB +;; because we may switch the operands and rB may end up being rA. + +(define_insn "cmov" + [(set (match_operand:SI 0 "register_operand" "=r") + (if_then_else:SI + (match_operator 1 "comparison_operator" + [(match_operand 4 "cc_reg_operand" "") + (const_int 0)]) + (match_operand:SI 2 "register_operand" "r") + (match_operand:SI 3 "register_operand" "r")))] + "TARGET_MASK_CMOV" + "* + return or1k_output_cmov(operands); + ") + +;; +;; .................... +;; +;; COMPARISONS +;; +;; .................... + +;; Flow here is rather complex: +;; +;; 1) The cmp{si,di,sf,df} routine is called. It deposits the +;; arguments into the branch_cmp array, and the type into +;; branch_type. No RTL is generated. +;; +;; 2) The appropriate branch define_expand is called, which then +;; creates the appropriate RTL for the comparison and branch. +;; Different CC modes are used, based on what type of branch is +;; done, so that we can constrain things appropriately. There +;; are assumptions in the rest of GCC that break if we fold the +;; operands into the branches for integer operations, and use cc0 +;; for floating point, so we use the fp status register instead. +;; If needed, an appropriate temporary is created to hold the +;; of the integer compare. + +;; Compare insns are next. Note that the RS/6000 has two types of compares, +;; signed & unsigned, and one type of branch. +;; +;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc +;; insns, and branches. We store the operands of compares until we see +;; how it is used. + +;; JPB 31-Aug-10: cmpxx appears to be obsolete in GCC 4.5. Needs more +;; investigation. + +;;(define_expand "cmpsi" +;; [(set (reg:CC CC_REG) +;; (compare:CC (match_operand:SI 0 "register_operand" "") +;; (match_operand:SI 1 "nonmemory_operand" "")))] +;; "" +;; { +;; if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) +;; operands[0] = force_reg (SImode, operands[0]); +;; or1k_compare_op0 = operands[0]; +;; or1k_compare_op1 = operands[1]; +;; DONE; +;; }) + +;; (define_expand "cmpsf" +;; [(set (reg:CC CC_REG) +;; (compare:CC (match_operand:SF 0 "register_operand" "") +;; (match_operand:SF 1 "register_operand" "")))] +;; "TARGET_HARD_FLOAT" +;; { +;; if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) +;; operands[0] = force_reg (SFmode, operands[0]); +;; or1k_compare_op0 = operands[0]; +;; or1k_compare_op1 = operands[1]; +;; DONE; +;; }) + +(define_expand "cbranchsi4" + [(match_operator 0 "comparison_operator" + [(match_operand:SI 1 "register_operand") + (match_operand:SI 2 "nonmemory_operand")]) + (match_operand 3 "")] + "" + { + or1k_expand_conditional_branch (operands, SImode); + DONE; + }) + +(define_expand "cbranchsf4" + [(match_operator 0 "comparison_operator" + [(match_operand:SF 1 "register_operand") + (match_operand:SF 2 "register_operand")]) + (match_operand 3 "")] + "TARGET_HARD_FLOAT" + { + or1k_expand_conditional_branch (operands, SFmode); + DONE; + }) + +;; +;; Setting a CCxx registers from comparision +;; + + + +;; Here are the actual compare insns. +(define_insn "*cmpsi_eq" + [(set (reg:CCEQ CC_REG) + (compare:CCEQ (match_operand:SI 0 "register_operand" "r,r") + (match_operand:SI 1 "nonmemory_operand" "I,r")))] + "" + "@ + l.sfeqi\t%0,%1 # cmpsi_eq + l.sfeq \t%0,%1 # cmpsi_eq" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + +(define_insn "*cmpsi_ne" + [(set (reg:CCNE CC_REG) + (compare:CCNE (match_operand:SI 0 "register_operand" "r,r") + (match_operand:SI 1 "nonmemory_operand" "I,r")))] + "" + "@ + l.sfnei\t%0,%1 # cmpsi_ne + l.sfne \t%0,%1 # cmpsi_ne" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + +(define_insn "*cmpsi_gt" + [(set (reg:CCGT CC_REG) + (compare:CCGT (match_operand:SI 0 "register_operand" "r,r") + (match_operand:SI 1 "nonmemory_operand" "I,r")))] + "" + "@ + l.sfgtsi\t%0,%1 # cmpsi_gt + l.sfgts \t%0,%1 # cmpsi_gt" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + +(define_insn "*cmpsi_gtu" + [(set (reg:CCGTU CC_REG) + (compare:CCGTU (match_operand:SI 0 "register_operand" "r,r") + (match_operand:SI 1 "nonmemory_operand" "I,r")))] + "" + "@ + l.sfgtui\t%0,%1 # cmpsi_gtu + l.sfgtu \t%0,%1 # cmpsi_gtu" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + +(define_insn "*cmpsi_lt" + [(set (reg:CCLT CC_REG) + (compare:CCLT (match_operand:SI 0 "register_operand" "r,r") + (match_operand:SI 1 "nonmemory_operand" "I,r")))] + "" + "@ + l.sfltsi\t%0,%1 # cmpsi_lt + l.sflts \t%0,%1 # cmpsi_lt" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + +(define_insn "*cmpsi_ltu" + [(set (reg:CCLTU CC_REG) + (compare:CCLTU (match_operand:SI 0 "register_operand" "r,r") + (match_operand:SI 1 "nonmemory_operand" "I,r")))] + "" + "@ + l.sfltui\t%0,%1 # cmpsi_ltu + l.sfltu \t%0,%1 # cmpsi_ltu" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + +(define_insn "*cmpsi_ge" + [(set (reg:CCGE CC_REG) + (compare:CCGE (match_operand:SI 0 "register_operand" "r,r") + (match_operand:SI 1 "nonmemory_operand" "I,r")))] + "" + "@ + l.sfgesi\t%0,%1 # cmpsi_ge + l.sfges \t%0,%1 # cmpsi_ge" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + + +(define_insn "*cmpsi_geu" + [(set (reg:CCGEU CC_REG) + (compare:CCGEU (match_operand:SI 0 "register_operand" "r,r") + (match_operand:SI 1 "nonmemory_operand" "I,r")))] + "" + "@ + l.sfgeui\t%0,%1 # cmpsi_geu + l.sfgeu \t%0,%1 # cmpsi_geu" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + + +(define_insn "*cmpsi_le" + [(set (reg:CCLE CC_REG) + (compare:CCLE (match_operand:SI 0 "register_operand" "r,r") + (match_operand:SI 1 "nonmemory_operand" "I,r")))] + "" + "@ + l.sflesi\t%0,%1 # cmpsi_le + l.sfles \t%0,%1 # cmpsi_le" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + +(define_insn "*cmpsi_leu" + [(set (reg:CCLEU CC_REG) + (compare:CCLEU (match_operand:SI 0 "register_operand" "r,r") + (match_operand:SI 1 "nonmemory_operand" "I,r")))] + "" + "@ + l.sfleui\t%0,%1 # cmpsi_leu + l.sfleu \t%0,%1 # cmpsi_leu" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + +;; Single precision floating point evaluation instructions +(define_insn "*cmpsf_eq" + [(set (reg:CCEQ CC_REG) + (compare:CCEQ (match_operand:SF 0 "register_operand" "r,r") + (match_operand:SF 1 "register_operand" "r,r")))] + "TARGET_HARD_FLOAT" + "lf.sfeq.s\t%0,%1 # cmpsf_eq" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + +(define_insn "*cmpsf_ne" + [(set (reg:CCNE CC_REG) + (compare:CCNE (match_operand:SF 0 "register_operand" "r,r") + (match_operand:SF 1 "register_operand" "r,r")))] + "TARGET_HARD_FLOAT" + "lf.sfne.s\t%0,%1 # cmpsf_ne" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + + +(define_insn "*cmpsf_gt" + [(set (reg:CCGT CC_REG) + (compare:CCGT (match_operand:SF 0 "register_operand" "r,r") + (match_operand:SF 1 "register_operand" "r,r")))] + "TARGET_HARD_FLOAT" + "lf.sfgt.s\t%0,%1 # cmpsf_gt" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + +(define_insn "*cmpsf_ge" + [(set (reg:CCGE CC_REG) + (compare:CCGE (match_operand:SF 0 "register_operand" "r,r") + (match_operand:SF 1 "register_operand" "r,r")))] + "TARGET_HARD_FLOAT" + "lf.sfge.s\t%0,%1 # cmpsf_ge" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + + +(define_insn "*cmpsf_lt" + [(set (reg:CCLT CC_REG) + (compare:CCLT (match_operand:SF 0 "register_operand" "r,r") + (match_operand:SF 1 "register_operand" "r,r")))] + "TARGET_HARD_FLOAT" + "lf.sflt.s\t%0,%1 # cmpsf_lt" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + +(define_insn "*cmpsf_le" + [(set (reg:CCLE CC_REG) + (compare:CCLE (match_operand:SF 0 "register_operand" "r,r") + (match_operand:SF 1 "register_operand" "r,r")))] + "TARGET_HARD_FLOAT" + "lf.sfle.s\t%0,%1 # cmpsf_le" + [(set_attr "type" "compare") + (set_attr "length" "1")]) + +(define_insn "*bf" + [(set (pc) + (if_then_else (match_operator 1 "comparison_operator" + [(match_operand 2 + "cc_reg_operand" "") + (const_int 0)]) + (label_ref (match_operand 0 "" "")) + (pc)))] + "" + "* + return or1k_output_bf(operands); + " + [(set_attr "type" "branch") + (set_attr "length" "1")]) + +;; +;; +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; +(define_insn_and_split "movdi" + [(set (match_operand:DI 0 "nonimmediate_operand" "=r, r, m, r") + (match_operand:DI 1 "general_operand" " r, m, r, n"))] + "" + "* + return or1k_output_move_double (operands); + " + "&& reload_completed && CONSTANT_P (operands[1])" + [(set (match_dup 2) (match_dup 3)) (set (match_dup 4) (match_dup 5))] + "operands[2] = operand_subword (operands[0], 0, 0, DImode); + operands[3] = operand_subword (operands[1], 0, 0, DImode); + operands[4] = operand_subword (operands[0], 1, 0, DImode); + operands[5] = operand_subword (operands[1], 1, 0, DImode);" + [(set_attr "length" "2,2,2,3")]) + +;; Moving double and single precision floating point values + + +(define_insn "movdf" + [(set (match_operand:DF 0 "nonimmediate_operand" "=r, r, m, r") + (match_operand:DF 1 "general_operand" " r, m, r, i"))] + "" + "* + return or1k_output_move_double (operands); + " + [(set_attr "length" "2,2,2,3")]) + + +(define_insn "movsf" + [(set (match_operand:SF 0 "general_operand" "=r,r,m") + (match_operand:SF 1 "general_operand" "r,m,r"))] + "" + "@ + l.ori \t%0,%1,0\t # movsf + l.lwz \t%0,%1\t # movsf + l.sw \t%0,%1\t # movsf" + [(set_attr "type" "move,load,store") + (set_attr "length" "1,1,1")]) + + +;; +;; extendqisi2 +;; + +(define_expand "extendqisi2" + [(use (match_operand:SI 0 "register_operand" "")) + (use (match_operand:QI 1 "nonimmediate_operand" ""))] + "" + " +{ + if (TARGET_MASK_SEXT) + emit_insn (gen_extendqisi2_sext(operands[0], operands[1])); + else { + if ( GET_CODE(operands[1]) == MEM ) { + emit_insn (gen_extendqisi2_no_sext_mem(operands[0], operands[1])); + } + else { + emit_insn (gen_extendqisi2_no_sext_reg(operands[0], operands[1])); + } + } + DONE; +}") + +(define_insn "extendqisi2_sext" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] + "TARGET_MASK_SEXT" + "@ + l.extbs \t%0,%1\t # extendqisi2_has_signed_extend + l.lbs \t%0,%1\t # extendqisi2_has_signed_extend" + [(set_attr "length" "1,1") + (set_attr "type" "extend,load")]) + +(define_insn "extendqisi2_no_sext_mem" + [(set (match_operand:SI 0 "register_operand" "=r") + (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))] + "!TARGET_MASK_SEXT" + "l.lbs \t%0,%1\t # extendqisi2_no_sext_mem" + [(set_attr "length" "1") + (set_attr "type" "load")]) + +(define_expand "extendqisi2_no_sext_reg" + [(set (match_dup 2) + (ashift:SI (match_operand:QI 1 "register_operand" "") + (const_int 24))) + (set (match_operand:SI 0 "register_operand" "") + (ashiftrt:SI (match_dup 2) + (const_int 24)))] + "!TARGET_MASK_SEXT" + " +{ + operands[1] = gen_lowpart (SImode, operands[1]); + operands[2] = gen_reg_rtx (SImode); }") + +;; +;; extendhisi2 +;; + +(define_expand "extendhisi2" + [(use (match_operand:SI 0 "register_operand" "")) + (use (match_operand:HI 1 "nonimmediate_operand" ""))] + "" + " +{ + if (TARGET_MASK_SEXT) + emit_insn (gen_extendhisi2_sext(operands[0], operands[1])); + else { + if ( GET_CODE(operands[1]) == MEM ) { + emit_insn (gen_extendhisi2_no_sext_mem(operands[0], operands[1])); + } + else { + emit_insn (gen_extendhisi2_no_sext_reg(operands[0], operands[1])); + } + } + DONE; +}") + +(define_insn "extendhisi2_sext" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] + "TARGET_MASK_SEXT" + "@ + l.exths \t%0,%1\t # extendhisi2_has_signed_extend + l.lhs \t%0,%1\t # extendhisi2_has_signed_extend" + [(set_attr "length" "1,1") + (set_attr "type" "extend,load")]) + +(define_insn "extendhisi2_no_sext_mem" + [(set (match_operand:SI 0 "register_operand" "=r") + (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))] + "!TARGET_MASK_SEXT" + "l.lhs \t%0,%1\t # extendhisi2_no_sext_mem" + [(set_attr "length" "1") + (set_attr "type" "load")]) + +(define_expand "extendhisi2_no_sext_reg" + [(set (match_dup 2) + (ashift:SI (match_operand:HI 1 "register_operand" "") + (const_int 16))) + (set (match_operand:SI 0 "register_operand" "") + (ashiftrt:SI (match_dup 2) + (const_int 16)))] + "!TARGET_MASK_SEXT" + " +{ + operands[1] = gen_lowpart (SImode, operands[1]); + operands[2] = gen_reg_rtx (SImode); }") + + +;; +;; zero_extend2 +;; + +(define_insn "zero_extendqisi2" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] + "" + "@ + l.andi \t%0,%1,0xff\t # zero_extendqisi2 + l.lbz \t%0,%1\t # zero_extendqisi2" + [(set_attr "type" "logic,load") + (set_attr "length" "1,1")]) + + +(define_insn "zero_extendhisi2" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] + "" + "@ + l.andi \t%0,%1,0xffff\t # zero_extendqisi2 + l.lhz \t%0,%1\t # zero_extendqisi2" + [(set_attr "type" "logic,load") + (set_attr "length" "1,1")]) + +;; +;; Shift/rotate operations +;; + +(define_insn "ashlsi3" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (ashift:SI (match_operand:SI 1 "register_operand" "r,r") + (match_operand:SI 2 "nonmemory_operand" "r,L")))] + "" + "@ + l.sll \t%0,%1,%2 # ashlsi3 + l.slli \t%0,%1,%2 # ashlsi3" + [(set_attr "type" "shift,shift") + (set_attr "length" "1,1")]) + +(define_insn "ashrsi3" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (ashiftrt:SI (match_operand:SI 1 "register_operand" "r,r") + (match_operand:SI 2 "nonmemory_operand" "r,L")))] + "" + "@ + l.sra \t%0,%1,%2 # ashrsi3 + l.srai \t%0,%1,%2 # ashrsi3" + [(set_attr "type" "shift,shift") + (set_attr "length" "1,1")]) + +(define_insn "lshrsi3" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r") + (match_operand:SI 2 "nonmemory_operand" "r,L")))] + "" + "@ + l.srl \t%0,%1,%2 # lshrsi3 + l.srli \t%0,%1,%2 # lshrsi3" + [(set_attr "type" "shift,shift") + (set_attr "length" "1,1")]) + +(define_insn "rotrsi3" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (rotatert:SI (match_operand:SI 1 "register_operand" "r,r") + (match_operand:SI 2 "nonmemory_operand" "r,L")))] + "TARGET_MASK_ROR" + "@ + l.ror \t%0,%1,%2 # rotrsi3 + l.rori \t%0,%1,%2 # rotrsi3" + [(set_attr "type" "shift,shift") + (set_attr "length" "1,1")]) + +;; +;; Logical bitwise operations +;; + +(define_insn "andsi3" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (and:SI (match_operand:SI 1 "register_operand" "%r,r") + (match_operand:SI 2 "nonmemory_operand" "r,K")))] + "" + "@ + l.and \t%0,%1,%2 # andsi3 + l.andi \t%0,%1,%2 # andsi3" + [(set_attr "type" "logic,logic") + (set_attr "length" "1,1")]) + +(define_insn "iorsi3" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (ior:SI (match_operand:SI 1 "register_operand" "%r,r") + (match_operand:SI 2 "nonmemory_operand" "r,K")))] + "" + "@ + l.or \t%0,%1,%2 # iorsi3 + l.ori \t%0,%1,%2 # iorsi3" + [(set_attr "type" "logic,logic") + (set_attr "length" "1,1")]) + +(define_insn "xorsi3" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (xor:SI (match_operand:SI 1 "register_operand" "%r,r") + (match_operand:SI 2 "nonmemory_operand" "r,I")))] + "" + "@ + l.xor \t%0,%1,%2 # xorsi3 + l.xori \t%0,%1,%2 # xorsi3" + [(set_attr "type" "logic,logic") + (set_attr "length" "1,1")]) + +(define_insn "one_cmplqi2" + [(set (match_operand:QI 0 "register_operand" "=r") + (not:QI (match_operand:QI 1 "register_operand" "r")))] + "" + "l.xori \t%0,%1,0x00ff # one_cmplqi2" + [(set_attr "type" "logic") + (set_attr "length" "1")]) + +(define_insn "one_cmplsi2" + [(set (match_operand:SI 0 "register_operand" "=r") + (not:SI (match_operand:SI 1 "register_operand" "r")))] + "" + "l.xori \t%0,%1,0xffff # one_cmplsi2" + [(set_attr "type" "logic") + (set_attr "length" "1")]) + +;; +;; Arithmetic operations +;; + +(define_insn "negsi2" + [(set (match_operand:SI 0 "register_operand" "=r") + (neg:SI (match_operand:SI 1 "register_operand" "r")))] + "" + "l.sub \t%0,r0,%1 # negsi2" + [(set_attr "type" "add") + (set_attr "length" "1")]) + +(define_insn "addsi3" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (plus:SI (match_operand:SI 1 "register_operand" "%r,r") + (match_operand:SI 2 "nonmemory_operand" "r,I")))] + "" + "@ + l.add \t%0,%1,%2 # addsi3 + l.addi \t%0,%1,%2 # addsi3" + [(set_attr "type" "add,add") + (set_attr "length" "1,1")]) + +(define_insn "subsi3" + [(set (match_operand:SI 0 "register_operand" "=r,r") + (minus:SI (match_operand:SI 1 "register_operand" "r,r") + (match_operand:SI 2 "nonmemory_operand" "r,I")))] + "" + "@ + l.sub \t%0,%1,%2 # subsi3 + l.addi \t%0,%1,%n2 # subsi3" + [(set_attr "type" "add,add")] +) + +;; +;; mul and div +;; + +(define_insn "mulsi3" + [(set (match_operand:SI 0 "register_operand" "=r") + (mult:SI (match_operand:SI 1 "register_operand" "r") + (match_operand:SI 2 "register_operand" "r")))] + "TARGET_HARD_MUL" + "l.mul \t%0,%1,%2 # mulsi3" + [(set_attr "type" "mul") + (set_attr "length" "1")]) + +(define_insn "divsi3" + [(set (match_operand:SI 0 "register_operand" "=r") + (div:SI (match_operand:SI 1 "register_operand" "r") + (match_operand:SI 2 "register_operand" "r")))] + "TARGET_HARD_DIV" + "l.div \t%0,%1,%2 # divsi3" + [(set_attr "type" "mul") + (set_attr "length" "1")]) + +(define_insn "udivsi3" + [(set (match_operand:SI 0 "register_operand" "=r") + (udiv:SI (match_operand:SI 1 "register_operand" "r") + (match_operand:SI 2 "register_operand" "r")))] + "TARGET_HARD_DIV" + "l.divu \t%0,%1,%2 # udivsi3" + [(set_attr "type" "mul") + (set_attr "length" "1")]) + +;; +;; jumps +;; + +;; jump + +(define_expand "jump" + [(set (pc) + (label_ref (match_operand 0 "" "")))] + "" + " +{ + emit_jump_insn (gen_jump_internal (operands[0])); + DONE; +}") + +(define_insn "jump_internal" + [(set (pc) + (label_ref (match_operand 0 "" "")))] + "" + "l.j \t%l0 # jump_internal%(" + [(set_attr "type" "jump") + (set_attr "length" "1")]) + +;; indirect jump + +(define_expand "indirect_jump" + [(set (pc) (match_operand:SI 0 "register_operand" "r"))] + "" + " +{ + emit_jump_insn (gen_indirect_jump_internal (operands[0])); + DONE; + +}") + +(define_insn "indirect_jump_internal" + [(set (pc) (match_operand:SI 0 "register_operand" "r"))] + "" + "l.jr \t%0 # indirect_jump_internal%(" + [(set_attr "type" "jump") + (set_attr "length" "1")]) + +;; +;; calls +;; + +;; call + +(define_expand "call" + [(parallel [(call (match_operand:SI 0 "sym_ref_mem_operand" "") + (match_operand 1 "" "i")) + (clobber (reg:SI 9)) + (use (reg:SI 16))])] + "" + " +{ + emit_call_insn (gen_call_internal (operands[0], operands[1])); + DONE; +}") + +(define_insn "call_internal" +[(parallel [(call (match_operand:SI 0 "sym_ref_mem_operand" "") + (match_operand 1 "" "i")) + (clobber (reg:SI 9)) + (use (reg:SI 16))])] + "" + { + if (flag_pic) + { + crtl->uses_pic_offset_table = 1; + return "l.jal \tplt(%S0)# call_internal%("; + } + + return "l.jal \t%S0# call_internal%("; + } + [(set_attr "type" "jump") + (set_attr "length" "1")]) + +;; call value + +(define_expand "call_value" + [(parallel [(set (match_operand 0 "register_operand" "=r") + (call (match_operand:SI 1 "sym_ref_mem_operand" "") + (match_operand 2 "" "i"))) + (clobber (reg:SI 9)) + (use (reg:SI 16))])] + "" + " +{ + emit_call_insn (gen_call_value_internal (operands[0], operands[1], operands[2])); + DONE; +}") + +(define_insn "call_value_internal" +[(parallel [(set (match_operand 0 "register_operand" "=r") + (call (match_operand:SI 1 "sym_ref_mem_operand" "") + (match_operand 2 "" "i"))) + (clobber (reg:SI 9)) + (use (reg:SI 16))])] + "" + { + if (flag_pic) + { + crtl->uses_pic_offset_table = 1; + return "l.jal \tplt(%S1) # call_value_internal%("; + } + return "l.jal \t%S1 # call_value_internal%("; + } + [(set_attr "type" "jump") + (set_attr "length" "1")]) + +;; indirect call value + +(define_expand "call_value_indirect" + [(parallel [(set (match_operand 0 "register_operand" "=r") + (call (mem:SI (match_operand:SI 1 "register_operand" "r")) + (match_operand 2 "" "i"))) + (clobber (reg:SI 9)) + (use (reg:SI 16))])] + "" + " +{ + emit_call_insn (gen_call_value_indirect_internal (operands[0], operands[1], operands[2])); + DONE; +}") + +(define_insn "call_value_indirect_internal" + [(parallel [(set (match_operand 0 "register_operand" "=r") + (call (mem:SI (match_operand:SI 1 "register_operand" "r")) + (match_operand 2 "" "i"))) + (clobber (reg:SI 9)) + (use (reg:SI 16))])] + "" + "l.jalr \t%1 # call_value_indirect_internal%(" + [(set_attr "type" "jump") + (set_attr "length" "1")]) + +;; indirect call + +(define_expand "call_indirect" + [(parallel [(call (mem:SI (match_operand:SI 0 "register_operand" "r")) + (match_operand 1 "" "i")) + (clobber (reg:SI 9)) + (use (reg:SI 16))])] + "" + " +{ + emit_call_insn (gen_call_indirect_internal (operands[0], operands[1])); + DONE; +}") + +(define_insn "call_indirect_internal" +[(parallel [(call (mem:SI (match_operand:SI 0 "register_operand" "r")) + (match_operand 1 "" "i")) + (clobber (reg:SI 9)) + (use (reg:SI 16))])] + "" + "l.jalr \t%0 # call_indirect_internal%(" + [(set_attr "type" "jump") + (set_attr "length" "1")]) + +;; table jump + +(define_expand "tablejump" + [(set (pc) (match_operand:SI 0 "register_operand" "r")) + (use (label_ref (match_operand 1 "" "")))] + "" + " +{ + if (CASE_VECTOR_PC_RELATIVE || flag_pic) + operands[0] + = force_reg (Pmode, + gen_rtx_PLUS (Pmode, operands[0], + gen_rtx_LABEL_REF (Pmode, operands[1]))); + emit_jump_insn (gen_tablejump_internal (operands[0], operands[1])); + DONE; +}") + +(define_insn "tablejump_internal" + [(set (pc) (match_operand:SI 0 "register_operand" "r")) + (use (label_ref (match_operand 1 "" "")))] + "" + "l.jr \t%0 # tablejump_internal%(" + [(set_attr "type" "jump") + (set_attr "length" "1")]) + + +;; no-op + +(define_insn "nop" + [(const_int 0)] + "" + "l.nop" + [(set_attr "type" "logic") + (set_attr "length" "1")]) + +;; +;; floating point +;; + +;; floating point arithmetic + +(define_insn "addsf3" + [(set (match_operand:SF 0 "register_operand" "=r") + (plus:SF (match_operand:SF 1 "register_operand" "r") + (match_operand:SF 2 "register_operand" "r")))] + "TARGET_HARD_FLOAT" + "lf.add.s\t%0,%1,%2 # addsf3" + [(set_attr "type" "fp") + (set_attr "length" "1")]) + +(define_insn "adddf3" + [(set (match_operand:DF 0 "register_operand" "=r") + (plus:DF (match_operand:DF 1 "register_operand" "r") + (match_operand:DF 2 "register_operand" "r")))] + "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT" + "lf.add.d\t%0,%1,%2 # adddf3" + [(set_attr "type" "fp") + (set_attr "length" "1")]) + +(define_insn "subsf3" + [(set (match_operand:SF 0 "register_operand" "=r") + (minus:SF (match_operand:SF 1 "register_operand" "r") + (match_operand:SF 2 "register_operand" "r")))] + "TARGET_HARD_FLOAT" + "lf.sub.s\t%0,%1,%2 # subsf3" + [(set_attr "type" "fp") + (set_attr "length" "1")]) + +(define_insn "subdf3" + [(set (match_operand:DF 0 "register_operand" "=r") + (minus:DF (match_operand:DF 1 "register_operand" "r") + (match_operand:DF 2 "register_operand" "r")))] + "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT" + "lf.sub.d\t%0,%1,%2 # subdf3" + [(set_attr "type" "fp") + (set_attr "length" "1")]) + +(define_insn "mulsf3" + [(set (match_operand:SF 0 "register_operand" "=r") + (mult:SF (match_operand:SF 1 "register_operand" "r") + (match_operand:SF 2 "register_operand" "r")))] + "TARGET_HARD_FLOAT" + "lf.mul.s\t%0,%1,%2 # mulsf3" + [(set_attr "type" "fp") + (set_attr "length" "1")]) + +(define_insn "muldf3" + [(set (match_operand:DF 0 "register_operand" "=r") + (mult:DF (match_operand:DF 1 "register_operand" "r") + (match_operand:DF 2 "register_operand" "r")))] + "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT" + "lf.mul.d\t%0,%1,%2 # muldf3" + [(set_attr "type" "fp") + (set_attr "length" "1")]) + +(define_insn "divsf3" + [(set (match_operand:SF 0 "register_operand" "=r") + (div:SF (match_operand:SF 1 "register_operand" "r") + (match_operand:SF 2 "register_operand" "r")))] + "TARGET_HARD_FLOAT" + "lf.div.s\t%0,%1,%2 # divsf3" + [(set_attr "type" "fp") + (set_attr "length" "1")]) + +(define_insn "divdf3" + [(set (match_operand:DF 0 "register_operand" "=r") + (div:DF (match_operand:DF 1 "register_operand" "r") + (match_operand:DF 2 "register_operand" "r")))] + "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT" + "lf.div.d\t%0,%1,%2 # divdf3" + [(set_attr "type" "fp") + (set_attr "length" "1")]) + +;; Conversion between fixed point and floating point. + + +(define_insn "floatsisf2" + [(set (match_operand:SF 0 "register_operand" "=r") + (float:SF (match_operand:SI 1 "register_operand" "r")))] + "TARGET_HARD_FLOAT" + "lf.itof.s\t%0, %1 # floatsisf2" + [(set_attr "type" "fp") + (set_attr "length" "1")]) + +;; not working +(define_insn "fixunssfsi2" + [(set (match_operand:SI 0 "register_operand" "=r") + (fix:SI (match_operand:SF 1 "register_operand" "r")))] + "TARGET_HARD_FLOAT" + "lf.ftoi.s\t%0, %1 # fixunssfsi2" + [(set_attr "type" "fp") + (set_attr "length" "1")]) + +;; The insn to set GOT. +;; TODO: support for no-delay target +(define_insn "set_got" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(const_int 0)] UNSPEC_SET_GOT)) + (clobber (reg:SI 9)) + (clobber (reg:SI 16))] + "" + "l.jal \t8 + \tl.movhi \tr16,gotpchi(_GLOBAL_OFFSET_TABLE_-4) + \tl.ori \tr16,r16,gotpclo(_GLOBAL_OFFSET_TABLE_+0) + \tl.add \tr16,r16,r9" + [(set_attr "length" "16")]) + + +;; Local variables: +;; mode:emacs-lisp +;; comment-start: ";; " +;; eval: (set-syntax-table (copy-sequence (syntax-table))) +;; eval: (modify-syntax-entry ?[ "(]") +;; eval: (modify-syntax-entry ?] ")[") +;; eval: (modify-syntax-entry ?{ "(}") +;; eval: (modify-syntax-entry ?} "){") +;; eval: (setq indent-tabs-mode t) +;; End: diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/or1k-modes.def gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k-modes.def --- gcc-4.8.3/gcc/config/or1k/or1k-modes.def 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k-modes.def 2014-07-29 10:33:53.906097395 +0200 @@ -0,0 +1,38 @@ +/* Definitions of target machine for GNU compiler, for OR32. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +/* Add any extra modes needed to represent the condition code. + */ + +CC_MODE (CCEQ); +CC_MODE (CCNE); + +CC_MODE (CCLE); +CC_MODE (CCGE); +CC_MODE (CCLT); +CC_MODE (CCGT); + +CC_MODE (CCLEU); +CC_MODE (CCGEU); +CC_MODE (CCLTU); +CC_MODE (CCGTU); + +CC_MODE(CCFP); +CC_MODE(CCUNS); diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/or1k.opt gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k.opt --- gcc-4.8.3/gcc/config/or1k/or1k.opt 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k.opt 2014-07-29 10:33:53.906097395 +0200 @@ -0,0 +1,96 @@ +; Options for the OR1K port of the compiler +; This file is part of GCC. +; +; Copyright (C) 2010 Embecosm Limited +; +; GCC is free software; you can redistribute it and/or modify it under +; the terms of the GNU General Public License as published by the Free +; Software Foundation; either version 3, or (at your option) any later +; version. +; +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY +; WARRANTY; without even the implied warranty of MERCHANTABILITY or +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +; for more details. +; +; You should have received a copy of the GNU General Public License +; along with GCC; see the file COPYING3. If not see +; . + +HeaderInclude +config/or1k/or1k-opts.h + +Variable +enum or1k_delay or1k_delay_selected = OR1K_DELAY_DEFAULT + +mdelay +Target RejectNegative Negative(mno-delay) Var(or1k_delay_selected, OR1K_DELAY_ON) +Assume branches and jumps have a delay slot + +mno-delay +Target RejectNegative Negative(mcompat-delay) Var(or1k_delay_selected, OR1K_DELAY_OFF) +Assume branches and jumps do not have a delay slot + +mcompat-delay +Target RejectNegative Negative(mdelay) Var(or1k_delay_selected, OR1K_DELAY_COMPAT) +Assume branches and jumps have a delay slot, but fill them with nops + +mhard-float +Target RejectNegative Mask(HARD_FLOAT) +Use hardware floating point + +msoft-float +Target RejectNegative InverseMask(HARD_FLOAT) +Do not use hardware floating point + +mdouble-float +Target Report RejectNegative Mask(DOUBLE_FLOAT) +Allow hardware floating-point instructions to cover both 32-bit and 64-bit operations + +mhard-div +Target RejectNegative Mask(HARD_DIV) +Use hardware division + +msoft-div +Target RejectNegative InverseMask(HARD_DIV) +Do not use hardware division + +mhard-mul +Target RejectNegative Mask(HARD_MUL) +Use hardware multiplication + +msoft-mul +Target RejectNegative InverseMask(HARD_MUL) +Do not use hardware multiplication + +msext +Target Mask(MASK_SEXT) +Use sign-extending instructions + +mcmov +Target Mask(MASK_CMOV) +Use conditional move instructions + +mror +Target Mask(MASK_ROR) +Emit ROR instructions + +mboard= +Target RejectNegative Joined +Link with libgloss configuration suitable for this board + +mnewlib +Target Report RejectNegative +Compile for the Linux/Gnu/newlib based toolchain + +;; provide struct padding as in previous releases. +;; Note that this will only affect STRUCTURE_SIZE_BOUNDARY, in particular +;; make 2 byte structs 4-byte alignned and sized. +;; We still use ROUND_TYPE_ALIGN to increase alignment of larger structs. +mpadstruct +Target Report RejectNegative Mask(PADSTRUCT) +Make structs a multiple of 4 bytes (warning: ABI altered) + +mredzone= +Target RejectNegative Joined UInteger Var(or1k_redzone) Init(128) +Set the size of the stack below sp that is assumed to be safe from interrupts. diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/or1k-opts.h gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k-opts.h --- gcc-4.8.3/gcc/config/or1k/or1k-opts.h 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k-opts.h 2014-07-29 10:33:53.906097395 +0200 @@ -0,0 +1,14 @@ +#ifndef OR1K_OPTS_H +#define OR1K_OPTS_H + +enum or1k_delay { + OR1K_DELAY_OFF = 0, + OR1K_DELAY_ON = 1, + OR1K_DELAY_COMPAT = 2 +}; + +#define TARGET_DELAY_ON (or1k_delay_selected == OR1K_DELAY_ON) +#define TARGET_DELAY_OFF (or1k_delay_selected == OR1K_DELAY_OFF) +#define TARGET_DELAY_COMPAT (or1k_delay_selected == OR1K_DELAY_COMPAT) + +#endif diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/or1k-protos.h gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k-protos.h --- gcc-4.8.3/gcc/config/or1k/or1k-protos.h 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/or1k-protos.h 2014-07-29 10:33:53.906097395 +0200 @@ -0,0 +1,62 @@ +/* Definitions of target machine for GNU compiler, OR1K cpu. + + Copyright (C) 2010 Embecosm Limited + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OR1K_PROTOS_H +#define GCC_OR1K_PROTOS_H + +/* The following are for general support. */ +extern int or1k_trampoline_code_size (void); + +/* The following are only needed when handling the machine definition. */ +#ifdef RTX_CODE +extern void or1k_init_expanders (void); +extern void or1k_expand_prologue (void); +extern void or1k_expand_epilogue (void); +extern bool or1k_expand_move (enum machine_mode mode, rtx operands[]); +extern const char *or1k_output_move_double (rtx *operands); +extern void or1k_expand_conditional_branch (rtx *operands, + enum machine_mode mode); +extern int or1k_emit_cmove (rtx dest, + rtx op, + rtx true_cond, + rtx false_cond); +extern enum machine_mode or1k_select_cc_mode (enum rtx_code op); +extern const char *or1k_output_bf (rtx * operands); +extern const char *or1k_output_cmov (rtx * operands); +extern void or1k_emit_set_const32 (rtx op0, + rtx op1); +extern bool or1k_expand_symbol_ref (enum machine_mode mode, + rtx operands[]); +#endif + +#endif +extern int or1k_struct_alignment (tree); +extern int or1k_data_alignment (tree, int); + +extern int or1k_initial_elimination_offset (int, int); +extern bool or1k_save_reg_p_cached (int regno); +extern void or1k_print_jump_restore (rtx jump_address); +extern rtx or1k_eh_return_handler_rtx (void); +extern rtx or1k_return_addr_rtx (int, rtx); + +extern int or1k_legitimate_pic_operand_p (rtx x); + +/* For RETURN_ADDR_RTX */ +extern rtx get_hard_reg_initial_val (enum machine_mode, unsigned int); diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/predicates.md gcc-4.8.3-or1k-rtems/gcc/config/or1k/predicates.md --- gcc-4.8.3/gcc/config/or1k/predicates.md 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/predicates.md 2014-07-29 10:33:53.906097395 +0200 @@ -0,0 +1,74 @@ +;; Predicate definitions for OR32 +;; +;; Copyright (C) 2010 Embecosm Limited +;; +;; This file is part of GCC. +;; +;; GCC is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. +;; +;; GCC is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GCC; see the file COPYING3. If not see +;; . + +(define_predicate "cc_reg_operand" + (match_code "subreg,reg") +{ + register_operand (op, mode); + + if (GET_CODE (op) == REG && REGNO (op) == CC_REG) + return 1; + + return 0; +}) + +(define_predicate "input_operand" + (match_code "subreg,reg,const_int,mem,const") +{ + /* If both modes are non-void they must be the same. */ + if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) + return 0; + + /* Allow any one instruction integer constant, and all CONST_INT + variants when we are working in DImode and !arch64. */ + if (GET_MODE_CLASS (mode) == MODE_INT + && ((GET_CODE (op) == CONST_INT) + && (satisfies_constraint_K (op) + || satisfies_constraint_M (op) + || satisfies_constraint_I (op)))) + return 1; + + if (register_operand (op, mode)) + return 1; + + /* If this is a SUBREG, look inside so that we handle + paradoxical ones. */ + if (GET_CODE (op) == SUBREG) + op = SUBREG_REG (op); + + + /* Check for valid MEM forms. */ + if (GET_CODE (op) == MEM) + return memory_address_p (mode, XEXP (op, 0)); + + return 0; +}) + +(define_predicate "sym_ref_mem_operand" + (match_code "mem") +{ + if (GET_CODE (op) == MEM) + { + rtx t1 = XEXP (op, 0); + if (GET_CODE (t1) == SYMBOL_REF) + return 1; + } + return 0; +}) diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/rtems.h gcc-4.8.3-or1k-rtems/gcc/config/or1k/rtems.h --- gcc-4.8.3/gcc/config/or1k/rtems.h 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/rtems.h 2014-07-29 10:33:53.906097395 +0200 @@ -0,0 +1,43 @@ +/* Definitions for rtems targeting an OpenRisc OR1K using ELF + + Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. + Contributed by Joel Sherrill (joel@OARcorp.com). + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Use ELF */ +#undef OBJECT_FORMAT_ELF +#define OBJECT_FORMAT_ELF + +/* what does this comment go to? + or1k debug info support is controlled by tm.h header files we include: + dbxelf.h enables optional stabs debug info. + elfos.h sets PREFERRED_DEBUGGING_TYPE to DWARF2_DEBUG . */ + +/* RTEMS always uses newlib */ +#undef DRIVER_SELF_SPECS + +/* Target OS builtins. */ +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__rtems__"); \ + builtin_assert ("system=rtems"); \ + } \ + while (0) diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/t-linux gcc-4.8.3-or1k-rtems/gcc/config/or1k/t-linux --- gcc-4.8.3/gcc/config/or1k/t-linux 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/t-linux 2014-07-29 10:33:53.906097395 +0200 @@ -0,0 +1,12 @@ +MULTILIB_DIRNAMES = +EXTRA_MULTILIB_PARTS = crti.o crtbegin.o crtend.o crtn.o + +# hack: +# the non-shared uclibc-0.9.31/libc/misc/internals/__uClibc_main.c +# already defines __dso_handle. To avoid a duplicate definition, +# we rename the crtbegin one. +# JPB 18-Nov-10: Commented out, since uClibc no longer defines. +# amend gcc Makefile CLFAGS variable +# $(T)crtbegin.o: CRTSTUFF_CFLAGS += '-D__dso_handle=__dso_handle_dummy' +# amend libgcc Makefile CLFAGS variable +# crtbegin$(objext): CRTSTUFF_T_CFLAGS += '-D__dso_handle=__dso_handle_dummy' diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/t-or1k gcc-4.8.3-or1k-rtems/gcc/config/or1k/t-or1k --- gcc-4.8.3/gcc/config/or1k/t-or1k 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/t-or1k 2014-07-29 10:33:53.906097395 +0200 @@ -0,0 +1,28 @@ +# t-or1k is a Makefile fragment to be included when +# building gcc for the or1k target + +# Copyright (C) 2010 Embecosm Limited + +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# we don't support -g so don't use it +LIBGCC2_DEBUG_CFLAGS = + +# Build the libraries for both hard and soft floating point +MULTILIB_OPTIONS = mno-delay/mcompat-delay msoft-float +MULTILIB_DIRNAMES = no-delay compat-delay soft-float +MULTILIB_MATCHES = diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/t-or1knd gcc-4.8.3-or1k-rtems/gcc/config/or1k/t-or1knd --- gcc-4.8.3/gcc/config/or1k/t-or1knd 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/t-or1knd 2014-07-29 10:33:53.907097413 +0200 @@ -0,0 +1,28 @@ +# t-or1knd is a Makefile fragment to be included when +# building gcc for the or1k target + +# Copyright (C) 2010 Embecosm Limited + +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# we don't support -g so don't use it +LIBGCC2_DEBUG_CFLAGS = + +# Build the libraries for both hard and soft floating point +MULTILIB_OPTIONS = mdelay/mcompat-delay msoft-float +MULTILIB_DIRNAMES = delay compat-delay soft-float +MULTILIB_MATCHES = diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config/or1k/t-rtems gcc-4.8.3-or1k-rtems/gcc/config/or1k/t-rtems --- gcc-4.8.3/gcc/config/or1k/t-rtems 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config/or1k/t-rtems 2014-07-29 10:33:53.907097413 +0200 @@ -0,0 +1,2 @@ +# Custom multilibs for RTEMS + diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config.gcc gcc-4.8.3-or1k-rtems/gcc/config.gcc --- gcc-4.8.3/gcc/config.gcc 2014-05-06 17:29:04.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config.gcc 2014-07-29 10:33:53.907097413 +0200 @@ -415,6 +415,12 @@ extra_headers="loongson.h" extra_options="${extra_options} g.opt mips/mips-tables.opt" ;; +or1k-*-*) + cpu_type=or1k + ;; +or1knd-*-*) + cpu_type=or1k + ;; picochip-*-*) cpu_type=picochip ;; @@ -1972,6 +1978,40 @@ use_collect2=no use_gcc_stdint=wrap ;; +or1k-*-elf*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h ${cpu_type}/elf.h" + extra_parts="crti.o crtbegin.o crtend.o crtn.o" + tmake_file=or1k/t-or1k + tm_defines="${tm_defines} OR1K_DELAY_DEFAULT=OR1K_DELAY_ON" + ;; +or1k-*-linux-*) + tm_file="${tm_file} dbxelf.h elfos.h or1k/elf.h gnu-user.h linux.h or1k/linux-gas.h or1k/linux-elf.h uclibc-stdint.h" + tmake_file="or1k/t-or1k or1k/t-linux ${tmake_file}" + tm_defines="${tm_defines} OR1K_DELAY_DEFAULT=OR1K_DELAY_ON" + ;; +or1k-*-rtems*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h rtems.h ${cpu_type}/elf.h or1k/rtems.h" + extra_parts="crti.o crtbegin.o crtend.o crtn.o" + tmake_file="or1k/t-or1k t-rtems or1k/t-rtems" + tm_defines="${tm_defines} OR1K_DELAY_DEFAULT=OR1K_DELAY_ON" + ;; +or1knd-*-elf*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h ${cpu_type}/elf.h" + extra_parts="crti.o crtbegin.o crtend.o crtn.o" + tmake_file=or1k/t-or1knd + tm_defines="${tm_defines} OR1K_DELAY_DEFAULT=OR1K_DELAY_OFF" + ;; +or1knd-*-linux-*) + tm_file="${tm_file} dbxelf.h elfos.h or1k/elf.h linux.h or1k/linux-gas.h or1k/linux-elf.h uclibc-stdint.h" + tmake_file="or1k/t-or1knd or1k/t-linux ${tmake_file}" + tm_defines="${tm_defines} OR1K_DELAY_DEFAULT=OR1K_DELAY_OFF" + ;; +or1knd-*-rtems*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h rtems.h ${cpu_type}/elf.h or1k/rtems.h" + extra_parts="crti.o crtbegin.o crtend.o crtn.o" + tmake_file="or1k/t-or1k t-rtems or1k/t-rtems" + tm_defines="${tm_defines} OR1K_DELAY_DEFAULT=OR1K_DELAY_OFF" + ;; pdp11-*-*) tm_file="${tm_file} newlib-stdint.h" use_gcc_stdint=wrap diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/config.gcc.orig gcc-4.8.3-or1k-rtems/gcc/config.gcc.orig --- gcc-4.8.3/gcc/config.gcc.orig 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/config.gcc.orig 2014-05-06 17:29:04.000000000 +0200 @@ -0,0 +1,3869 @@ +# GCC target-specific configuration file. +# Copyright (C) 1997-2013 Free Software Foundation, Inc. + +#This file is part of GCC. + +#GCC is free software; you can redistribute it and/or modify it under +#the terms of the GNU General Public License as published by the Free +#Software Foundation; either version 3, or (at your option) any later +#version. + +#GCC is distributed in the hope that it will be useful, but WITHOUT +#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +#for more details. + +#You should have received a copy of the GNU General Public License +#along with GCC; see the file COPYING3. If not see +#. + +# This is the GCC target-specific configuration file +# where a configuration type is mapped to different system-specific +# definitions and files. This is invoked by the autoconf-generated +# configure script. Putting it in a separate shell file lets us skip +# running autoconf when modifying target-specific information. + +# When you change the cases in the OS or target switches, consider +# updating ../libgcc/config.host also. + +# This file switches on the shell variable ${target}, and also uses the +# following shell variables: +# +# with_* Various variables as set by configure. +# +# enable_threads Either the name, yes or no depending on whether +# threads support was requested. +# +# default_use_cxa_atexit +# The default value for the $enable___cxa_atexit +# variable. enable___cxa_atexit needs to be set to +# "yes" for the correct operation of C++ destructors +# but it relies upon the presence of a non-standard C +# library function called __cxa_atexit. +# Since not all C libraries provide __cxa_atexit the +# default value of $default_use_cxa_atexit is set to +# "no" except for targets which are known to be OK. +# +# default_gnu_indirect_function +# The default value for the $enable_gnu_indirect_function +# variable. enable_gnu_indirect_function relies +# upon the presence of a non-standard gnu ifunc support +# in the assembler, linker and dynamic linker. +# Since not all libraries provide the dynamic linking +# support, the default value of +# $default_gnu_indirect_function is set to +# "no" except for targets which are known to be OK. +# +# gas_flag Either yes or no depending on whether GNU as was +# requested. +# +# gnu_ld_flag Either yes or no depending on whether GNU ld was +# requested. + +# This file sets the following shell variables for use by the +# autoconf-generated configure script: +# +# cpu_type The name of the cpu, if different from the first +# chunk of the canonical target name. +# +# tm_defines List of target macros to define for all compilations. +# +# tm_file A list of target macro files, if different from +# "$cpu_type/$cpu_type.h". Usually it's constructed +# per target in a way like this: +# tm_file="${tm_file} dbxelf.h elfos.h ${cpu_type.h}/elf.h" +# Note that the preferred order is: +# - specific target header "${cpu_type}/${cpu_type.h}" +# - generic headers like dbxelf.h elfos.h, etc. +# - specializing target headers like ${cpu_type.h}/elf.h +# This helps to keep OS specific stuff out of the CPU +# defining header ${cpu_type}/${cpu_type.h}. +# +# It is possible to include automatically-generated +# build-directory files by prefixing them with "./". +# All other files should relative to $srcdir/config. +# +# tm_p_file Location of file with declarations for functions +# in $out_file. +# +# out_file The name of the machine description C support +# file, if different from "$cpu_type/$cpu_type.c". +# +# common_out_file The name of the source file for code shared between +# the compiler proper and the driver. +# +# md_file The name of the machine-description file, if +# different from "$cpu_type/$cpu_type.md". +# +# tmake_file A list of machine-description-specific +# makefile-fragments, if different from +# "$cpu_type/t-$cpu_type". +# +# extra_modes The name of the file containing a list of extra +# machine modes, if necessary and different from +# "$cpu_type/$cpu_type-modes.def". +# +# extra_objs List of extra objects that should be linked into +# the compiler proper (cc1, cc1obj, cc1plus) +# depending on target. +# +# extra_gcc_objs List of extra objects that should be linked into +# the compiler driver (gcc) depending on target. +# +# extra_headers List of used header files from the directory +# config/${cpu_type}. +# +# user_headers_inc_next_pre +# List of header file names of internal gcc header +# files, which should be prefixed by an include_next. +# user_headers_inc_next_post +# List of header file names of internal gcc header +# files, which should be postfixed by an include_next. +# use_gcc_tgmath If set, add tgmath.h to the list of used header +# files. +# +# use_gcc_stdint If "wrap", install a version of stdint.h that +# wraps the system's copy for hosted compilations; +# if "provide", provide a version of systems without +# such a system header; otherwise "none", do not +# provide such a header at all. +# +# extra_programs List of extra executables compiled for this target +# machine, used when linking. +# +# extra_options List of target-dependent .opt files. +# +# c_target_objs List of extra target-dependent objects that be +# linked into the C compiler only. +# +# cxx_target_objs List of extra target-dependent objects that be +# linked into the C++ compiler only. +# +# fortran_target_objs List of extra target-dependent objects that be +# linked into the fortran compiler only. +# +# target_gtfiles List of extra source files with type information. +# +# xm_defines List of macros to define when compiling for the +# target machine. +# +# xm_file List of files to include when compiling for the +# target machine. +# +# use_collect2 Set to yes or no, depending on whether collect2 +# will be used. +# +# target_cpu_default Set to override the default target model. +# +# gdb_needs_out_file_path +# Set to yes if gdb needs a dir command with +# `dirname $out_file`. +# +# thread_file Set to control which thread package to use. +# +# gas Set to yes or no depending on whether the target +# system normally uses GNU as. +# +# need_64bit_hwint Set to yes if HOST_WIDE_INT must be 64 bits wide +# for this target. This is true if this target +# supports "long" or "wchar_t" wider than 32 bits, +# or BITS_PER_WORD is wider than 32 bits. +# The setting made here must match the one made in +# other locations such as libcpp/configure.ac +# +# configure_default_options +# Set to an initializer for configure_default_options +# in configargs.h, based on --with-cpu et cetera. +# +# native_system_header_dir +# Where system header files are found for this +# target. This defaults to /usr/include. If +# the --with-sysroot configure option or the +# --sysroot command line option is used this +# will be relative to the sysroot. +# target_type_format_char +# The default character to be used for formatting +# the attribute in a +# .type symbol_name, ${t_t_f_c} +# directive. + +# The following variables are used in each case-construct to build up the +# outgoing variables: +# +# gnu_ld Set to yes or no depending on whether the target +# system normally uses GNU ld. +# +# target_has_targetcm Set to yes or no depending on whether the target +# has its own definition of targetcm. +# +# target_has_targetm_common Set to yes or no depending on whether the +# target has its own definition of targetm_common. + +out_file= +common_out_file= +tmake_file= +extra_headers= +user_headers_inc_next_pre= +user_headers_inc_next_post= +use_gcc_tgmath=yes +use_gcc_stdint=none +extra_programs= +extra_objs= +extra_gcc_objs= +extra_options= +c_target_objs= +cxx_target_objs= +fortran_target_objs= +target_has_targetcm=no +target_has_targetm_common=yes +tm_defines= +xm_defines= +# Set this to force installation and use of collect2. +use_collect2= +# Set this to override the default target model. +target_cpu_default= +# Set this if gdb needs a dir command with `dirname $out_file` +gdb_needs_out_file_path= +# Set this to control which thread package will be used. +thread_file= +# Reinitialize these from the flag values every loop pass, since some +# configure entries modify them. +gas="$gas_flag" +gnu_ld="$gnu_ld_flag" +default_use_cxa_atexit=no +default_gnu_indirect_function=no +target_gtfiles= +need_64bit_hwint= +need_64bit_isa= +native_system_header_dir=/usr/include +target_type_format_char='@' + +# Don't carry these over build->host->target. Please. +xm_file= +md_file= + +# Obsolete configurations. +case ${target} in + picochip-* \ + | score-* \ + ) + if test "x$enable_obsolete" != xyes; then + echo "*** Configuration ${target} is obsolete." >&2 + echo "*** Specify --enable-obsolete to build it anyway." >&2 + echo "*** Support will be REMOVED in the next major release of GCC," >&2 + echo "*** unless a maintainer comes forward." >&2 + exit 1 + fi;; +esac + +# Unsupported targets list. Do not put an entry in this list unless +# it would otherwise be caught by a more permissive pattern. The list +# should be in alphabetical order. +case ${target} in + # Avoid special cases that are not obsolete + arm*-*-*eabi* \ + ) + ;; + arm*-wince-pe* \ + | arm*-*-ecos-elf \ + | arm*-*-elf \ + | arm*-*-freebsd* \ + | arm*-*-linux* \ + | arm*-*-uclinux* \ + | i[34567]86-go32-* \ + | i[34567]86-*-go32* \ + | m68k-*-uclinuxoldabi* \ + | mips64orion*-*-rtems* \ + | pdp11-*-bsd \ + | sparc-hal-solaris2* \ + | thumb-*-* \ + | *-*-freebsd[12] | *-*-freebsd[12].* \ + | *-*-freebsd*aout* \ + | *-*-linux*aout* \ + | *-*-linux*coff* \ + | *-*-linux*libc1* \ + | *-*-linux*oldld* \ + | *-*-rtemsaout* \ + | *-*-rtemscoff* \ + | *-*-solaris2 \ + | *-*-solaris2.[0-8] \ + | *-*-solaris2.[0-8].* \ + | *-*-sysv* \ + | vax-*-vms* \ + ) + echo "*** Configuration ${target} not supported" 1>&2 + exit 1 + ;; +esac + +# Set default cpu_type, tm_file, tm_p_file and xm_file so it can be +# updated in each machine entry. Also set default extra_headers for some +# machines. +tm_p_file= +cpu_type=`echo ${target} | sed 's/-.*$//'` +cpu_is_64bit= +case ${target} in +m32c*-*-*) + cpu_type=m32c + tmake_file=m32c/t-m32c + target_has_targetm_common=no + ;; +aarch64*-*-*) + cpu_type=aarch64 + need_64bit_hwint=yes + extra_headers="arm_neon.h" + extra_objs="aarch64-builtins.o" + target_has_targetm_common=yes + ;; +alpha*-*-*) + cpu_type=alpha + need_64bit_hwint=yes + extra_options="${extra_options} g.opt" + ;; +am33_2.0-*-linux*) + cpu_type=mn10300 + ;; +arm*-*-*) + cpu_type=arm + extra_headers="mmintrin.h arm_neon.h" + target_type_format_char='%' + c_target_objs="arm-c.o" + cxx_target_objs="arm-c.o" + extra_options="${extra_options} arm/arm-tables.opt" + ;; +avr-*-*) + cpu_type=avr + c_target_objs="avr-c.o" + cxx_target_objs="avr-c.o" + extra_options="${extra_options} avr/avr-tables.opt" + ;; +bfin*-*) + cpu_type=bfin + ;; +crisv32-*) + cpu_type=cris + ;; +frv*) cpu_type=frv + extra_options="${extra_options} g.opt" + ;; +moxie*) cpu_type=moxie + target_has_targetm_common=no + ;; +fido-*-*) + cpu_type=m68k + extra_headers=math-68881.h + extra_options="${extra_options} m68k/m68k-tables.opt" + ;; +i[34567]86-*-*) + cpu_type=i386 + c_target_objs="i386-c.o" + cxx_target_objs="i386-c.o" + need_64bit_hwint=yes + extra_options="${extra_options} fused-madd.opt" + extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h + pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h + nmmintrin.h bmmintrin.h fma4intrin.h wmmintrin.h + immintrin.h x86intrin.h avxintrin.h xopintrin.h + ia32intrin.h cross-stdarg.h lwpintrin.h popcntintrin.h + lzcntintrin.h bmiintrin.h bmi2intrin.h tbmintrin.h + avx2intrin.h fmaintrin.h f16cintrin.h rtmintrin.h + xtestintrin.h rdseedintrin.h prfchwintrin.h adxintrin.h + fxsrintrin.h xsaveintrin.h xsaveoptintrin.h" + ;; +x86_64-*-*) + cpu_type=i386 + c_target_objs="i386-c.o" + cxx_target_objs="i386-c.o" + extra_options="${extra_options} fused-madd.opt" + extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h + pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h + nmmintrin.h bmmintrin.h fma4intrin.h wmmintrin.h + immintrin.h x86intrin.h avxintrin.h xopintrin.h + ia32intrin.h cross-stdarg.h lwpintrin.h popcntintrin.h + lzcntintrin.h bmiintrin.h tbmintrin.h bmi2intrin.h + avx2intrin.h fmaintrin.h f16cintrin.h rtmintrin.h + xtestintrin.h rdseedintrin.h prfchwintrin.h adxintrin.h + fxsrintrin.h xsaveintrin.h xsaveoptintrin.h" + need_64bit_hwint=yes + ;; +ia64-*-*) + extra_headers=ia64intrin.h + need_64bit_hwint=yes + extra_options="${extra_options} g.opt fused-madd.opt" + ;; +hppa*-*-*) + cpu_type=pa + ;; +lm32*) + extra_options="${extra_options} g.opt" + ;; +m32r*-*-*) + cpu_type=m32r + extra_options="${extra_options} g.opt" + ;; +m68k-*-*) + extra_headers=math-68881.h + extra_options="${extra_options} m68k/m68k-tables.opt" + ;; +microblaze*-*-*) + cpu_type=microblaze + extra_options="${extra_options} g.opt" + ;; +mips*-*-*) + cpu_type=mips + need_64bit_hwint=yes + extra_headers="loongson.h" + extra_options="${extra_options} g.opt mips/mips-tables.opt" + ;; +picochip-*-*) + cpu_type=picochip + ;; +powerpc*-*-*) + cpu_type=rs6000 + extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h htmintrin.h htmxlintrin.h" + need_64bit_hwint=yes + case x$with_cpu in + xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|Xe6500) + cpu_is_64bit=yes + ;; + esac + extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt" + ;; +rs6000*-*-*) + need_64bit_hwint=yes + extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt" + ;; +score*-*-*) + cpu_type=score + extra_options="${extra_options} g.opt" + ;; +sparc*-*-*) + cpu_type=sparc + c_target_objs="sparc-c.o" + cxx_target_objs="sparc-c.o" + extra_headers="visintrin.h" + need_64bit_hwint=yes + ;; +spu*-*-*) + cpu_type=spu + need_64bit_hwint=yes + ;; +s390*-*-*) + cpu_type=s390 + need_64bit_hwint=yes + extra_options="${extra_options} fused-madd.opt" + extra_headers="s390intrin.h htmintrin.h htmxlintrin.h" + ;; +# Note the 'l'; we need to be able to match e.g. "shle" or "shl". +sh[123456789lbe]*-*-* | sh-*-*) + cpu_type=sh + need_64bit_hwint=yes + extra_options="${extra_options} fused-madd.opt" + ;; +v850*-*-*) + cpu_type=v850 + ;; +tic6x-*-*) + cpu_type=c6x + extra_headers="c6x_intrinsics.h" + extra_options="${extra_options} c6x/c6x-tables.opt" + ;; +xtensa*-*-*) + extra_options="${extra_options} fused-madd.opt" + ;; +tilegx*-*-*) + cpu_type=tilegx + need_64bit_hwint=yes + ;; +tilepro-*-*) + cpu_type=tilepro + need_64bit_hwint=yes + ;; +esac + +tm_file=${cpu_type}/${cpu_type}.h +if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-protos.h +then + tm_p_file=${cpu_type}/${cpu_type}-protos.h +fi +extra_modes= +if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def +then + extra_modes=${cpu_type}/${cpu_type}-modes.def +fi +if test -f ${srcdir}/config/${cpu_type}/${cpu_type}.opt +then + extra_options="${extra_options} ${cpu_type}/${cpu_type}.opt" +fi + +case ${target} in +i[34567]86-*-*) + if test "x$with_abi" != x; then + echo "This target does not support --with-abi." + exit 1 + fi + if test "x$enable_cld" = xyes; then + tm_defines="${tm_defines} USE_IX86_CLD=1" + fi + if test "x$enable_frame_pointer" = xyes; then + tm_defines="${tm_defines} USE_IX86_FRAME_POINTER=1" + fi + tm_file="vxworks-dummy.h ${tm_file}" + ;; +x86_64-*-*) + case ${with_abi} in + "") + if test "x$with_multilib_list" = xmx32; then + tm_file="i386/biarchx32.h ${tm_file}" + else + tm_file="i386/biarch64.h ${tm_file}" + fi + ;; + 64 | m64) + tm_file="i386/biarch64.h ${tm_file}" + ;; + x32 | mx32) + tm_file="i386/biarchx32.h ${tm_file}" + ;; + *) + echo "Unknown ABI used in --with-abi=$with_abi" + exit 1 + esac + if test "x$enable_cld" = xyes; then + tm_defines="${tm_defines} USE_IX86_CLD=1" + fi + if test "x$enable_frame_pointer" = xyes; then + tm_defines="${tm_defines} USE_IX86_FRAME_POINTER=1" + fi + tm_file="vxworks-dummy.h ${tm_file}" + ;; +arm*-*-* | mips*-*-* | sh*-*-* | sparc*-*-*) + tm_file="vxworks-dummy.h ${tm_file}" + ;; +esac + +# On a.out targets, we need to use collect2. +case ${target} in +*-*-*aout*) + use_collect2=yes + ;; +esac + +# Common C libraries. +tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" + +# Common parts for widely ported systems. +case ${target} in +*-*-darwin*) + tmake_file="t-darwin ${cpu_type}/t-darwin" + tm_file="${tm_file} darwin.h" + case ${target} in + *-*-darwin9*) + tm_file="${tm_file} darwin9.h" + ;; + *-*-darwin[12][0-9]*) + tm_file="${tm_file} darwin9.h darwin10.h" + ;; + esac + tm_file="${tm_file} ${cpu_type}/darwin.h" + tm_p_file="${tm_p_file} darwin-protos.h" + target_gtfiles="\$(srcdir)/config/darwin.c" + extra_options="${extra_options} darwin.opt" + c_target_objs="${c_target_objs} darwin-c.o" + cxx_target_objs="${cxx_target_objs} darwin-c.o" + fortran_target_objs="darwin-f.o" + target_has_targetcm=yes + extra_objs="darwin.o" + extra_gcc_objs="darwin-driver.o" + default_use_cxa_atexit=yes + use_gcc_stdint=wrap + case ${enable_threads} in + "" | yes | posix) thread_file='posix' ;; + esac + ;; +*-*-freebsd*) + # This is the generic ELF configuration of FreeBSD. Later + # machine-specific sections may refine and add to this + # configuration. + # + # Due to tm_file entry ordering issues that vary between cpu + # architectures, we only define fbsd_tm_file to allow the + # machine-specific section to dictate the final order of all + # entries of tm_file with the minor exception that components + # of the tm_file set here will always be of the form: + # + # freebsd.h [freebsd-.h ...] freebsd-spec.h freebsd.h + # + # The machine-specific section should not tamper with this + # ordering but may order all other entries of tm_file as it + # pleases around the provided core setting. + gas=yes + gnu_ld=yes + fbsd_major=`echo ${target} | sed -e 's/.*freebsd//g' | sed -e 's/\..*//g'` + tm_defines="${tm_defines} FBSD_MAJOR=${fbsd_major}" + tmake_file="t-slibgcc" + case ${enable_threads} in + no) + fbsd_tm_file="${fbsd_tm_file} freebsd-nthr.h" + ;; + "" | yes | posix) + thread_file='posix' + ;; + *) + echo 'Unknown thread configuration for FreeBSD' + exit 1 + ;; + esac + fbsd_tm_file="${fbsd_tm_file} freebsd-spec.h freebsd.h freebsd-stdint.h" + extra_options="$extra_options rpath.opt freebsd.opt" + case ${target} in + *-*-freebsd[345].*) + :;; + *) + default_use_cxa_atexit=yes;; + esac + # need_64bit_hwint=yes # system compiler has this for all arch! + use_gcc_stdint=wrap + ;; +*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu) + extra_options="$extra_options gnu-user.opt" + gas=yes + gnu_ld=yes + case ${enable_threads} in + "" | yes | posix) thread_file='posix' ;; + esac + tmake_file="t-slibgcc" + case $target in + *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-kopensolaris*-gnu) + :;; + *-*-gnu*) + native_system_header_dir=/include + ;; + esac + # glibc / uclibc / bionic switch. + # uclibc and bionic aren't usable for GNU/Hurd and neither for GNU/k*BSD. + case $target in + *linux*) + extra_options="$extra_options linux.opt";; + esac + case $target in + *-*-*android*) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_BIONIC" + ;; + *-*-*uclibc*) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC" + ;; + *) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" + ;; + esac + # Assume that glibc or uClibc or Bionic are being used and so __cxa_atexit + # is provided. + default_use_cxa_atexit=yes + use_gcc_tgmath=no + use_gcc_stdint=wrap + # Add Android userspace support to Linux targets. + case $target in + *linux*) + tm_file="$tm_file linux-android.h" + extra_options="$extra_options linux-android.opt" + ;; + esac + # Enable compilation for Android by default for *android* targets. + case $target in + *-*-*android*) + tm_defines="$tm_defines ANDROID_DEFAULT=1" + ;; + *) + tm_defines="$tm_defines ANDROID_DEFAULT=0" + ;; + esac + c_target_objs="${c_target_objs} glibc-c.o" + cxx_target_objs="${cxx_target_objs} glibc-c.o" + tmake_file="${tmake_file} t-glibc" + target_has_targetcm=yes + ;; +*-*-netbsd*) + tmake_file="t-slibgcc" + gas=yes + gnu_ld=yes + + # NetBSD 2.0 and later get POSIX threads enabled by default. + # Allow them to be explicitly enabled on any other version. + case ${enable_threads} in + "") + case ${target} in + *-*-netbsd[2-9]* | *-*-netbsdelf[2-9]*) + thread_file='posix' + tm_defines="${tm_defines} NETBSD_ENABLE_PTHREADS" + ;; + esac + ;; + yes | posix) + thread_file='posix' + tm_defines="${tm_defines} NETBSD_ENABLE_PTHREADS" + ;; + esac + + # NetBSD 2.0 and later provide __cxa_atexit(), which we use by + # default (unless overridden by --disable-__cxa_atexit). + case ${target} in + *-*-netbsd[2-9]* | *-*-netbsdelf[2-9]*) + default_use_cxa_atexit=yes + ;; + esac + ;; +*-*-openbsd*) + tmake_file="t-openbsd" + case ${enable_threads} in + yes) + thread_file='posix' + ;; + esac + case ${target} in + *-*-openbsd2.*|*-*-openbsd3.[012]) + tm_defines="${tm_defines} HAS_LIBC_R=1" ;; + esac + case ${target} in + *-*-openbsd4.[3-9]|*-*-openbsd[5-9]*) + default_use_cxa_atexit=yes + ;; + esac + ;; +*-*-rtems*) + case ${enable_threads} in + yes) thread_file='rtems' ;; + esac + extra_options="${extra_options} rtems.opt" + default_use_cxa_atexit=yes + use_gcc_stdint=wrap + ;; +*-*-uclinux*) + extra_options="$extra_options gnu-user.opt" + use_gcc_stdint=wrap + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC" + ;; +*-*-rdos*) + use_gcc_stdint=wrap + ;; +*-*-solaris2*) + # i?86-*-solaris2* needs to insert headers between cpu default and + # Solaris 2 specific ones. + sol2_tm_file="dbxelf.h elfos.h ${cpu_type}/sysv4.h sol2.h ${cpu_type}/sol2.h" + case ${target} in + *-*-solaris2.1[0-9]*) + sol2_tm_file="${sol2_tm_file} sol2-10.h" + use_gcc_stdint=wrap + ;; + *) + use_gcc_stdint=provide + ;; + esac + if test x$gnu_ld = xyes; then + tm_file="usegld.h ${tm_file}" + fi + if test x$gas = xyes; then + tm_file="usegas.h ${tm_file}" + fi + tm_p_file="${tm_p_file} sol2-protos.h" + tmake_file="${tmake_file} t-sol2 t-slibgcc" + c_target_objs="${c_target_objs} sol2-c.o" + cxx_target_objs="${cxx_target_objs} sol2-c.o sol2-cxx.o" + extra_objs="sol2.o sol2-stubs.o" + extra_options="${extra_options} sol2.opt" + case ${enable_threads}:${have_pthread_h}:${have_thread_h} in + "":yes:* | yes:yes:* ) + thread_file=posix + ;; + esac + ;; +*-*-*vms*) + extra_options="${extra_options} vms/vms.opt" + xmake_file=vms/x-vms + tmake_file="vms/t-vms t-slibgcc" + extra_objs="vms.o" + target_gtfiles="$target_gtfiles \$(srcdir)/config/vms/vms.c" + tm_p_file="${tm_p_file} vms/vms-protos.h" + xm_file="vms/xm-vms.h" + c_target_objs="vms-c.o" + cxx_target_objs="vms-c.o" + fortran_target_objs="vms-f.o" + use_gcc_stdint=provide + tm_file="${tm_file} vms/vms-stdint.h" + if test x$gnu_ld != xyes; then + # Build wrappers for native case. + extra_programs="ld\$(exeext) ar\$(exeext)" + tmake_file="$tmake_file vms/t-vmsnative" + fi + ;; +*-*-vxworks*) + tmake_file=t-vxworks + xm_defines=POSIX + extra_options="${extra_options} vxworks.opt" + extra_objs=vxworks.o + case ${enable_threads} in + no) ;; + "" | yes | vxworks) thread_file='vxworks' ;; + *) echo 'Unknown thread configuration for VxWorks'; exit 1 ;; + esac + ;; +*-*-elf) + # Assume that newlib is being used and so __cxa_atexit is provided. + default_use_cxa_atexit=yes + use_gcc_stdint=wrap + ;; +esac + +case ${target} in +aarch64*-*-elf) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-elf-raw.h" + tmake_file="${tmake_file} aarch64/t-aarch64" + use_gcc_stdint=wrap + case $target in + aarch64_be-*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" + ;; + esac + ;; +aarch64*-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-linux.h" + tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-linux" + case $target in + aarch64_be-*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" + ;; + esac + ;; +alpha*-*-linux*) + tm_file="elfos.h ${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h glibc-stdint.h" + tmake_file="${tmake_file} alpha/t-linux" + extra_options="${extra_options} alpha/elf.opt" + ;; +alpha*-*-freebsd*) + tm_file="elfos.h ${tm_file} ${fbsd_tm_file} alpha/elf.h alpha/freebsd.h" + extra_options="${extra_options} alpha/elf.opt" + ;; +alpha*-*-netbsd*) + tm_file="elfos.h ${tm_file} netbsd.h alpha/elf.h netbsd-elf.h alpha/netbsd.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt \ + alpha/elf.opt" + ;; +alpha*-*-openbsd*) + tm_defines="${tm_defines} OBSD_HAS_DECLARE_FUNCTION_NAME OBSD_HAS_DECLARE_FUNCTION_SIZE OBSD_HAS_DECLARE_OBJECT" + tm_file="elfos.h alpha/alpha.h alpha/elf.h openbsd.h openbsd-stdint.h alpha/openbsd.h openbsd-libpthread.h" + extra_options="${extra_options} openbsd.opt alpha/elf.opt" + # default x-alpha is only appropriate for dec-osf. + ;; +alpha*-dec-*vms*) + tm_file="${tm_file} vms/vms.h alpha/vms.h" + tmake_file="${tmake_file} alpha/t-vms" + ;; +arm-wrs-vxworks) + tm_file="elfos.h arm/elf.h arm/aout.h ${tm_file} vx-common.h vxworks.h arm/vxworks.h" + extra_options="${extra_options} arm/vxworks.opt" + tmake_file="${tmake_file} arm/t-arm arm/t-vxworks" + ;; +arm*-*-netbsdelf*) + tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h ${tm_file} arm/netbsd-elf.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + tmake_file="${tmake_file} arm/t-arm" + ;; +arm*-*-linux-*) # ARM GNU/Linux with ELF + tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" + case $target in + arm*b-*-linux*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" + ;; + esac + tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi" + tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h arm/aout.h vxworks-dummy.h arm/arm.h" + # Define multilib configuration for arm-linux-androideabi. + case ${target} in + *-androideabi) + tmake_file="$tmake_file arm/t-linux-androideabi" + ;; + esac + # The BPABI long long divmod functions return a 128-bit value in + # registers r0-r3. Correctly modeling that requires the use of + # TImode. + need_64bit_hwint=yes + # The EABI requires the use of __cxa_atexit. + default_use_cxa_atexit=yes + with_tls=${with_tls:-gnu} + ;; +arm*-*-uclinux*eabi*) # ARM ucLinux + tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/linux-gas.h arm/uclinux-elf.h glibc-stdint.h" + tmake_file="arm/t-arm arm/t-arm-elf arm/t-bpabi" + tm_file="$tm_file arm/bpabi.h arm/uclinux-eabi.h arm/aout.h vxworks-dummy.h arm/arm.h" + # The BPABI long long divmod functions return a 128-bit value in + # registers r0-r3. Correctly modeling that requires the use of + # TImode. + need_64bit_hwint=yes + # The EABI requires the use of __cxa_atexit. + default_use_cxa_atexit=yes + ;; +arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*) + case ${target} in + arm*eb-*-eabi*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" + esac + # The BPABI long long divmod functions return a 128-bit value in + # registers r0-r3. Correctly modeling that requires the use of + # TImode. + need_64bit_hwint=yes + default_use_cxa_atexit=yes + tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/bpabi.h" + tmake_file="arm/t-arm arm/t-arm-elf" + case ${target} in + arm*-*-eabi*) + tm_file="$tm_file newlib-stdint.h" + tmake_file="${tmake_file} arm/t-bpabi" + use_gcc_stdint=wrap + ;; + arm*-*-rtems*) + tm_file="${tm_file} rtems.h arm/rtems-eabi.h newlib-stdint.h" + tmake_file="${tmake_file} arm/t-bpabi t-rtems arm/t-rtems-eabi" + ;; + arm*-*-symbianelf*) + tm_file="${tm_file} arm/symbian.h" + # We do not include t-bpabi for Symbian OS because the system + # provides its own implementation of the BPABI functions. + tmake_file="${tmake_file} arm/t-symbian" + ;; + esac + tm_file="${tm_file} arm/aout.h vxworks-dummy.h arm/arm.h" + ;; +avr-*-rtems*) + tm_file="elfos.h avr/elf.h avr/avr-arch.h avr/avr.h dbxelf.h avr/rtems.h rtems.h newlib-stdint.h" + tmake_file="avr/t-avr avr/t-multilib t-rtems avr/t-rtems" + extra_gcc_objs="driver-avr.o avr-devices.o" + extra_objs="avr-devices.o avr-log.o" + ;; +avr-*-*) + tm_file="elfos.h avr/elf.h avr/avr-arch.h avr/avr.h dbxelf.h avr/avr-stdint.h" + if test x${with_avrlibc} != xno; then + tm_file="${tm_file} ${cpu_type}/avrlibc.h" + tm_defines="${tm_defines} WITH_AVRLIBC" + fi + tmake_file="avr/t-avr avr/t-multilib" + use_gcc_stdint=wrap + extra_gcc_objs="driver-avr.o avr-devices.o" + extra_objs="avr-devices.o avr-log.o" + ;; +bfin*-elf*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h bfin/elf.h" + tmake_file=bfin/t-bfin-elf + use_collect2=no + ;; +bfin*-uclinux*) + tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h gnu-user.h linux.h glibc-stdint.h bfin/uclinux.h" + tmake_file=bfin/t-bfin-uclinux + use_collect2=no + ;; +bfin*-linux-uclibc*) + tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h gnu-user.h linux.h glibc-stdint.h bfin/linux.h ./linux-sysroot-suffix.h" + tmake_file="bfin/t-bfin-linux t-slibgcc" + use_collect2=no + ;; +bfin*-rtems*) + tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h bfin/rtems.h rtems.h newlib-stdint.h" + tmake_file="t-rtems bfin/t-rtems" + ;; +bfin*-*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h bfin/elf.h" + use_collect2=no + use_gcc_stdint=wrap + ;; +cr16-*-elf) + tm_file="elfos.h ${tm_file}" + tmake_file="${tmake_file} cr16/t-cr16 " + use_collect2=no + ;; +crisv32-*-elf | crisv32-*-none) + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + tmake_file="cris/t-cris" + target_cpu_default=32 + gas=yes + extra_options="${extra_options} cris/elf.opt" + use_gcc_stdint=wrap + ;; +cris-*-elf | cris-*-none) + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + tmake_file="cris/t-cris cris/t-elfmulti" + gas=yes + extra_options="${extra_options} cris/elf.opt" + use_gcc_stdint=wrap + ;; +crisv32-*-linux* | cris-*-linux*) + tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h glibc-stdint.h cris/linux.h" + # We need to avoid using t-linux, so override default tmake_file + tmake_file="cris/t-cris cris/t-linux t-slibgcc" + extra_options="${extra_options} cris/linux.opt" + case $target in + cris-*-*) + target_cpu_default=10 + ;; + crisv32-*-*) + target_cpu_default=32 + ;; + esac + ;; +epiphany-*-elf ) + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + tmake_file="epiphany/t-epiphany" + extra_options="${extra_options} fused-madd.opt" + extra_objs="$extra_objs mode-switch-use.o resolve-sw-modes.o" + tm_defines="${tm_defines} EPIPHANY_STACK_OFFSET=${with_stack_offset:-8}" + extra_headers="epiphany_intrinsics.h" + ;; +fr30-*-elf) + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + ;; +frv-*-elf) + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + tmake_file=frv/t-frv + ;; +frv-*-*linux*) + tm_file="dbxelf.h elfos.h ${tm_file} \ + gnu-user.h linux.h glibc-stdint.h frv/linux.h" + tmake_file="${tmake_file} frv/t-frv frv/t-linux" + ;; +moxie-*-elf) + gas=yes + gnu_ld=yes + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + tmake_file="${tmake_file} moxie/t-moxie" + ;; +moxie-*-uclinux*) + gas=yes + gnu_ld=yes + tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h glibc-stdint.h moxie/uclinux.h" + tmake_file="${tmake_file} moxie/t-moxie" + ;; +moxie-*-rtems*) + tmake_file="${tmake_file} moxie/t-moxie t-rtems" + tm_file="moxie/moxie.h dbxelf.h elfos.h moxie/rtems.h rtems.h newlib-stdint.h" + ;; +h8300-*-rtems*) + tmake_file="h8300/t-h8300 t-rtems h8300/t-rtems" + tm_file="h8300/h8300.h dbxelf.h elfos.h h8300/elf.h h8300/rtems.h rtems.h newlib-stdint.h" + ;; +h8300-*-elf*) + tmake_file="h8300/t-h8300" + tm_file="h8300/h8300.h dbxelf.h elfos.h newlib-stdint.h h8300/elf.h" + ;; +hppa*64*-*-linux*) + target_cpu_default="MASK_PA_11|MASK_PA_20" + tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h gnu-user.h linux.h \ + glibc-stdint.h pa/pa-linux.h pa/pa64-regs.h pa/pa-64.h \ + pa/pa64-linux.h" + gas=yes gnu_ld=yes + need_64bit_hwint=yes + ;; +hppa*-*-linux*) + target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS" + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h pa/pa-linux.h \ + pa/pa32-regs.h pa/pa32-linux.h" + tmake_file="${tmake_file} pa/t-linux" + ;; +hppa*-*-openbsd*) + target_cpu_default="MASK_PA_11" + tm_file="${tm_file} dbxelf.h elfos.h openbsd.h openbsd-stdint.h openbsd-libpthread.h \ + pa/pa-openbsd.h pa/pa32-regs.h pa/pa32-openbsd.h" + tmake_file="${tmake_file} pa/t-openbsd" + extra_options="${extra_options} openbsd.opt" + gas=yes + gnu_ld=yes + ;; +hppa[12]*-*-hpux10*) + case ${target} in + hppa1.1-*-* | hppa2*-*-*) + target_cpu_default="MASK_PA_11" + ;; + esac + tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h \ + pa/pa-hpux.h pa/pa-hpux10.h" + extra_options="${extra_options} pa/pa-hpux.opt pa/pa-hpux10.opt" + case ${target} in + *-*-hpux10.[1-9]*) + tm_file="${tm_file} pa/pa-hpux1010.h" + extra_options="${extra_options} pa/pa-hpux1010.opt" + ;; + esac + use_gcc_stdint=provide + tm_file="${tm_file} hpux-stdint.h" + tmake_file="t-slibgcc" + case ${enable_threads} in + "") + if test x$have_pthread_h = xyes ; then + tmake_file="${tmake_file} pa/t-dce-thr" + fi + ;; + yes | dce) + tmake_file="${tmake_file} pa/t-dce-thr" + ;; + esac + use_collect2=yes + gas=yes + if test "x$with_dwarf2" != x; then + echo "Warning: dwarf2 debug format is not supported for this target, --with-dwarf2 ignored" 1>&2 + dwarf2=no + fi + ;; +hppa*64*-*-hpux11*) + target_cpu_default="MASK_PA_11|MASK_PA_20" + if test x$gnu_ld = xyes + then + target_cpu_default="${target_cpu_default}|MASK_GNU_LD" + fi + tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h \ + pa/pa64-regs.h pa/pa-hpux.h pa/pa-hpux1010.h \ + pa/pa-hpux11.h" + case ${target} in + *-*-hpux11.[12]*) + tm_file="${tm_file} pa/pa-hpux1111.h pa/pa-64.h pa/pa64-hpux.h" + extra_options="${extra_options} pa/pa-hpux1111.opt" + ;; + *-*-hpux11.[3-9]*) + tm_file="${tm_file} pa/pa-hpux1131.h pa/pa-64.h pa/pa64-hpux.h" + extra_options="${extra_options} pa/pa-hpux1131.opt" + ;; + *) + tm_file="${tm_file} pa/pa-64.h pa/pa64-hpux.h" + ;; + esac + extra_options="${extra_options} pa/pa-hpux.opt \ + pa/pa-hpux1010.opt pa/pa64-hpux.opt hpux11.opt" + need_64bit_hwint=yes + tmake_file="t-slibgcc" + case x${enable_threads} in + x | xyes | xposix ) + thread_file=posix + ;; + esac + gas=yes + case ${target} in + *-*-hpux11.[01]*) + use_gcc_stdint=provide + tm_file="${tm_file} hpux-stdint.h" + ;; + *-*-hpux11.[23]*) + use_gcc_stdint=wrap + tm_file="${tm_file} hpux-stdint.h" + ;; + esac + ;; +hppa[12]*-*-hpux11*) + case ${target} in + hppa1.1-*-* | hppa2*-*-*) + target_cpu_default="MASK_PA_11" + ;; + esac + tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h \ + pa/pa-hpux.h pa/pa-hpux1010.h pa/pa-hpux11.h" + extra_options="${extra_options} pa/pa-hpux.opt pa/pa-hpux1010.opt \ + hpux11.opt" + case ${target} in + *-*-hpux11.[12]*) + tm_file="${tm_file} pa/pa-hpux1111.h" + extra_options="${extra_options} pa/pa-hpux1111.opt" + ;; + *-*-hpux11.[3-9]*) + tm_file="${tm_file} pa/pa-hpux1131.h" + extra_options="${extra_options} pa/pa-hpux1131.opt" + ;; + esac + tmake_file="t-slibgcc" + case x${enable_threads} in + x | xyes | xposix ) + thread_file=posix + ;; + esac + use_collect2=yes + gas=yes + case ${target} in + *-*-hpux11.[01]*) + use_gcc_stdint=provide + tm_file="${tm_file} hpux-stdint.h" + ;; + *-*-hpux11.[23]*) + use_gcc_stdint=wrap + tm_file="${tm_file} hpux-stdint.h" + ;; + esac + if test "x$with_dwarf2" != x; then + echo "Warning: dwarf2 debug format is not supported for this target, --with-dwarf2 ignored" 1>&2 + dwarf2=no + fi + ;; +i[34567]86-*-darwin*) + need_64bit_isa=yes + # Baseline choice for a machine that allows m64 support. + with_cpu=${with_cpu:-core2} + tmake_file="${tmake_file} t-slibgcc" + ;; +x86_64-*-darwin*) + with_cpu=${with_cpu:-core2} + tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc" + tm_file="${tm_file} ${cpu_type}/darwin64.h" + ;; +i[34567]86-*-elf*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h" + ;; +x86_64-*-elf*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h" + ;; +i[34567]86-*-rdos*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/rdos.h" + ;; +x86_64-*-rdos*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rdos.h i386/rdos64.h" + tmake_file="i386/t-i386elf t-svr4" + ;; +i[34567]86-*-freebsd*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h" + ;; +x86_64-*-freebsd*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h" + ;; +i[34567]86-*-netbsdelf*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + ;; +x86_64-*-netbsd*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + ;; +i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123]) + tm_file="i386/i386.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h i386/openbsd.h" + extra_options="${extra_options} openbsd.opt" + # needed to unconfuse gdb + tmake_file="${tmake_file} t-openbsd i386/t-openbsd" + # we need collect2 until our bug is fixed... + use_collect2=yes + ;; +i[34567]86-*-openbsd*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h" + tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/openbsdelf.h" + extra_options="${extra_options} openbsd.opt" + gas=yes + gnu_ld=yes + ;; +x86_64-*-openbsd*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h" + tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/x86-64.h i386/openbsdelf.h" + extra_options="${extra_options} openbsd.opt" + gas=yes + gnu_ld=yes + ;; +i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu) + # Intel 80386's running GNU/* + # with ELF format using glibc 2 + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h gnu-user.h glibc-stdint.h" + case ${target} in + i[34567]86-*-linux*) + tm_file="${tm_file} linux.h" + # Assume modern glibc + default_gnu_indirect_function=yes + if test x$enable_targets = xall; then + tm_file="${tm_file} i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h i386/linux-common.h i386/linux64.h" + tm_defines="${tm_defines} TARGET_BI_ARCH=1" + tmake_file="${tmake_file} i386/t-linux64" + x86_multilibs="${with_multilib_list}" + if test "$x86_multilibs" = "default"; then + x86_multilibs="m64,m32" + fi + x86_multilibs=`echo $x86_multilibs | sed -e 's/,/ /g'` + for x86_multilib in ${x86_multilibs}; do + case ${x86_multilib} in + m32 | m64 | mx32) + TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${x86_multilib}" + ;; + *) + echo "--with-multilib-list=${x86_with_multilib} not supported." + exit 1 + esac + done + TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'` + need_64bit_isa=yes + case X"${with_cpu}" in + Xgeneric|Xatom|Xcore2|Xcorei7|Xcorei7-avx|Xnocona|Xx86-64|Xbdver3|Xbdver2|Xbdver1|Xbtver2|Xbtver1|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx|Xathlon64-sse3|Xk8-sse3|Xopteron-sse3) + ;; + X) + if test x$with_cpu_64 = x; then + with_cpu_64=generic + fi + ;; + *) + echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2 + echo "generic atom core2 corei7 corei7-avx nocona x86-64 bdver3 bdver2 bdver1 btver2 btver1 amdfam10 barcelona k8 opteron athlon64 athlon-fx athlon64-sse3 k8-sse3 opteron-sse3" 1>&2 + exit 1 + ;; + esac + else + tm_file="${tm_file} i386/gnu-user-common.h i386/gnu-user.h i386/linux-common.h i386/linux.h" + fi + ;; + i[34567]86-*-knetbsd*-gnu) + tm_file="${tm_file} i386/gnu-user-common.h i386/gnu-user.h knetbsd-gnu.h i386/knetbsd-gnu.h" + ;; + i[34567]86-*-kfreebsd*-gnu) + tm_file="${tm_file} i386/gnu-user-common.h i386/gnu-user.h kfreebsd-gnu.h i386/kfreebsd-gnu.h" + ;; + i[34567]86-*-kopensolaris*-gnu) + tm_file="${tm_file} i386/gnu-user-common.h i386/gnu-user.h kopensolaris-gnu.h i386/kopensolaris-gnu.h" + ;; + i[34567]86-*-gnu*) + tm_file="$tm_file i386/gnu-user-common.h i386/gnu-user.h gnu.h i386/gnu.h" + ;; + esac + ;; +x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h gnu-user.h glibc-stdint.h \ + i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h" + case ${target} in + x86_64-*-linux*) + tm_file="${tm_file} linux.h i386/linux-common.h i386/linux64.h" + # Assume modern glibc + default_gnu_indirect_function=yes + ;; + x86_64-*-kfreebsd*-gnu) + tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu64.h" + ;; + x86_64-*-knetbsd*-gnu) + tm_file="${tm_file} knetbsd-gnu.h" + ;; + esac + tmake_file="${tmake_file} i386/t-linux64" + x86_multilibs="${with_multilib_list}" + if test "$x86_multilibs" = "default"; then + case ${with_abi} in + x32 | mx32) + x86_multilibs="mx32" + ;; + *) + x86_multilibs="m64,m32" + ;; + esac + fi + x86_multilibs=`echo $x86_multilibs | sed -e 's/,/ /g'` + for x86_multilib in ${x86_multilibs}; do + case ${x86_multilib} in + m32 | m64 | mx32) + TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${x86_multilib}" + ;; + *) + echo "--with-multilib-list=${x86_with_multilib} not supported." + exit 1 + esac + done + TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'` + ;; +i[34567]86-pc-msdosdjgpp*) + xm_file=i386/xm-djgpp.h + tm_file="dbxcoff.h ${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/djgpp.h i386/djgpp-stdint.h" + native_system_header_dir=/dev/env/DJDIR/include + extra_options="${extra_options} i386/djgpp.opt" + gnu_ld=yes + gas=yes + use_gcc_stdint=wrap + ;; +i[34567]86-*-lynxos*) + xm_defines=POSIX + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/lynx.h lynx.h" + tmake_file="${tmake_file} t-lynx" + extra_options="${extra_options} lynx.opt" + thread_file=lynx + gnu_ld=yes + gas=yes + ;; +i[34567]86-*-nto-qnx*) + tm_file="${tm_file} i386/att.h dbxelf.h tm-dwarf2.h elfos.h i386/unix.h i386/nto.h" + extra_options="${extra_options} i386/nto.opt" + gnu_ld=yes + gas=yes + ;; +i[34567]86-*-rtems*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/rtemself.h rtems.h newlib-stdint.h" + tmake_file="${tmake_file} i386/t-rtems t-rtems" + ;; +i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*) + tm_file="${tm_file} i386/unix.h i386/att.h ${sol2_tm_file}" + # Set default arch_32 to pentium4, tune_32 to generic like the other + # i386 targets, although config.guess defaults to i386-pc-solaris2*. + case ${target} in + *-*-solaris2.9*) + # Solaris 9/x86 cannot execute SSE/SSE2 instructions by default. + with_arch_32=${with_arch_32:-pentiumpro} + ;; + *) + with_arch_32=${with_arch_32:-pentium4} + ;; + esac + with_tune_32=${with_tune_32:-generic} + case ${target} in + *-*-solaris2.1[0-9]*) + tm_file="${tm_file} i386/x86-64.h i386/sol2-bi.h sol2-bi.h" + tm_defines="${tm_defines} TARGET_BI_ARCH=1" + tmake_file="$tmake_file i386/t-sol2-64" + need_64bit_isa=yes + case X"${with_cpu}" in + Xgeneric|Xatom|Xcore2|Xcorei7|Xcorei7-avx|Xnocona|Xx86-64|Xbdver3|Xbdver2|Xbdver1|Xbtver2|Xbtver1|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx|Xathlon64-sse3|Xk8-sse3|Xopteron-sse3) + ;; + X) + if test x$with_cpu_64 = x; then + with_cpu_64=generic + fi + ;; + *) + echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2 + echo "generic atom core2 corei7 corei7-avx nocona x86-64 bdver3 bdver2 bdver1 btver2 btver1 amdfam10 barcelona k8 opteron athlon64 athlon-fx athlon64-sse3 k8-sse3 opteron-sse3" 1>&2 + exit 1 + ;; + esac + ;; + esac + ;; +i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae) + tm_file="${tm_file} i386/unix.h i386/att.h elfos.h vx-common.h" + case ${target} in + *-vxworksae*) + tm_file="${tm_file} vxworksae.h i386/vx-common.h i386/vxworksae.h" + tmake_file="${tmake_file} i386/t-vxworks i386/t-vxworksae" + ;; + *) + tm_file="${tm_file} vxworks.h i386/vx-common.h i386/vxworks.h" + tmake_file="${tmake_file} i386/t-vxworks" + ;; + esac + ;; +i[34567]86-*-cygwin*) + tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/cygwin.h i386/cygwin-stdint.h" + xm_file=i386/xm-cygwin.h + tmake_file="${tmake_file} i386/t-cygming t-slibgcc" + target_gtfiles="\$(srcdir)/config/i386/winnt.c" + extra_options="${extra_options} i386/cygming.opt" + extra_objs="winnt.o winnt-stubs.o" + c_target_objs="${c_target_objs} msformat-c.o" + cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o" + if test x$enable_threads = xyes; then + thread_file='posix' + fi + use_gcc_stdint=wrap + ;; +i[34567]86-*-mingw* | x86_64-*-mingw*) + tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h" + xm_file=i386/xm-mingw32.h + case ${target} in + x86_64-*-* | *-w64-*) + need_64bit_isa=yes + ;; + *) + ;; + esac + if test x$enable_threads = xposix ; then + tm_file="${tm_file} i386/mingw-pthread.h" + fi + tm_file="${tm_file} i386/mingw32.h" + # This makes the logic if mingw's or the w64 feature set has to be used + case ${target} in + *-w64-*) + user_headers_inc_next_post="${user_headers_inc_next_post} float.h" + user_headers_inc_next_pre="${user_headers_inc_next_pre} stddef.h stdarg.h" + tm_file="${tm_file} i386/mingw-w64.h" + if test x$enable_targets = xall; then + tm_defines="${tm_defines} TARGET_BI_ARCH=1" + case X"${with_cpu}" in + Xgeneric|Xatom|Xcore2|Xcorei7|Xcorei7-avx|Xnocona|Xx86-64|Xbdver3|Xbdver2|Xbdver1|Xbtver2|Xbtver1|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx|Xathlon64-sse3|Xk8-sse3|Xopteron-sse3) + ;; + X) + if test x$with_cpu_64 = x; then + with_cpu_64=generic + fi + ;; + *) + echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2 + echo "generic atom core2 corei7 Xcorei7-avx nocona x86-64 bdver3 bdver2 bdver1 btver2 btver1 amdfam10 barcelona k8 opteron athlon64 athlon-fx athlon64-sse3 k8-sse3 opteron-sse3" 1>&2 + exit 1 + ;; + esac + fi + ;; + *) + ;; + esac + tm_file="${tm_file} i386/mingw-stdint.h" + tmake_file="${tmake_file} i386/t-cygming t-slibgcc" + case ${target} in + x86_64-w64-*) + tmake_file="${tmake_file} i386/t-mingw-w64" + ;; + i[34567]86-w64-*) + tmake_file="${tmake_file} i386/t-mingw-w32" + ;; + esac + native_system_header_dir=/mingw/include + target_gtfiles="\$(srcdir)/config/i386/winnt.c" + extra_options="${extra_options} i386/cygming.opt i386/mingw.opt" + case ${target} in + *-w64-*) + extra_options="${extra_options} i386/mingw-w64.opt" + ;; + *) + ;; + esac + extra_objs="winnt.o winnt-stubs.o" + c_target_objs="${c_target_objs} msformat-c.o" + cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o" + gas=yes + gnu_ld=yes + default_use_cxa_atexit=yes + use_gcc_stdint=wrap + case ${enable_threads} in + "" | yes | win32) + thread_file='win32' + ;; + posix) + thread_file='posix' + ;; + esac + case ${target} in + *mingw32crt*) + tm_file="${tm_file} i386/crtdll.h" + ;; + *mingw32msv* | *mingw*) + ;; + esac + ;; +i[34567]86-*-interix[3-9]*) + tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/i386-interix.h" + tmake_file="${tmake_file} i386/t-interix" + extra_options="${extra_options} rpath.opt i386/interix.opt" + extra_objs="winnt.o winnt-stubs.o" + target_gtfiles="\$(srcdir)/config/i386/winnt.c" + if test x$enable_threads = xyes ; then + thread_file='posix' + fi + if test x$stabs = xyes ; then + tm_file="${tm_file} dbxcoff.h" + fi + ;; +ia64*-*-elf*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h ia64/sysv4.h ia64/elf.h" + tmake_file="ia64/t-ia64" + target_cpu_default="0" + if test x$gas = xyes + then + target_cpu_default="${target_cpu_default}|MASK_GNU_AS" + fi + if test x$gnu_ld = xyes + then + target_cpu_default="${target_cpu_default}|MASK_GNU_LD" + fi + ;; +ia64*-*-freebsd*) + tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} ia64/sysv4.h ia64/freebsd.h" + target_cpu_default="MASK_GNU_AS|MASK_GNU_LD" + tmake_file="${tmake_file} ia64/t-ia64" + ;; +ia64*-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ia64/sysv4.h ia64/linux.h" + tmake_file="${tmake_file} ia64/t-ia64 ia64/t-linux t-libunwind" + target_cpu_default="MASK_GNU_AS|MASK_GNU_LD" + ;; +ia64*-*-hpux*) + tm_file="${tm_file} dbxelf.h elfos.h ia64/sysv4.h ia64/hpux.h" + tmake_file="ia64/t-ia64 ia64/t-hpux t-slibgcc" + target_cpu_default="MASK_GNU_AS" + case x$enable_threads in + x | xyes | xposix ) + thread_file=posix + ;; + esac + use_collect2=no + c_target_objs="ia64-c.o" + cxx_target_objs="ia64-c.o" + extra_options="${extra_options} ia64/ilp32.opt hpux11.opt" + use_gcc_stdint=wrap + tm_file="${tm_file} hpux-stdint.h" + case ${target} in + *-*-hpux11.3*) + tm_file="${tm_file} ia64/hpux-unix2003.h" + ;; + esac + ;; +ia64-hp-*vms*) + tm_file="${tm_file} elfos.h ia64/sysv4.h vms/vms.h ia64/vms.h" + tmake_file="${tmake_file} ia64/t-ia64" + target_cpu_default="0" + if test x$gas = xyes + then + target_cpu_default="${target_cpu_default}|MASK_GNU_AS" + fi + extra_options="${extra_options} ia64/vms.opt" + ;; +iq2000*-*-elf*) + tm_file="elfos.h newlib-stdint.h iq2000/iq2000.h" + out_file=iq2000/iq2000.c + md_file=iq2000/iq2000.md + ;; +lm32-*-elf*) + tm_file="dbxelf.h elfos.h ${tm_file}" + tmake_file="${tmake_file} lm32/t-lm32" + ;; +lm32-*-rtems*) + tm_file="dbxelf.h elfos.h ${tm_file} lm32/rtems.h rtems.h newlib-stdint.h" + tmake_file="${tmake_file} lm32/t-lm32" + tmake_file="${tmake_file} t-rtems" + tmake_file="${tmake_file} lm32/t-rtems" + ;; +lm32-*-uclinux*) + tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h lm32/uclinux-elf.h" + tmake_file="${tmake_file} lm32/t-lm32" + ;; +m32r-*-elf*) + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + ;; +m32rle-*-elf*) + tm_file="dbxelf.h elfos.h newlib-stdint.h m32r/little.h ${tm_file}" + ;; +m32r-*-rtems*) + tm_file="dbxelf.h elfos.h ${tm_file} m32r/rtems.h rtems.h newlib-stdint.h" + tmake_file="m32r/t-m32r t-rtems" + ;; +m32r-*-linux*) + tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} m32r/linux.h" + # We override the tmake_file for linux -- why? + tmake_file="m32r/t-linux t-slibgcc" + gnu_ld=yes + if test x$enable_threads = xyes; then + thread_file='posix' + fi + ;; +m32rle-*-linux*) + tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h m32r/little.h ${tm_file} m32r/linux.h" + # We override the tmake_file for linux -- why? + tmake_file="m32r/t-linux t-slibgcc" + gnu_ld=yes + if test x$enable_threads = xyes; then + thread_file='posix' + fi + ;; +m68k-*-elf* | fido-*-elf*) + case ${target} in + fido-*-elf*) + # Check that $with_cpu makes sense. + case $with_cpu in + "" | "fidoa") + ;; + *) + echo "Cannot accept --with-cpu=$with_cpu" + exit 1 + ;; + esac + with_cpu=fidoa + ;; + *) + default_m68k_cpu=68020 + default_cf_cpu=5206 + ;; + esac + tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h newlib-stdint.h m68k/m68kemb.h m68k/m68020-elf.h" + tm_defines="${tm_defines} MOTOROLA=1" + tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-m68kelf" + # Add multilibs for targets other than fido. + case ${target} in + fido-*-elf*) + ;; + *) + tmake_file="$tmake_file m68k/t-mlibs" + ;; + esac + ;; +m68k*-*-netbsdelf*) + default_m68k_cpu=68020 + default_cf_cpu=5475 + tm_file="${tm_file} dbxelf.h elfos.h netbsd.h netbsd-elf.h m68k/netbsd-elf.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + tm_defines="${tm_defines} MOTOROLA=1" + ;; +m68k*-*-openbsd*) + default_m68k_cpu=68020 + default_cf_cpu=5475 + # needed to unconfuse gdb + tm_defines="${tm_defines} OBSD_OLD_GAS" + tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h m68k/openbsd.h" + extra_options="${extra_options} openbsd.opt" + tmake_file="t-openbsd m68k/t-openbsd" + # we need collect2 until our bug is fixed... + use_collect2=yes + ;; +m68k-*-uclinux*) # Motorola m68k/ColdFire running uClinux + # with uClibc, using the new GNU/Linux-style + # ABI. + default_m68k_cpu=68020 + default_cf_cpu=5206 + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h flat.h m68k/linux.h m68k/uclinux.h ./sysroot-suffix.h" + extra_options="${extra_options} m68k/uclinux.opt" + tm_defines="${tm_defines} MOTOROLA=1" + tmake_file="m68k/t-floatlib m68k/t-uclinux m68k/t-mlibs" + ;; +m68k-*-linux*) # Motorola m68k's running GNU/Linux + # with ELF format using glibc 2 + # aka the GNU/Linux C library 6. + default_m68k_cpu=68020 + default_cf_cpu=5475 + with_arch=${with_arch:-m68k} + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h m68k/linux.h ./sysroot-suffix.h" + extra_options="${extra_options} m68k/ieee.opt" + tm_defines="${tm_defines} MOTOROLA=1" + tmake_file="${tmake_file} m68k/t-floatlib m68k/t-linux m68k/t-mlibs" + ;; +m68k-*-rtems*) + default_m68k_cpu=68020 + default_cf_cpu=5206 + tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-crtstuff t-rtems m68k/t-rtems m68k/t-mlibs" + tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/m68kemb.h m68k/m68020-elf.h m68k/rtemself.h rtems.h newlib-stdint.h" + tm_defines="${tm_defines} MOTOROLA=1" + ;; +mcore-*-elf) + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file} mcore/mcore-elf.h" + tmake_file=mcore/t-mcore + inhibit_libc=true + ;; +mep-*-*) + tm_file="dbxelf.h elfos.h ${tm_file}" + tmake_file=mep/t-mep + c_target_objs="mep-pragma.o" + cxx_target_objs="mep-pragma.o" + if test -d "${srcdir}/../newlib/libc/include" && + test "x$with_headers" = x; then + with_headers=yes + fi + use_gcc_stdint=wrap + ;; +microblaze*-linux*) + case $target in + microblazeel-*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=0" + ;; + microblaze-*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=4321" + ;; + esac + tm_file="${tm_file} dbxelf.h gnu-user.h linux.h microblaze/linux.h" + tm_file="${tm_file} glibc-stdint.h" + c_target_objs="${c_target_objs} microblaze-c.o" + cxx_target_objs="${cxx_target_objs} microblaze-c.o" + tmake_file="${tmake_file} microblaze/t-microblaze" + tmake_file="${tmake_file} microblaze/t-microblaze-linux" + ;; +microblaze*-*-rtems*) + case $target in + microblazeel-*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=0" + ;; + microblaze-*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=4321" + ;; + esac + tm_file="${tm_file} dbxelf.h" + tm_file="${tm_file} microblaze/rtems.h rtems.h newlib-stdint.h" + c_target_objs="${c_target_objs} microblaze-c.o" + cxx_target_objs="${cxx_target_objs} microblaze-c.o" + tmake_file="${tmake_file} microblaze/t-microblaze" + tmake_file="${tmake_file} t-rtems microblaze/t-rtems" + ;; +microblaze*-*-elf) + case $target in + microblazeel-*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=0" + ;; + microblaze-*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=4321" + ;; + esac + tm_file="${tm_file} dbxelf.h newlib-stdint.h" + c_target_objs="${c_target_objs} microblaze-c.o" + cxx_target_objs="${cxx_target_objs} microblaze-c.o" + tmake_file="${tmake_file} microblaze/t-microblaze" + ;; +mips*-*-netbsd*) # NetBSD/mips, either endian. + target_cpu_default="MASK_ABICALLS" + tm_file="elfos.h ${tm_file} mips/elf.h netbsd.h netbsd-elf.h mips/netbsd.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + ;; +mips*-mti-linux*) + tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h mips/mti-linux.h" + tmake_file="${tmake_file} mips/t-mti-linux" + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33 MIPS_ABI_DEFAULT=ABI_32" + gnu_ld=yes + gas=yes + test x$with_llsc != x || with_llsc=yes + ;; +mips64*-*-linux* | mipsisa64*-*-linux*) + tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h" + tmake_file="${tmake_file} mips/t-linux64" + tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32" + case ${target} in + mips64el-st-linux-gnu) + tm_file="${tm_file} mips/st.h" + tmake_file="${tmake_file} mips/t-st" + ;; + mips64octeon*-*-linux*) + tm_defines="${tm_defines} MIPS_CPU_STRING_DEFAULT=\\\"octeon\\\"" + target_cpu_default=MASK_SOFT_FLOAT_ABI + ;; + mipsisa64r2*-*-linux*) + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=65" + ;; + esac + gnu_ld=yes + gas=yes + test x$with_llsc != x || with_llsc=yes + ;; +mips*-*-linux*) # Linux MIPS, either endian. + tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h" + if test x$enable_targets = xall; then + tm_file="${tm_file} mips/gnu-user64.h mips/linux64.h" + tmake_file="${tmake_file} mips/t-linux64" + fi + tm_file="${tm_file} mips/linux-common.h" + case ${target} in + mipsisa32r2*) + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33" + ;; + mipsisa32*) + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=32" + esac + test x$with_llsc != x || with_llsc=yes + ;; +mips*-mti-elf*) + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/sde.h mips/mti-elf.h" + tmake_file="mips/t-mti-elf" + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33 MIPS_ABI_DEFAULT=ABI_32" + ;; +mips*-sde-elf*) + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/sde.h" + tmake_file="mips/t-sde" + extra_options="${extra_options} mips/sde.opt" + case "${with_newlib}" in + yes) + # newlib / libgloss. + ;; + *) + # MIPS toolkit libraries. + tm_file="$tm_file mips/sdemtk.h" + tmake_file="$tmake_file mips/t-sdemtk" + case ${enable_threads} in + "" | yes | mipssde) + thread_file='mipssde' + ;; + esac + ;; + esac + case ${target} in + mipsisa32r2*) + tm_defines="MIPS_ISA_DEFAULT=33 MIPS_ABI_DEFAULT=ABI_32" + ;; + mipsisa32*) + tm_defines="MIPS_ISA_DEFAULT=32 MIPS_ABI_DEFAULT=ABI_32" + ;; + mipsisa64r2*) + tm_defines="MIPS_ISA_DEFAULT=65 MIPS_ABI_DEFAULT=ABI_N32" + ;; + mipsisa64*) + tm_defines="MIPS_ISA_DEFAULT=64 MIPS_ABI_DEFAULT=ABI_N32" + ;; + esac + ;; +mipsisa32-*-elf* | mipsisa32el-*-elf* | \ +mipsisa32r2-*-elf* | mipsisa32r2el-*-elf* | \ +mipsisa64-*-elf* | mipsisa64el-*-elf* | \ +mipsisa64r2-*-elf* | mipsisa64r2el-*-elf*) + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h" + tmake_file="mips/t-isa3264" + case ${target} in + mipsisa32r2*) + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33" + ;; + mipsisa32*) + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=32" + ;; + mipsisa64r2*) + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=65" + ;; + mipsisa64*) + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=64" + ;; + esac + case ${target} in + mipsisa32*-*-elfoabi*) + tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_32" + tm_file="${tm_file} mips/elfoabi.h" + ;; + mipsisa64*-*-elfoabi*) + tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_O64" + tm_file="${tm_file} mips/elfoabi.h" + ;; + *-*-elf*) + tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_EABI" + ;; + esac + ;; +mipsisa64sr71k-*-elf*) + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h" + tmake_file=mips/t-sr71k + target_cpu_default="MASK_64BIT|MASK_FLOAT64" + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=64 MIPS_CPU_STRING_DEFAULT=\\\"sr71000\\\" MIPS_ABI_DEFAULT=ABI_EABI" + ;; +mipsisa64sb1-*-elf* | mipsisa64sb1el-*-elf*) + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h" + tmake_file="mips/t-elf mips/t-sb1" + target_cpu_default="MASK_64BIT|MASK_FLOAT64" + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=64 MIPS_CPU_STRING_DEFAULT=\\\"sb1\\\" MIPS_ABI_DEFAULT=ABI_O64" + ;; +mips-*-elf* | mipsel-*-elf*) + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h" + tmake_file="mips/t-elf" + ;; +mips64-*-elf* | mips64el-*-elf*) + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h" + tmake_file="mips/t-elf" + target_cpu_default="MASK_64BIT|MASK_FLOAT64" + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64" + ;; +mips64vr-*-elf* | mips64vrel-*-elf*) + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/vr.h mips/elf.h" + tmake_file=mips/t-vr + tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_EABI" + ;; +mips64orion-*-elf* | mips64orionel-*-elf*) + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elforion.h mips/elf.h" + tmake_file="mips/t-elf" + target_cpu_default="MASK_64BIT|MASK_FLOAT64" + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64" + ;; +mips*-*-rtems*) + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/rtems.h rtems.h" + tmake_file="mips/t-elf t-rtems mips/t-rtems" + ;; +mips-wrs-vxworks) + tm_file="elfos.h ${tm_file} mips/elf.h vx-common.h vxworks.h mips/vxworks.h" + tmake_file="${tmake_file} mips/t-vxworks" + ;; +mipstx39-*-elf* | mipstx39el-*-elf*) + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/r3900.h mips/elf.h" + tmake_file="mips/t-r3900" + ;; +mmix-knuth-mmixware) + tm_file="${tm_file} newlib-stdint.h" + need_64bit_hwint=yes + use_gcc_stdint=wrap + ;; +mn10300-*-*) + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + if test x$stabs = xyes + then + tm_file="${tm_file} dbx.h" + fi + use_collect2=no + use_gcc_stdint=wrap + ;; +pdp11-*-*) + tm_file="${tm_file} newlib-stdint.h" + use_gcc_stdint=wrap + ;; +picochip-*) + tm_file="${tm_file} newlib-stdint.h" + use_gcc_stdint=wrap + tmake_file="picochip/t-picochip t-pnt16-warn" + ;; +# port not yet contributed +#powerpc-*-openbsd*) +# tmake_file="${tmake_file} rs6000/t-fprules" +# extra_headers= +# ;; +powerpc-*-darwin*) + extra_options="${extra_options} rs6000/darwin.opt" + case ${target} in + *-darwin1[0-9]* | *-darwin[8-9]*) + tmake_file="${tmake_file} rs6000/t-darwin8" + tm_file="${tm_file} rs6000/darwin8.h" + ;; + *-darwin7*) + tm_file="${tm_file} rs6000/darwin7.h" + ;; + *-darwin[0-6]*) + ;; + esac + tmake_file="${tmake_file} t-slibgcc" + extra_headers=altivec.h + ;; +powerpc64-*-darwin*) + extra_options="${extra_options} ${cpu_type}/darwin.opt" + tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc" + tm_file="${tm_file} ${cpu_type}/darwin8.h ${cpu_type}/darwin64.h" + extra_headers=altivec.h + ;; +powerpc*-*-freebsd*) + tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} rs6000/sysv4.h" + extra_options="${extra_options} rs6000/sysv4.opt" + tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" + case ${target} in + powerpc64*) + tm_file="${tm_file} rs6000/default64.h rs6000/freebsd64.h" + tmake_file="${tmake_file} rs6000/t-freebsd64" + extra_options="${extra_options} rs6000/linux64.opt" + ;; + *) + tm_file="${tm_file} rs6000/freebsd.h" + ;; + esac + ;; +powerpc-*-netbsd*) + tm_file="${tm_file} dbxelf.h elfos.h netbsd.h netbsd-elf.h freebsd-spec.h rs6000/sysv4.h rs6000/netbsd.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + tmake_file="${tmake_file} rs6000/t-netbsd" + extra_options="${extra_options} rs6000/sysv4.opt" + ;; +powerpc-*-eabispe*) + tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabispe.h" + extra_options="${extra_options} rs6000/sysv4.opt" + tmake_file="rs6000/t-spe rs6000/t-ppccomm" + use_gcc_stdint=wrap + ;; +powerpc-*-eabisimaltivec*) + tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h rs6000/eabialtivec.h" + extra_options="${extra_options} rs6000/sysv4.opt" + tmake_file="rs6000/t-fprules rs6000/t-ppcendian rs6000/t-ppccomm" + use_gcc_stdint=wrap + ;; +powerpc-*-eabisim*) + tm_file="${tm_file} dbxelf.h elfos.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h" + extra_options="${extra_options} rs6000/sysv4.opt" + tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm" + use_gcc_stdint=wrap + ;; +powerpc-*-elf*) + tm_file="${tm_file} dbxelf.h elfos.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h" + extra_options="${extra_options} rs6000/sysv4.opt" + tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm" + ;; +powerpc-*-eabialtivec*) + tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabialtivec.h" + extra_options="${extra_options} rs6000/sysv4.opt" + tmake_file="rs6000/t-fprules rs6000/t-ppcendian rs6000/t-ppccomm" + use_gcc_stdint=wrap + ;; +powerpc-xilinx-eabi*) + tm_file="${tm_file} dbxelf.h elfos.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/singlefp.h rs6000/xfpu.h rs6000/xilinx.h" + extra_options="${extra_options} rs6000/sysv4.opt rs6000/xilinx.opt" + tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm rs6000/t-xilinx" + use_gcc_stdint=wrap + ;; +powerpc-*-eabi*) + tm_file="${tm_file} dbxelf.h elfos.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h" + extra_options="${extra_options} rs6000/sysv4.opt" + tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm" + use_gcc_stdint=wrap + ;; +powerpc-*-rtems*) + tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/rtems.h rtems.h" + extra_options="${extra_options} rs6000/sysv4.opt" + tmake_file="rs6000/t-fprules rs6000/t-rtems t-rtems rs6000/t-ppccomm" + ;; +powerpc*-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h" + extra_options="${extra_options} rs6000/sysv4.opt" + tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" + case ${target} in + powerpc*le-*-*) + tm_file="${tm_file} rs6000/sysv4le.h" ;; + esac + maybe_biarch=yes + case ${target} in + powerpc64*-*-linux*spe* | powerpc64*-*-linux*paired*) + echo "*** Configuration ${target} not supported" 1>&2 + exit 1 + ;; + powerpc*-*-linux*spe* | powerpc*-*-linux*paired*) + maybe_biarch= + ;; + powerpc64*-*-linux*) + test x$with_cpu != x || cpu_is_64bit=yes + maybe_biarch=always + ;; + esac + case ${maybe_biarch}:${enable_targets}:${cpu_is_64bit} in + always:* | yes:*powerpc64* | yes:all:* | yes:*:yes) + if test x$cpu_is_64bit = xyes; then + tm_file="${tm_file} rs6000/default64.h" + fi + tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h glibc-stdint.h" + tmake_file="$tmake_file rs6000/t-linux64" + case ${target} in + powerpc*le-*-*) + tmake_file="$tmake_file rs6000/t-linux64le" + case ${enable_targets} in + all | *powerpc64-* | *powerpc-*) + tmake_file="$tmake_file rs6000/t-linux64lebe" ;; + esac ;; + *) + case ${enable_targets} in + all | *powerpc64le-* | *powerpcle-*) + tmake_file="$tmake_file rs6000/t-linux64bele" ;; + esac ;; + esac + extra_options="${extra_options} rs6000/linux64.opt" + ;; + *) + tm_file="${tm_file} rs6000/linux.h glibc-stdint.h" + tmake_file="$tmake_file rs6000/t-linux" + ;; + esac + case ${target} in + powerpc*-*-linux*ppc476*) + tm_file="${tm_file} rs6000/476.h" + extra_options="${extra_options} rs6000/476.opt" ;; + powerpc*-*-linux*altivec*) + tm_file="${tm_file} rs6000/linuxaltivec.h" ;; + powerpc*-*-linux*spe*) + tm_file="${tm_file} rs6000/linuxspe.h rs6000/e500.h" ;; + powerpc*-*-linux*paired*) + tm_file="${tm_file} rs6000/750cl.h" ;; + esac + if test x${enable_secureplt} = xyes; then + tm_file="rs6000/secureplt.h ${tm_file}" + fi + ;; +powerpc-wrs-vxworks|powerpc-wrs-vxworksae) + tm_file="${tm_file} elfos.h freebsd-spec.h rs6000/sysv4.h" + tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppccomm rs6000/t-vxworks" + extra_options="${extra_options} rs6000/sysv4.opt" + extra_headers=ppc-asm.h + case ${target} in + *-vxworksae*) + tm_file="${tm_file} vx-common.h vxworksae.h rs6000/vxworks.h rs6000/e500.h" + tmake_file="${tmake_file} rs6000/t-vxworksae" + ;; + *-vxworks*) + tm_file="${tm_file} vx-common.h vxworks.h rs6000/vxworks.h rs6000/e500.h" + ;; + esac + ;; +powerpc-*-lynxos*) + xm_defines=POSIX + tm_file="${tm_file} dbxelf.h elfos.h rs6000/sysv4.h rs6000/lynx.h lynx.h" + tmake_file="t-lynx rs6000/t-lynx" + extra_options="${extra_options} rs6000/sysv4.opt lynx.opt" + thread_file=lynx + gnu_ld=yes + gas=yes + ;; +powerpcle-*-elf*) + tm_file="${tm_file} dbxelf.h elfos.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/sysv4le.h" + tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm" + extra_options="${extra_options} rs6000/sysv4.opt" + ;; +powerpcle-*-eabisim*) + tm_file="${tm_file} dbxelf.h elfos.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h" + tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm" + extra_options="${extra_options} rs6000/sysv4.opt" + use_gcc_stdint=wrap + ;; +powerpcle-*-eabi*) + tm_file="${tm_file} dbxelf.h elfos.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h rs6000/e500.h" + tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm" + extra_options="${extra_options} rs6000/sysv4.opt" + use_gcc_stdint=wrap + ;; +rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*) + tm_file="rs6000/biarch64.h ${tm_file} rs6000/aix.h rs6000/aix43.h rs6000/xcoff.h rs6000/aix-stdint.h" + tmake_file="rs6000/t-aix43 t-slibgcc" + extra_options="${extra_options} rs6000/aix64.opt" + use_collect2=yes + thread_file='aix' + use_gcc_stdint=provide + extra_headers= + ;; +rs6000-ibm-aix5.1.* | powerpc-ibm-aix5.1.*) + tm_file="rs6000/biarch64.h ${tm_file} rs6000/aix.h rs6000/aix51.h rs6000/xcoff.h rs6000/aix-stdint.h" + extra_options="${extra_options} rs6000/aix64.opt" + tmake_file="rs6000/t-aix43 t-slibgcc" + use_collect2=yes + thread_file='aix' + use_gcc_stdint=wrap + extra_headers= + ;; +rs6000-ibm-aix5.2.* | powerpc-ibm-aix5.2.*) + tm_file="${tm_file} rs6000/aix.h rs6000/aix52.h rs6000/xcoff.h rs6000/aix-stdint.h" + tmake_file="rs6000/t-aix52 t-slibgcc" + extra_options="${extra_options} rs6000/aix64.opt" + use_collect2=yes + thread_file='aix' + use_gcc_stdint=wrap + extra_headers= + ;; +rs6000-ibm-aix5.3.* | powerpc-ibm-aix5.3.*) + tm_file="${tm_file} rs6000/aix.h rs6000/aix53.h rs6000/xcoff.h rs6000/aix-stdint.h" + tmake_file="rs6000/t-aix52 t-slibgcc" + extra_options="${extra_options} rs6000/aix64.opt" + use_collect2=yes + thread_file='aix' + use_gcc_stdint=wrap + extra_headers=altivec.h + ;; +rs6000-ibm-aix[6789].* | powerpc-ibm-aix[6789].*) + tm_file="${tm_file} rs6000/aix.h rs6000/aix61.h rs6000/xcoff.h rs6000/aix-stdint.h" + tmake_file="rs6000/t-aix52 t-slibgcc" + extra_options="${extra_options} rs6000/aix64.opt" + use_collect2=yes + thread_file='aix' + use_gcc_stdint=wrap + extra_headers=altivec.h + ;; +rl78-*-elf*) + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + target_has_targetm_common=no + c_target_objs="rl78-c.o" + cxx_target_objs="rl78-c.o" + tmake_file="${tmake_file} rl78/t-rl78" + ;; +rx-*-elf*) + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + tmake_file="${tmake_file} rx/t-rx" + ;; +s390-*-linux*) + default_gnu_indirect_function=yes + tm_file="s390/s390.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h s390/linux.h" + if test x$enable_targets = xall; then + tmake_file="${tmake_file} s390/t-linux64" + fi + ;; +s390x-*-linux*) + default_gnu_indirect_function=yes + tm_file="s390/s390x.h s390/s390.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h s390/linux.h" + tm_p_file=s390/s390-protos.h + md_file=s390/s390.md + extra_modes=s390/s390-modes.def + out_file=s390/s390.c + tmake_file="${tmake_file} s390/t-linux64" + ;; +s390x-ibm-tpf*) + tm_file="s390/s390x.h s390/s390.h dbxelf.h elfos.h s390/tpf.h" + tm_p_file=s390/s390-protos.h + md_file=s390/s390.md + extra_modes=s390/s390-modes.def + out_file=s390/s390.c + thread_file='tpf' + extra_options="${extra_options} s390/tpf.opt" + ;; +score-*-elf) + gas=yes + gnu_ld=yes + tm_file="dbxelf.h elfos.h score/elf.h score/score.h newlib-stdint.h" + ;; +sh-*-elf* | sh[12346l]*-*-elf* | \ + sh-*-linux* | sh[2346lbe]*-*-linux* | \ + sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \ + sh64-*-netbsd* | sh64l*-*-netbsd*) + tmake_file="${tmake_file} sh/t-sh sh/t-elf" + if test x${with_endian} = x; then + case ${target} in + sh[1234]*be-*-* | sh[1234]*eb-*-*) with_endian=big ;; + shbe-*-* | sheb-*-*) with_endian=big,little ;; + sh[1234]l* | sh[34]*-*-linux*) with_endian=little ;; + shl* | sh64l* | sh*-*-linux* | \ + sh5l* | sh-superh-elf) with_endian=little,big ;; + sh[1234]*-*-*) with_endian=big ;; + *) with_endian=big,little ;; + esac + fi + # TM_ENDIAN_CONFIG is used by t-sh to determine multilibs. + # First word : the default endian. + # Second word: the secondary endian (optional). + case ${with_endian} in + big) TM_ENDIAN_CONFIG=mb ;; + little) TM_ENDIAN_CONFIG=ml ;; + big,little) TM_ENDIAN_CONFIG="mb ml" ;; + little,big) TM_ENDIAN_CONFIG="ml mb" ;; + *) echo "with_endian=${with_endian} not supported."; exit 1 ;; + esac + case ${with_endian} in + little*) tm_file="sh/little.h ${tm_file}" ;; + esac + tm_file="${tm_file} dbxelf.h elfos.h sh/elf.h" + case ${target} in + sh*-*-linux*) tmake_file="${tmake_file} sh/t-linux" + tm_file="${tm_file} gnu-user.h linux.h glibc-stdint.h sh/linux.h" ;; + sh*-*-netbsd*) + tm_file="${tm_file} netbsd.h netbsd-elf.h sh/netbsd-elf.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + + ;; + sh*-superh-elf) if test x$with_libgloss != xno; then + with_libgloss=yes + tm_file="${tm_file} sh/newlib.h" + fi + tm_file="${tm_file} sh/embed-elf.h" + tm_file="${tm_file} sh/superh.h" + extra_options="${extra_options} sh/superh.opt" ;; + *) if test x$with_newlib = xyes \ + && test x$with_libgloss = xyes; then + tm_file="${tm_file} sh/newlib.h" + fi + tm_file="${tm_file} sh/embed-elf.h" ;; + esac + case ${target} in + sh5*-*-netbsd*) + # SHmedia, 32-bit ABI + tmake_file="${tmake_file} sh/t-sh64" + ;; + sh64*-netbsd*) + # SHmedia, 64-bit ABI + tmake_file="${tmake_file} sh/t-sh64 sh/t-netbsd-sh5-64" + ;; + *-*-netbsd) + ;; + sh64*-*-linux*) + tmake_file="${tmake_file} sh/t-sh64" + tm_file="${tm_file} sh/sh64.h" + extra_headers="shmedia.h ushmedia.h sshmedia.h" + ;; + sh64*) + tmake_file="${tmake_file} sh/t-sh64" + tm_file="${tm_file} sh/sh64.h" + if test x$with_newlib = xyes; then + tm_file="${tm_file} newlib-stdint.h" + fi + extra_headers="shmedia.h ushmedia.h sshmedia.h" + ;; + *-*-elf*) + tm_file="${tm_file} newlib-stdint.h" + ;; + esac + # sed el/eb endian suffixes away to avoid confusion with sh[23]e + case `echo ${target} | sed 's/e[lb]-/-/'` in + sh64*-*-netbsd*) sh_cpu_target=sh5-64media ;; + sh64* | sh5*-*-netbsd*) sh_cpu_target=sh5-32media ;; + sh4a_single_only*) sh_cpu_target=sh4a-single-only ;; + sh4a_single*) sh_cpu_target=sh4a-single ;; + sh4a_nofpu*) sh_cpu_target=sh4a-nofpu ;; + sh4al) sh_cpu_target=sh4al ;; + sh4a*) sh_cpu_target=sh4a ;; + sh4_single_only*) sh_cpu_target=sh4-single-only ;; + sh4_single*) sh_cpu_target=sh4-single ;; + sh4_nofpu*) sh_cpu_target=sh4-nofpu ;; + sh4* | sh-superh-*) sh_cpu_target=sh4 ;; + sh3e*) sh_cpu_target=sh3e ;; + sh*-*-netbsd* | sh3*) sh_cpu_target=sh3 ;; + sh2a_single_only*) sh_cpu_target=sh2a-single-only ;; + sh2a_single*) sh_cpu_target=sh2a-single ;; + sh2a_nofpu*) sh_cpu_target=sh2a-nofpu ;; + sh2a*) sh_cpu_target=sh2a ;; + sh2e*) sh_cpu_target=sh2e ;; + sh2*) sh_cpu_target=sh2 ;; + *) sh_cpu_target=sh1 ;; + esac + # did the user say --without-fp ? + if test x$with_fp = xno; then + case ${sh_cpu_target} in + sh5-*media) sh_cpu_target=${sh_cpu_target}-nofpu ;; + sh4al | sh1) ;; + sh4a* ) sh_cpu_target=sh4a-nofpu ;; + sh4*) sh_cpu_target=sh4-nofpu ;; + sh3*) sh_cpu_target=sh3 ;; + sh2a*) sh_cpu_target=sh2a-nofpu ;; + sh2*) sh_cpu_target=sh2 ;; + *) echo --without-fp not available for $target: ignored + esac + tm_defines="$tm_defines STRICT_NOFPU=1" + fi + sh_cpu_default="`echo $with_cpu|sed s/^m/sh/|tr A-Z_ a-z-`" + case $sh_cpu_default in + sh5-64media-nofpu | sh5-64media | \ + sh5-32media-nofpu | sh5-32media | sh5-compact-nofpu | sh5-compact | \ + sh2a-single-only | sh2a-single | sh2a-nofpu | sh2a | \ + sh4a-single-only | sh4a-single | sh4a-nofpu | sh4a | sh4al | \ + sh4-single-only | sh4-single | sh4-nofpu | sh4 | sh4-300 | \ + sh3e | sh3 | sh2e | sh2 | sh1) ;; + "") sh_cpu_default=${sh_cpu_target} ;; + *) echo "with_cpu=$with_cpu not supported"; exit 1 ;; + esac + sh_multilibs=${with_multilib_list} + if test "$sh_multilibs" = "default" ; then + case ${target} in + sh64-superh-linux* | \ + sh[1234]*) sh_multilibs=${sh_cpu_target} ;; + sh64* | sh5*) sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu ;; + sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;; + sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4 ;; + sh*-*-netbsd*) sh_multilibs=m3,m3e,m4 ;; + *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;; + esac + if test x$with_fp = xno; then + sh_multilibs="`echo $sh_multilibs|sed -e s/m4/sh4-nofpu/ -e s/,m4-[^,]*//g -e s/,m[23]e// -e s/m2a,m2a-single/m2a-nofpu/ -e s/m5-..m....,//g`" + fi + fi + target_cpu_default=SELECT_`echo ${sh_cpu_default}|tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_` + tm_defines=${tm_defines}' SH_MULTILIB_CPU_DEFAULT=\"'`echo $sh_cpu_default|sed s/sh/m/`'\"' + tm_defines="$tm_defines SUPPORT_`echo $sh_cpu_default | sed 's/^m/sh/' | tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`=1" + sh_multilibs=`echo $sh_multilibs | sed -e 's/,/ /g' -e 's/^[Ss][Hh]/m/' -e 's/ [Ss][Hh]/ m/g' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ_ abcdefghijklmnopqrstuvwxyz-` + for sh_multilib in ${sh_multilibs}; do + case ${sh_multilib} in + m1 | m2 | m2e | m3 | m3e | \ + m4 | m4-single | m4-single-only | m4-nofpu | m4-300 |\ + m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al | \ + m2a | m2a-single | m2a-single-only | m2a-nofpu | \ + m5-64media | m5-64media-nofpu | \ + m5-32media | m5-32media-nofpu | \ + m5-compact | m5-compact-nofpu) + # TM_MULTILIB_CONFIG is used by t-sh for the non-endian multilib definition + # It is passed to MULTIILIB_OPTIONS verbatim. + TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG}/${sh_multilib}" + tm_defines="$tm_defines SUPPORT_`echo $sh_multilib | sed 's/^m/sh/' | tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`=1" + ;; + \!*) # TM_MULTILIB_EXCEPTIONS_CONFIG is used by t-sh + # It is passed the MULTILIB_EXCEPTIONS verbatim. + TM_MULTILIB_EXCEPTIONS_CONFIG="${TM_MULTILIB_EXCEPTIONS_CONFIG} `echo $sh_multilib | sed 's/^!//'`" ;; + *) + echo "with_multilib_list=${sh_multilib} not supported." + exit 1 + ;; + esac + done + TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'` + if test x${enable_incomplete_targets} = xyes ; then + tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SH5_32MEDIA=1 SUPPORT_SH5_32MEDIA_NOFPU=1 SUPPORT_SH5_64MEDIA=1 SUPPORT_SH5_64MEDIA_NOFPU=1" + fi + tm_file="$tm_file ./sysroot-suffix.h" + tmake_file="$tmake_file t-sysroot-suffix" + ;; +sh-*-rtems*) + tmake_file="sh/t-sh t-rtems sh/t-rtems" + tm_file="${tm_file} dbxelf.h elfos.h sh/elf.h sh/embed-elf.h sh/rtemself.h rtems.h newlib-stdint.h" + ;; +sh-wrs-vxworks) + tmake_file="$tmake_file sh/t-sh sh/t-vxworks" + tm_file="${tm_file} elfos.h sh/elf.h sh/embed-elf.h vx-common.h vxworks.h sh/vxworks.h" + ;; +sparc-*-elf*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h sparc/sysv4.h sparc/sp-elf.h" + case ${target} in + *-leon-*) + tmake_file="sparc/t-sparc sparc/t-leon" + ;; + *-leon[3-9]*) + tmake_file="sparc/t-sparc sparc/t-leon3" + ;; + *) + tmake_file="sparc/t-sparc sparc/t-elf" + ;; + esac + ;; +sparc-*-rtems*) + tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h newlib-stdint.h" + tmake_file="sparc/t-sparc sparc/t-elf sparc/t-rtems t-rtems" + ;; +sparc-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/tso.h" + extra_options="${extra_options} sparc/long-double-switch.opt" + case ${target} in + *-leon-*) + tmake_file="${tmake_file} sparc/t-sparc sparc/t-leon" + ;; + *-leon[3-9]*) + tmake_file="${tmake_file} sparc/t-sparc sparc/t-leon3" + ;; + *) + tmake_file="${tmake_file} sparc/t-sparc" + ;; + esac + if test x$enable_targets = xall; then + tm_file="sparc/biarch64.h ${tm_file} sparc/linux64.h" + tmake_file="${tmake_file} sparc/t-linux64" + else + tm_file="${tm_file} sparc/linux.h" + tmake_file="${tmake_file} sparc/t-linux" + fi + ;; +sparc-*-netbsdelf*) + tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h netbsd.h netbsd-elf.h sparc/netbsd-elf.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + extra_options="${extra_options} sparc/long-double-switch.opt" + tmake_file="${tmake_file} sparc/t-sparc" + ;; +sparc*-*-solaris2*) + tm_file="sparc/biarch64.h ${tm_file} ${sol2_tm_file} sol2-bi.h sparc/tso.h" + case ${target} in + sparc64-*-* | sparcv9-*-*) + tm_file="sparc/default-64.h ${tm_file}" + ;; + *) + test x$with_cpu != x || with_cpu=v9 + ;; + esac + tmake_file="${tmake_file} sparc/t-sparc sparc/t-sol2-64" + ;; +sparc-wrs-vxworks) + tm_file="${tm_file} elfos.h sparc/sysv4.h vx-common.h vxworks.h sparc/vxworks.h" + tmake_file="${tmake_file} sparc/t-sparc sparc/t-vxworks" + ;; +sparc64-*-elf*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h sparc/sysv4.h sparc/sp64-elf.h" + extra_options="${extra_options}" + tmake_file="${tmake_file} sparc/t-sparc" + ;; +sparc64-*-rtems*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h sparc/sysv4.h sparc/sp64-elf.h sparc/rtemself.h rtems.h" + extra_options="${extra_options}" + tmake_file="${tmake_file} sparc/t-sparc sparc/t-rtems-64 t-rtems" + ;; +sparc64-*-linux*) + tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/default-64.h sparc/linux64.h sparc/tso.h" + extra_options="${extra_options} sparc/long-double-switch.opt" + tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux64" + ;; +sparc64-*-freebsd*|ultrasparc-*-freebsd*) + tm_file="${tm_file} ${fbsd_tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/freebsd.h" + extra_options="${extra_options} sparc/long-double-switch.opt" + case "x$with_cpu" in + xultrasparc) ;; + x) with_cpu=ultrasparc ;; + *) echo "$with_cpu not supported for freebsd target"; exit 1 ;; + esac + tmake_file="${tmake_file} sparc/t-sparc" + ;; +sparc64-*-netbsd*) + tm_file="sparc/biarch64.h ${tm_file}" + tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h netbsd.h netbsd-elf.h sparc/netbsd-elf.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + extra_options="${extra_options} sparc/long-double-switch.opt" + tmake_file="${tmake_file} sparc/t-sparc sparc/t-netbsd64" + ;; +sparc64-*-openbsd*) + tm_file="sparc/openbsd1-64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp64-elf.h" + tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h sparc/openbsd64.h" + extra_options="${extra_options} openbsd.opt" + extra_options="${extra_options}" + gas=yes gnu_ld=yes + with_cpu=ultrasparc + tmake_file="${tmake_file} sparc/t-sparc" + ;; +spu-*-elf*) + tm_file="dbxelf.h elfos.h spu/spu-elf.h spu/spu.h newlib-stdint.h" + tmake_file="spu/t-spu-elf" + native_system_header_dir=/include + extra_headers="spu_intrinsics.h spu_internals.h vmx2spu.h spu_mfcio.h vec_types.h spu_cache.h" + extra_modes=spu/spu-modes.def + c_target_objs="${c_target_objs} spu-c.o" + cxx_target_objs="${cxx_target_objs} spu-c.o" + ;; +tic6x-*-elf) + tm_file="elfos.h ${tm_file} c6x/elf-common.h c6x/elf.h" + tm_file="${tm_file} dbxelf.h tm-dwarf2.h newlib-stdint.h" + tmake_file="c6x/t-c6x c6x/t-c6x-elf" + use_collect2=no + ;; +tic6x-*-uclinux) + tm_file="elfos.h ${tm_file} gnu-user.h linux.h c6x/elf-common.h c6x/uclinux-elf.h" + tm_file="${tm_file} dbxelf.h tm-dwarf2.h glibc-stdint.h" + tm_file="${tm_file} ./sysroot-suffix.h" + tmake_file="t-sysroot-suffix t-slibgcc" + tmake_file="${tmake_file} c6x/t-c6x c6x/t-c6x-elf c6x/t-c6x-uclinux" + use_collect2=no + ;; +tilegx-*-linux*) + tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h tilegx/linux.h ${tm_file}" + tmake_file="${tmake_file} tilegx/t-tilegx" + extra_objs="mul-tables.o" + c_target_objs="${c_target_objs} tilegx-c.o" + cxx_target_objs="${cxx_target_objs} tilegx-c.o" + extra_headers="feedback.h" + ;; +tilepro-*-linux*) + tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h tilepro/linux.h ${tm_file}" + tmake_file="${tmake_file} tilepro/t-tilepro" + extra_objs="mul-tables.o" + c_target_objs="${c_target_objs} tilepro-c.o" + cxx_target_objs="${cxx_target_objs} tilepro-c.o" + extra_headers="feedback.h" + ;; +v850-*-rtems*) + target_cpu_default="TARGET_CPU_generic" + tm_file="dbxelf.h elfos.h v850/v850.h" + tm_file="${tm_file} rtems.h v850/rtems.h newlib-stdint.h" + tmake_file="${tmake_file} v850/t-v850" + tmake_file="${tmake_file} t-rtems v850/t-rtems" + use_collect2=no + c_target_objs="v850-c.o" + cxx_target_objs="v850-c.o" + ;; +v850*-*-*) + case ${target} in + v850e3v5-*-*) + target_cpu_default="TARGET_CPU_v850e3v5" + ;; + v850e2v3-*-*) + target_cpu_default="TARGET_CPU_v850e2v3" + ;; + v850e2-*-*) + target_cpu_default="TARGET_CPU_v850e2" + ;; + v850e1-*-* | v850es-*-*) + target_cpu_default="TARGET_CPU_v850e1" + ;; + v850e-*-*) + target_cpu_default="TARGET_CPU_v850e" + ;; + v850-*-*) + target_cpu_default="TARGET_CPU_generic" + ;; + esac + tm_file="dbxelf.h elfos.h newlib-stdint.h v850/v850.h" + if test x$stabs = xyes + then + tm_file="${tm_file} dbx.h" + fi + use_collect2=no + c_target_objs="v850-c.o" + cxx_target_objs="v850-c.o" + use_gcc_stdint=wrap + ;; +vax-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h vax/elf.h vax/linux.h" + extra_options="${extra_options} vax/elf.opt" + ;; +vax-*-netbsdelf*) + tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h vax/elf.h vax/netbsd-elf.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt vax/elf.opt" + ;; +vax-*-openbsd*) + tm_file="vax/vax.h vax/openbsd1.h openbsd.h openbsd-stdint.h openbsd-pthread.h vax/openbsd.h" + extra_options="${extra_options} openbsd.opt" + use_collect2=yes + ;; +xstormy16-*-elf) + # For historical reasons, the target files omit the 'x'. + tm_file="dbxelf.h elfos.h newlib-stdint.h stormy16/stormy16.h" + tm_p_file=stormy16/stormy16-protos.h + md_file=stormy16/stormy16.md + out_file=stormy16/stormy16.c + extra_options=stormy16/stormy16.opt + tmake_file="stormy16/t-stormy16" + ;; +xtensa*-*-elf*) + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h xtensa/elf.h" + extra_options="${extra_options} xtensa/elf.opt" + ;; +xtensa*-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/linux.h" + tmake_file="${tmake_file} xtensa/t-xtensa" + ;; +am33_2.0-*-linux*) + tm_file="mn10300/mn10300.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h mn10300/linux.h" + gas=yes gnu_ld=yes + use_collect2=no + ;; +m32c-*-rtems*) + tm_file="dbxelf.h elfos.h ${tm_file} m32c/rtems.h rtems.h newlib-stdint.h" + tmake_file="${tmake_file} t-rtems" + c_target_objs="m32c-pragma.o" + cxx_target_objs="m32c-pragma.o" + ;; +m32c-*-elf*) + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + c_target_objs="m32c-pragma.o" + cxx_target_objs="m32c-pragma.o" + ;; +*) + echo "*** Configuration ${target} not supported" 1>&2 + exit 1 + ;; +esac + +case ${target} in +i[34567]86-*-linux* | x86_64-*-linux*) + tmake_file="${tmake_file} i386/t-pmm_malloc i386/t-i386" + ;; +i[34567]86-*-* | x86_64-*-*) + tmake_file="${tmake_file} i386/t-gmm_malloc i386/t-i386" + ;; +powerpc*-*-* | rs6000-*-*) + tm_file="${tm_file} rs6000/option-defaults.h" +esac + +if [ "$target_has_targetcm" = "no" ]; then + c_target_objs="$c_target_objs default-c.o" + cxx_target_objs="$cxx_target_objs default-c.o" +fi + +if [ "$common_out_file" = "" ]; then + if [ "$target_has_targetm_common" = "yes" ]; then + common_out_file="$cpu_type/$cpu_type-common.c" + else + common_out_file="default-common.c" + fi +fi + +# Support for --with-cpu and related options (and a few unrelated options, +# too). +case ${with_cpu} in + yes | no) + echo "--with-cpu must be passed a value" 1>&2 + exit 1 + ;; +esac + +# Set arch and cpu from ${target} and ${target_noncanonical}. Set cpu +# to generic if there is no processor scheduler model for the target. +arch= +cpu= +arch_without_sse2=no +arch_without_64bit=no +case ${target} in + i386-*-freebsd*) + if test $fbsd_major -ge 6; then + arch=i486 + else + arch=i386 + fi + cpu=generic + arch_without_sse2=yes + arch_without_64bit=yes + ;; + i386-*-*) + arch=i386 + cpu=i386 + arch_without_sse2=yes + arch_without_64bit=yes + ;; + i486-*-*) + arch=i486 + cpu=i486 + arch_without_sse2=yes + arch_without_64bit=yes + ;; + i586-*-*) + arch_without_sse2=yes + arch_without_64bit=yes + case ${target_noncanonical} in + k6_2-*) + arch=k6-2 + cpu=k6-2 + ;; + k6_3-*) + arch=k6-3 + cpu=k6-3 + ;; + k6-*) + arch=k6 + cpu=k6 + ;; + pentium_mmx-*|winchip_c6-*|winchip2-*|c3-*) + arch=pentium-mmx + cpu=pentium-mmx + ;; + *) + arch=pentium + cpu=pentium + ;; + esac + ;; + i686-*-* | i786-*-*) + case ${target_noncanonical} in + bdver3-*) + arch=bdver3 + cpu=bdver3 + ;; + bdver2-*) + arch=bdver2 + cpu=bdver2 + ;; + bdver1-*) + arch=bdver1 + cpu=bdver1 + ;; + btver1-*) + arch=btver1 + cpu=btver1 + ;; + btver2-*) + arch=btver2 + cpu=btver2 + ;; + amdfam10-*|barcelona-*) + arch=amdfam10 + cpu=amdfam10 + ;; + k8_sse3-*|opteron_sse3-*|athlon64_sse3-*) + arch=k8-sse3 + cpu=k8-sse3 + ;; + k8-*|opteron-*|athlon64-*|athlon_fx-*) + arch=k8 + cpu=k8 + ;; + athlon_xp-*|athlon_mp-*|athlon_4-*) + arch=athlon-4 + cpu=athlon-4 + arch_without_sse2=yes + arch_without_64bit=yes + ;; + athlon_tbird-*|athlon-*) + arch=athlon + cpu=athlon + arch_without_sse2=yes + ;; + geode-*) + arch=geode + cpu=geode + arch_without_sse2=yes + ;; + pentium2-*) + arch=pentium2 + cpu=pentium2 + arch_without_sse2=yes + ;; + pentium3-*|pentium3m-*) + arch=pentium3 + cpu=pentium3 + arch_without_sse2=yes + ;; + pentium4-*|pentium4m-*) + arch=pentium4 + cpu=pentium4 + ;; + prescott-*) + arch=prescott + cpu=prescott + ;; + nocona-*) + arch=nocona + cpu=nocona + ;; + atom-*) + arch=atom + cpu=atom + ;; + core2-*) + arch=core2 + cpu=core2 + ;; + corei7-*) + arch=corei7 + cpu=corei7 + ;; + corei7_avx-*) + arch=corei7-avx + cpu=corei7-avx + ;; + pentium_m-*) + arch=pentium-m + cpu=pentium-m + ;; + pentiumpro-*) + arch=pentiumpro + cpu=pentiumpro + arch_without_sse2=yes + ;; + *) + arch=pentiumpro + cpu=generic + arch_without_sse2=yes + arch_without_64bit=yes + ;; + esac + ;; + x86_64-*-*) + case ${target_noncanonical} in + bdver3-*) + arch=bdver3 + cpu=bdver3 + ;; + bdver2-*) + arch=bdver2 + cpu=bdver2 + ;; + bdver1-*) + arch=bdver1 + cpu=bdver1 + ;; + btver1-*) + arch=btver1 + cpu=btver1 + ;; + btver2-*) + arch=btver2 + cpu=btver2 + ;; + amdfam10-*|barcelona-*) + arch=amdfam10 + cpu=amdfam10 + ;; + k8_sse3-*|opteron_sse3-*|athlon64_sse3-*) + arch=k8-sse3 + cpu=k8-sse3 + ;; + k8-*|opteron-*|athlon_64-*) + arch=k8 + cpu=k8 + ;; + nocona-*) + arch=nocona + cpu=nocona + ;; + atom-*) + arch=atom + cpu=atom + ;; + core2-*) + arch=core2 + cpu=core2 + ;; + corei7-*) + arch=corei7 + cpu=corei7 + ;; + *) + arch=x86-64 + cpu=generic + ;; + esac + ;; +esac + +# If there is no $with_cpu option, try to infer one from ${target}. +# This block sets nothing except for with_cpu. +if test x$with_cpu = x ; then + case ${target} in + i[34567]86-*-*|x86_64-*-*) + with_cpu=$cpu + ;; + alphaev6[78]*-*-*) + with_cpu=ev67 + ;; + alphaev6*-*-*) + with_cpu=ev6 + ;; + alphapca56*-*-*) + with_cpu=pca56 + ;; + alphaev56*-*-*) + with_cpu=ev56 + ;; + alphaev5*-*-*) + with_cpu=ev5 + ;; + frv-*-*linux* | frv400-*-*linux*) + with_cpu=fr400 + ;; + frv550-*-*linux*) + with_cpu=fr550 + ;; + m68k*-*-*) + case "$with_arch" in + "cf") + with_cpu=${default_cf_cpu} + ;; + "" | "m68k") + with_cpu=m${default_m68k_cpu} + ;; + esac + ;; + mips*-*-vxworks) + with_arch=mips2 + ;; + powerpc*-*-*spe*) + if test x$enable_e500_double = xyes; then + with_cpu=8548 + else + with_cpu=8540 + fi + ;; + sparc*-*-*) + case ${target} in + *-leon-*) + with_cpu=leon + ;; + *-leon[3-9]*) + with_cpu=leon3 + ;; + *) + with_cpu="`echo ${target} | sed 's/-.*$//'`" + ;; + esac + ;; + esac + + # Avoid overriding --with-cpu-32 and --with-cpu-64 values. + case ${target} in + i[34567]86-*-*|x86_64-*-*) + if test x$with_cpu_32 != x || test x$with_cpu_64 != x; then + if test x$with_cpu_32 = x; then + with_cpu_32=$with_cpu + fi + if test x$with_cpu_64 = x; then + with_cpu_64=$with_cpu + fi + with_cpu= + fi + ;; + esac +fi + +# Support for --with-arch and related options (and a few unrelated options, +# too). +case ${with_arch} in + yes | no) + echo "--with-arch must be passed a value" 1>&2 + exit 1 + ;; +esac + +# If there is no $with_arch option, try to infer one from ${target}. +# This block sets nothing except for with_arch. +if test x$with_arch = x ; then + case ${target} in + i[34567]86-*-darwin*|x86_64-*-darwin*) + # Default arch is set via TARGET_SUBTARGET32_ISA_DEFAULT + # and TARGET_SUBTARGET64_ISA_DEFAULT in config/i386/darwin.h. + ;; + i[34567]86-*-*) + # --with-fpmath sets the default ISA to SSE2, which is the same + # ISA supported by Pentium 4. + if test x$with_fpmath = x || test $arch_without_sse2 = no; then + with_arch=$arch + else + with_arch=pentium4 + fi + ;; + x86_64-*-*) + with_arch=$arch + ;; + esac + + # Avoid overriding --with-arch-32 and --with-arch-64 values. + case ${target} in + i[34567]86-*-darwin*|x86_64-*-darwin*) + # Default arch is set via TARGET_SUBTARGET32_ISA_DEFAULT + # and TARGET_SUBTARGET64_ISA_DEFAULT in config/i386/darwin.h. + ;; + i[34567]86-*-*|x86_64-*-*) + if test x$with_arch_32 != x || test x$with_arch_64 != x; then + if test x$with_arch_32 = x; then + with_arch_32=$with_arch + fi + if test x$with_arch_64 = x; then + if test $arch_without_64bit = yes; then + # Set the default 64bit arch to x86-64 if the default arch + # doesn't support 64bit. + with_arch_64=x86-64 + else + with_arch_64=$with_arch + fi + fi + with_arch= + elif test $arch_without_64bit$need_64bit_isa = yesyes; then + # Set the default 64bit arch to x86-64 if the default arch + # doesn't support 64bit and we need 64bit ISA. + with_arch_32=$with_arch + with_arch_64=x86-64 + with_arch= + fi + ;; + esac +fi + +# Support --with-fpmath. +if test x$with_fpmath != x; then + case ${target} in + i[34567]86-*-* | x86_64-*-*) + case ${with_fpmath} in + avx) + tm_file="${tm_file} i386/avxmath.h" + ;; + sse) + tm_file="${tm_file} i386/ssemath.h" + ;; + *) + echo "Invalid --with-fpmath=$with_fpmath" 1>&2 + exit 1 + ;; + esac + ;; + *) + echo "--with-fpmath isn't supported for $target." 1>&2 + exit 1 + ;; + esac +fi + +# Similarly for --with-schedule. +if test x$with_schedule = x; then + case ${target} in + hppa1*) + # Override default PA8000 scheduling model. + with_schedule=7100LC + ;; + esac +fi + +# Validate and mark as valid any --with options supported +# by this target. In order to use a particular --with option +# you must list it in supported_defaults; validating the value +# is optional. This case statement should set nothing besides +# supported_defaults. + +supported_defaults= +case "${target}" in + aarch64*-*-*) + supported_defaults="cpu arch" + for which in cpu arch; do + + eval "val=\$with_$which" + base_val=`echo $val | sed -e 's/\+.*//'` + ext_val=`echo $val | sed -e 's/[a-z0-9\-]\+//'` + + if [ $which = arch ]; then + def=aarch64-arches.def + pattern=AARCH64_ARCH + else + def=aarch64-cores.def + pattern=AARCH64_CORE + fi + + ext_mask=AARCH64_CPU_DEFAULT_FLAGS + + # Find the base CPU or ARCH id in aarch64-cores.def or + # aarch64-arches.def + if [ x"$base_val" = x ] \ + || grep "^$pattern(\"$base_val\"," \ + ${srcdir}/config/aarch64/$def \ + > /dev/null; then + + if [ $which = arch ]; then + base_id=`grep "^$pattern(\"$base_val\"," \ + ${srcdir}/config/aarch64/$def | \ + sed -e 's/^[^,]*,[ ]*//' | \ + sed -e 's/,.*$//'` + # Extract the architecture flags from aarch64-arches.def + ext_mask=`grep "^$pattern(\"$base_val\"," \ + ${srcdir}/config/aarch64/$def | \ + sed -e 's/)$//' | \ + sed -e 's/^.*,//'` + else + base_id=`grep "^$pattern(\"$base_val\"," \ + ${srcdir}/config/aarch64/$def | \ + sed -e 's/^[^,]*,[ ]*//' | \ + sed -e 's/,.*$//'` + fi + + while [ x"$ext_val" != x ] + do + ext_val=`echo $ext_val | sed -e 's/\+//'` + ext=`echo $ext_val | sed -e 's/\+.*//'` + base_ext=`echo $ext | sed -e 's/^no//'` + + if [ x"$base_ext" = x ] \ + || grep "^AARCH64_OPT_EXTENSION(\"$base_ext\"," \ + ${srcdir}/config/aarch64/aarch64-option-extensions.def \ + > /dev/null; then + + ext_on=`grep "^AARCH64_OPT_EXTENSION(\"$base_ext\"," \ + ${srcdir}/config/aarch64/aarch64-option-extensions.def | \ + sed -e 's/^[^,]*,[ ]*//' | \ + sed -e 's/,.*$//'` + ext_off=`grep "^AARCH64_OPT_EXTENSION(\"$base_ext\"," \ + ${srcdir}/config/aarch64/aarch64-option-extensions.def | \ + sed -e 's/^[^,]*,[ ]*[^,]*,[ ]*//' | \ + sed -e 's/,.*$//' | \ + sed -e 's/).*$//'` + + if [ $ext = $base_ext ]; then + # Adding extension + ext_mask="("$ext_mask") | ("$ext_on")" + else + # Removing extension + ext_mask="("$ext_mask") & ~("$ext_off")" + fi + + true + else + echo "Unknown extension used in --with-$which=$val" 1>&2 + exit 1 + fi + ext_val=`echo $ext_val | sed -e 's/[a-z0-9]\+//'` + done + + ext_mask="(("$ext_mask") << 6)" + if [ x"$base_id" != x ]; then + target_cpu_cname="TARGET_CPU_$base_id | $ext_mask" + fi + true + else + echo "Unknown $which used in --with-$which=$val" 1>&2 + exit 1 + fi + done + ;; + + alpha*-*-*) + supported_defaults="cpu tune" + for which in cpu tune; do + eval "val=\$with_$which" + case "$val" in + "" \ + | ev4 | ev45 | 21064 | ev5 | 21164 | ev56 | 21164a \ + | pca56 | 21164PC | 21164pc | ev6 | 21264 | ev67 \ + | 21264a) + ;; + *) + echo "Unknown CPU used in --with-$which=$val" 1>&2 + exit 1 + ;; + esac + done + ;; + + arm*-*-*) + supported_defaults="arch cpu float tune fpu abi mode tls" + for which in cpu tune; do + # See if it matches any of the entries in arm-cores.def + eval "val=\$with_$which" + if [ x"$val" = x ] \ + || grep "^ARM_CORE(\"$val\"," \ + ${srcdir}/config/arm/arm-cores.def \ + > /dev/null; then + # Ok + new_val=`grep "^ARM_CORE(\"$val\"," \ + ${srcdir}/config/arm/arm-cores.def | \ + sed -e 's/^[^,]*,[ ]*//' | \ + sed -e 's/,.*$//'` + eval "target_${which}_cname=$new_val" + echo "For $val real value is $new_val" + true + else + echo "Unknown CPU used in --with-$which=$val" 1>&2 + exit 1 + fi + done + + case "$with_arch" in + "" \ + | armv[23456] | armv2a | armv3m | armv4t | armv5t \ + | armv5te | armv6j |armv6k | armv6z | armv6zk | armv6-m \ + | armv7 | armv7-a | armv7-r | armv7-m | armv8-a \ + | iwmmxt | ep9312) + # OK + ;; + *) + echo "Unknown arch used in --with-arch=$with_arch" 1>&2 + exit 1 + ;; + esac + + case "$with_float" in + "" \ + | soft | hard | softfp) + # OK + ;; + *) + echo "Unknown floating point type used in --with-float=$with_float" 1>&2 + exit 1 + ;; + esac + + case "$with_fpu" in + "" \ + | vfp | vfp3 | vfpv3 \ + | vfpv3-fp16 | vfpv3-d16 | vfpv3-d16-fp16 | vfpv3xd \ + | vfpv3xd-fp16 | neon | neon-fp16 | vfpv4 | vfpv4-d16 \ + | fpv4-sp-d16 | neon-vfpv4 | fp-arm-v8 | neon-fp-armv8 \ + | crypto-neon-fp-armv8) + # OK + ;; + *) + echo "Unknown fpu used in --with-fpu=$with_fpu" 2>&1 + exit 1 + ;; + esac + + case "$with_abi" in + "" \ + | apcs-gnu | atpcs | aapcs | iwmmxt | aapcs-linux ) + #OK + ;; + *) + echo "Unknown ABI used in --with-abi=$with_abi" + exit 1 + ;; + esac + + case "$with_mode" in + "" \ + | arm | thumb ) + #OK + ;; + *) + echo "Unknown mode used in --with-mode=$with_mode" + exit 1 + ;; + esac + + case "$with_tls" in + "" \ + | gnu | gnu2) + # OK + ;; + *) + echo "Unknown TLS method used in --with-tls=$with_tls" 1>&2 + exit 1 + ;; + esac + + if test "x$with_arch" != x && test "x$with_cpu" != x; then + echo "Warning: --with-arch overrides --with-cpu=$with_cpu" 1>&2 + fi + ;; + + fr*-*-*linux*) + supported_defaults=cpu + case "$with_cpu" in + fr400) ;; + fr550) ;; + *) + echo "Unknown cpu used in --with-cpu=$with_cpu" 1>&2 + exit 1 + ;; + esac + ;; + + fido-*-* | m68k*-*-*) + supported_defaults="arch cpu" + case "$with_arch" in + "" | "m68k"| "cf") + m68k_arch_family="$with_arch" + ;; + *) + echo "Invalid --with-arch=$with_arch" 1>&2 + exit 1 + ;; + esac + + # We always have a $with_cpu setting here. + case "$with_cpu" in + "m68000" | "m68010" | "m68020" | "m68030" | "m68040" | "m68060") + m68k_cpu_ident=$with_cpu + ;; + "m68020-40") + m68k_cpu_ident=m68020 + tm_defines="$tm_defines M68K_DEFAULT_TUNE=u68020_40" + ;; + "m68020-60") + m68k_cpu_ident=m68020 + tm_defines="$tm_defines M68K_DEFAULT_TUNE=u68020_60" + ;; + *) + # We need the C identifier rather than the string. + m68k_cpu_ident=`awk -v arg="\"$with_cpu\"" \ + 'BEGIN { FS="[ \t]*[,()][ \t]*" }; \ + $1 == "M68K_DEVICE" && $2 == arg { print $3 }' \ + ${srcdir}/config/m68k/m68k-devices.def` + if [ x"$m68k_cpu_ident" = x ] ; then + echo "Unknown CPU used in --with-cpu=$with_cpu" 1>&2 + exit 1 + fi + with_cpu="mcpu=$with_cpu" + ;; + esac + ;; + + hppa*-*-*) + supported_defaults="arch schedule" + + case "$with_arch" in + "" | 1.0 | 1.1 | 2.0) + # OK + ;; + *) + echo "Unknown architecture used in --with-arch=$with_arch" 1>&2 + exit 1 + ;; + esac + + case "$with_schedule" in + "" | 700 | 7100 | 7100LC | 7200 | 7300 | 8000) + # OK + ;; + *) + echo "Unknown processor used in --with-schedule=$with_schedule." 1>&2 + exit 1 + ;; + esac + ;; + + i[34567]86-*-* | x86_64-*-*) + supported_defaults="abi arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64" + for which in arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64; do + eval "val=\$with_$which" + case ${val} in + i386 | i486 \ + | i586 | pentium | pentium-mmx | winchip-c6 | winchip2 \ + | c3 | c3-2 | i686 | pentiumpro | pentium2 | pentium3 \ + | pentium4 | k6 | k6-2 | k6-3 | athlon | athlon-tbird \ + | athlon-4 | athlon-xp | athlon-mp | geode \ + | prescott | pentium-m | pentium4m | pentium3m) + case "${target}" in + x86_64-*-*) + case "x$which" in + *_32) + ;; + *) + echo "CPU given in --with-$which=$val doesn't support 64bit mode." 1>&2 + exit 1 + ;; + esac + ;; + esac + # OK + ;; + "" | x86-64 | generic | native \ + | k8 | k8-sse3 | athlon64 | athlon64-sse3 | opteron \ + | opteron-sse3 | athlon-fx | bdver3 | bdver2 | bdver1 | btver2 \ + | btver1 | amdfam10 | barcelona | nocona | core2 | corei7 \ + | corei7-avx | core-avx-i | core-avx2 | atom) + # OK + ;; + *) + echo "Unknown CPU given in --with-$which=$val." 1>&2 + exit 1 + ;; + esac + done + ;; + + mips*-*-*) + supported_defaults="abi arch arch_32 arch_64 float tune tune_32 tune_64 divide llsc mips-plt synci" + + case ${with_float} in + "" | soft | hard) + # OK + ;; + *) + echo "Unknown floating point type used in --with-float=$with_float" 1>&2 + exit 1 + ;; + esac + + case ${with_abi} in + "" | 32 | o64 | n32 | 64 | eabi) + # OK + ;; + *) + echo "Unknown ABI used in --with-abi=$with_abi" 1>&2 + exit 1 + ;; + esac + + case ${with_divide} in + "" | breaks | traps) + # OK + ;; + *) + echo "Unknown division check type use in --with-divide=$with_divide" 1>&2 + exit 1 + ;; + esac + + case ${with_llsc} in + yes) + with_llsc=llsc + ;; + no) + with_llsc="no-llsc" + ;; + "") + # OK + ;; + *) + echo "Unknown llsc type used in --with-llsc" 1>&2 + exit 1 + ;; + esac + + case ${with_mips_plt} in + yes) + with_mips_plt=plt + ;; + no) + with_mips_plt=no-plt + ;; + "") + ;; + *) + echo "Unknown --with-mips-plt argument: $with_mips_plt" 1>&2 + exit 1 + ;; + esac + + case ${with_synci} in + yes) + with_synci=synci + ;; + no) + with_synci=no-synci + ;; + "") + ;; + *) + echo "Unknown synci type used in --with-synci" 1>&2 + exit 1 + ;; + esac + ;; + + powerpc*-*-* | rs6000-*-*) + supported_defaults="abi cpu cpu_32 cpu_64 float tune tune_32 tune_64" + + for which in cpu cpu_32 cpu_64 tune tune_32 tune_64; do + eval "val=\$with_$which" + case ${val} in + default32 | default64) + case $which in + cpu | tune) + ;; + *) + echo "$val only valid for --with-cpu and --with-tune." 1>&2 + exit 1 + ;; + esac + with_which="with_$which" + eval $with_which= + ;; + 405cr) + tm_defines="${tm_defines} CONFIG_PPC405CR" + eval "with_$which=405" + ;; + "" | common \ + | power | power[2345678] | power6x | powerpc | powerpc64 \ + | rios | rios1 | rios2 | rsc | rsc1 | rs64a \ + | 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \ + | 476 | 476fp | 505 | 601 | 602 | 603 | 603e | ec603e \ + | 604 | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \ + | a2 | e300c[23] | 854[08] | e500mc | e500mc64 | e5500 | e6500 \ + | titan | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell) + # OK + ;; + *) + echo "Unknown cpu used in --with-$which=$val." 1>&2 + exit 1 + ;; + esac + done + + case "$with_abi" in + "" | elfv1 | elfv2 ) + #OK + ;; + *) + echo "Unknown ABI used in --with-abi=$with_abi" + exit 1 + ;; + esac + ;; + + s390*-*-*) + supported_defaults="arch mode tune" + + for which in arch tune; do + eval "val=\$with_$which" + case ${val} in + "" | g5 | g6 | z900 | z990 | z9-109 | z9-ec | z10 | z196 | zEC12) + # OK + ;; + *) + echo "Unknown cpu used in --with-$which=$val." 1>&2 + exit 1 + ;; + esac + done + + case ${with_mode} in + "" | esa | zarch) + # OK + ;; + *) + echo "Unknown architecture mode used in --with-mode=$with_mode." 1>&2 + exit 1 + ;; + esac + ;; + + sh[123456ble]-*-* | sh-*-*) + supported_defaults="cpu" + case "`echo $with_cpu | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ_ abcdefghijklmnopqrstuvwxyz- | sed s/sh/m/`" in + "" | m1 | m2 | m2e | m3 | m3e | m4 | m4-single | m4-single-only | m4-nofpu ) + # OK + ;; + m2a | m2a-single | m2a-single-only | m2a-nofpu) + ;; + m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al) + ;; + *) + echo "Unknown CPU used in --with-cpu=$with_cpu, known values:" 1>&2 + echo "m1 m2 m2e m3 m3e m4 m4-single m4-single-only m4-nofpu" 1>&2 + echo "m4a m4a-single m4a-single-only m4a-nofpu m4al" 1>&2 + echo "m2a m2a-single m2a-single-only m2a-nofpu" 1>&2 + exit 1 + ;; + esac + ;; + sparc*-*-*) + supported_defaults="cpu float tune" + + for which in cpu tune; do + eval "val=\$with_$which" + case ${val} in + "" | sparc | sparcv9 | sparc64 \ + | v7 | cypress \ + | v8 | supersparc | hypersparc | leon | leon3 \ + | sparclite | f930 | f934 | sparclite86x \ + | sparclet | tsc701 \ + | v9 | ultrasparc | ultrasparc3 | niagara | niagara2 \ + | niagara3 | niagara4) + # OK + ;; + *) + echo "Unknown cpu used in --with-$which=$val" 1>&2 + exit 1 + ;; + esac + done + + case ${with_float} in + "" | soft | hard) + # OK + ;; + *) + echo "Unknown floating point type used in --with-float=$with_float" 1>&2 + exit 1 + ;; + esac + ;; + + spu-*-*) + supported_defaults="arch tune" + + for which in arch tune; do + eval "val=\$with_$which" + case ${val} in + "" | cell | celledp) + # OK + ;; + *) + echo "Unknown cpu used in --with-$which=$val." 1>&2 + exit 1 + ;; + esac + done + ;; + + tic6x-*-*) + supported_defaults="arch" + + case ${with_arch} in + "" | c62x | c64x | c64x+ | c67x | c67x+ | c674x) + # OK + ;; + *) + echo "Unknown arch used in --with-arch=$with_arch." 1>&2 + exit 1 + ;; + esac + ;; + + v850*-*-*) + supported_defaults=cpu + case ${with_cpu} in + "" | v850e | v850e1 | v850e2 | v850es | v850e2v3 | v850e3v5) + # OK + ;; + *) + echo "Unknown cpu used in --with-cpu=$with_cpu" 1>&2 + exit 1 + ;; + esac + ;; +esac + +# Set some miscellaneous flags for particular targets. +target_cpu_default2= +case ${target} in + aarch64*-*-*) + if test x"$target_cpu_cname" != x + then + target_cpu_default2=$target_cpu_cname + fi + ;; + + arm*-*-*) + if test x$target_cpu_cname = x + then + target_cpu_default2=TARGET_CPU_generic + else + target_cpu_default2=TARGET_CPU_$target_cpu_cname + fi + ;; + + hppa*-*-*) + target_cpu_default2="MASK_BIG_SWITCH" + if test x$gas = xyes + then + target_cpu_default2="${target_cpu_default2}|MASK_GAS|MASK_JUMP_IN_DELAY" + fi + ;; + + fido*-*-* | m68k*-*-*) + target_cpu_default2=$m68k_cpu_ident + tmake_file="m68k/t-opts $tmake_file" + if [ x"$m68k_arch_family" != x ]; then + tmake_file="m68k/t-$m68k_arch_family $tmake_file" + fi + ;; + + i[34567]86-*-darwin* | x86_64-*-darwin*) + ;; + i[34567]86-*-linux* | x86_64-*-linux*) + tmake_file="$tmake_file i386/t-linux" + ;; + i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu) + tmake_file="$tmake_file i386/t-kfreebsd" + ;; + i[34567]86-*-gnu*) + tmake_file="$tmake_file i386/t-gnu" + ;; + i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*) + ;; + i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*) + ;; + i[34567]86-*-freebsd* | x86_64-*-freebsd*) + ;; + ia64*-*-linux*) + ;; + + mips*-*-*) + if test x$gnu_ld = xyes + then + target_cpu_default2="MASK_SPLIT_ADDRESSES" + fi + case ${target} in + mips*el-*-*) + tm_defines="TARGET_ENDIAN_DEFAULT=0 $tm_defines" + ;; + esac + tmake_file="mips/t-mips $tmake_file" + ;; + + powerpc*-*-* | rs6000-*-*) + # FIXME: The PowerPC port uses the value set at compile time, + # although it's only cosmetic. + if test "x$with_cpu" != x + then + target_cpu_default2="\\\"$with_cpu\\\"" + fi + out_file=rs6000/rs6000.c + c_target_objs="${c_target_objs} rs6000-c.o" + cxx_target_objs="${cxx_target_objs} rs6000-c.o" + tmake_file="rs6000/t-rs6000 ${tmake_file}" + ;; + + sh[123456ble]*-*-* | sh-*-*) + c_target_objs="${c_target_objs} sh-c.o" + cxx_target_objs="${cxx_target_objs} sh-c.o" + ;; + + sparc*-*-*) + # Some standard aliases. + case x$with_cpu in + xsparc) + with_cpu=v7 + ;; + xsparcv9 | xsparc64) + with_cpu=v9 + ;; + esac + + if test x$with_tune = x ; then + case ${target} in + *-leon-*) + with_tune=leon + ;; + *-leon[3-9]*) + with_tune=leon3 + ;; + esac + fi + + # The SPARC port checks this value at compile-time. + target_cpu_default2="TARGET_CPU_$with_cpu" + ;; + + v850*-*-*) + case "x$with_cpu" in + x) + ;; + xv850e | xv850e1 | xv850e2 | xv850e2v3 | xv850e3v5) + target_cpu_default2="TARGET_CPU_$with_cpu" + ;; + xv850es) + target_cpu_default2="TARGET_CPU_v850e1" + ;; + esac + ;; +esac + +t= +all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu divide llsc mips-plt synci tls" +for option in $all_defaults +do + eval "val=\$with_"`echo $option | sed s/-/_/g` + if test -n "$val"; then + case " $supported_defaults " in + *" $option "*) + ;; + *) + echo "This target does not support --with-$option." 2>&1 + echo "Valid --with options are: $supported_defaults" 2>&1 + exit 1 + ;; + esac + + if test "x$t" = x + then + t="{ \"$option\", \"$val\" }" + else + t="${t}, { \"$option\", \"$val\" }" + fi + fi +done + +if test "x$t" = x +then + configure_default_options="{ { NULL, NULL} }" +else + configure_default_options="{ ${t} }" +fi + +if test "$target_cpu_default2" != "" +then + if test "$target_cpu_default" != "" + then + target_cpu_default="(${target_cpu_default}|${target_cpu_default2})" + else + target_cpu_default=$target_cpu_default2 + fi +fi diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/configure.ac gcc-4.8.3-or1k-rtems/gcc/configure.ac --- gcc-4.8.3/gcc/configure.ac 2014-04-28 12:05:29.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/configure.ac 2014-07-29 10:33:53.937097951 +0200 @@ -3030,6 +3030,20 @@ tls_first_minor=20 tls_as_opt='--fatal-warnings' ;; + or1k*-*-*) + conftest_s=' + .section ".tdata","awT",%progbits +foo: .long 25 + .text + l.movhi r3,tlsgdhi(foo) + l.ori r3,r3,tlsgdlo(foo) + + l.jal __tls_get_addr + l.nop' + tls_first_major=2 + tls_first_minor=23 + tls_as_opt='--fatal-warnings' + ;; powerpc-ibm-aix*) conftest_s=' .extern __get_tpointer diff -Naur -x '*.swp' -x '*.out' -x '*.diff' -x '*java*' gcc-4.8.3/gcc/configure.ac.orig gcc-4.8.3-or1k-rtems/gcc/configure.ac.orig --- gcc-4.8.3/gcc/configure.ac.orig 1970-01-01 02:00:00.000000000 +0200 +++ gcc-4.8.3-or1k-rtems/gcc/configure.ac.orig 2014-04-28 12:05:29.000000000 +0200 @@ -0,0 +1,5352 @@ +# configure.ac for GCC +# Process this file with autoconf to generate a configuration script. + +# Copyright (C) 1997-2013 Free Software Foundation, Inc. + +#This file is part of GCC. + +#GCC is free software; you can redistribute it and/or modify it under +#the terms of the GNU General Public License as published by the Free +#Software Foundation; either version 3, or (at your option) any later +#version. + +#GCC is distributed in the hope that it will be useful, but WITHOUT +#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +#for more details. + +#You should have received a copy of the GNU General Public License +#along with GCC; see the file COPYING3. If not see +#. + +# -------------------------------- +# Initialization and sanity checks +# -------------------------------- + +AC_PREREQ(2.64) +AC_INIT +AC_CONFIG_SRCDIR(tree.c) +AC_CONFIG_HEADER(auto-host.h:config.in) + +gcc_version=`cat $srcdir/BASE-VER` + +# Determine the host, build, and target systems +AC_CANONICAL_BUILD +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + +# Determine the noncanonical target name, for directory use. +ACX_NONCANONICAL_TARGET + +# Determine the target- and build-specific subdirectories +GCC_TOPLEV_SUBDIRS + +# Set program_transform_name +AC_ARG_PROGRAM + +# Check for bogus environment variables. +# Test if LIBRARY_PATH contains the notation for the current directory +# since this would lead to problems installing/building glibc. +# LIBRARY_PATH contains the current directory if one of the following +# is true: +# - one of the terminals (":" and ";") is the first or last sign +# - two terminals occur directly after each other +# - the path contains an element with a dot in it +AC_MSG_CHECKING(LIBRARY_PATH variable) +changequote(,)dnl +case ${LIBRARY_PATH} in + [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) + library_path_setting="contains current directory" + ;; + *) + library_path_setting="ok" + ;; +esac +changequote([,])dnl +AC_MSG_RESULT($library_path_setting) +if test "$library_path_setting" != "ok"; then +AC_MSG_ERROR([ +*** LIBRARY_PATH shouldn't contain the current directory when +*** building gcc. Please change the environment variable +*** and run configure again.]) +fi + +# Test if GCC_EXEC_PREFIX contains the notation for the current directory +# since this would lead to problems installing/building glibc. +# GCC_EXEC_PREFIX contains the current directory if one of the following +# is true: +# - one of the terminals (":" and ";") is the first or last sign +# - two terminals occur directly after each other +# - the path contains an element with a dot in it +AC_MSG_CHECKING(GCC_EXEC_PREFIX variable) +changequote(,)dnl +case ${GCC_EXEC_PREFIX} in + [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) + gcc_exec_prefix_setting="contains current directory" + ;; + *) + gcc_exec_prefix_setting="ok" + ;; +esac +changequote([,])dnl +AC_MSG_RESULT($gcc_exec_prefix_setting) +if test "$gcc_exec_prefix_setting" != "ok"; then +AC_MSG_ERROR([ +*** GCC_EXEC_PREFIX shouldn't contain the current directory when +*** building gcc. Please change the environment variable +*** and run configure again.]) +fi + +# ----------- +# Directories +# ----------- + +# Specify the local prefix +local_prefix= +AC_ARG_WITH(local-prefix, +[AS_HELP_STRING([--with-local-prefix=DIR], + [specifies directory to put local include])], +[case "${withval}" in +yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;; +no) ;; +*) local_prefix=$with_local_prefix ;; +esac]) + +# Default local prefix if it is empty +if test x$local_prefix = x; then + local_prefix=/usr/local +fi + +# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only +# passed in by the toplevel make and thus we'd get different behavior +# depending on where we built the sources. +gcc_gxx_include_dir= +# Specify the g++ header file directory +AC_ARG_WITH(gxx-include-dir, +[AS_HELP_STRING([--with-gxx-include-dir=DIR], + [specifies directory to put g++ header files])], +[case "${withval}" in +yes) AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;; +no) ;; +*) gcc_gxx_include_dir=$with_gxx_include_dir ;; +esac]) + +# This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO. +if test x${gcc_gxx_include_dir} = x; then + if test x${enable_version_specific_runtime_libs} = xyes; then + gcc_gxx_include_dir='${libsubdir}/include/c++' + else + libstdcxx_incdir='include/c++/$(version)' + if test x$host != x$target; then + libstdcxx_incdir="$target_alias/$libstdcxx_incdir" + fi + gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir" + fi +fi + +gcc_gxx_include_dir_add_sysroot=0 +if test "${with_sysroot+set}" = set; then + gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'` + if test "${gcc_gxx_without_sysroot}"; then + gcc_gxx_include_dir="${gcc_gxx_without_sysroot}" + gcc_gxx_include_dir_add_sysroot=1 + fi +fi + +AC_ARG_WITH(cpp_install_dir, +[AC_HELP_STRING([--with-cpp-install-dir=DIR], + [install the user visible C preprocessor in DIR + (relative to PREFIX) as well as PREFIX/bin])], +[if test x$withval = xyes; then + AC_MSG_ERROR([option --with-cpp-install-dir requires an argument]) +elif test x$withval != xno; then + cpp_install_dir=$withval +fi]) + +# We would like to our source tree to be readonly. However when releases or +# pre-releases are generated, the flex/bison generated files as well as the +# various formats of manuals need to be included along with the rest of the +# sources. Therefore we have --enable-generated-files-in-srcdir to do +# just that. + +AC_MSG_CHECKING([whether to place generated files in the source directory]) + dnl generated-files-in-srcdir is disabled by default + AC_ARG_ENABLE(generated-files-in-srcdir, + [AS_HELP_STRING([--enable-generated-files-in-srcdir], + [put copies of generated files in source dir + intended for creating source tarballs for users + without texinfo bison or flex])], + generated_files_in_srcdir=$enableval, + generated_files_in_srcdir=no) + +AC_MSG_RESULT($generated_files_in_srcdir) + +if test "$generated_files_in_srcdir" = "yes"; then + GENINSRC='' +else + GENINSRC='#' +fi +AC_SUBST(GENINSRC) + +# ------------------- +# Find default linker +# ------------------- + +# With GNU ld +AC_ARG_WITH(gnu-ld, +[AS_HELP_STRING([--with-gnu-ld], [arrange to work with GNU ld])], +gnu_ld_flag="$with_gnu_ld", +gnu_ld_flag=no) + +# With pre-defined ld +AC_ARG_WITH(ld, +[AS_HELP_STRING([--with-ld], [arrange to use the specified ld (full pathname)])], +DEFAULT_LINKER="$with_ld") +if test x"${DEFAULT_LINKER+set}" = x"set"; then + if test ! -x "$DEFAULT_LINKER"; then + AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER]) + elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then + gnu_ld_flag=yes + fi + AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER", + [Define to enable the use of a default linker.]) +fi + +AC_MSG_CHECKING([whether a default linker was specified]) +if test x"${DEFAULT_LINKER+set}" = x"set"; then + if test x"$gnu_ld_flag" = x"no"; then + AC_MSG_RESULT([yes ($DEFAULT_LINKER)]) + else + AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)]) + fi +else + AC_MSG_RESULT(no) +fi + +# With demangler in GNU ld +AC_ARG_WITH(demangler-in-ld, +[AS_HELP_STRING([--with-demangler-in-ld], [try to use demangler in GNU ld])], +demangler_in_ld="$with_demangler_in_ld", +demangler_in_ld=yes) + +# ---------------------- +# Find default assembler +# ---------------------- + +# With GNU as +AC_ARG_WITH(gnu-as, +[AS_HELP_STRING([--with-gnu-as], [arrange to work with GNU as])], +gas_flag="$with_gnu_as", +gas_flag=no) + +AC_ARG_WITH(as, +[AS_HELP_STRING([--with-as], [arrange to use the specified as (full pathname)])], +DEFAULT_ASSEMBLER="$with_as") +if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then + if test ! -x "$DEFAULT_ASSEMBLER"; then + AC_MSG_ERROR([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER]) + elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then + gas_flag=yes + fi + AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER", + [Define to enable the use of a default assembler.]) +fi + +AC_MSG_CHECKING([whether a default assembler was specified]) +if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then + if test x"$gas_flag" = x"no"; then + AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)]) + else + AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)]) + fi +else + AC_MSG_RESULT(no) +fi + +# --------------- +# Find C compiler +# --------------- + +# If a non-executable a.out is present (e.g. created by GNU as above even if +# invoked with -v only), the IRIX 6 native ld just overwrites the existing +# file, even when creating an executable, so an execution test fails. +# Remove possible default executable files to avoid this. +# +# FIXME: This really belongs into AC_PROG_CC and can be removed once +# Autoconf includes it. +rm -f a.out a.exe b.out + +# Find the native compiler +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_CXX +ACX_PROG_GNAT([-I"$srcdir"/ada]) + +# autoconf is lame and doesn't give us any substitution variable for this. +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then + NO_MINUS_C_MINUS_O=yes +else + OUTPUT_OPTION='-o $@' +fi +AC_SUBST(NO_MINUS_C_MINUS_O) +AC_SUBST(OUTPUT_OPTION) + +# Remove the -O2: for historical reasons, unless bootstrapping we prefer +# optimizations to be activated explicitly by the toplevel. +case "$CC" in + */prev-gcc/xgcc*) ;; + *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" ` + CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" ` ;; +esac +AC_SUBST(CFLAGS) +AC_SUBST(CXXFLAGS) + +# Determine PICFLAG for target gnatlib. +GCC_PICFLAG_FOR_TARGET +AC_SUBST(PICFLAG_FOR_TARGET) + +# ------------------------- +# Check C compiler features +# ------------------------- + +AC_USE_SYSTEM_EXTENSIONS +AC_PROG_CPP +AC_C_INLINE + +AC_SYS_LARGEFILE + +# sizeof(char) is 1 by definition. +AC_CHECK_SIZEOF(void *) +AC_CHECK_SIZEOF(short) +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(long) +AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)]) +AC_CHECK_TYPES([__int64], [AC_CHECK_SIZEOF(__int64)]) +GCC_STDINT_TYPES + +# --------------------- +# Warnings and checking +# --------------------- + +# Check $CC warning features (if it's GCC). +# We want to use -pedantic, but we don't want warnings about +# * 'long long' +# * variadic macros +# * overlong strings +# * C++11 narrowing conversions in { } +# So, we only use -pedantic if we can disable those warnings. + +ACX_PROG_CC_WARNING_OPTS( + m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual])), [loose_warn]) +ACX_PROG_CC_WARNING_OPTS( + m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes])), + [c_loose_warn]) +ACX_PROG_CC_WARNING_OPTS( + m4_quote(m4_do([-Wmissing-format-attribute])), [strict_warn]) +ACX_PROG_CC_WARNING_OPTS( + m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn]) +ACX_PROG_CC_WARNING_ALMOST_PEDANTIC( + m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ], + [-Wno-overlength-strings])), [strict_warn]) +ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual], [strict_warn]) + +# The above macros do nothing if the compiler is not GCC. However, the +# Makefile has more goo to add other flags, so these variables are used +# to enable warnings only for GCC. +warn_cflags= +warn_cxxflags= +if test "x$GCC" = "xyes"; then + warn_cflags='$(GCC_WARN_CFLAGS)' + warn_cxxflags='$(GCC_WARN_CXXFLAGS)' +fi +AC_SUBST(warn_cflags) +AC_SUBST(warn_cxxflags) + +# Disable exceptions and RTTI if building with g++ +ACX_PROG_CC_WARNING_OPTS( + m4_quote(m4_do([-fno-exceptions -fno-rtti -fasynchronous-unwind-tables])), + [noexception_flags]) + +# Enable expensive internal checks +is_release= +if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then + is_release=yes +fi + +AC_ARG_ENABLE(checking, +[AS_HELP_STRING([[--enable-checking[=LIST]]], + [enable expensive run-time checks. With LIST, + enable only specific categories of checks. + Categories are: yes,no,all,none,release. + Flags are: assert,df,fold,gc,gcac,gimple,misc, + rtlflag,rtl,runtime,tree,valgrind,types])], +[ac_checking_flags="${enableval}"],[ +# Determine the default checks. +if test x$is_release = x ; then + ac_checking_flags=yes +else + ac_checking_flags=release +fi]) +IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," +for check in release $ac_checking_flags +do + case $check in + # these set all the flags to specific states + yes) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ; + ac_fold_checking= ; ac_gc_checking=1 ; + ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ; + ac_rtlflag_checking=1 ; ac_runtime_checking=1 ; + ac_tree_checking=1 ; ac_valgrind_checking= ; + ac_types_checking=1 ;; + no|none) ac_assert_checking= ; ac_checking= ; ac_df_checking= ; + ac_fold_checking= ; ac_gc_checking= ; + ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ; + ac_rtlflag_checking= ; ac_runtime_checking= ; + ac_tree_checking= ; ac_valgrind_checking= ; + ac_types_checking= ;; + all) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ; + ac_fold_checking=1 ; ac_gc_checking=1 ; + ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ; + ac_rtlflag_checking=1 ; ac_runtime_checking=1 ; + ac_tree_checking=1 ; ac_valgrind_checking= ; + ac_types_checking=1 ;; + release) ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ; + ac_fold_checking= ; ac_gc_checking= ; + ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ; + ac_rtlflag_checking= ; ac_runtime_checking=1 ; + ac_tree_checking= ; ac_valgrind_checking= ; + ac_types_checking= ;; + # these enable particular checks + assert) ac_assert_checking=1 ;; + df) ac_df_checking=1 ;; + fold) ac_fold_checking=1 ;; + gc) ac_gc_checking=1 ;; + gcac) ac_gc_always_collect=1 ;; + gimple) ac_gimple_checking=1 ;; + misc) ac_checking=1 ;; + rtl) ac_rtl_checking=1 ;; + rtlflag) ac_rtlflag_checking=1 ;; + runtime) ac_runtime_checking=1 ;; + tree) ac_tree_checking=1 ;; + types) ac_types_checking=1 ;; + valgrind) ac_valgrind_checking=1 ;; + *) AC_MSG_ERROR(unknown check category $check) ;; + esac +done +IFS="$ac_save_IFS" + +nocommon_flag="" +if test x$ac_checking != x ; then + AC_DEFINE(ENABLE_CHECKING, 1, +[Define if you want more run-time sanity checks. This one gets a grab + bag of miscellaneous but relatively cheap checks.]) + nocommon_flag=-fno-common +fi +AC_SUBST(nocommon_flag) +if test x$ac_df_checking != x ; then + AC_DEFINE(ENABLE_DF_CHECKING, 1, +[Define if you want more run-time sanity checks for dataflow.]) +fi +if test x$ac_assert_checking != x ; then + AC_DEFINE(ENABLE_ASSERT_CHECKING, 1, +[Define if you want assertions enabled. This is a cheap check.]) +fi +if test x$ac_gimple_checking != x ; then + AC_DEFINE(ENABLE_GIMPLE_CHECKING, 1, +[Define if you want operations on GIMPLE (the basic data structure of +the high-level optimizers) to be checked for dynamic type safety at +runtime. This is moderately expensive.]) +fi +GCC_TARGET_TEMPLATE(ENABLE_RUNTIME_CHECKING) +if test x$ac_runtime_checking != x ; then + AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1, +[Define if you want runtime assertions enabled. This is a cheap check.]) +fi +if test x$ac_tree_checking != x ; then + AC_DEFINE(ENABLE_TREE_CHECKING, 1, +[Define if you want all operations on trees (the basic data + structure of the front ends) to be checked for dynamic type safety + at runtime. This is moderately expensive. The tree browser debugging + routines will also be enabled by this option. + ]) + TREEBROWSER=tree-browser.o + TREECHECKING=yes +fi +if test x$ac_types_checking != x ; then + AC_DEFINE(ENABLE_TYPES_CHECKING, 1, +[Define if you want all gimple types to be verified after gimplifiation. + This is cheap. + ]) +fi +AC_SUBST(TREEBROWSER) +AC_SUBST(TREECHECKING) +if test x$ac_rtl_checking != x ; then + AC_DEFINE(ENABLE_RTL_CHECKING, 1, +[Define if you want all operations on RTL (the basic data structure + of the optimizer and back end) to be checked for dynamic type safety + at runtime. This is quite expensive.]) +fi +if test x$ac_rtlflag_checking != x ; then + AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1, +[Define if you want RTL flag accesses to be checked against the RTL + codes that are supported for each access macro. This is relatively + cheap.]) +fi +if test x$ac_gc_checking != x ; then + AC_DEFINE(ENABLE_GC_CHECKING, 1, +[Define if you want the garbage collector to do object poisoning and + other memory allocation checks. This is quite expensive.]) +fi +if test x$ac_gc_always_collect != x ; then + AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1, +[Define if you want the garbage collector to operate in maximally + paranoid mode, validating the entire heap and collecting garbage at + every opportunity. This is extremely expensive.]) +fi +if test x$ac_fold_checking != x ; then + AC_DEFINE(ENABLE_FOLD_CHECKING, 1, +[Define if you want fold checked that it never destructs its argument. + This is quite expensive.]) +fi +valgrind_path_defines= +valgrind_command= + +dnl # This check AC_REQUIREs various stuff, so it *must not* be inside +dnl # an if statement. This was the source of very frustrating bugs +dnl # in converting to autoconf 2.5x! +AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no) + +if test x$ac_valgrind_checking != x ; then + # It is certainly possible that there's valgrind but no valgrind.h. + # GCC relies on making annotations so we must have both. + AC_MSG_CHECKING(for VALGRIND_DISCARD in ) + AC_PREPROC_IFELSE([AC_LANG_SOURCE( + [[#include +#ifndef VALGRIND_DISCARD +#error VALGRIND_DISCARD not defined +#endif]])], + [gcc_cv_header_valgrind_memcheck_h=yes], + [gcc_cv_header_valgrind_memcheck_h=no]) + AC_MSG_RESULT($gcc_cv_header_valgrind_memcheck_h) + AC_MSG_CHECKING(for VALGRIND_DISCARD in ) + AC_PREPROC_IFELSE([AC_LANG_SOURCE( + [[#include +#ifndef VALGRIND_DISCARD +#error VALGRIND_DISCARD not defined +#endif]])], + [gcc_cv_header_memcheck_h=yes], + [gcc_cv_header_memcheck_h=no]) + AC_MSG_RESULT($gcc_cv_header_memcheck_h) + AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind, + [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1]) + if test "x$valgrind_path" = "x" \ + || (test $have_valgrind_h = no \ + && test $gcc_cv_header_memcheck_h = no \ + && test $gcc_cv_header_valgrind_memcheck_h = no); then + AC_MSG_ERROR([*** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h]) + fi + valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"' + valgrind_command="$valgrind_path -q" + AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1, +[Define if you want to run subprograms and generated programs + through valgrind (a memory checker). This is extremely expensive.]) + if test $gcc_cv_header_valgrind_memcheck_h = yes; then + AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1, + [Define if valgrind's valgrind/memcheck.h header is installed.]) + fi + if test $gcc_cv_header_memcheck_h = yes; then + AC_DEFINE(HAVE_MEMCHECK_H, 1, + [Define if valgrind's memcheck.h header is installed.]) + fi +fi +AC_SUBST(valgrind_path_defines) +AC_SUBST(valgrind_command) + +# Enable code coverage collection +AC_ARG_ENABLE(coverage, +[AS_HELP_STRING([[--enable-coverage[=LEVEL]]], + [enable compiler's code coverage collection. + Use to measure compiler performance and locate + unused parts of the compiler. With LEVEL, specify + optimization. Values are opt, noopt, + default is noopt])], +[case "${enableval}" in + yes|noopt) + coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0" + ;; + opt) + coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2" + ;; + no) + # a.k.a. --disable-coverage + coverage_flags="" + ;; + *) + AC_MSG_ERROR(unknown coverage setting $enableval) + ;; +esac], +[coverage_flags=""]) +AC_SUBST(coverage_flags) + +AC_ARG_ENABLE(gather-detailed-mem-stats, +[AS_HELP_STRING([--enable-gather-detailed-mem-stats], + [enable detailed memory allocation stats gathering])], [], +[enable_gather_detailed_mem_stats=no]) +gather_stats=`if test $enable_gather_detailed_mem_stats != no; then echo 1; else echo 0; fi` +AC_DEFINE_UNQUOTED(GATHER_STATISTICS, $gather_stats, +[Define to enable detailed memory allocation stats gathering.]) + +# ------------------------------- +# Miscenalleous configure options +# ------------------------------- + +# With stabs +AC_ARG_WITH(stabs, +[AS_HELP_STRING([--with-stabs], + [arrange to use stabs instead of host debug format])], +stabs="$with_stabs", +stabs=no) + +# Determine whether or not multilibs are enabled. +AC_ARG_ENABLE(multilib, +[AS_HELP_STRING([--enable-multilib], + [enable library support for multiple ABIs])], +[], [enable_multilib=yes]) +AC_SUBST(enable_multilib) + +# Determine whether or not multiarch is enabled. +AC_ARG_ENABLE(multiarch, +[AS_HELP_STRING([--enable-multiarch], + [enable support for multiarch paths])], +[case "${enableval}" in +yes|no|auto) enable_multiarch=$enableval;; +*) AC_MSG_ERROR(bad value ${enableval} given for --enable-multiarch option) ;; +esac], [enable_multiarch=auto]) +if test x${enable_multiarch} = xauto; then + if test x${with_native_system_header_dir} != x; then + ma_msg_suffix=", disabled auto check (configured with --native-system-header-dir)" + enable_multiarch=no + fi + if test x$host != x$target && test "x$with_sysroot" = x; then + ma_msg_suffix=", disabled auto check (cross build configured without --with-sysroot)" + enable_multiarch=no + fi +fi +AC_MSG_CHECKING(for multiarch configuration) +AC_SUBST(enable_multiarch) +AC_MSG_RESULT($enable_multiarch$ma_msg_suffix) + +# needed for setting the multiarch name for soft-float/hard-float ABIs +AC_SUBST(with_cpu) +AC_SUBST(with_float) + +# Enable __cxa_atexit for C++. +AC_ARG_ENABLE(__cxa_atexit, +[AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])], +[], []) + +# Enable C extension for decimal float if target supports it. +GCC_AC_ENABLE_DECIMAL_FLOAT([$target]) + +dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi` +AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_FLOAT, $dfp, +[Define to 1 to enable decimal float extension to C.]) + +# Use default_decimal_float for dependency. +enable_decimal_float=$default_decimal_float + +bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi` +AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_BID_FORMAT, $bid, +[Define to 1 to specify that we are using the BID decimal floating +point format instead of DPD]) + +# Enable C extension for fixed-point arithmetic. +AC_ARG_ENABLE(fixed-point, +[AS_HELP_STRING([--enable-fixed-point], + [enable fixed-point arithmetic extension to C])], +[], +[ + case $target in + arm*) + enable_fixed_point=yes + ;; + + mips*-*-*) + enable_fixed_point=yes + ;; + *) + AC_MSG_WARN([fixed-point is not supported for this target, ignored]) + enable_fixed_point=no + ;; + esac +]) +AC_SUBST(enable_fixed_point) + +fixedpoint=`if test $enable_fixed_point = yes; then echo 1; else echo 0; fi` +AC_DEFINE_UNQUOTED(ENABLE_FIXED_POINT, $fixedpoint, +[Define to 1 to enable fixed-point arithmetic extension to C.]) + +# Enable threads +# Pass with no value to take the default +# Pass with a value to specify a thread package +AC_ARG_ENABLE(threads, +[AS_HELP_STRING([[--enable-threads[=LIB]]], + [enable thread usage for target GCC, + using LIB thread package])],, +[enable_threads='']) + +AC_ARG_ENABLE(tls, +[AS_HELP_STRING([--enable-tls], + [enable or disable generation of tls code + overriding the assembler check for tls support])], +[ + case $enable_tls in + yes | no) ;; + *) AC_MSG_ERROR(['$enable_tls' is an invalid value for --enable-tls. +Valid choices are 'yes' and 'no'.]) ;; + esac +], [enable_tls='']) + +AC_ARG_ENABLE(objc-gc, +[AS_HELP_STRING([--enable-objc-gc], + [enable the use of Boehm's garbage collector with + the GNU Objective-C runtime])], +if test x$enable_objc_gc = xno; then + objc_boehm_gc='' +else + objc_boehm_gc=1 +fi, +objc_boehm_gc='') + +AC_ARG_WITH(dwarf2, +[AS_HELP_STRING([--with-dwarf2], [force the default debug format to be DWARF 2])], +dwarf2="$with_dwarf2", +dwarf2=no) + +AC_ARG_ENABLE(shared, +[AS_HELP_STRING([--disable-shared], [don't provide a shared libgcc])], +[ + case $enable_shared in + yes | no) ;; + *) + enable_shared=no + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; + esac +], [enable_shared=yes]) +AC_SUBST(enable_shared) + +AC_ARG_WITH([native-system-header-dir], + [ --with-native-system-header-dir=dir + use dir as the directory to look for standard + system header files in. Defaults to /usr/include.], +[ + case ${with_native_system_header_dir} in + yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;; + /* | [[A-Za-z]]:[[\\/]]*) ;; + *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;; + esac + configured_native_system_header_dir="${withval}" +], [configured_native_system_header_dir=]) + +AC_ARG_WITH(build-sysroot, + [AS_HELP_STRING([--with-build-sysroot=sysroot], + [use sysroot as the system root during the build])], + [if test x"$withval" != x ; then + SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval" + fi], + [SYSROOT_CFLAGS_FOR_TARGET=]) +AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET) + +if test "x$prefix" = xNONE; then + test_prefix=/usr/local +else + test_prefix=$prefix +fi +if test "x$exec_prefix" = xNONE; then + test_exec_prefix=$test_prefix +else + test_exec_prefix=$exec_prefix +fi + +AC_ARG_WITH(sysroot, +[AS_HELP_STRING([[--with-sysroot[=DIR]]], + [search for usr/lib, usr/include, et al, within DIR])], +[ + case ${with_sysroot} in + yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;; + *) TARGET_SYSTEM_ROOT=$with_sysroot ;; + esac + + TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' + CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)' + + case ${TARGET_SYSTEM_ROOT} in + "${test_prefix}"|"${test_prefix}/"*|\ + "${test_exec_prefix}"|"${test_exec_prefix}/"*|\ + '${prefix}'|'${prefix}/'*|\ + '${exec_prefix}'|'${exec_prefix}/'*) + t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE" + TARGET_SYSTEM_ROOT_DEFINE="$t" + ;; + esac +], [ + TARGET_SYSTEM_ROOT= + TARGET_SYSTEM_ROOT_DEFINE= + CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include' +]) +AC_SUBST(TARGET_SYSTEM_ROOT) +AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) +AC_SUBST(CROSS_SYSTEM_HEADER_DIR) + +AC_ARG_WITH(specs, + [AS_HELP_STRING([--with-specs=SPECS], + [add SPECS to driver command-line processing])], + [CONFIGURE_SPECS=$withval], + [CONFIGURE_SPECS=] +) +AC_SUBST(CONFIGURE_SPECS) + +ACX_PKGVERSION([GCC]) +ACX_BUGURL([http://gcc.gnu.org/bugs.html]) + +# Sanity check enable_languages in case someone does not run the toplevel +# configure # script. +AC_ARG_ENABLE(languages, +[AS_HELP_STRING([--enable-languages=LIST], [specify which front-ends to build])], +[case ,${enable_languages}, in + ,,|,yes,) + # go safe -- we cannot be much sure without the toplevel + # configure's + # analysis of which target libs are present and usable + enable_languages=c + ;; + *,all,*) + AC_MSG_ERROR([only the toplevel supports --enable-languages=all]) + ;; + *,c,*) + ;; + *) + enable_languages=c,${enable_languages} + ;; +esac], +[enable_languages=c]) + +AC_ARG_WITH(multilib-list, +[AS_HELP_STRING([--with-multilib-list], [select multilibs (SH and x86-64 only)])], +:, +with_multilib_list=default) + +# ------------------------- +# Checks for other programs +# ------------------------- + +AC_PROG_MAKE_SET + +# Find some useful tools +AC_PROG_AWK +# We need awk to create options.c and options.h. +# Bail out if it's missing. +case ${AWK} in + "") AC_MSG_ERROR([can't build without awk, bailing out]) ;; +esac + +gcc_AC_PROG_LN_S +ACX_PROG_LN($LN_S) +AC_PROG_RANLIB +ranlib_flags="" +AC_SUBST(ranlib_flags) + +gcc_AC_PROG_INSTALL + +# See if cmp has --ignore-initial. +gcc_AC_PROG_CMP_IGNORE_INITIAL + +# See if we have the mktemp command. +AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no) + +# See if makeinfo has been installed and is modern enough +# that we can use it. +ACX_CHECK_PROG_VER(MAKEINFO, makeinfo, --version, + [GNU texinfo.* \([0-9][0-9.]*\)], + [4.[7-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*]) +if test $gcc_cv_prog_makeinfo_modern = no; then + AC_MSG_WARN([ +*** Makeinfo is missing or too old. +*** Info documentation will not be built.]) + BUILD_INFO= +else + BUILD_INFO=info +fi +AC_SUBST(BUILD_INFO) + +# Is pod2man recent enough to regenerate manpages? +AC_MSG_CHECKING([for recent Pod::Man]) +if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then + AC_MSG_RESULT(yes) + GENERATED_MANPAGES=generated-manpages +else + AC_MSG_RESULT(no) + GENERATED_MANPAGES= +fi +AC_SUBST(GENERATED_MANPAGES) + +MISSING="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing" + +# How about lex? +dnl Don't use AC_PROG_LEX; we insist on flex. +dnl LEXLIB is not useful in gcc. +AC_CHECK_PROGS([FLEX], flex, [$MISSING flex]) + +# Bison? +AC_CHECK_PROGS([BISON], bison, [$MISSING bison]) + +# Binutils are not build modules, unlike bison/flex/makeinfo. So we +# check for build == host before using them. + +# NM +if test x${build} = x${host} && test -f $srcdir/../binutils/nm.c \ + && test -d ../binutils ; then + NM='${objdir}/../binutils/nm-new' +else + AC_CHECK_PROG(NM, nm, nm, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing nm) +fi + +# AR +if test x${build} = x${host} && test -f $srcdir/../binutils/ar.c \ + && test -d ../binutils ; then + AR='${objdir}/../binutils/ar' +else + AC_CHECK_PROG(AR, ar, ar, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing ar) +fi + + +# -------------------- +# Checks for C headers +# -------------------- + +# Need to reject headers which give warnings, so that the -Werror bootstrap +# works later. *sigh* This needs to come before all header checks. +AC_PROG_CPP_WERROR + +AC_HEADER_STDC +AC_HEADER_TIME +ACX_HEADER_STRING +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \ + fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \ + sys/resource.h sys/param.h sys/times.h sys/stat.h \ + direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h) + +# Check for thread headers. +AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=]) +AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=]) + +# These tests can't be done till we know if we have limits.h. +gcc_AC_C_CHAR_BIT +AC_C_BIGENDIAN + +# ---------------------- +# Checks for C++ headers +# ---------------------- + +dnl Autoconf will give an error in the configure script if there is no +dnl C++ preprocessor. Hack to prevent that. +m4_pushdef([AC_MSG_ERROR], m4_defn([AC_MSG_WARN]))[]dnl +AC_PROG_CXXCPP +m4_popdef([AC_MSG_ERROR])[]dnl + +AC_LANG_PUSH(C++) + +AC_CHECK_HEADERS(unordered_map) +AC_CHECK_HEADERS(tr1/unordered_map) +AC_CHECK_HEADERS(ext/hash_map) + +AC_LANG_POP(C++) + +# -------- +# UNSORTED +# -------- + + +# These libraries may be used by collect2. +# We may need a special search path to get them linked. +AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs, +[save_LIBS="$LIBS" +for libs in '' -lld -lmld \ + '-L/usr/lib/cmplrs/cc2.11 -lmld' \ + '-L/usr/lib/cmplrs/cc3.11 -lmld' +do + LIBS="$libs" + AC_TRY_LINK_FUNC(ldopen, + [gcc_cv_collect2_libs="$libs"; break]) +done +LIBS="$save_LIBS" +test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required']) +case $gcc_cv_collect2_libs in + "none required") ;; + *) COLLECT2_LIBS=$gcc_cv_collect2_libs ;; +esac +AC_SUBST(COLLECT2_LIBS) + +# When building Ada code on Alpha, we need exc_resume which is usually in +# -lexc. So test for it. +save_LIBS="$LIBS" +LIBS= +AC_SEARCH_LIBS(exc_resume, exc) +GNAT_LIBEXC="$LIBS" +LIBS="$save_LIBS" +AC_SUBST(GNAT_LIBEXC) + +# To support -mcpu=native on Solaris/SPARC, we need libkstat. +save_LIBS="$LIBS" +LIBS= +AC_SEARCH_LIBS(kstat_open, kstat) +EXTRA_GCC_LIBS="$LIBS" +LIBS="$save_LIBS" +AC_SUBST(EXTRA_GCC_LIBS) + +# Some systems put ldexp and frexp in libm instead of libc; assume +# they're both in the same place. jcf-dump needs them. +save_LIBS="$LIBS" +LIBS= +AC_SEARCH_LIBS(ldexp, m) +LDEXP_LIB="$LIBS" +LIBS="$save_LIBS" +AC_SUBST(LDEXP_LIB) + +# Use only if it exists, +# doesn't clash with , and declares intmax_t. +AC_MSG_CHECKING(for inttypes.h) +AC_CACHE_VAL(gcc_cv_header_inttypes_h, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[#include +#include ]], + [[intmax_t i = -1;]])], + [gcc_cv_header_inttypes_h=yes], + [gcc_cv_header_inttypes_h=no])]) +AC_MSG_RESULT($gcc_cv_header_inttypes_h) +if test $gcc_cv_header_inttypes_h = yes; then + AC_DEFINE(HAVE_INTTYPES_H, 1, + [Define if you have a working header file.]) +fi + +dnl Disabled until we have a complete test for buggy enum bitfields. +dnl gcc_AC_C_ENUM_BF_UNSIGNED + +define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl + ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl + fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl + fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl + putchar_unlocked putc_unlocked) +AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoll atoq \ + sysconf strsignal getrusage nl_langinfo \ + gettimeofday mbstowcs wcswidth mmap setlocale \ + gcc_UNLOCKED_FUNCS madvise) + +if test x$ac_cv_func_mbstowcs = xyes; then + AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works, +[ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include +int main() +{ + mbstowcs(0, "", 0); + return 0; +}]])], + [gcc_cv_func_mbstowcs_works=yes], + [gcc_cv_func_mbstowcs_works=no], + [gcc_cv_func_mbstowcs_works=yes])]) + if test x$gcc_cv_func_mbstowcs_works = xyes; then + AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1, + [Define this macro if mbstowcs does not crash when its + first argument is NULL.]) + fi +fi + +AC_CHECK_TYPE(ssize_t, int) +AC_CHECK_TYPE(caddr_t, char *) + +GCC_AC_FUNC_MMAP_BLACKLIST + +case "${host}" in +*-*-*vms*) + # Under VMS, vfork works very differently than on Unix. The standard test + # won't work, and it isn't easily adaptable. It makes more sense to + # just force it. + ac_cv_func_vfork_works=yes + ;; +esac +AC_FUNC_FORK + +# g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different +# iconv() prototype. +AC_LANG_PUSH([C++]) +AM_ICONV +AC_LANG_POP([C++]) + +# Until we have in-tree GNU iconv: +LIBICONV_DEP= +AC_SUBST(LIBICONV_DEP) + +AM_LC_MESSAGES + +AM_LANGINFO_CODESET + +# We will need to find libiberty.h and ansidecl.h +saved_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC" +saved_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC" +gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \ + strsignal strstr stpcpy strverscmp \ + errno snprintf vsnprintf vasprintf malloc realloc calloc \ + free basename getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[ +#include "ansidecl.h" +#include "system.h"]) + +gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[ +#include "ansidecl.h" +#include "system.h" +#ifdef HAVE_SYS_RESOURCE_H +#include +#endif +]) + +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include "ansidecl.h" +#include "system.h" +#ifdef HAVE_SYS_RESOURCE_H +#include +#endif +]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long], +[Define to `long' if doesn't define.])]) + +# On AIX 5.2, conflicts with , as both define incompatible +# FREAD and FWRITE macros. Fortunately, for GCC's single usage of ldgetname +# in collect2.c, isn't visible, but the configure test below needs +# to undef these macros to get the correct value for HAVE_DECL_LDGETNAME. +gcc_AC_CHECK_DECLS(ldgetname, , ,[ +#include "ansidecl.h" +#include "system.h" +#ifdef HAVE_LDFCN_H +#undef FREAD +#undef FWRITE +#include +#endif +]) + +gcc_AC_CHECK_DECLS(times, , ,[ +#include "ansidecl.h" +#include "system.h" +#ifdef HAVE_SYS_TIMES_H +#include +#endif +]) + +gcc_AC_CHECK_DECLS(sigaltstack, , ,[ +#include "ansidecl.h" +#include "system.h" +#include +]) + +# g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which hides the madvise() +# prototype. +AC_LANG_PUSH([C++]) +gcc_AC_CHECK_DECLS(madvise, , ,[ + #include "ansidecl.h" + #include "system.h" +]) +AC_LANG_POP([C++]) + +# More time-related stuff. +AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include "ansidecl.h" +#include "system.h" +#ifdef HAVE_SYS_TIMES_H +#include +#endif +]], [[struct tms tms;]])],[ac_cv_struct_tms=yes],[ac_cv_struct_tms=no])]) +if test $ac_cv_struct_tms = yes; then + AC_DEFINE(HAVE_STRUCT_TMS, 1, + [Define if defines struct tms.]) +fi + +# use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE. +# revisit after autoconf 2.50. +AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include "ansidecl.h" +#include "system.h" +]], [[clock_t x;]])],[gcc_cv_type_clock_t=yes],[gcc_cv_type_clock_t=no])]) +if test $gcc_cv_type_clock_t = yes; then + AC_DEFINE(HAVE_CLOCK_T, 1, + [Define if defines clock_t.]) +fi + +# Check if F_SETLKW is supported by fcntl. +AC_CACHE_CHECK(for F_SETLKW, ac_cv_f_setlkw, [ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include ]], [[ +struct flock fl; +fl.l_whence = 0; +fl.l_start = 0; +fl.l_len = 0; +fl.l_pid = 0; +return fcntl (1, F_SETLKW, &fl);]])], +[ac_cv_f_setlkw=yes],[ac_cv_f_setlkw=no])]) +if test $ac_cv_f_setlkw = yes; then + AC_DEFINE(HOST_HAS_F_SETLKW, 1, + [Define if F_SETLKW supported by fcntl.]) +fi + +# Restore CFLAGS, CXXFLAGS from before the gcc_AC_NEED_DECLARATIONS tests. +CFLAGS="$saved_CFLAGS" +CXXFLAGS="$saved_CXXFLAGS" + +# mkdir takes a single argument on some systems. +gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG + +# File extensions +manext='.1' +objext='.o' +AC_SUBST(manext) +AC_SUBST(objext) + +# With Setjmp/Longjmp based exception handling. +AC_ARG_ENABLE(sjlj-exceptions, +[AS_HELP_STRING([--enable-sjlj-exceptions], + [arrange to use setjmp/longjmp exception handling])], +[case $target in + *-*-hpux10*) + if test $enableval != yes; then + AC_MSG_WARN([dwarf2 exceptions not supported, sjlj exceptions forced]) + enableval=yes + fi + ;; +esac +force_sjlj_exceptions=yes], +[case $target in + *-*-hpux10*) + force_sjlj_exceptions=yes + enableval=yes + ;; + *) + force_sjlj_exceptions=no + ;; +esac]) +if test $force_sjlj_exceptions = yes; then + sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi` + AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj, + [Define 0/1 to force the choice for exception handling model.]) +fi + +# -------------------------------------------------------- +# Build, host, and target specific configuration fragments +# -------------------------------------------------------- + +# Collect build-machine-specific information. +. ${srcdir}/config.build + +# Collect host-machine-specific information. +. ${srcdir}/config.host + +target_gtfiles= + +# Collect target-machine-specific information. +. ${srcdir}/config.gcc + +extra_objs="${host_extra_objs} ${extra_objs}" +extra_gcc_objs="${host_extra_gcc_objs} ${extra_gcc_objs}" + +# Default the target-machine variables that were not explicitly set. +if test x"$tm_file" = x +then tm_file=$cpu_type/$cpu_type.h; fi + +if test x"$extra_headers" = x +then extra_headers=; fi + +if test x$md_file = x +then md_file=$cpu_type/$cpu_type.md; fi + +if test x$out_file = x +then out_file=$cpu_type/$cpu_type.c; fi + +if test x"$tmake_file" = x +then tmake_file=$cpu_type/t-$cpu_type +fi + +# Support --enable-initfini-array. +if test x$enable_initfini_array != xno; then + tm_file="${tm_file} initfini-array.h" +fi + +if test x"$dwarf2" = xyes +then tm_file="$tm_file tm-dwarf2.h" +fi + +# Say what files are being used for the output code and MD file. +echo "Using \`$srcdir/config/$out_file' for machine-specific logic." +echo "Using \`$srcdir/config/$md_file' as machine description file." + +# If any of the xm_file variables contain nonexistent files, warn +# about them and drop them. + +bx= +for x in $build_xm_file; do + if test -f $srcdir/config/$x + then bx="$bx $x" + else AC_MSG_WARN($srcdir/config/$x does not exist.) + fi +done +build_xm_file="$bx" + +hx= +for x in $host_xm_file; do + if test -f $srcdir/config/$x + then hx="$hx $x" + else AC_MSG_WARN($srcdir/config/$x does not exist.) + fi +done +host_xm_file="$hx" + +tx= +for x in $xm_file; do + if test -f $srcdir/config/$x + then tx="$tx $x" + else AC_MSG_WARN($srcdir/config/$x does not exist.) + fi +done +xm_file="$tx" + +count=a +for f in $tm_file; do + count=${count}x +done +if test $count = ax; then + echo "Using \`$srcdir/config/$tm_file' as target machine macro file." +else + echo "Using the following target machine macro files:" + for f in $tm_file; do + echo " $srcdir/config/$f" + done +fi + +if test x$need_64bit_hwint = xyes; then + AC_DEFINE(NEED_64BIT_HOST_WIDE_INT, 1, +[Define to 1 if HOST_WIDE_INT must be 64 bits wide (see hwint.h).]) +fi + +if test x$use_long_long_for_widest_fast_int = xyes; then + AC_DEFINE(USE_LONG_LONG_FOR_WIDEST_FAST_INT, 1, +[Define to 1 if the 'long long' (or '__int64') is wider than 'long' but still +efficiently supported by the host hardware.]) +fi + +gnu_ld_bool=`if test x"$gnu_ld" = x"yes"; then echo 1; else echo 0; fi` +AC_DEFINE_UNQUOTED(HAVE_GNU_LD, $gnu_ld_bool, [Define to 1 if using GNU ld.]) + +gnu_as_bool=`if test x"$gas" = x"yes"; then echo 1; else echo 0; fi` +AC_DEFINE_UNQUOTED(HAVE_GNU_AS, $gnu_as_bool, [Define to 1 if using GNU as.]) + +count=a +for f in $host_xm_file; do + count=${count}x +done +if test $count = a; then + : +elif test $count = ax; then + echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file." +else + echo "Using the following host machine macro files:" + for f in $host_xm_file; do + echo " $srcdir/config/$f" + done +fi +echo "Using ${out_host_hook_obj} for host machine hooks." + +if test "$host_xm_file" != "$build_xm_file"; then + count=a + for f in $build_xm_file; do + count=${count}x + done + if test $count = a; then + : + elif test $count = ax; then + echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file." + else + echo "Using the following build machine macro files:" + for f in $build_xm_file; do + echo " $srcdir/config/$f" + done + fi +fi + +if test -n "$configured_native_system_header_dir"; then + native_system_header_dir=$configured_native_system_header_dir +fi +NATIVE_SYSTEM_HEADER_DIR="$native_system_header_dir" +AC_SUBST(NATIVE_SYSTEM_HEADER_DIR) + +case ${host} in + powerpc*-*-darwin*) + AC_CACHE_CHECK([whether mcontext_t fields have underscores], + gcc_cv_mcontext_underscores, + AC_COMPILE_IFELSE([ +#include +#include +#include +int main() { mcontext_t m; if (m->ss.srr0) return 0; return 0; } +], + gcc_cv_mcontext_underscores=no, gcc_cv_mcontext_underscores=yes)) + if test $gcc_cv_mcontext_underscores = yes; then + AC_DEFINE(HAS_MCONTEXT_T_UNDERSCORES,,dnl + [mcontext_t fields start with __]) + fi + ;; +esac + +# --------- +# Threading +# --------- + +# Check if a valid thread package +case ${enable_threads} in + "" | no) + # No threads + target_thread_file='single' + ;; + yes) + # default + target_thread_file='single' + ;; + aix | dce | lynx | mipssde | posix | rtems | \ + single | tpf | vxworks | win32) + target_thread_file=${enable_threads} + ;; + *) + echo "${enable_threads} is an unknown thread package" 1>&2 + exit 1 + ;; +esac + +if test x${thread_file} = x; then + # No thread file set by target-specific clauses in config.gcc, + # so use file chosen by default logic above + thread_file=${target_thread_file} +fi + +# -------- +# UNSORTED +# -------- + +use_cxa_atexit=no +if test x$enable___cxa_atexit = xyes || \ + test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then + if test x$host = x$target; then + case $host in + # mingw32 doesn't have __cxa_atexit but uses atexit registration + # keyed to flag_use_cxa_atexit + *-*-mingw32*) + use_cxa_atexit=yes + ;; + powerpc-ibm-aix*) + use_cxa_atexit=yes + ;; + *) + AC_CHECK_FUNC(__cxa_atexit,[use_cxa_atexit=yes], + [echo "__cxa_atexit can't be enabled on this target"]) + ;; + esac + else + # We can't check for __cxa_atexit when building a cross, so assume + # it is available + use_cxa_atexit=yes + fi + if test x$use_cxa_atexit = xyes; then + AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 2, + [Define if you want to use __cxa_atexit, rather than atexit, to + register C++ destructors for local statics and global objects. + This is essential for fully standards-compliant handling of + destructors, but requires __cxa_atexit in libc.]) + fi +fi + +# Look for a file containing extra machine modes. +if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then + extra_modes_file='$(srcdir)'/config/${extra_modes} + AC_SUBST(extra_modes_file) + AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "config/$extra_modes", + [Define to the name of a file containing a list of extra machine modes + for this architecture.]) +fi + +# Convert extra_options into a form suitable for Makefile use. +extra_opt_files= +all_opt_files= +for f in $extra_options; do + extra_opt_files="$extra_opt_files \$(srcdir)/config/$f" + all_opt_files="$all_opt_files $srcdir/config/$f" +done +AC_SUBST(extra_opt_files) + +# auto-host.h is the file containing items generated by autoconf and is +# the first file included by config.h. +# If host=build, it is correct to have bconfig include auto-host.h +# as well. If host!=build, we are in error and need to do more +# work to find out the build config parameters. +if test x$host = x$build +then + build_auto=auto-host.h +else + # We create a subdir, then run autoconf in the subdir. + # To prevent recursion we set host and build for the new + # invocation of configure to the build for this invocation + # of configure. + tempdir=build.$$ + rm -rf $tempdir + mkdir $tempdir + cd $tempdir + case ${srcdir} in + /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};; + *) realsrcdir=../${srcdir};; + esac + # Clearing GMPINC is necessary to prevent host headers being + # used by the build compiler. Defining GENERATOR_FILE stops + # system.h from including gmp.h. + CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ + CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ + LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ + GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \ + ${realsrcdir}/configure \ + --enable-languages=${enable_languages-all} \ + --target=$target_alias --host=$build_alias --build=$build_alias + + # We just finished tests for the build machine, so rename + # the file auto-build.h in the gcc directory. + mv auto-host.h ../auto-build.h + cd .. + rm -rf $tempdir + build_auto=auto-build.h +fi +AC_SUBST(build_subdir) + +tm_file="${tm_file} defaults.h" +tm_p_file="${tm_p_file} tm-preds.h" +host_xm_file="auto-host.h ansidecl.h ${host_xm_file}" +build_xm_file="${build_auto} ansidecl.h ${build_xm_file}" +# We don't want ansidecl.h in target files, write code there in ISO/GNU C. +# put this back in temporarily. +xm_file="auto-host.h ansidecl.h ${xm_file}" + +# -------- +# UNSORTED +# -------- + +changequote(,)dnl +# Compile in configure arguments. +if test -f configargs.h ; then + # Being re-configured. + gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'` + gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS" +else + gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS" +fi + +# Double all backslashes and backslash all quotes to turn +# gcc_config_arguments into a C string. +sed -e 's/\\/\\\\/g; s/"/\\"/g' <conftest.out +$gcc_config_arguments +EOF +gcc_config_arguments_str=`cat conftest.out` +rm -f conftest.out + +cat > configargs.h < plugin-version.h <target assembler and hope that it will have the same features +# as the host->target assembler we'll be using. +gcc_cv_gas_major_version= +gcc_cv_gas_minor_version= +gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas + +m4_pattern_allow([AS_FOR_TARGET])dnl +AS_VAR_SET_IF(gcc_cv_as,, [ +if test -x "$DEFAULT_ASSEMBLER"; then + gcc_cv_as="$DEFAULT_ASSEMBLER" +elif test -f $gcc_cv_as_gas_srcdir/configure.in \ + && test -f ../gas/Makefile \ + && test x$build = x$host; then + gcc_cv_as=../gas/as-new$build_exeext +elif test -x as$build_exeext; then + # Build using assembler in the current directory. + gcc_cv_as=./as$build_exeext +elif ( set dummy $AS_FOR_TARGET; test -x $[2] ); then + gcc_cv_as="$AS_FOR_TARGET" +else + AC_PATH_PROG(gcc_cv_as, $AS_FOR_TARGET) +fi]) + +ORIGINAL_AS_FOR_TARGET=$gcc_cv_as +AC_SUBST(ORIGINAL_AS_FOR_TARGET) +case "$ORIGINAL_AS_FOR_TARGET" in + ./as | ./as$build_exeext) ;; + *) AC_CONFIG_FILES(as:exec-tool.in, [chmod +x as]) ;; +esac + +AC_MSG_CHECKING(what assembler to use) +if test "$gcc_cv_as" = ../gas/as-new$build_exeext; then + # Single tree build which includes gas. We want to prefer it + # over whatever linker top-level may have detected, since + # we'll use what we're building after installation anyway. + AC_MSG_RESULT(newly built gas) + in_tree_gas=yes + _gcc_COMPUTE_GAS_VERSION + in_tree_gas_is_elf=no + if grep 'obj_format = elf' ../gas/Makefile > /dev/null \ + || (grep 'obj_format = multi' ../gas/Makefile \ + && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null + then + in_tree_gas_is_elf=yes + fi +else + AC_MSG_RESULT($gcc_cv_as) + in_tree_gas=no +fi + +# Identify the linker which will work hand-in-glove with the newly +# built GCC, so that we can examine its features. This is the linker +# which will be driven by the driver program. +# +# If build != host, and we aren't building gas in-tree, we identify a +# build->target linker and hope that it will have the same features +# as the host->target linker we'll be using. +gcc_cv_gld_major_version= +gcc_cv_gld_minor_version= +gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld +gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd + +AS_VAR_SET_IF(gcc_cv_ld,, [ +if test -x "$DEFAULT_LINKER"; then + gcc_cv_ld="$DEFAULT_LINKER" +elif test -f $gcc_cv_ld_gld_srcdir/configure.in \ + && test -f ../ld/Makefile \ + && test x$build = x$host; then + gcc_cv_ld=../ld/ld-new$build_exeext +elif test -x collect-ld$build_exeext; then + # Build using linker in the current directory. + gcc_cv_ld=./collect-ld$build_exeext +elif ( set dummy $LD_FOR_TARGET; test -x $[2] ); then + gcc_cv_ld="$LD_FOR_TARGET" +else + AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET) +fi]) + +ORIGINAL_PLUGIN_LD_FOR_TARGET=$gcc_cv_ld +PLUGIN_LD_SUFFIX=`basename $gcc_cv_ld | sed -e "s,$target_alias-,,"` +# if the PLUGIN_LD is set ld-new, just have it as ld +# as that is the installed named. +if test x$PLUGIN_LD_SUFFIX = xld-new \ + || test x$PLUGIN_LD_SUFFIX = xcollect-ld ; then + PLUGIN_LD_SUFFIX=ld +fi +AC_ARG_WITH(plugin-ld, +[AS_HELP_STRING([[--with-plugin-ld=[ARG]]], [specify the plugin linker])], +[if test x"$withval" != x; then + ORIGINAL_PLUGIN_LD_FOR_TARGET="$withval" + PLUGIN_LD_SUFFIX=`echo $withval | sed -e "s,$target_alias-,,"` + fi]) +AC_SUBST(ORIGINAL_PLUGIN_LD_FOR_TARGET) +AC_DEFINE_UNQUOTED(PLUGIN_LD_SUFFIX, "$PLUGIN_LD_SUFFIX", [Specify plugin linker]) + +# Check to see if we are using gold instead of ld +AC_MSG_CHECKING(whether we are using gold) +ld_is_gold=no +if test x$gcc_cv_ld != x; then + if $gcc_cv_ld --version 2>/dev/null | sed 1q \ + | grep "GNU gold" > /dev/null; then + ld_is_gold=yes + fi +fi +AC_MSG_RESULT($ld_is_gold) + +ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld +AC_SUBST(ORIGINAL_LD_FOR_TARGET) +case "$ORIGINAL_LD_FOR_TARGET" in + ./collect-ld | ./collect-ld$build_exeext) ;; + *) AC_CONFIG_FILES(collect-ld:exec-tool.in, [chmod +x collect-ld]) ;; +esac + +AC_MSG_CHECKING(what linker to use) +if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext \ + || test "$gcc_cv_ld" = ../gold/ld-new$build_exeext; then + # Single tree build which includes ld. We want to prefer it + # over whatever linker top-level may have detected, since + # we'll use what we're building after installation anyway. + AC_MSG_RESULT(newly built ld) + in_tree_ld=yes + in_tree_ld_is_elf=no + if (grep 'EMUL = .*elf' ../ld/Makefile \ + || grep 'EMUL = .*linux' ../ld/Makefile \ + || grep 'EMUL = .*lynx' ../ld/Makefile) > /dev/null; then + in_tree_ld_is_elf=yes + elif test "$ld_is_gold" = yes; then + in_tree_ld_is_elf=yes + fi + for f in $gcc_cv_ld_bfd_srcdir/configure $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.in $gcc_cv_ld_gld_srcdir/Makefile.in + do +changequote(,)dnl + gcc_cv_gld_version=`sed -n -e 's/^[ ]*VERSION=[^0-9A-Za-z_]*\([0-9]*\.[0-9]*.*\)/VERSION=\1/p' < $f` + if test x$gcc_cv_gld_version != x; then + break + fi + done + case $gcc_cv_gld_version in + VERSION=[0-9]*) ;; +changequote([,])dnl + *) AC_MSG_ERROR([[cannot find version of in-tree linker]]) ;; +changequote(,)dnl + esac + gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"` + gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"` +changequote([,])dnl +else + AC_MSG_RESULT($gcc_cv_ld) + in_tree_ld=no +fi + +# Figure out what nm we will be using. +gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils +AS_VAR_SET_IF(gcc_cv_nm,, [ +if test -f $gcc_cv_binutils_srcdir/configure.in \ + && test -f ../binutils/Makefile \ + && test x$build = x$host; then + gcc_cv_nm=../binutils/nm-new$build_exeext +elif test -x nm$build_exeext; then + gcc_cv_nm=./nm$build_exeext +elif ( set dummy $NM_FOR_TARGET; test -x $[2] ); then + gcc_cv_nm="$NM_FOR_TARGET" +else + AC_PATH_PROG(gcc_cv_nm, $NM_FOR_TARGET) +fi]) + +AC_MSG_CHECKING(what nm to use) +if test "$gcc_cv_nm" = ../binutils/nm-new$build_exeext; then + # Single tree build which includes binutils. + AC_MSG_RESULT(newly built nm) + in_tree_nm=yes +else + AC_MSG_RESULT($gcc_cv_nm) + in_tree_nm=no +fi + +ORIGINAL_NM_FOR_TARGET=$gcc_cv_nm +AC_SUBST(ORIGINAL_NM_FOR_TARGET) +case "$ORIGINAL_NM_FOR_TARGET" in + ./nm | ./nm$build_exeext) ;; + *) AC_CONFIG_FILES(nm:exec-tool.in, [chmod +x nm]) ;; +esac + + +# Figure out what objdump we will be using. +AS_VAR_SET_IF(gcc_cv_objdump,, [ +if test -f $gcc_cv_binutils_srcdir/configure.in \ + && test -f ../binutils/Makefile \ + && test x$build = x$host; then + # Single tree build which includes binutils. + gcc_cv_objdump=../binutils/objdump$build_exeext +elif test -x objdump$build_exeext; then + gcc_cv_objdump=./objdump$build_exeext +elif ( set dummy $OBJDUMP_FOR_TARGET; test -x $[2] ); then + gcc_cv_objdump="$OBJDUMP_FOR_TARGET" +else + AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET) +fi]) + +AC_MSG_CHECKING(what objdump to use) +if test "$gcc_cv_objdump" = ../binutils/objdump$build_exeext; then + # Single tree build which includes binutils. + AC_MSG_RESULT(newly built objdump) +elif test x$gcc_cv_objdump = x; then + AC_MSG_RESULT(not found) +else + AC_MSG_RESULT($gcc_cv_objdump) +fi + +# Figure out what readelf we will be using. +AS_VAR_SET_IF(gcc_cv_readelf,, [ +if test -f $gcc_cv_binutils_srcdir/configure.in \ + && test -f ../binutils/Makefile \ + && test x$build = x$host; then + # Single tree build which includes binutils. + gcc_cv_readelf=../binutils/readelf$build_exeext +elif test -x readelf$build_exeext; then + gcc_cv_readelf=./readelf$build_exeext +else + AC_PATH_PROG(gcc_cv_readelf, readelf) +fi]) + +AC_MSG_CHECKING(what readelf to use) +if test "$gcc_cv_readelf" = ../binutils/readelf$build_exeext; then + # Single tree build which includes binutils. + AC_MSG_RESULT(newly built readelf) +elif test x$gcc_cv_readelf = x; then + AC_MSG_RESULT(not found) +else + AC_MSG_RESULT($gcc_cv_readelf) +fi + +# Figure out what assembler alignment features are present. +gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align, + [2,6,0],, +[.balign 4 +.p2align 2],, +[AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1, + [Define if your assembler supports .balign and .p2align.])]) + +gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align, + [2,8,0],, + [.p2align 4,,7],, +[AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1, + [Define if your assembler supports specifying the maximum number + of bytes to skip when using the GAS .p2align command.])]) + +gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16, + [2,8,0],, + [.literal16],, +[AC_DEFINE(HAVE_GAS_LITERAL16, 1, + [Define if your assembler supports .literal16.])]) + +gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1, + [elf,2,9,0],, + [conftest_label1: .word 0 +.subsection -1 +conftest_label2: .word 0 +.previous], + [if test x$gcc_cv_nm != x; then + $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1 + $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2 + if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1 + then : + else gcc_cv_as_subsection_m1=yes + fi + rm -f conftest.nm1 conftest.nm2 + fi], + [AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1, + [Define if your assembler supports .subsection and .subsection -1 starts + emitting at the beginning of your section.])]) + +gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak, + [2,2,0],, + [ .weak foobar],, +[AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])]) + +gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref, + [2,17,0],, + [ .weakref foobar, barfnot],, +[AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports .weakref.])]) + +gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat, + [2,15,91],, + [ .SPACE $TEXT$ + .NSUBSPA $CODE$,COMDAT],, +[AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])]) + +# .hidden needs to be supported in both the assembler and the linker, +# because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN. +# This is irritatingly difficult to feature test for; we have to check the +# date string after the version number. If we've got an in-tree +# ld, we don't know its patchlevel version, so we set the baseline at 2.13 +# to be safe. +# The gcc_GAS_CHECK_FEATURE call just sets a cache variable. +gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden, + [elf,2,13,0],, +[ .hidden foobar +foobar:],[ +# Solaris 9/x86 as incorrectly emits an alias for a hidden symbol with +# STV_HIDDEN, so disable .hidden support if so. +case "${target}" in + i?86-*-solaris2* | x86_64-*-solaris2.1[[0-9]]*) + if test x$gcc_cv_as != x && test x$gcc_cv_objdump != x; then + cat > conftest.s <