www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2011/10/26/04:15:59

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-Id: <201110260815.p9Q8FoVI023833@delorie.com>
X-Recipient: djgpp AT delorie DOT com
From: "Josep M." <josepmaria AT turomas DOT com>
To: <djgpp AT delorie DOT com>
Subject: RE: _rdtsc(void) inline function in time.h - cause problem with multiple definition during linking
Date: Wed, 26 Oct 2011 09:49:08 +0200
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook, Build 11.0.5510
In-reply-to: <83k47tc9u2.fsf@gnu.org>
Thread-Index: AcyTM7z59uXYe2UDRNKtbn0JK8ijowAf6mUg
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id p9Q8FuVI023838
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

I don't know if that could be the problem but rdtsc returns 2 32 bits
values. The example is not an inline function, but an rdtsc function could
be like:

long long unsigned rdtsc()
{
long unsigned hi,lo;
long long unsigned nmb;

asm volatile(
	"rdtsc"
    :"=a"(lo),"=d"(hi)
    );
nmb=(((long long)hi)<<32)|((long long)lo);
return nmb;
}



-----Mensaje original-----
De: Eli Zaretskii [mailto:eliz AT gnu DOT org] 
Enviado el: dimarts, 25 / octubre / 2011 18:31
Para: djgpp AT delorie DOT com
Asunto: Re: _rdtsc(void) inline function in time.h - cause problem with
multiple definition during linking

> From: RayeR <glaux AT centrum DOT cz>
> Date: Tue, 25 Oct 2011 04:02:09 -0700 (PDT)
> 
> during compiling large sources I run into troubles with multiple
> _rdtsc(void) definition during linking. The problem is caused when in
> 1st stage is compiled a library that includes time.h and then in 2nd
> stage is compiled main app that also includes time.h Because there is
> _rdtsc() code already in library linker got confused what to use.
> 
> Do you think it should be fixed DJGPP time.h header to redefine
> 
> extern __inline__ unsigned long long
> _rdtsc(void)
> {
>   unsigned long long result;
>   __asm__ __volatile__ ("rdtsc" : "=A"(result) );
>   return result;
> }
> 
> to static?

Can you show the error messages you get?

It is strange that you should get any errors at all: an inline
function is like a macro, it disappears without a trace in the
compiled object code, so the linker should not complain, because
there's no symbol corresponding to the function for it to see any
multiple definitions.  There simply should not be any definition at
all.

Did you perhaps disable inlining, or compiled with some headers that
define away __inline__?


__________ Información de NOD32, revisión 6574 (20111025) __________

Este mensaje ha sido analizado con NOD32 antivirus system
http://www.nod32.com



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019