X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Authenticated: #27081556 X-Provags-ID: V01U2FsdGVkX181eytdszg1Q3ruvKhfSJxGirLEqERE29m7rRniZG arhtLgXRVgxzmt From: Juan Manuel Guerrero To: djgpp-workers AT delorie DOT com Subject: Multiple definition of rdtsc. Date: Tue, 4 Jan 2011 01:13:25 +0100 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201101040113.25277.juan.guerrero@gmx.de> X-Y-GMX-Trusted: 0 Reply-To: djgpp-workers AT delorie DOT com Some time ago I reported difficulties compiling sources when time.h was included. See thread: The reason for the failure was the changed extern __inline__ semantics between gnu89 and gnu99 (ISO C99). The issue was fixed by replacing extern with static qualifier. But that was wrong. Assuming that the original behviour shall be retained, I think that the patch below will do a better job. Of course, there are other headers that need to be adjusted too concerning the changed extern __inline__ semantics. Regards, Juan M. Guerrero * include/time.h: Ensure that old GNU extern inline semantics is used (aka -fgnu89-inline). diff -aprNU7 djgpp.orig/include/time.h djgpp/include/time.h --- djgpp.orig/include/time.h 2009-08-01 04:56:16 +0000 +++ djgpp/include/time.h 2011-01-04 00:38:04 +0000 @@ -1,7 +1,8 @@ +/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #ifndef __dj_include_time_h_ #define __dj_include_time_h_ @@ -106,17 +107,25 @@ typedef long long uclock_t; int gettimeofday(struct timeval *_tp, struct timezone *_tzp); unsigned long rawclock(void); int select(int _nfds, fd_set *_readfds, fd_set *_writefds, fd_set *_exceptfds, struct timeval *_timeout); int settimeofday(struct timeval *_tp, ...); void tzsetwall(void); uclock_t uclock(void); -static unsigned long long _rdtsc(void); +/* Ensure that always old GNU extern inline semantics is used + (aka -fgnu89-inline) even if ISO C99 semantics has been specified. */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) +# define EXTERN_INLINE extern inline __attribute__ ((__gnu_inline__)) +#else +# define EXTERN_INLINE extern inline +#endif + +unsigned long long _rdtsc(void); -static __inline__ unsigned long long +EXTERN_INLINE unsigned long long _rdtsc(void) { unsigned long long result; __asm__ __volatile__ ("rdtsc" : "=A"(result) ); return result; }