From c49a69620430855d0b44d4248f4722b0ce0e6013 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 14 Jun 2011 21:11:37 +0100 Subject: common-target-def.h, [...]: New files. * common/common-target-def.h, common/common-target.def, common/common-target.h, common/config/default-common.c, common/config/pa/pa-common.c: New files. * Makefile.in (common_out_file, common_out_object_file, COMMON_TARGET_H, COMMON_TARGET_DEF_H): New. (OBJS-libcommon-target): Include $(common_out_object_file). (prefix.o): Update dependencies. ($(common_out_object_file), common/common-target-hooks-def.h, s-common-target-hooks-def-h): New. (s-tm-texi): Also check timestamp on common-target.def. (build/genhooks.o): Update dependencies. * config.gcc (common_out_file, target_has_targetm_common): Define. * config/pa/som.h (ALWAYS_STRIP_DOTDOT): Replace with TARGET_ALWAYS_STRIP_DOTDOT. * configure.ac (common_out_object_file): Define. (common_out_file, common_out_object_file): Substitute. (common): Create directory. * configure: Regenerate. * doc/tm.texi.in (targetm_common): Document. (TARGET_ALWAYS_STRIP_DOTDOT): Add @hook entry. * doc/tm.texi: Regenerate. * genhooks.c (hook_array): Also include common/common-target.def. * prefix.c (tm.h): Don't include. (common/common-target.h): Include. (ALWAYS_STRIP_DOTDOT): Don't define. (update_path): Use targetm_common.always_strip_dotdot instead of ALWAYS_STRIP_DOTDOT. * system.h (ALWAYS_STRIP_DOTDOT): Poison. From-SVN: r175052 --- gcc/ChangeLog | 31 ++++++++++++++++++++++++++++++ gcc/Makefile.in | 30 +++++++++++++++++++++++++---- gcc/common/common-target-def.h | 20 +++++++++++++++++++ gcc/common/common-target.def | 39 ++++++++++++++++++++++++++++++++++++++ gcc/common/common-target.h | 35 ++++++++++++++++++++++++++++++++++ gcc/common/config/default-common.c | 34 +++++++++++++++++++++++++++++++++ gcc/common/config/pa/pa-common.c | 28 +++++++++++++++++++++++++++ gcc/config.gcc | 17 +++++++++++++++++ gcc/config/pa/som.h | 5 +++-- gcc/configure | 11 ++++++++--- gcc/configure.ac | 5 ++++- gcc/doc/tm.texi | 14 ++++++++++++++ gcc/doc/tm.texi.in | 12 ++++++++++++ gcc/genhooks.c | 1 + gcc/prefix.c | 11 ++++------- gcc/system.h | 2 +- 16 files changed, 277 insertions(+), 18 deletions(-) create mode 100644 gcc/common/common-target-def.h create mode 100644 gcc/common/common-target.def create mode 100644 gcc/common/common-target.h create mode 100644 gcc/common/config/default-common.c create mode 100644 gcc/common/config/pa/pa-common.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b293ce4..9afdada 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,34 @@ +2011-06-14 Joseph Myers + + * common/common-target-def.h, common/common-target.def, + common/common-target.h, common/config/default-common.c, + common/config/pa/pa-common.c: New files. + * Makefile.in (common_out_file, common_out_object_file, + COMMON_TARGET_H, COMMON_TARGET_DEF_H): New. + (OBJS-libcommon-target): Include $(common_out_object_file). + (prefix.o): Update dependencies. + ($(common_out_object_file), common/common-target-hooks-def.h, + s-common-target-hooks-def-h): New. + (s-tm-texi): Also check timestamp on common-target.def. + (build/genhooks.o): Update dependencies. + * config.gcc (common_out_file, target_has_targetm_common): Define. + * config/pa/som.h (ALWAYS_STRIP_DOTDOT): Replace with + TARGET_ALWAYS_STRIP_DOTDOT. + * configure.ac (common_out_object_file): Define. + (common_out_file, common_out_object_file): Substitute. + (common): Create directory. + * configure: Regenerate. + * doc/tm.texi.in (targetm_common): Document. + (TARGET_ALWAYS_STRIP_DOTDOT): Add @hook entry. + * doc/tm.texi: Regenerate. + * genhooks.c (hook_array): Also include common/common-target.def. + * prefix.c (tm.h): Don't include. + (common/common-target.h): Include. + (ALWAYS_STRIP_DOTDOT): Don't define. + (update_path): Use targetm_common.always_strip_dotdot instead of + ALWAYS_STRIP_DOTDOT. + * system.h (ALWAYS_STRIP_DOTDOT): Poison. + 2011-06-14 David Li * passes.c (execute_function_todo): Remove TODO_dump_func. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 24d1615..2f9610a 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -480,6 +480,8 @@ TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@ TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@ out_file=$(srcdir)/config/@out_file@ out_object_file=@out_object_file@ +common_out_file=$(srcdir)/common/config/@common_out_file@ +common_out_object_file=@common_out_object_file@ md_file=$(srcdir)/config/@md_file@ tm_file_list=@tm_file_list@ tm_include_list=@tm_include_list@ @@ -888,8 +890,10 @@ VEC_H = vec.h statistics.h EXCEPT_H = except.h $(HASHTAB_H) vecprim.h vecir.h TARGET_DEF = target.def target-hooks-macros.h C_TARGET_DEF = c-family/c-target.def target-hooks-macros.h +COMMON_TARGET_DEF = common/common-target.def target-hooks-macros.h TARGET_H = $(TM_H) target.h $(TARGET_DEF) insn-modes.h C_TARGET_H = c-family/c-target.h $(C_TARGET_DEF) +COMMON_TARGET_H = common/common-target.h $(COMMON_TARGET_DEF) MACHMODE_H = machmode.h mode-classes.def insn-modes.h HOOKS_H = hooks.h $(MACHMODE_H) HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H) @@ -897,6 +901,8 @@ LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H) TARGET_DEF_H = target-def.h target-hooks-def.h $(HOOKS_H) targhooks.h C_TARGET_DEF_H = c-family/c-target-def.h c-family/c-target-hooks-def.h \ $(TREE_H) $(C_COMMON_H) $(HOOKS_H) +COMMON_TARGET_DEF_H = common/common-target-def.h \ + common/common-target-hooks-def.h $(HOOKS_H) RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) reg-notes.def insn-notes.def \ $(INPUT_H) $(REAL_H) statistics.h $(VEC_H) $(FIXED_VALUE_H) alias.h \ $(HASHTAB_H) @@ -1492,7 +1498,8 @@ OBJS-libcommon = diagnostic.o pretty-print.o intl.o input.o version.o # Objects in libcommon-target.a, used by drivers and by the core # compiler and containing target-dependent code. -OBJS-libcommon-target = prefix.o opts-common.o options.o +OBJS-libcommon-target = $(common_out_object_file) prefix.o opts-common.o \ + options.o # This lists all host objects for the front ends. ALL_HOST_FRONTEND_OBJS = $(C_OBJS) \ @@ -2224,8 +2231,8 @@ incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \ intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \ $(MACHMODE_H) -prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) prefix.h \ - Makefile $(BASEVER) +prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h prefix.h \ + $(COMMON_TARGET_H) Makefile $(BASEVER) $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \ -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s) \ -c $(srcdir)/prefix.c $(OUTPUT_OPTION) @@ -3544,6 +3551,11 @@ $(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \ $(out_file) $(OUTPUT_OPTION) +$(common_out_object_file): $(common_out_file) $(CONFIG_H) $(SYSTEM_H) \ + coretypes.h $(COMMON_TARGET_H) $(COMMON_TARGET_DEF_H) $(TM_H) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \ + $< $(OUTPUT_OPTION) + # Build auxiliary files that support ecoff format. mips-tfile: mips-tfile.o $(LIBDEPS) $(LINKER) $(LINKERFLAGS) $(LDFLAGS) -o $@ \ @@ -3743,6 +3755,15 @@ s-c-target-hooks-def-h: build/genhooks$(build_exeext) c-family/c-target-hooks-def.h $(STAMP) s-c-target-hooks-def-h +common/common-target-hooks-def.h: s-common-target-hooks-def-h; @true + +s-common-target-hooks-def-h: build/genhooks$(build_exeext) + $(RUN_GEN) build/genhooks$(build_exeext) "Common Target Hook" \ + > tmp-common-target-hooks-def.h + $(SHELL) $(srcdir)/../move-if-change tmp-common-target-hooks-def.h \ + common/common-target-hooks-def.h + $(STAMP) s-common-target-hooks-def-h + # check if someone mistakenly only changed tm.texi. # We use a different pathname here to avoid a circular dependency. s-tm-texi: $(srcdir)/doc/../doc/tm.texi @@ -3765,6 +3786,7 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in elif test $(srcdir)/doc/tm.texi -nt $(srcdir)/doc/tm.texi.in \ && ( test $(srcdir)/doc/tm.texi -nt $(srcdir)/target.def \ || test $(srcdir)/doc/tm.texi -nt $(srcdir)/c-family/c-target.def \ + || test $(srcdir)/doc/tm.texi -nt $(srcdir)/common/common-target.def \ ); then \ echo >&2 ; \ echo You should edit $(srcdir)/doc/tm.texi.in rather than $(srcdir)/doc/tm.texi . >&2 ; \ @@ -3979,7 +4001,7 @@ build/genpreds.o : genpreds.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF) \ - $(BCONFIG_H) $(SYSTEM_H) errors.h + $(COMMON_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h # Compile the programs that generate insn-* from the machine description. # They are compiled with $(COMPILER_FOR_BUILD), and associated libraries, diff --git a/gcc/common/common-target-def.h b/gcc/common/common-target-def.h new file mode 100644 index 0000000..a058708 --- /dev/null +++ b/gcc/common/common-target-def.h @@ -0,0 +1,20 @@ +/* Default initializers for common target hooks. + Copyright (C) 2011 + Free Software Foundation, Inc. + + 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, 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; see the file COPYING3. If not see + . */ + +#include "common/common-target-hooks-def.h" +#include "hooks.h" diff --git a/gcc/common/common-target.def b/gcc/common/common-target.def new file mode 100644 index 0000000..57fc5c4 --- /dev/null +++ b/gcc/common/common-target.def @@ -0,0 +1,39 @@ +/* Target hook definitions for common hooks. + Copyright (C) 2011 + Free Software Foundation, Inc. + + 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, 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; see the file COPYING3. If not see + . */ + +/* See target-hooks-macros.h for details of macros that should be + provided by the including file, and how to use them here. */ +#include "target-hooks-macros.h" + +#undef HOOK_TYPE +#define HOOK_TYPE "Common Target Hook" + +HOOK_VECTOR (TARGETM_COMMON_INITIALIZER, gcc_targetm_common) + +#undef HOOK_PREFIX +#define HOOK_PREFIX "TARGET_" + +DEFHOOKPOD +(always_strip_dotdot, + "True if @file{..} components should always be removed from directory names\ + computed relative to GCC's internal directories, false (default) if such\ + components should be preserved and directory names containing them passed\ + to other tools such as the linker.", + bool, false) + +HOOK_VECTOR_END (C90_EMPTY_HACK) diff --git a/gcc/common/common-target.h b/gcc/common/common-target.h new file mode 100644 index 0000000..615ac08 --- /dev/null +++ b/gcc/common/common-target.h @@ -0,0 +1,35 @@ +/* Data structure definitions for common hooks. + Copyright (C) 2011 + Free Software Foundation, Inc. + + 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, 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; see the file COPYING3. If not see + . + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! */ + +#ifndef GCC_COMMON_TARGET_H +#define GCC_COMMON_TARGET_H + +#define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME; +#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NAME) PARAMS; +#define DEFHOOK_UNDOC DEFHOOK +#define HOOKSTRUCT(FRAGMENT) FRAGMENT + +#include "common-target.def" + +extern struct gcc_targetm_common targetm_common; + +#endif /* GCC_C_TARGET_H */ diff --git a/gcc/common/config/default-common.c b/gcc/common/config/default-common.c new file mode 100644 index 0000000..8ea2354 --- /dev/null +++ b/gcc/common/config/default-common.c @@ -0,0 +1,34 @@ +/* Default common target hooks initializer. + 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 "common/common-target.h" +#include "common/common-target-def.h" + +/* Do not include tm.h or tm_p.h here; if it is useful for a target to + define some macros for the initializer in a header without defining + targetm_common itself (for example, because of interactions with + some hooks depending on the target OS and others on the target + architecture), create a separate tm_common.h for only the relevant + definitions. */ + +struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; diff --git a/gcc/common/config/pa/pa-common.c b/gcc/common/config/pa/pa-common.c new file mode 100644 index 0000000..a14e9b1 --- /dev/null +++ b/gcc/common/config/pa/pa-common.c @@ -0,0 +1,28 @@ +/* HPPA common hooks. + 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 "common/common-target.h" +#include "common/common-target-def.h" +#include "tm.h" + +struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; diff --git a/gcc/config.gcc b/gcc/config.gcc index e9704f3..ee9391d 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -96,6 +96,9 @@ # 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". # @@ -192,8 +195,12 @@ # # 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= @@ -210,6 +217,7 @@ c_target_objs= cxx_target_objs= fortran_target_objs= target_has_targetcm=no +target_has_targetm_common=no tm_defines= xm_defines= libgcc_tm_file= @@ -359,6 +367,7 @@ ia64-*-*) ;; hppa*-*-*) cpu_type=pa + target_has_targetm_common=yes ;; lm32*) extra_options="${extra_options} g.opt" @@ -2667,6 +2676,14 @@ if [ "$target_has_targetcm" = "no" ]; then 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 diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h index 73095e5..e8a47cc 100644 --- a/gcc/config/pa/som.h +++ b/gcc/config/pa/som.h @@ -1,5 +1,5 @@ /* Definitions for SOM assembler support. - Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2007, 2010 + Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2007, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -269,7 +269,8 @@ do { \ must be removed from library prefixes to prevent binaries from depending on the location of the GCC tool directory. The downside is GCC cannot be moved after installation using a symlink. */ -#define ALWAYS_STRIP_DOTDOT 1 +#undef TARGET_ALWAYS_STRIP_DOTDOT +#define TARGET_ALWAYS_STRIP_DOTDOT true /* If GAS supports weak, we can support weak when we have working linker support for secondary definitions and are generating code for GAS. diff --git a/gcc/configure b/gcc/configure index cc48431..6fcb5ab 100755 --- a/gcc/configure +++ b/gcc/configure @@ -624,6 +624,8 @@ tm_defines tm_include_list tm_file_list thread_file +common_out_object_file +common_out_file out_object_file out_file objc_boehm_gc @@ -11217,6 +11219,7 @@ done tmake_file="${tmake_file_}" out_object_file=`basename $out_file .c`.o +common_out_object_file=`basename $common_out_file .c`.o tm_file_list="options.h" tm_include_list="options.h insn-constants.h" @@ -17517,7 +17520,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17520 "configure" +#line 17523 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17623,7 +17626,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17626 "configure" +#line 17629 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -26394,6 +26397,8 @@ fi + + # Echo link setup. if test x${build} = x${host} ; then if test x${host} = x${target} ; then @@ -27951,7 +27956,7 @@ case ${CONFIG_HEADERS} in echo > cstamp-h ;; esac # Make sure all the subdirs exist. -for d in $subdirs doc build c-family +for d in $subdirs doc build common c-family do test -d $d || mkdir $d done diff --git a/gcc/configure.ac b/gcc/configure.ac index 70b3dbc..5f3641b 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1628,6 +1628,7 @@ done tmake_file="${tmake_file_}" out_object_file=`basename $out_file .c`.o +common_out_object_file=`basename $common_out_file .c`.o tm_file_list="options.h" tm_include_list="options.h insn-constants.h" @@ -4877,6 +4878,8 @@ AC_SUBST(md_file) AC_SUBST(objc_boehm_gc) AC_SUBST(out_file) AC_SUBST(out_object_file) +AC_SUBST(common_out_file) +AC_SUBST(common_out_object_file) AC_SUBST(thread_file) AC_SUBST(tm_file_list) AC_SUBST(tm_include_list) @@ -5081,7 +5084,7 @@ case ${CONFIG_HEADERS} in echo > cstamp-h ;; esac # Make sure all the subdirs exist. -for d in $subdirs doc build c-family +for d in $subdirs doc build common c-family do test -d $d || mkdir $d done diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index b32ff89..cda7f30 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -99,6 +99,16 @@ initializer @code{TARGETCM_INITIALIZER} in themselves, they should set @code{target_has_targetcm=yes} in @file{config.gcc}; otherwise a default definition is used. +Similarly, there is a @code{targetm_common} variable for hooks that +are shared between the compiler driver and the compilers proper, +documented as ``Common Target Hook''. This is declared in +@file{common/common-target.h}, the initializer +@code{TARGETM_COMMON_INITIALIZER} in +@file{common/common-target-def.h}. If targets initialize +@code{targetm_common} themselves, they should set +@code{target_has_targetm_common=yes} in @file{config.gcc}; otherwise a +default definition is used. + @node Driver @section Controlling the Compilation Driver, @file{gcc} @cindex driver @@ -383,6 +393,10 @@ directories from linking commands. Do not give it a nonzero value if removing duplicate search directories changes the linker's semantics. @end defmac +@deftypevr {Common Target Hook} bool TARGET_ALWAYS_STRIP_DOTDOT +True if @file{..} components should always be removed from directory names computed relative to GCC's internal directories, false (default) if such components should be preserved and directory names containing them passed to other tools such as the linker. +@end deftypevr + @defmac MULTILIB_DEFAULTS Define this macro as a C expression for the initializer of an array of string to tell the driver program which options are defaults for this diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 667b1ef..3ea77c5 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -99,6 +99,16 @@ initializer @code{TARGETCM_INITIALIZER} in themselves, they should set @code{target_has_targetcm=yes} in @file{config.gcc}; otherwise a default definition is used. +Similarly, there is a @code{targetm_common} variable for hooks that +are shared between the compiler driver and the compilers proper, +documented as ``Common Target Hook''. This is declared in +@file{common/common-target.h}, the initializer +@code{TARGETM_COMMON_INITIALIZER} in +@file{common/common-target-def.h}. If targets initialize +@code{targetm_common} themselves, they should set +@code{target_has_targetm_common=yes} in @file{config.gcc}; otherwise a +default definition is used. + @node Driver @section Controlling the Compilation Driver, @file{gcc} @cindex driver @@ -383,6 +393,8 @@ directories from linking commands. Do not give it a nonzero value if removing duplicate search directories changes the linker's semantics. @end defmac +@hook TARGET_ALWAYS_STRIP_DOTDOT + @defmac MULTILIB_DEFAULTS Define this macro as a C expression for the initializer of an array of string to tell the driver program which options are defaults for this diff --git a/gcc/genhooks.c b/gcc/genhooks.c index d70c4fe..789744c 100644 --- a/gcc/genhooks.c +++ b/gcc/genhooks.c @@ -34,6 +34,7 @@ static struct hook_desc hook_array[] = { { "*", #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT, HOOK_TYPE }, #include "target.def" #include "c-family/c-target.def" +#include "common/common-target.def" #undef DEFHOOK }; diff --git a/gcc/prefix.c b/gcc/prefix.c index 90261ae..369ede7 100644 --- a/gcc/prefix.c +++ b/gcc/prefix.c @@ -1,6 +1,6 @@ /* Utility to update paths from internal to external forms. Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2007 Free Software Foundation, Inc. + 2007, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -67,11 +67,11 @@ License along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" -#include "tm.h" #if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY) #include #endif #include "prefix.h" +#include "common/common-target.h" static const char *std_prefix = PREFIX; @@ -271,10 +271,6 @@ update_path (const char *path, const char *key) else result = xstrdup (path); -#ifndef ALWAYS_STRIP_DOTDOT -#define ALWAYS_STRIP_DOTDOT 0 -#endif - p = result; while (1) { @@ -289,7 +285,8 @@ update_path (const char *path, const char *key) && (p != result && IS_DIR_SEPARATOR (p[-1]))) { *p = 0; - if (!ALWAYS_STRIP_DOTDOT && access (result, X_OK) == 0) + if (!targetm_common.always_strip_dotdot + && access (result, X_OK) == 0) { *p = '.'; break; diff --git a/gcc/system.h b/gcc/system.h index d95b950..6b8fde2 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -759,7 +759,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; LABEL_ALIGN_MAX_SKIP LOOP_ALIGN_MAX_SKIP \ LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP JUMP_ALIGN_MAX_SKIP \ CAN_DEBUG_WITHOUT_FP UNLIKELY_EXECUTED_TEXT_SECTION_NAME \ - HOT_TEXT_SECTION_NAME LEGITIMATE_CONSTANT_P + HOT_TEXT_SECTION_NAME LEGITIMATE_CONSTANT_P ALWAYS_STRIP_DOTDOT /* Target macros only used for code built for the target, that have moved to libgcc-tm.h or have never been present elsewhere. */ -- cgit v1.1