Re: [linux-sh:03284] Caclulting HZ for procps on SH based kernels

Stuart MENEFY <[email protected]> Wed, 14 Jul 2004 16:44:24 +0100
Newsgroups gmane.linux.ports.sh.devel,gmane.linux.ports.sh.general
Organization STMicroelectronics (Bristol)
Message-ID <[email protected]>
Hi Alex

On Wed, 14 Jul 2004 12:20:27 +0100 Alex Bennee <[email protected]> wrote:
> We've just been updating our on-board tools and compiling the latest
> procps (3.2.1) started getting warnings about the kernel not having an
> ELF note. This looks like a change in behaviour (as well as a kludgy
> hack).
> 
> So apart from scanning kcore for random notes is there a clean way to
> export HZ for SH kernels?

Which glibc are you using? I have a patch lying around (which is attached)
which I think I put in to solve this problem.

The problem is that environ is incorrectly initialised early in the
run time start up. It later gets initialised correctly, but because
procps reads the ELF notes in a constructor, it sees the broken value.

Stuart
glibc-2.2.5-initenvp.patch (application/octet-stream, 438 B)
# Set the initial value of envp correctly.
# This will only be visible to constructors, as the value is later rewitten
# correctly before calling remain.

--- glibc-2.2.5.bak/sysdeps/sh/dl-machine.h	Tue Aug  5 17:47:47 2003
+++ glibc-2.2.5/sysdeps/sh/dl-machine.h	Tue Aug  5 17:48:39 2003
@@ -350,6 +350,7 @@
 	mov r5,r7\n\
 	shll2 r7\n\
 	add r15,r7\n\
+	add #8,r7\n\
 	mov.l .L_dl_loaded,r0\n\
 	mov.l @(r0,r12),r0\n\
 	mov.l @r0,r4\n\
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFA9VTY61BlSKQGbXkRAj6gAJ4oEDOFggOXRlbHQyFncnX7NOYMowCfR17u
pPs4K8z8OPFvKZU8+AS3Ffs=
=iVxg
-----END PGP SIGNATURE-----