aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard@codesourcery.com>2007-03-06 09:06:35 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2007-03-06 09:06:35 +0000
commit3ca43df7e29a55204fb844247e8ea54a1e0c8d0d (patch)
treefa567fbbc441d903bfb15b0ab0bddc883ac070a9
parent4ab870f5c3a98ca14e851597546eca367eae9dc1 (diff)
downloadgcc-3ca43df7e29a55204fb844247e8ea54a1e0c8d0d.zip
gcc-3ca43df7e29a55204fb844247e8ea54a1e0c8d0d.tar.gz
gcc-3ca43df7e29a55204fb844247e8ea54a1e0c8d0d.tar.bz2
configure.ac: Allow tm_file to contain build-directory files.
gcc/ * configure.ac: Allow tm_file to contain build-directory files. * configure: Regenerate. * config.gcc (m68k-*-uclinux*): Add ./sysroot-suffix.h to tm_file. * config/m68k/t-uclinux (sysroot-suffix.h): New target. * config/m68k/print-sysroot-suffix.sh: New file. From-SVN: r122613
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config.gcc2
-rw-r--r--gcc/config/m68k/print-sysroot-suffix.sh82
-rw-r--r--gcc/config/m68k/t-uclinux7
-rwxr-xr-xgcc/configure5
-rw-r--r--gcc/configure.ac5
6 files changed, 108 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7cac0a2..60b9530 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2007-03-06 Richard Sandiford <richard@codesourcery.com>
+ * configure.ac: Allow tm_file to contain build-directory files.
+ * configure: Regenerate.
+ * config.gcc (m68k-*-uclinux*): Add ./sysroot-suffix.h to tm_file.
+ * config/m68k/t-uclinux (sysroot-suffix.h): New target.
+ * config/m68k/print-sysroot-suffix.sh: New file.
+
+2007-03-06 Richard Sandiford <richard@codesourcery.com>
+
* config/m68k/m68k.h (PIC_OFFSET_TABLE_REGNUM): Use the REGNO
of pic_offset_table_rtx if reload_completed.
(CONDITIONAL_REGISTER_USAGE): Use PIC_REG instead of
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 55679ba..ab33d1b 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1548,7 +1548,7 @@ m68k-*-uclinux*) # Motorola m68k/ColdFire running uClinux
# ABI.
default_m68k_cpu=68020
default_cf_cpu=5206
- tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h flat.h m68k/linux.h m68k/uclinux.h"
+ tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h flat.h m68k/linux.h m68k/uclinux.h ./sysroot-suffix.h"
tm_defines="${tm_defines} MOTOROLA=1 USE_GAS UCLIBC_DEFAULT=1"
extra_options="${extra_options} linux.opt"
tmake_file="m68k/t-floatlib m68k/t-uclinux m68k/t-mlibs"
diff --git a/gcc/config/m68k/print-sysroot-suffix.sh b/gcc/config/m68k/print-sysroot-suffix.sh
new file mode 100644
index 0000000..ff83ddd
--- /dev/null
+++ b/gcc/config/m68k/print-sysroot-suffix.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+# Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor,
+# Boston MA 02110-1301, USA.
+
+# This script takes the following arguments:
+#
+# - the target sysroot
+# - the value of $(MULTILIB_MATCHES)
+# - the value of $(MULTILIB_OPTIONS)
+#
+# It uses these arguments to construct a definition of SYSROOT_SUFFIX_SPEC,
+# which it prints to the standard output. For each multilib directory FOO,
+# the script checks whether $sysroot has a subdirectory FOO, and if so will
+# use /FOO for all compatible command-line options. It will not add a
+# suffix for /FOO's options otherwise. These suffixes are concatenated,
+# with one subspec for each space-separated entry in $(MULTILIB_OPTIONS).
+set -e
+sysroot=$1
+matches=$2
+options=$3
+
+# For each multilib option OPT, add to $substs a sed command of the
+# form "-e 's/OPT/OPT/'".
+substs=""
+for option in `echo "$options" | tr '/' ' '`
+do
+ substs="$substs -e 's/$option/$option/g'"
+done
+
+# For each ALIAS=CANONICAL entry in $MULTILIB_MATCHES, look for sed
+# arguments in $substs of the form "-e 's/CANONICAL/.../'". Replace
+# such entries with "-e 's/CANONICAL/ALIAS|.../'". Both the ALIAS and
+# CANONICAL parts of $MULTILIB_MATCHES use '?' to stand for '='.
+#
+# After this loop, a command of the form "echo FOO | eval sed $substs"
+# will replace a canonical option FOO with a %{...}-style spec pattern.
+for match in $matches
+do
+ canonical=`echo "$match" | sed -e 's/=.*//' -e 's/?/=/g'`
+ alias=`echo "$match" | sed -e 's/.*=//' -e 's/?/=/g'`
+ substs=`echo "$substs" | sed -e "s,s/$canonical/,&$alias|,"`
+done
+
+# Build up the final SYSROOT_SUFFIX_SPEC in $spec.
+spec=
+for combo in $options
+do
+ # See which option alternatives in $combo have their own sysroot
+ # directory. Create a subspec of the form "%{PAT1:/DIR1;...;PATn:DIRn}"
+ # from each such option OPTi, where DIRi is the directory associated
+ # with OPTi and PATi is the result of passing OPTi through $substs.
+ subspec=
+ for option in `echo "$combo" | tr '/' ' '`
+ do
+ dir=`echo "$option" | sed 's/cpu=//'`
+ if test -d "$sysroot/$dir"; then
+ test -z "$subspec" || subspec="$subspec;"
+ subspec="$subspec"`echo "$option" | eval sed $substs`":/$dir"
+ fi
+ done
+ # Concatenate all the subspecs.
+ test -z "$subspec" || spec="$spec%{$subspec}"
+done
+if test -n "$spec"; then
+ echo "#undef SYSROOT_SUFFIX_SPEC"
+ echo "#define SYSROOT_SUFFIX_SPEC \"$spec\""
+fi
diff --git a/gcc/config/m68k/t-uclinux b/gcc/config/m68k/t-uclinux
index f705364..3ee359d 100644
--- a/gcc/config/m68k/t-uclinux
+++ b/gcc/config/m68k/t-uclinux
@@ -7,3 +7,10 @@ M68K_MLIB_CPU += && (MLIB == "68020" || !match(FLAGS, "FL_MMU"))
# Add multilibs for execute-in-place and shared-library code.
M68K_MLIB_OPTIONS += msep-data/mid-shared-library
M68K_MLIB_DIRNAMES += msep-data mid-shared-library
+
+# This rule uses MULTILIB_MATCHES to generate a definition of
+# SYSROOT_SUFFIX_SPEC.
+sysroot-suffix.h: $(srcdir)/config/m68k/print-sysroot-suffix.sh
+ $(SHELL) $(srcdir)/config/m68k/print-sysroot-suffix.sh \
+ "$(SYSTEM_HEADER_DIR)/../.." "$(MULTILIB_MATCHES)" \
+ "$(MULTILIB_OPTIONS)" > $@
diff --git a/gcc/configure b/gcc/configure
index 1e63c02..fcbcb4f 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -13027,6 +13027,11 @@ tm_file_list="options.h"
tm_include_list="options.h"
for f in $tm_file; do
case $f in
+ ./* )
+ f=`echo $f | sed 's/^..//'`
+ tm_file_list="${tm_file_list} $f"
+ tm_include_list="${tm_include_list} $f"
+ ;;
defaults.h )
tm_file_list="${tm_file_list} \$(srcdir)/$f"
tm_include_list="${tm_include_list} $f"
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 83e13dd..0d30652 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1610,6 +1610,11 @@ tm_file_list="options.h"
tm_include_list="options.h"
for f in $tm_file; do
case $f in
+ ./* )
+ f=`echo $f | sed 's/^..//'`
+ tm_file_list="${tm_file_list} $f"
+ tm_include_list="${tm_include_list} $f"
+ ;;
defaults.h )
tm_file_list="${tm_file_list} \$(srcdir)/$f"
tm_include_list="${tm_include_list} $f"