+2011-06-14 Joseph Myers <joseph@codesourcery.com>
+
+ * 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 <davidxl@google.com>
* passes.c (execute_function_todo): Remove TODO_dump_func.
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@
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)
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)
# 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) \
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)
$(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 $@ \
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
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 ; \
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,
--- /dev/null
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include "common/common-target-hooks-def.h"
+#include "hooks.h"
--- /dev/null
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+/* 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)
--- /dev/null
+/* 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
+ <http://www.gnu.org/licenses/>.
+
+ 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 */
--- /dev/null
+/* 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
+<http://www.gnu.org/licenses/>. */
+
+#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;
--- /dev/null
+/* 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
+<http://www.gnu.org/licenses/>. */
+
+#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;
# 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".
#
#
# 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=
cxx_target_objs=
fortran_target_objs=
target_has_targetcm=no
+target_has_targetm_common=no
tm_defines=
xm_defines=
libgcc_tm_file=
;;
hppa*-*-*)
cpu_type=pa
+ target_has_targetm_common=yes
;;
lm32*)
extra_options="${extra_options} g.opt"
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
/* 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.
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.
tm_include_list
tm_file_list
thread_file
+common_out_object_file
+common_out_file
out_object_file
out_file
objc_boehm_gc
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"
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
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
+
+
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
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"
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)
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
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
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
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
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
{ "*", #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT, HOOK_TYPE },
#include "target.def"
#include "c-family/c-target.def"
+#include "common/common-target.def"
#undef DEFHOOK
};
/* 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.
#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "tm.h"
#if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY)
#include <windows.h>
#endif
#include "prefix.h"
+#include "common/common-target.h"
static const char *std_prefix = PREFIX;
else
result = xstrdup (path);
-#ifndef ALWAYS_STRIP_DOTDOT
-#define ALWAYS_STRIP_DOTDOT 0
-#endif
-
p = result;
while (1)
{
&& (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;
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. */