summaryrefslogtreecommitdiff
path: root/elf/dl-profile.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-04-26 20:12:37 +0000
committerUlrich Drepper <drepper@redhat.com>2009-04-26 20:12:37 +0000
commit6cc8844f1dd985360f662e78ff2272039025635f (patch)
tree6ebb2abaf95bc129ee800558415fdcfac72642ce /elf/dl-profile.c
parent5efe86507d871acd6f52d8d25ee437b7394ac6d5 (diff)
* sysdeps/unix/sysv/linux/dl-osinfo.h (dl_fatal): Remove inline
from definition. * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Don't define label if it is not used. * elf/dl-profile.c (_dl_start_profile): Define real-type variant of gmon_hist_hdr and gmon_hdr structures and use them. * elf/dl-load.c (open_verify): Add temporary variable to avoid warning. * nscd/nscd_helper.c (get_mapping): Avoid casts to avoid warnings. * sunrpc/clnt_raw.c (clntraw_private_s): Use union in definition to avoid cast. * inet/rexec.c (rexec_af): Make sa2 a union to avoid warnings. * inet/rcmd.c (rcmd_af): Make from a union of the various needed types to avoid warnings. (iruserok_af): Use ss_family instead of casts. * gmon/gmon.c (write_hist): Define real-type variant of gmon_hist_hdr structure and use it. (write_gmon): Likewise for gmon_hdr. * sysdeps/unix/sysv/linux/readv.c: Avoid declaration of replacement function if we are not going to define it. * sysdeps/unix/sysv/linux/writev.c: Likewise. * inet/inet6_option.c (optin_alloc): Add temporary variable to avoid warning. * libio/strfile.h (struct _IO_streambuf): Use correct type and name of VTable element. * libio/iovsprintf.c: Avoid casts to avoid warnings. * libio/iovsscanf.c: Likewise. * libio/vasprintf.c: Likewise. * libio/vsnprintf.c: Likewise. * stdio-common/isoc99_vsscanf.c: Likewise. * stdlib/strfmon_l.c: Likewise. * debug/vasprintf_chk.c: Likewise. * debug/vsnprintf_chk.c: Likewise. * debug/vsprintf_chk.c: Likewise.
Diffstat (limited to 'elf/dl-profile.c')
-rw-r--r--elf/dl-profile.c53
1 files changed, 44 insertions, 9 deletions
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 47033f32ef..d9250bcadd 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -1,5 +1,5 @@
/* Profiling of shared libraries.
- Copyright (C) 1997-2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997-2004, 2006, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
Based on the BSD mcount implementation.
@@ -178,8 +178,6 @@ _dl_start_profile (void)
const ElfW(Phdr) *ph;
ElfW(Addr) mapstart = ~((ElfW(Addr)) 0);
ElfW(Addr) mapend = 0;
- struct gmon_hdr gmon_hdr;
- struct gmon_hist_hdr hist_hdr;
char *hist, *cp;
size_t idx;
size_t tossize;
@@ -251,15 +249,52 @@ _dl_start_profile (void)
+ 4 + 4 + fromssize * sizeof (struct here_cg_arc_record));
/* Create the gmon_hdr we expect or write. */
- memset (&gmon_hdr, '\0', sizeof (struct gmon_hdr));
+ struct real_gmon_hdr
+ {
+ char cookie[4];
+ int32_t version;
+ char spare[3 * 4];
+ } gmon_hdr;
+ if (sizeof (gmon_hdr) != sizeof (struct gmon_hdr)
+ || (offsetof (struct real_gmon_hdr, cookie)
+ != offsetof (struct gmon_hdr, cookie))
+ || (offsetof (struct real_gmon_hdr, version)
+ != offsetof (struct gmon_hdr, version)))
+ abort ();
+
memcpy (&gmon_hdr.cookie[0], GMON_MAGIC, sizeof (gmon_hdr.cookie));
- *(int32_t *) gmon_hdr.version = GMON_SHOBJ_VERSION;
+ gmon_hdr.version = GMON_SHOBJ_VERSION;
+ memset (gmon_hdr.spare, '\0', sizeof (gmon_hdr.spare));
/* Create the hist_hdr we expect or write. */
- *(char **) hist_hdr.low_pc = (char *) mapstart;
- *(char **) hist_hdr.high_pc = (char *) mapend;
- *(int32_t *) hist_hdr.hist_size = kcountsize / sizeof (HISTCOUNTER);
- *(int32_t *) hist_hdr.prof_rate = __profile_frequency ();
+ struct real_gmon_hist_hdr
+ {
+ char *low_pc;
+ char *high_pc;
+ int32_t hist_size;
+ int32_t prof_rate;
+ char dimen[15];
+ char dimen_abbrev;
+ } hist_hdr;
+ if (sizeof (hist_hdr) != sizeof (struct gmon_hist_hdr)
+ || (offsetof (struct real_gmon_hist_hdr, low_pc)
+ != offsetof (struct gmon_hist_hdr, low_pc))
+ || (offsetof (struct real_gmon_hist_hdr, high_pc)
+ != offsetof (struct gmon_hist_hdr, high_pc))
+ || (offsetof (struct real_gmon_hist_hdr, hist_size)
+ != offsetof (struct gmon_hist_hdr, hist_size))
+ || (offsetof (struct real_gmon_hist_hdr, prof_rate)
+ != offsetof (struct gmon_hist_hdr, prof_rate))
+ || (offsetof (struct real_gmon_hist_hdr, dimen)
+ != offsetof (struct gmon_hist_hdr, dimen))
+ || (offsetof (struct real_gmon_hist_hdr, dimen_abbrev)
+ != offsetof (struct gmon_hist_hdr, dimen_abbrev)))
+ abort ();
+
+ hist_hdr.low_pc = (char *) mapstart;
+ hist_hdr.high_pc = (char *) mapend;
+ hist_hdr.hist_size = kcountsize / sizeof (HISTCOUNTER);
+ hist_hdr.prof_rate = __profile_frequency ();
if (sizeof (hist_hdr.dimen) >= sizeof ("seconds"))
{
memcpy (hist_hdr.dimen, "seconds", sizeof ("seconds"));