X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com Message-ID: <4EA6EFEB.2000803@iki.fi> Date: Tue, 25 Oct 2011 20:20:43 +0300 From: Andris Pavenis User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20110927 Thunderbird/7.0 MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: _rdtsc(void) inline function in time.h - cause problem with multiple definition during linking References: <4ce51722-c2fd-4fe0-8cb9-ebae498c3271 AT r1g2000yqm DOT googlegroups DOT com> <83k47tc9u2 DOT fsf AT gnu DOT org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com On 10/25/2011 07:33 PM, Ozkan Sezer wrote: > On Tue, Oct 25, 2011 at 7:30 PM, Eli Zaretskii wrote: >>> From: RayeR >>> 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__? >> > > BTW, is the issue with 2.03 or 2.04? IIRC, 2.04 had fix applied for this. Yes. But the fix is newer than the beta version from djgpp/beta/v2 as far as I remember Perhaps it could be good time to release a new beta sometime. Andris