From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22474 invoked by alias); 20 May 2011 12:22:00 -0000 Received: (qmail 22440 invoked by uid 22791); 20 May 2011 12:21:56 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_50,TW_JC,TW_RG,TW_VF,TW_XG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 20 May 2011 12:21:38 +0000 Received: (qmail 16526 invoked from network); 20 May 2011 12:21:37 -0000 Received: from unknown (HELO digraph.polyomino.org.uk) (joseph@127.0.0.2) by mail.codesourcery.com with ESMTPA; 20 May 2011 12:21:37 -0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.72) (envelope-from ) id 1QNOhz-0007MI-AO; Fri, 20 May 2011 12:21:35 +0000 Date: Fri, 20 May 2011 13:51:00 -0000 From: "Joseph S. Myers" To: gcc-patches@gcc.gnu.org cc: gdr@integrable-solutions.net, bonzini@gnu.org, dj@redhat.com, neroden@gcc.gnu.org, aoliva@redhat.com, Ralf.Wildenhues@gmx.de, ro@CeBiTec.Uni-Bielefeld.DE Subject: Link more common objects consistently into host programs Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-05/txt/msg01450.txt.bz2 There are an increasing number of common object files that get linked into a range of programs GCC builds and installs for the host, including but not limited to the core compilers and the drivers. These have various ad hoc code listing them explicitly for each program using some of them, with the objects split in non-obvious ways between $(GCC_OBJS) and the Makefile.in rules linking xgcc (for example). As the set of common objects increases, it seems better to put them in a .a file and just link that in everywhere, rather than explicitly listing the exact set used by each program; the static linker will then take care of using just the set required by a given program. This patch does so, for five common objects. Linking in the common diagnostics code means that programs may get the version of fancy_abort from that code (where previously they got either the version from errors.o, which is no longer built for the host after this patch, or no version of that function at all); so that it is obviously safe to call that version, the various programs (gcov, gcov-dump, lto-wrapper, jcf-dump, jvgenmain) are made to initialize the diagnostics code. This patch does *not* convert those programs to using the common diagnostics functions in place of their own diagnostics functions (or raw fprintf), except where the functions had the same names as the common ones and so were removed. (It would make sense to convert those programs to the common code, although gcov-dump is only an uninstalled debugging program so maybe should be added to po/EXCLUDES so the messages don't need to be translated. Indeed, I think it would make sense for the generator programs to use the common code instead of errors.c, although the copy built for the build system should have all i18n support disabled in that case.) I haven't tested building mips-tdump or mips-tfile with this patch, but don't think it should cause any problems as the static linker should just ignore the diagnostics objects for those programs. In principle mips-tfile should use the common code instead of its own implementations of error and fancy_abort, but I doubt it's worth converting it (the line-number handling makes it a nontrivial conversion as that would need to move to the line-map infrastructure as well). Bootstrapped with no regressions on x86_64-unknown-linux-gnu. OK to commit? (I think this needs build system review for the build system changes, and diagnostics review for the changes to make various programs initialize diagnostics.) (I expect to create a second layer of common code in a separate archive, used by a smaller subset of programs, with eventually versions of prefix.o opts.o opts-common.o options.o and the new common target hooks used by those files.) (Apart from the arbitrary division between GCC_OBJS and the xgcc link rule, mentioned above, there are other arbitrary divisions that don't make sense to me. In particular, the separation between OBJS-common, OBJS-md and OBJS-archive, all used only in the definition of OBJS and all ending up in libbackend.a. The "not used by all languages" description seems doubtful for most of the files, and while there may be a logical separation of a few objects as only used by cpplib-using languages, right now we just link cpplib into everything because that's where the line-maps code is.) 2011-05-20 Joseph Myers * Makefile.in (LIBDEPS): Add libcommon.a. (LIBS): Likewise. (GCC_OBJS): Remove diagnostic.o, pretty-print.o and input.o. (OBJS-common): Remove diagnostic.o, input.o, intl.o, pretty-print.o and version.o. (OBJS-libcommon): New. (ALL_HOST_BACKEND_OBJS): Add $(OBJS-libcommon). (BACKEND): Add libcommon.a. (MOSTLYCLEANFILES): Likewise. (libcommon.a): New. (xgcc$(exeext)): Don't explicitly use version.o and intl.o. (cpp$(exeext)): Likewise. (COLLECT2_OBJS): Remove intl.o, version.o, diagnostic.o, pretty-print.o and input.o. (lto-wrapper$(exeext)): Don't explicitly use intl.o. (lto-wrapper.o): Depend on $(DIAGNOSTIC_H). (errors.o): Remove. (mips-tfile): Don't explicitly use version.o. (mips-tdump): Likewise. (gcov.o): Depend on $(DIAGNOSTIC_H). (gcov-dump.o): Depend on intl.h and $(DIAGNOSTIC_H). (GCOV_OBJS): Remove intl.o, version.o and errors.o. (GCOV_DUMP_OBJS): Remove version.o and errors.o. * gcov-dump.c: Include intl.h and diagnostic.h. (main): Initialize diagnostics. * gcov.c: Include diagnostic.h. (fnotice): Remove. (main): Initialize diagnostics. * lto-wrapper.c: Include diagnostic.h. (main): Initialize diagnostics. ada: 2011-05-20 Joseph Myers * gcc-interface/Make-lang.in (EXTRA_GNATBIND_OBJS): Remove version.o. * gcc-interface/Makefile.in (EXTRA_GNATTOOLS_OBJS): Use libcommon.a instead of version.o. cp: 2011-05-20 Joseph Myers * Make-lang.in (GXX_OBJS): Remove intl.o and version.o. fortran: 2011-05-20 Joseph Myers * Make-lang.in (GFORTRAN_D_OBJS): Remove version.o and intl.o. go: 2011-05-20 Joseph Myers * Make-lang.in (GCCGO_OBJS): Remove intl.o and version.o. java: 2011-05-20 Joseph Myers * Make-lang.in ($(XGCJ)$(exeext)): Don't explicitly use intl.o and version.o. (JCFDUMP_OBJS): Remove errors.o, version.o and intl.o. (JVGENMAIN_OBJS): Remove errors.o and intl.o. (java/jcf-dump.o, java/jvgenmain.o): Depend in $(DIAGNOSTIC_H). * jcf-dump.c: Include diagnostic.h. (main): Initialize diagnostics. * jvgenmain.c: Include diagnostic.h. (main): Initialize diagnostics. Index: gcc/java/jcf-dump.c =================================================================== --- gcc/java/jcf-dump.c (revision 173917) +++ gcc/java/jcf-dump.c (working copy) @@ -52,6 +52,7 @@ The Free Software Foundation is independ #include "system.h" #include "coretypes.h" #include "intl.h" +#include "diagnostic.h" #include "jcf.h" #include "tree.h" @@ -1172,12 +1173,22 @@ main (int argc, char** argv) { JCF jcf[1]; int argi, opt; + const char *p; + + p = argv[0] + strlen (argv[0]); + while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1])) + --p; + progname = p; + + xmalloc_set_program_name (progname); /* Unlock the stdio streams. */ unlock_std_streams (); gcc_init_libintl (); + diagnostic_initialize (global_dc, 0); + if (argc <= 1) { fprintf (stderr, _("jcf-dump: no classes specified\n")); Index: gcc/java/Make-lang.in =================================================================== --- gcc/java/Make-lang.in (revision 173917) +++ gcc/java/Make-lang.in (working copy) @@ -1,7 +1,7 @@ # Top level -*- makefile -*- fragment for the GNU compiler for the Java(TM) # language. # Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. #This file is part of GCC. @@ -63,11 +63,10 @@ jvspec.o: $(srcdir)/java/jvspec.c $(SYST $(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION)) # Create the compiler driver for $(XGCJ). -$(XGCJ)$(exeext): $(GCC_OBJS) jvspec.o java/jcf-path.o version.o \ - prefix.o intl.o $(LIBDEPS) $(EXTRA_GCC_OBJS) +$(XGCJ)$(exeext): $(GCC_OBJS) jvspec.o java/jcf-path.o \ + prefix.o $(LIBDEPS) $(EXTRA_GCC_OBJS) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) \ - jvspec.o java/jcf-path.o prefix.o intl.o \ - version.o $(EXTRA_GCC_OBJS) $(LIBS) + jvspec.o java/jcf-path.o prefix.o $(EXTRA_GCC_OBJS) $(LIBS) # Create a version of the $(XGCJ) driver which calls the cross-compiler. $(XGCJ)-cross$(exeext): $(XGCJ)$(exeext) @@ -86,9 +85,9 @@ JAVA_OBJS = java/class.o java/decl.o jav java/jcf-path.o java/boehm.o java/java-gimplify.o JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \ - java/win32-host.o java/zextract.o errors.o version.o ggc-none.o intl.o + java/win32-host.o java/zextract.o ggc-none.o -JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o errors.o intl.o +JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o java_OBJS = $(sort $(JAVA_OBJS) $(JCFDUMP_OBJS) $(JVGENMAIN_OBJS)) jvspec.o @@ -269,7 +268,7 @@ JAVA_TREE_H = $(TREE_H) $(HASHTAB_H) jav java/jcf-dump.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(JAVA_TREE_H) \ java/jcf-dump.c java/jcf-reader.c java/jcf.h java/javaop.h java/javaop.def \ - version.h $(GGC_H) intl.h java/zipfile.h + version.h $(GGC_H) intl.h java/zipfile.h $(DIAGNOSTIC_H) java/boehm.o: java/boehm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(JAVA_TREE_H) java/parse.h java/builtins.o: java/builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ @@ -299,7 +298,7 @@ java/jcf-parse.o: java/jcf-parse.c $(CON java/parse.h $(GGC_H) debug.h $(REAL_H) gt-java-jcf-parse.h \ java/jcf-reader.c java/zipfile.h java/jcf.h $(BITMAP_H) java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \ - coretypes.h $(TM_H) intl.h + coretypes.h $(TM_H) intl.h $(DIAGNOSTIC_H) java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \ $(SYSTEM_H) coretypes.h $(TM_H) $(DIAGNOSTIC_H) \ langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h $(OPTS_H) $(OPTIONS_H) \ Index: gcc/java/jvgenmain.c =================================================================== --- gcc/java/jvgenmain.c (revision 173917) +++ gcc/java/jvgenmain.c (working copy) @@ -1,6 +1,6 @@ /* Program to generate "main" a Java(TM) class containing a main method. Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2010 Free Software Foundation, Inc. + 2007, 2008, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -32,6 +32,7 @@ The Free Software Foundation is independ #include "tree.h" #include "java-tree.h" #include "intl.h" +#include "diagnostic.h" #include "tm.h" /* FIXME: For gcc_obstack_init from defaults.h. */ static char * do_mangle_classname (const char *string); @@ -59,11 +60,20 @@ main (int argc, char **argv) int indirect = 0; char *prog_name = argv[0]; + p = argv[0] + strlen (argv[0]); + while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1])) + --p; + progname = p; + + xmalloc_set_program_name (progname); + /* Unlock the stdio streams. */ unlock_std_streams (); gcc_init_libintl (); + diagnostic_initialize (global_dc, 0); + if (argc > 1 && ! strcmp (argv[1], "-findirect-dispatch")) { indirect = 1; Index: gcc/gcov.c =================================================================== --- gcc/gcov.c (revision 173917) +++ gcc/gcov.c (working copy) @@ -37,6 +37,7 @@ along with Gcov; see the file COPYING3. #include "coretypes.h" #include "tm.h" #include "intl.h" +#include "diagnostic.h" #include "version.h" #include @@ -342,7 +343,6 @@ static int flag_preserve_paths = 0; static int flag_counts = 0; /* Forward declarations. */ -static void fnotice (FILE *, const char *, ...) ATTRIBUTE_PRINTF_2; static int process_args (int, char **); static void print_usage (int) ATTRIBUTE_NORETURN; static void print_version (void) ATTRIBUTE_NORETURN; @@ -369,12 +369,22 @@ main (int argc, char **argv) { int argno; int first_arg; + const char *p; + + p = argv[0] + strlen (argv[0]); + while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1])) + --p; + progname = p; + + xmalloc_set_program_name (progname); /* Unlock the stdio streams. */ unlock_std_streams (); gcc_init_libintl (); + diagnostic_initialize (global_dc, 0); + /* Handle response files. */ expandargv (&argc, &argv); @@ -401,16 +411,6 @@ main (int argc, char **argv) return 0; } - -static void -fnotice (FILE *file, const char *cmsgid, ...) -{ - va_list ap; - - va_start (ap, cmsgid); - vfprintf (file, _(cmsgid), ap); - va_end (ap); -} /* Print a usage message and exit. If ERROR_P is nonzero, this is an error, otherwise the output of --help. */ Index: gcc/cp/Make-lang.in =================================================================== --- gcc/cp/Make-lang.in (revision 173917) +++ gcc/cp/Make-lang.in (working copy) @@ -60,7 +60,7 @@ g++spec.o: $(srcdir)/cp/g++spec.c $(SYST $(INCLUDES) $(srcdir)/cp/g++spec.c) # Create the compiler driver for g++. -GXX_OBJS = $(GCC_OBJS) g++spec.o intl.o prefix.o version.o +GXX_OBJS = $(GCC_OBJS) g++spec.o prefix.o g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS) Index: gcc/lto-wrapper.c =================================================================== --- gcc/lto-wrapper.c (revision 173917) +++ gcc/lto-wrapper.c (working copy) @@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. #include "system.h" #include "coretypes.h" #include "intl.h" +#include "diagnostic.h" #include "obstack.h" int debug; /* true if -save-temps. */ @@ -627,8 +628,19 @@ cont: int main (int argc, char *argv[]) { + const char *p; + + p = argv[0] + strlen (argv[0]); + while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1])) + --p; + progname = p; + + xmalloc_set_program_name (progname); + gcc_init_libintl (); + diagnostic_initialize (global_dc, 0); + if (signal (SIGINT, SIG_IGN) != SIG_IGN) signal (SIGINT, fatal_signal); #ifdef SIGHUP Index: gcc/go/Make-lang.in =================================================================== --- gcc/go/Make-lang.in (revision 173917) +++ gcc/go/Make-lang.in (working copy) @@ -36,7 +36,7 @@ gospec.o: $(srcdir)/go/gospec.c $(SYSTEM $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \ $(INCLUDES) $(srcdir)/go/gospec.c) -GCCGO_OBJS = $(GCC_OBJS) gospec.o intl.o prefix.o version.o +GCCGO_OBJS = $(GCC_OBJS) gospec.o prefix.o gccgo$(exeext): $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS) $(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) $(LIBS) Index: gcc/ada/gcc-interface/Makefile.in =================================================================== --- gcc/ada/gcc-interface/Makefile.in (revision 173917) +++ gcc/ada/gcc-interface/Makefile.in (working copy) @@ -180,7 +180,7 @@ LIBINTL_DEP = @LIBINTL_DEP@ SYSLIBS = @GNAT_LIBEXC@ # List of extra object files linked in with various programs. -EXTRA_GNATTOOLS_OBJS = ../../prefix.o ../../version.o +EXTRA_GNATTOOLS_OBJS = ../../prefix.o ../../libcommon.a # List extra gnattools EXTRA_GNATTOOLS = Index: gcc/ada/gcc-interface/Make-lang.in =================================================================== --- gcc/ada/gcc-interface/Make-lang.in (revision 173917) +++ gcc/ada/gcc-interface/Make-lang.in (working copy) @@ -469,7 +469,7 @@ GNATBIND_OBJS = \ # List of extra object files linked in with various programs. EXTRA_GNAT1_OBJS = prefix.o -EXTRA_GNATBIND_OBJS = prefix.o version.o +EXTRA_GNATBIND_OBJS = prefix.o # Language-independent object files. ADA_BACKEND = $(BACKEND) attribs.o Index: gcc/fortran/Make-lang.in =================================================================== --- gcc/fortran/Make-lang.in (revision 173917) +++ gcc/fortran/Make-lang.in (working copy) @@ -1,6 +1,6 @@ # -*- makefile -*- # Top level makefile fragment for GNU gfortran, the GNU Fortran 95 compiler. -# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 # Free Software Foundation, Inc. # Contributed by Paul Brook @@ -84,7 +84,7 @@ gfortranspec.o: $(srcdir)/fortran/gfortr $(INCLUDES) $(srcdir)/fortran/gfortranspec.c) # Create the compiler driver gfortran. -GFORTRAN_D_OBJS = $(GCC_OBJS) gfortranspec.o version.o prefix.o intl.o +GFORTRAN_D_OBJS = $(GCC_OBJS) gfortranspec.o prefix.o gfortran$(exeext): $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBS) Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 173917) +++ gcc/Makefile.in (working copy) @@ -1047,7 +1047,8 @@ LIBIBERTY = ../libiberty/libiberty.a BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/libiberty.a # Dependencies on the intl and portability libraries. -LIBDEPS= $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) $(LIBDECNUMBER) +LIBDEPS= libcommon.a $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) \ + $(LIBDECNUMBER) # Likewise, for use in the tools that must run on this machine # even if we are cross-building GCC. @@ -1055,8 +1056,8 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY) # How to link with both our special library facilities # and the system's installed libraries. -LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER) \ - $(HOST_LIBS) +LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) \ + $(LIBDECNUMBER) $(HOST_LIBS) BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \ $(ZLIB) # Any system libraries needed just for GNAT. @@ -1167,8 +1168,7 @@ CXX_TARGET_OBJS=@cxx_target_objs@ FORTRAN_TARGET_OBJS=@fortran_target_objs@ # Object files for gcc driver. -GCC_OBJS = gcc.o opts-common.o gcc-options.o diagnostic.o pretty-print.o \ - input.o vec.o ggc-none.o +GCC_OBJS = gcc.o opts-common.o gcc-options.o vec.o ggc-none.o # Language-specific object files shared by all C-family front ends. C_COMMON_OBJS = c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o \ @@ -1239,7 +1239,6 @@ OBJS-common = \ df-problems.o \ df-scan.o \ dfp.o \ - diagnostic.o \ dojump.o \ dominance.o \ domwalk.o \ @@ -1288,10 +1287,8 @@ OBJS-common = \ ifcvt.o \ implicit-zee.o \ init-regs.o \ - input.o \ integrate.o \ internal-fn.o \ - intl.o \ ira.o \ ira-build.o \ ira-costs.o \ @@ -1336,7 +1333,6 @@ OBJS-common = \ postreload-gcse.o \ postreload.o \ predict.o \ - pretty-print.o \ print-rtl.o \ print-tree.o \ profile.o \ @@ -1464,7 +1460,6 @@ OBJS-common = \ var-tracking.o \ varasm.o \ vec.o \ - version.o \ vmsdbgout.o \ web.o \ xcoffout.o @@ -1501,12 +1496,16 @@ OBJS-archive = \ OBJS = $(OBJS-common) $(OBJS-md) $(OBJS-archive) +# Objects in libcommon.a, potentially used by all host binaries and with +# no target dependencies. +OBJS-libcommon = diagnostic.o pretty-print.o intl.o input.o version.o + # This lists all host objects for the front ends. ALL_HOST_FRONTEND_OBJS = $(C_OBJS) \ $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS)) -ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) \ - @TREEBROWSER@ main.o gccspec.o version.o intl.o prefix.o cppspec.o \ +ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) $(OBJS-libcommon) \ + @TREEBROWSER@ main.o gccspec.o prefix.o cppspec.o \ $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) mips-tfile.o mips-tdump.o \ $(GCOV_OBJS) $(GCOV_DUMP_OBJS) @@ -1514,7 +1513,8 @@ ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OB # compilation or not. ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS) $(ALL_HOST_BACKEND_OBJS) -BACKEND = main.o @TREEBROWSER@ libbackend.a $(CPPLIB) $(LIBDECNUMBER) +BACKEND = main.o @TREEBROWSER@ libbackend.a libcommon.a $(CPPLIB) \ + $(LIBDECNUMBER) MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \ insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \ @@ -1526,7 +1526,7 @@ MOSTLYCLEANFILES = insn-flags.h insn-con $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \ $(SPECS) collect2$(exeext) lto-wrapper$(exeext) \ gcov-iov$(build_exeext) gcov$(exeext) gcov-dump$(exeext) \ - *.[0-9][0-9].* *.[si] *-checksum.c libbackend.a libgcc.mk + *.[0-9][0-9].* *.[si] *-checksum.c libbackend.a libcommon.a libgcc.mk # Defined in libgcc2.c, included only in the static library. LIB2FUNCS_ST = _eprintf __gcc_bcmp @@ -1838,21 +1838,24 @@ libbackend.a: $(OBJS) $(AR) $(AR_FLAGS) libbackend.a $(OBJS) -$(RANLIB) $(RANLIB_FLAGS) libbackend.a +libcommon.a: $(OBJS-libcommon) + -rm -rf libcommon.a + $(AR) $(AR_FLAGS) libcommon.a $(OBJS-libcommon) + -$(RANLIB) $(RANLIB_FLAGS) libcommon.a + # We call this executable `xgcc' rather than `gcc' # to avoid confusion if the current directory is in the path # and CC is `gcc'. It is renamed to `gcc' when it is installed. -xgcc$(exeext): $(GCC_OBJS) gccspec.o version.o intl.o prefix.o \ - version.o $(LIBDEPS) $(EXTRA_GCC_OBJS) +xgcc$(exeext): $(GCC_OBJS) gccspec.o prefix.o $(LIBDEPS) $(EXTRA_GCC_OBJS) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) \ - gccspec.o intl.o prefix.o version.o $(EXTRA_GCC_OBJS) $(LIBS) + gccspec.o prefix.o $(EXTRA_GCC_OBJS) $(LIBS) # cpp is to cpp0 as gcc is to cc1. # The only difference from xgcc is that it's linked with cppspec.o # instead of gccspec.o. -cpp$(exeext): $(GCC_OBJS) cppspec.o version.o intl.o prefix.o \ - version.o $(LIBDEPS) $(EXTRA_GCC_OBJS) +cpp$(exeext): $(GCC_OBJS) cppspec.o prefix.o $(LIBDEPS) $(EXTRA_GCC_OBJS) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) \ - cppspec.o intl.o prefix.o version.o $(EXTRA_GCC_OBJS) $(LIBS) + cppspec.o prefix.o $(EXTRA_GCC_OBJS) $(LIBS) # Dump a specs file to make -B./ read these specs over installed ones. $(SPECS): xgcc$(exeext) @@ -2089,8 +2092,7 @@ sbitmap.o: sbitmap.c sbitmap.h $(CONFIG_ ebitmap.o: ebitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(EBITMAP_H) sparseset.o: sparseset.c $(SYSTEM_H) sparseset.h $(CONFIG_H) -COLLECT2_OBJS = collect2.o collect2-aix.o tlink.o intl.o version.o \ - diagnostic.o pretty-print.o input.o +COLLECT2_OBJS = collect2.o collect2-aix.o tlink.o COLLECT2_LIBS = @COLLECT2_LIBS@ collect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS) # Don't try modifying collect2 (aka ld) in place--it might be linking this. @@ -2111,12 +2113,12 @@ collect2-aix.o : collect2-aix.c $(CONFIG tlink.o: tlink.c $(DEMANGLE_H) $(HASHTAB_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(OBSTACK_H) collect2.h intl.h $(DIAGNOSTIC_CORE_H) -lto-wrapper$(exeext): lto-wrapper.o intl.o $(LIBDEPS) - +$(COMPILER) $(ALL_COMPILERFLAGS) $(LDFLAGS) -o T$@ lto-wrapper.o intl.o $(LIBS) +lto-wrapper$(exeext): lto-wrapper.o $(LIBDEPS) + +$(COMPILER) $(ALL_COMPILERFLAGS) $(LDFLAGS) -o T$@ lto-wrapper.o $(LIBS) mv -f T$@ $@ lto-wrapper.o: lto-wrapper.c $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h \ - $(OBSTACK_H) + $(OBSTACK_H) $(DIAGNOSTIC_H) # Files used by all variants of C. c-family/c-common.o : c-family/c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ @@ -3505,7 +3507,6 @@ params.o : params.c $(CONFIG_H) $(SYSTEM pointer-set.o: pointer-set.c pointer-set.h $(CONFIG_H) $(SYSTEM_H) hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(HOOKS_H) pretty-print.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h $(PRETTY_PRINT_H) -errors.o : errors.c $(CONFIG_H) $(SYSTEM_H) errors.h $(BCONFIG_H) dbgcnt.o: dbgcnt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) $(DBGCNT_H) \ $(TM_H) $(RTL_H) output.h lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ @@ -3527,16 +3528,16 @@ $(out_object_file): $(out_file) $(CONFIG $(out_file) $(OUTPUT_OPTION) # Build auxiliary files that support ecoff format. -mips-tfile: mips-tfile.o version.o $(LIBDEPS) +mips-tfile: mips-tfile.o $(LIBDEPS) $(LINKER) $(LINKERFLAGS) $(LDFLAGS) -o $@ \ - mips-tfile.o version.o $(LIBS) + mips-tfile.o $(LIBS) mips-tfile.o : mips-tfile.c $(CONFIG_H) $(SYSTEM_H) \ version.h $(srcdir)/../include/getopt.h $(GSTAB_H) intl.h -mips-tdump: mips-tdump.o version.o $(LIBDEPS) +mips-tdump: mips-tdump.o $(LIBDEPS) $(LINKER) $(LINKERFLAGS) $(LDFLAGS) -o $@ \ - mips-tdump.o version.o $(LIBS) + mips-tdump.o $(LIBS) mips-tdump.o : mips-tdump.c $(CONFIG_H) $(SYSTEM_H) \ version.h $(srcdir)/../include/getopt.h stab.def @@ -4060,14 +4061,14 @@ s-iov: build/gcov-iov$(build_exeext) $(B $(STAMP) s-iov gcov.o: gcov.c gcov-io.c $(GCOV_IO_H) intl.h $(SYSTEM_H) coretypes.h $(TM_H) \ - $(CONFIG_H) version.h + $(CONFIG_H) version.h $(DIAGNOSTIC_H) gcov-dump.o: gcov-dump.c gcov-io.c $(GCOV_IO_H) $(SYSTEM_H) coretypes.h \ - $(TM_H) $(CONFIG_H) version.h + $(TM_H) $(CONFIG_H) version.h intl.h $(DIAGNOSTIC_H) -GCOV_OBJS = gcov.o intl.o version.o errors.o +GCOV_OBJS = gcov.o gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_OBJS) $(LIBS) -o $@ -GCOV_DUMP_OBJS = gcov-dump.o version.o errors.o +GCOV_DUMP_OBJS = gcov-dump.o gcov-dump$(exeext): $(GCOV_DUMP_OBJS) $(LIBDEPS) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_DUMP_OBJS) \ $(LIBS) -o $@ Index: gcc/gcov-dump.c =================================================================== --- gcc/gcov-dump.c (revision 173917) +++ gcc/gcov-dump.c (working copy) @@ -22,6 +22,8 @@ along with Gcov; see the file COPYING3. #include "coretypes.h" #include "tm.h" #include "version.h" +#include "intl.h" +#include "diagnostic.h" #include #define IN_GCOV (-1) #include "gcov-io.h" @@ -76,10 +78,22 @@ int main (int argc ATTRIBUTE_UNUSED, char **argv) { int opt; + const char *p; + + p = argv[0] + strlen (argv[0]); + while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1])) + --p; + progname = p; + + xmalloc_set_program_name (progname); /* Unlock the stdio streams. */ unlock_std_streams (); + gcc_init_libintl (); + + diagnostic_initialize (global_dc, 0); + while ((opt = getopt_long (argc, argv, "hlpv", options, NULL)) != -1) { switch (opt) -- Joseph S. Myers joseph@codesourcery.com