This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: struct gmon_cg_arc_record


>>>>> "Ulrich" == Ulrich Drepper <drepper@redhat.com> writes:

Ulrich> Jes Sorensen <jes@linuxcare.com> writes:
>> If thats ok with you, I'll cook up a patch straight away.

Ulrich> I have no problem changing this for IA-64.  For Alpha rth
Ulrich> should say whether he think this is a problem.

My idea for a patch would solve the problem by changing the
assignments in gmon/gmon.c - it touches generic code but I doubt it's
too expensive.

I tried it out and it seems to work, can you accept a change like this?

Jes

2000-11-14  Jes Sorensen  <jes@linuxcare.com>

	* gmon/gmon.c (write_call_graph): Use memcpy() to store pointer
	entries in gmon_cg_arc_record array to avoid misaligned stores on
	64 bit architectures.

--- /home/jes/cygnus/libc-2.2/gmon/gmon.c	Tue Apr 18 22:39:11 2000
+++ libc-2.2/gmon/gmon.c	Tue Nov 14 15:23:54 2000
@@ -236,9 +236,9 @@
 	   to_index != 0;
 	   to_index = _gmonparam.tos[to_index].link)
 	{
-	  *(char **) raw_arc[nfilled].from_pc = (char *) frompc;
-	  *(char **) raw_arc[nfilled].self_pc =
-	    (char *)_gmonparam.tos[to_index].selfpc;
+	  memcpy (&raw_arc[nfilled].from_pc, &frompc, sizeof (u_long));
+	  memcpy (&raw_arc[nfilled].self_pc, &_gmonparam.tos[to_index].selfpc,
+		  sizeof (u_long));
 	  *(int *) raw_arc[nfilled].count = _gmonparam.tos[to_index].count;
 
 	  if (++nfilled == NARCS_PER_WRITEV)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]