aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorRong Xu <xur@gcc.gnu.org>2014-01-09 19:13:47 +0000
committerRong Xu <xur@gcc.gnu.org>2014-01-09 19:13:47 +0000
commit2c973ee7b3654c0c8b559250bef7ade3861747b3 (patch)
tree0ebca650b7992aca3c064fcce32a3e3cff7585c7 /libgcc
parent2899377bbbc8a3df0fb226ae37122b572801e451 (diff)
downloadgcc-2c973ee7b3654c0c8b559250bef7ade3861747b3.zip
gcc-2c973ee7b3654c0c8b559250bef7ade3861747b3.tar.gz
gcc-2c973ee7b3654c0c8b559250bef7ade3861747b3.tar.bz2
libgcov-driver.c (this_prg): make it local to save bss space.
2014-01-09 Rong Xu <xur@google.com> * libgcc/libgcov-driver.c (this_prg): make it local to save bss space. (gcov_exit_compute_summary): Ditto. (gcov_exit_merge_gcda): Ditto. (gcov_exit_merge_summary): Ditto. (gcov_exit_dump_gcov): Ditto. From-SVN: r206483
Diffstat (limited to 'libgcc')
-rw-r--r--libgcc/libgcov-driver.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c
index 8429c69..f8abdb1 100644
--- a/libgcc/libgcov-driver.c
+++ b/libgcc/libgcov-driver.c
@@ -303,8 +303,6 @@ gcov_compute_histogram (struct gcov_summary *sum)
}
}
-/* summary for program. */
-static struct gcov_summary this_prg;
/* gcda filename. */
static char *gi_filename;
/* buffer for the fn_data from another program. */
@@ -317,10 +315,10 @@ static struct gcov_summary_buffer *sum_buffer;
static int run_accounted = 0;
/* This funtions computes the program level summary and the histo-gram.
- It computes and returns CRC32 and stored summari in THIS_PRG. */
+ It computes and returns CRC32 and stored summary in THIS_PRG. */
static gcov_unsigned_t
-gcov_exit_compute_summary (void)
+gcov_exit_compute_summary (struct gcov_summary *this_prg)
{
struct gcov_info *gi_ptr;
const struct gcov_fn_info *gfi_ptr;
@@ -332,7 +330,7 @@ gcov_exit_compute_summary (void)
gcov_unsigned_t crc32 = 0;
/* Find the totals for this execution. */
- memset (&this_prg, 0, sizeof (this_prg));
+ memset (this_prg, 0, sizeof (*this_prg));
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
{
crc32 = crc32_unsigned (crc32, gi_ptr->stamp);
@@ -357,7 +355,7 @@ gcov_exit_compute_summary (void)
if (!gi_ptr->merge[t_ix])
continue;
- cs_ptr = &this_prg.ctrs[t_ix];
+ cs_ptr = &(this_prg->ctrs[t_ix]);
cs_ptr->num += ci_ptr->num;
crc32 = crc32_unsigned (crc32, ci_ptr->num);
@@ -371,7 +369,7 @@ gcov_exit_compute_summary (void)
}
}
}
- gcov_compute_histogram (&this_prg);
+ gcov_compute_histogram (this_prg);
return crc32;
}
@@ -393,6 +391,7 @@ struct gcov_filename_aux{
static int
gcov_exit_merge_gcda (struct gcov_info *gi_ptr,
struct gcov_summary *prg_p,
+ struct gcov_summary *this_prg,
gcov_position_t *summary_pos_p,
gcov_position_t *eof_pos_p,
gcov_unsigned_t crc32)
@@ -446,7 +445,7 @@ gcov_exit_merge_gcda (struct gcov_info *gi_ptr,
goto next_summary;
for (t_ix = 0; t_ix != GCOV_COUNTERS_SUMMABLE; t_ix++)
- if (tmp.ctrs[t_ix].num != this_prg.ctrs[t_ix].num)
+ if (tmp.ctrs[t_ix].num != this_prg->ctrs[t_ix].num)
goto next_summary;
*prg_p = tmp;
*summary_pos_p = *eof_pos_p;
@@ -636,7 +635,7 @@ gcov_exit_write_gcda (const struct gcov_info *gi_ptr,
static int
gcov_exit_merge_summary (const struct gcov_info *gi_ptr, struct gcov_summary *prg,
- gcov_unsigned_t crc32,
+ struct gcov_summary *this_prg, gcov_unsigned_t crc32,
struct gcov_summary *all_prg __attribute__ ((unused)))
{
struct gcov_ctr_summary *cs_prg, *cs_tprg;
@@ -650,7 +649,7 @@ gcov_exit_merge_summary (const struct gcov_info *gi_ptr, struct gcov_summary *pr
for (t_ix = 0; t_ix < GCOV_COUNTERS_SUMMABLE; t_ix++)
{
cs_prg = &(prg->ctrs[t_ix]);
- cs_tprg = &this_prg.ctrs[t_ix];
+ cs_tprg = &(this_prg->ctrs[t_ix]);
if (gi_ptr->merge[t_ix])
{
@@ -719,7 +718,8 @@ gcov_exit_merge_summary (const struct gcov_info *gi_ptr, struct gcov_summary *pr
static void
gcov_exit_dump_gcov (struct gcov_info *gi_ptr, struct gcov_filename_aux *gf,
- gcov_unsigned_t crc32, struct gcov_summary *all_prg)
+ gcov_unsigned_t crc32, struct gcov_summary *all_prg,
+ struct gcov_summary *this_prg)
{
struct gcov_summary prg; /* summary for this object over all program. */
int error;
@@ -743,7 +743,7 @@ gcov_exit_dump_gcov (struct gcov_info *gi_ptr, struct gcov_filename_aux *gf,
gcov_error ("profiling:%s:Not a gcov data file\n", gi_filename);
goto read_fatal;
}
- error = gcov_exit_merge_gcda (gi_ptr, &prg, &summary_pos, &eof_pos,
+ error = gcov_exit_merge_gcda (gi_ptr, &prg, this_prg, &summary_pos, &eof_pos,
crc32);
if (error == -1)
goto read_fatal;
@@ -757,7 +757,7 @@ gcov_exit_dump_gcov (struct gcov_info *gi_ptr, struct gcov_filename_aux *gf,
summary_pos = eof_pos;
}
- error = gcov_exit_merge_summary (gi_ptr, &prg, crc32, all_prg);
+ error = gcov_exit_merge_summary (gi_ptr, &prg, this_prg, crc32, all_prg);
if (error == -1)
goto read_fatal;
@@ -787,13 +787,14 @@ gcov_exit (void)
struct gcov_filename_aux gf;
gcov_unsigned_t crc32;
struct gcov_summary all_prg;
+ struct gcov_summary this_prg;
/* Prevent the counters from being dumped a second time on exit when the
application already wrote out the profile using __gcov_dump(). */
if (gcov_dump_complete)
return;
- crc32 = gcov_exit_compute_summary ();
+ crc32 = gcov_exit_compute_summary (&this_prg);
allocate_filename_struct (&gf);
#if !GCOV_LOCKED
@@ -802,7 +803,7 @@ gcov_exit (void)
/* Now merge each file. */
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
- gcov_exit_dump_gcov (gi_ptr, &gf, crc32, &all_prg);
+ gcov_exit_dump_gcov (gi_ptr, &gf, crc32, &all_prg, &this_prg);
run_accounted = 1;
if (gi_filename)