OSDN Git Service

gcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Mar 2007 09:06:35 +0000 (09:06 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Mar 2007 09:06:35 +0000 (09:06 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122613 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config.gcc
gcc/config/m68k/print-sysroot-suffix.sh [new file with mode: 0644]
gcc/config/m68k/t-uclinux
gcc/configure
gcc/configure.ac

index 7cac0a2..60b9530 100644 (file)
@@ -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
index 55679ba..ab33d1b 100644 (file)
@@ -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 (file)
index 0000000..ff83ddd
--- /dev/null
@@ -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
index f705364..3ee359d 100644 (file)
@@ -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)" > $@
index 1e63c02..fcbcb4f 100755 (executable)
@@ -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"
index 83e13dd..0d30652 100644 (file)
@@ -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"