delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
X-Recipient: | djgpp AT delorie DOT com |
X-Authenticated: | #27081556 |
X-Provags-ID: | V01U2FsdGVkX1/V41ZIwH/VM5FQvsva1ECity0Y2NN8+/CnXICs2H |
YairFhqTUBlUXf | |
From: | Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de> |
To: | djgpp AT delorie DOT com |
Subject: | Re: _rdtsc(void) inline function in time.h - cause problem with multiple definition during linking |
Date: | Tue, 25 Oct 2011 21:58:46 +0200 |
User-Agent: | KMail/1.9.10 |
MIME-Version: | 1.0 |
Message-Id: | <201110252158.46570.juan.guerrero@gmx.de> |
X-Y-GMX-Trusted: | 0 |
> Hi, > 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? This is not a correct fix. If time.h is changed to use static instead of extern, libc.a will no longer have _rdtsc symbol. There are many more uses of extern inline in DJGPP (grep for "extern __inline"). The problem is that djdev204 doesn't support extern inline functions with recent GCC versions in -std=c99 and -std=gnu99 modes. See: http://gcc.gnu.org/ml/gcc/2006-11/msg00006.html http://gcc.gnu.org/gcc-4.3/porting_to.html In short this has already been fixed in the CVS repository. See <http://www.delorie.com/archives/browse.cgi?p=djgpp-workers/2011/01/03/19:13:06>. The new macro _EXTERN_INLINE is defined in include/sys/cdefs.h and makes sure that the right GNU extern inline semantics is used depending on the compiler version used. Use it where appropriate. To solve your problems you can either check out the lib sources and recompile the library or add the following switch to the CFLAGS variable in the Makefiles you use: -fgnu89-inline Adding -fgnu89-inline to your compiler options and using the existing stock djdev204 should solve all your problems. HTH, Juan M. Guerrero
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |