[Python-Dev] --with-tsc compile fails

Michael Hudson mwh at python.net
Wed Sep 15 15:51:55 CEST 2004


Jeremy Hylton <jhylton at gmail.com> writes:

> I'm feeling pretty out of it :-).  I'm very happy to see that the
> Pentium tsc patch made it into the core; I had missed it.  I'm amused
> that the Pentium tsc patch works for PPC, too.

I did consider changing all the names but couldn't be bothered.

> Anyway, I tried to use it this evening and the compilation failed:
>
> ../Python/ceval.c:50:21: asm/msr.h: No such file or directory
> ../Python/ceval.c: In function `PyEval_EvalFrame':
> ../Python/ceval.c:575: warning: implicit declaration of function `rdtscll'
> ../Python/ceval.c:572: warning: `inst0' might be used uninitialized in
> this function
> ../Python/ceval.c:572: warning: `inst1' might be used uninitialized in
> this function
> ../Python/ceval.c:572: warning: `loop0' might be used uninitialized in
> this function
> ../Python/ceval.c:572: warning: `loop1' might be used uninitialized in
> this function
>
> It sounds like <asm/msr.h> is for Microsoft platforms, but I'm
> building on Linux.  Perhaps the change to add PPC support screwed up
> the ifdefs that were detecting a Windows compile?

Well, it failed like that for me both before and after my PPC changes.
I'm fairly sure I didn't mess this up.  Maybe there's some
kernel-headers package that's necessary.

OTOH, I think one could replace the include by

#define rdtscll(val) \
     __asm__ __volatile__("rdtsc" : "=A" (val))

if my limited googling is anything to go by.  It also seems asm/msr.h
is a "kernel internal header with absolutely no stable API
properties...." (Redhat bugzilla).

So, now I've written this email <wink>, I think we should take out the
include and put in the #define.

Anyone who cares about, e.g., Windows can find out how to make their
compiler do this.

Cheers,
mwh

-- 
  Presumably pronging in the wrong place zogs it.
                                        -- Aldabra Stoddart, ucam.chat


More information about the Python-Dev mailing list