This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
BeOS-PPC: problem in libiberty
- To: "'egcs-patches at cygnus dot com'" <egcs-patches at cygnus dot com>
- Subject: BeOS-PPC: problem in libiberty
- From: Andreas Sesterhenn <Andreas dot Sesterhenn at cgtec dot sema dot de>
- Date: Tue, 15 Sep 1998 09:08:58 +0200
- Cc: Andreas Sesterhenn <Andreas dot Sesterhenn at cgtec dot sema dot de>
Hi,
this is my first attempt to post a patch... I hope I did it correctly
(I folowed the instuctions from README-BUGS in the gcc directory)
The Problem:
1)
./configure on my BeBox66 (R3.2) detects the correct machine type
(BeOS-ppc)
2)
when make tries to compile getruntime.c in libiberty the compiler
complaines about
an undefined 'HZ'. in function 'get_runtime'
I checked otherplaces for 'HZ' and found in gcc/FSChangeLog that I
should prefer
CLK_TCK or _SC_CLK_TCK if available (which is on my BeBox).
What surprised me was that in gcc/toplev.c is anothe function
'get_runtime' which
in case of compiling for BeOS simply returns 0 (without any further
comment) instead
of what is nicely calculated afterwards.
I decided to include the nicely calculated result into getruntime.c
which compiles
correcty (say without any problems, whatever that means when it has to
run later).
Here is the patch (at least my first attempt. Let me know if I can
improve anything):
*** getruntime.c Sun Sep 13 15:24:04 1998
--- getruntime.c.orig Sat May 16 01:42:38 1998
***************
*** 40,49 ****
#include <sys/times.h>
#endif
- #ifdef HAVE_UNISTD_H
- #include <unistd.h>
- #endif
-
/* This is a fallback; if wrong, it will likely make obviously wrong
results. */
--- 40,45 ----
***************
*** 62,82 ****
+ rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
#else /* ! HAVE_GETRUSAGE */
#ifdef HAVE_TIMES
- #ifdef _SC_CLK_TCK
- {
- static int tick;
- struct tms tms;
- if (tick == 0)
- tick = 1000000 / sysconf(_SC_CLK_TCK);
- times (&tms);
- return (tms.tms_utime + tms.tms_stime) * tick;
- }
- #else
struct tms tms;
times (&tms);
return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
- #endif /* _SC_CLK_TCK */
#else /* ! HAVE_TIMES */
/* Fall back on clock and hope it's correctly implemented. */
const long clocks_per_sec = CLOCKS_PER_SEC;
--- 58,67 ----
Andreas Sesterhenn
Sema Group CGTec GmbH
e-mail: andreas.sesterhenn@cgtec.sema.de