From: <dan...@us...> - 2006-12-30 11:25:17
|
Revision: 853 http://svn.sourceforge.net/cegcc/?rev=853&view=rev Author: dannybackx Date: 2006-12-30 03:25:16 -0800 (Sat, 30 Dec 2006) Log Message: ----------- This is the gcc part of the profiling patch. Modified Paths: -------------- trunk/cegcc/src/gcc/gcc/ChangeLog.ce trunk/cegcc/src/gcc/gcc/config/arm/t-arm-coff trunk/cegcc/src/gcc/gcc/config/arm/t-arm-elf trunk/cegcc/src/gcc/gcc/config/arm/t-pe trunk/cegcc/src/gcc/gcc/config/arm/t-strongarm-elf trunk/cegcc/src/gcc/gcc/config/arm/t-strongarm-pe trunk/cegcc/src/gcc/gcc/config/arm/t-wince-pe trunk/cegcc/src/gcc/gcc/config/arm/t-xscale-coff trunk/cegcc/src/gcc/gcc/config/arm/t-xscale-elf trunk/cegcc/src/gcc/gcc/coverage.c trunk/cegcc/src/gcc/gcc/doc/gcov.texi trunk/cegcc/src/gcc/gcc/gcov-io.c trunk/cegcc/src/gcc/gcc/libgcov.c trunk/cegcc/src/gcc/gcc/tsystem.h Modified: trunk/cegcc/src/gcc/gcc/ChangeLog.ce =================================================================== --- trunk/cegcc/src/gcc/gcc/ChangeLog.ce 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/ChangeLog.ce 2006-12-30 11:25:16 UTC (rev 853) @@ -1,3 +1,21 @@ +2006-12-21 Danny Backx <dan...@us...> + + * config/arm/t-strongarm-pe config/arm/t-strongarm-elf config/arm/t-pe + config/arm/t-arm-elf config/arm/t-xscale-elf config/arm/t-xscale-coff + config/arm/t-arm-coff config/arm/t-wince-pe : Remove inhibit_libc . + + * coverage.c (build_gcov_info) : Add more support for dealing with + directory names in cross-debugging environment. Main difference + is that this is specified on the host, not the target platform. + + * doc/gcov.texi : Add documentation for GCOV_CROSS_PREFIX. + + * tsystem.h : Don't include <errno.h> when __MINGW32CE__ is defined. + + * gcov-io.c (gcov_open) : Call setvbuf instead of setbuf in mingw32ce. + + * libgcov.c (gcov_exit) : Don't call getenv and setenv in mingw32ce. + 2006-12-03 Pedro Alves <ped...@po...> * config/arm/arm.c (arm_major_arch, arm_thumb_arch_p): New Modified: trunk/cegcc/src/gcc/gcc/config/arm/t-arm-coff =================================================================== --- trunk/cegcc/src/gcc/gcc/config/arm/t-arm-coff 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/config/arm/t-arm-coff 2006-12-30 11:25:16 UTC (rev 853) @@ -31,4 +31,4 @@ # Currently there is a bug somewhere in GCC's alias analysis # or scheduling code that is breaking _fpmul_parts in fp-bit.c. # Disabling function inlining is a workaround for this problem. -TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline +TARGET_LIBGCC2_CFLAGS = -fno-inline Modified: trunk/cegcc/src/gcc/gcc/config/arm/t-arm-elf =================================================================== --- trunk/cegcc/src/gcc/gcc/config/arm/t-arm-elf 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/config/arm/t-arm-elf 2006-12-30 11:25:16 UTC (rev 853) @@ -67,7 +67,7 @@ # Currently there is a bug somewhere in GCC's alias analysis # or scheduling code that is breaking _fpmul_parts in fp-bit.c. # Disabling function inlining is a workaround for this problem. -TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline +TARGET_LIBGCC2_CFLAGS = -fno-inline # Assemble startup files. $(T)crti.o: $(srcdir)/config/arm/crti.asm $(GCC_PASSES) Modified: trunk/cegcc/src/gcc/gcc/config/arm/t-pe =================================================================== --- trunk/cegcc/src/gcc/gcc/config/arm/t-pe 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/config/arm/t-pe 2006-12-30 11:25:16 UTC (rev 853) @@ -47,4 +47,3 @@ LIBGCC = stmp-multilib INSTALL_LIBGCC = install-multilib -TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc Modified: trunk/cegcc/src/gcc/gcc/config/arm/t-strongarm-elf =================================================================== --- trunk/cegcc/src/gcc/gcc/config/arm/t-strongarm-elf 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/config/arm/t-strongarm-elf 2006-12-30 11:25:16 UTC (rev 853) @@ -32,7 +32,7 @@ # Currently there is a bug somewhere in GCC's alias analysis # or scheduling code that is breaking _fpmul_parts in fp-bit.c. # Disabling function inlining is a workaround for this problem. -TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline +TARGET_LIBGCC2_CFLAGS = -fno-inline # Assemble startup files. $(T)crti.o: $(srcdir)/config/arm/crti.asm $(GCC_PASSES) Modified: trunk/cegcc/src/gcc/gcc/config/arm/t-strongarm-pe =================================================================== --- trunk/cegcc/src/gcc/gcc/config/arm/t-strongarm-pe 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/config/arm/t-strongarm-pe 2006-12-30 11:25:16 UTC (rev 853) @@ -35,4 +35,4 @@ # Currently there is a bug somewhere in GCC's alias analysis # or scheduling code that is breaking _fpmul_parts in fp-bit.c. # Disabling function inlining is a workaround for this problem. -TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline +TARGET_LIBGCC2_CFLAGS = -fno-inline Modified: trunk/cegcc/src/gcc/gcc/config/arm/t-wince-pe =================================================================== --- trunk/cegcc/src/gcc/gcc/config/arm/t-wince-pe 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/config/arm/t-wince-pe 2006-12-30 11:25:16 UTC (rev 853) @@ -55,4 +55,4 @@ LIBGCC = stmp-multilib INSTALL_LIBGCC = install-multilib -TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc +TARGET_LIBGCC2_CFLAGS = Modified: trunk/cegcc/src/gcc/gcc/config/arm/t-xscale-coff =================================================================== --- trunk/cegcc/src/gcc/gcc/config/arm/t-xscale-coff 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/config/arm/t-xscale-coff 2006-12-30 11:25:16 UTC (rev 853) @@ -42,4 +42,4 @@ # Currently there is a bug somewhere in GCC's alias analysis # or scheduling code that is breaking _fpmul_parts in fp-bit.c. # Disabling function inlining is a workaround for this problem. -TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline +TARGET_LIBGCC2_CFLAGS = -fno-inline Modified: trunk/cegcc/src/gcc/gcc/config/arm/t-xscale-elf =================================================================== --- trunk/cegcc/src/gcc/gcc/config/arm/t-xscale-elf 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/config/arm/t-xscale-elf 2006-12-30 11:25:16 UTC (rev 853) @@ -54,7 +54,7 @@ # Currently there is a bug somewhere in GCC's alias analysis # or scheduling code that is breaking _fpmul_parts in fp-bit.c. # Disabling function inlining is a workaround for this problem. -TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline +TARGET_LIBGCC2_CFLAGS = -fno-inline # Assemble startup files. $(T)crti.o: $(srcdir)/config/arm/crti.asm $(GCC_PASSES) Modified: trunk/cegcc/src/gcc/gcc/coverage.c =================================================================== --- trunk/cegcc/src/gcc/gcc/coverage.c 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/coverage.c 2006-12-30 11:25:16 UTC (rev 853) @@ -776,6 +776,7 @@ unsigned n_fns; const struct function_list *fn; tree string_type; + char *gcov_cross_prefix; /* Count the number of active counters. */ for (n_ctr_types = 0, ix = 0; ix != GCOV_COUNTERS; ix++) @@ -811,12 +812,26 @@ field = build_decl (FIELD_DECL, NULL_TREE, string_type); TREE_CHAIN (field) = fields; fields = field; - filename = getpwd (); - filename = (filename && da_file_name[0] != '/' + + /* + * Additional environment variable for cross-development. + */ + if (gcov_cross_prefix = getenv ("GCOV_CROSS_PREFIX")) + { + filename = concat (gcov_cross_prefix, "/", da_file_name, NULL); + filename_len = strlen (filename); + filename_string = build_string (filename_len + 1, filename); + } + else + { + filename = getpwd (); + filename = (filename && da_file_name[0] != '/' ? concat (filename, "/", da_file_name, NULL) : da_file_name); - filename_len = strlen (filename); - filename_string = build_string (filename_len + 1, filename); + filename_len = strlen (filename); + filename_string = build_string (filename_len + 1, filename); + } + if (filename != da_file_name) free (filename); TREE_TYPE (filename_string) = build_array_type Modified: trunk/cegcc/src/gcc/gcc/doc/gcov.texi =================================================================== --- trunk/cegcc/src/gcc/gcc/doc/gcov.texi 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/doc/gcov.texi 2006-12-30 11:25:16 UTC (rev 853) @@ -544,7 +544,8 @@ to create the needed directory structure, if it is not already present. To support cross-profiling, a program compiled with @option{-fprofile-arcs} -can relocate the data files based on two environment variables: +can relocate the data files based on two environment variables on the target +platform, or one on the host platform: @itemize @bullet @item @@ -558,6 +559,11 @@ @emph{Note:} GCOV_PREFIX_STRIP has no effect if GCOV_PREFIX is undefined, empty or non-absolute. + +@item +GCOV_CROSS_PREFIX is a host platform environment variable. Use it to specify +a target directory to prefix the compiled file name with, replacing the +compile directory. @end itemize For example, if the object file @file{/user/build/foo.o} was built with @@ -568,6 +574,13 @@ @samp{GCOV_PREFIX=/target/run} and @samp{GCOV_PREFIX_STRIP=1}. Such a setting will name the data file @file{/target/run/build/foo.gcda}. +Alternatively, you can set @samp{GCOV_CROSS_PREFIX=/target/run/build} when +compiling, to achieve the same effect. The object file will no longer contain +the information @file{/user/build/foo.o} but @file{/target/run/build/foo.o}. + +The host and target mechanisms are independent of each other, so they can be +used together. + You must move the data files to the expected directory tree in order to use them for profile directed optimizations (@option{--use-profile}), or to use the @command{gcov} tool. Modified: trunk/cegcc/src/gcc/gcc/gcov-io.c =================================================================== --- trunk/cegcc/src/gcc/gcc/gcov-io.c 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/gcov-io.c 2006-12-30 11:25:16 UTC (rev 853) @@ -134,7 +134,11 @@ return 0; #endif +#ifdef __MINGW32CE__ + setvbuf (gcov_var.file, (char *)0, _IONBF, (size_t)0); +#else setbuf (gcov_var.file, (char *)0); +#endif return 1; } Modified: trunk/cegcc/src/gcc/gcc/libgcov.c =================================================================== --- trunk/cegcc/src/gcc/gcc/libgcov.c 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/libgcov.c 2006-12-30 11:25:16 UTC (rev 853) @@ -194,6 +194,12 @@ } } +#ifdef __MINGW32CE__ + /* No getenv support, so disable this. */ + gcov_prefix = (char *)0; + gcov_prefix_strip = 0; + prefix_length = 0; +#else /* Get file name relocation prefix. Non-absolute values are ignored. */ gcov_prefix = getenv("GCOV_PREFIX"); if (gcov_prefix && IS_ABSOLUTE_PATH (gcov_prefix)) @@ -216,6 +222,7 @@ } else prefix_length = 0; +#endif /* Allocate and initialize the filename scratch space. */ gi_filename = alloca (prefix_length + gcov_max_filename + 1); @@ -310,6 +317,15 @@ continue; } #endif +#ifdef UNDER_CE + { + wchar_t x[256]; + int l = strlen(gi_filename); + l = (l < 256) ? l : 255; + wcstombs(x, gi_filename, l); + MessageBoxW(0, L"gcov_open", x, 0); + } +#endif if (!gcov_open (gi_filename)) { fprintf (stderr, "profiling:%s:Cannot open\n", gi_filename); Modified: trunk/cegcc/src/gcc/gcc/tsystem.h =================================================================== --- trunk/cegcc/src/gcc/gcc/tsystem.h 2006-12-30 11:23:27 UTC (rev 852) +++ trunk/cegcc/src/gcc/gcc/tsystem.h 2006-12-30 11:25:16 UTC (rev 853) @@ -92,12 +92,14 @@ /* All systems have this header. */ #include <sys/types.h> -/* All systems have this header. */ +#ifndef __MINGW32CE__ +/* All systems except Windows CE have this header. */ #include <errno.h> #ifndef errno extern int errno; #endif +#endif /* GCC (fixproto) guarantees these system headers exist. */ #include <string.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |