Mail Archives: djgpp/2015/05/17/06:44:06
On 05/17/2015 11:45 AM, Ozkan Sezer (sezeroz AT gmail DOT com) wrote:
> On 5/17/15, Andris Pavenis (andris DOT pavenis AT iki DOT fi) <djgpp AT delorie DOT com> wrote:
>> On 05/16/2015 10:56 PM, Ozkan Sezer (sezeroz AT gmail DOT com) wrote:
>>> On 5/16/15, Andris Pavenis (andris DOT pavenis AT iki DOT fi) <djgpp AT delorie DOT com>
>>> wrote:
>>>> with gcc >= 4.8?
>>>> If we define own _rdtsc() we get duplicate definition of it when GCC own
>>>> header x86intrin.h is also
>>>> included (for new GCC version). That was the reason why I used GCC
>>>> defined
>>>> function instead
>>>> of DJGPP one.
>>>>
>>>> Can you please show the error or warning messages form each
>>>> problematic case?
>>>>
>>>> I tried to reproduce the problems: commented out the -I$(GCC_INC_DIR)
>>>> additions to CFLAGS in both src/ and tests/makefile.in, compiled src
>>>> using my gcc5 cross-compiler and got no errors or warnings for _rdtsc()
>>>> Tried compiling the test programs: since I am on linux, had to do some
>>>> voodoo in the makefiles by changing gcc and ld to cross- versions and
>>>> by replacing rem.com with /bin/true, they just compiled. (of course,
>>>> no run tests, and found other issues, but no _rdtsc() issues.)
>> I do not remember exactly with which piece of software I got this problem
>> with _rdtsc
>>
>> With DJGPP own _rdtsc the following 2 includes causes compile error:
>>
>> #include <x86intrin.h>
>> #include <time.h>
>>
>> One should be able to use SSE/MMX/AVX instructions with DJGPP.
>>
>> ia32intrin.h defines _rdtsc() and as result one gets duplicate definition if
>> one includes
>> x86intrin.h before time.h without that change (including x86intrin.h
>> instead
>> of defining _rdtsc()).
>>
>> There is fortunately another way without including x86intrin.h from time.h:
>>
>> ia86intrin.h contains '#define _rdtsc() __rdtsc()' and it defines __rdtsc as
>> an inline function.
>> One could also undefine _rdtsc before defining our own.
>>
>> Andris
>>
>>
>
> How about something like the following: when building djgpp, keep our
> version of _rdtsc(), but for users defer to gcc's version:
I already committed change which avoid to include x86intrin.h at all. So also
-Wcat-qual related warnings from GCC MMX/SSE/AVX related stuff no more matter.
About removing GCC own include directory from header files search path:
I would prefer not to do it. The idea of -nostdinc was to tell GCC not to look-up
installed DJGPP header files but use ones from build directory added from command line.
GCC include files is a different stuff and should not be removed from look-up.
It is better to have them included in the same way as it is done when building
user applications.
Andris
>
> Index: include/time.h
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/include/time.h,v
> retrieving revision 1.16
> diff -u -r1.16 time.h
> --- include/time.h 2 May 2015 07:31:49 -0000 1.16
> +++ include/time.h 17 May 2015 08:14:37 -0000
> @@ -112,7 +112,7 @@
> void tzsetwall(void);
> uclock_t uclock(void);
>
> -#if ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || (__GNUC__ > 4))
> +#if !defined(_IN_DJBUILD) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
> || (__GNUC__ > 4))
>
> /* GCC-4.8 has own built-in _rdtsc for ix86. Therefore use it insted
> of DJGPP one. */
> #include <x86intrin.h>
> Index: src/makefile.cfg
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/makefile.cfg,v
> retrieving revision 1.6
> diff -u -r1.6 makefile.cfg
> --- src/makefile.cfg 11 May 2015 11:00:14 -0000 1.6
> +++ src/makefile.cfg 17 May 2015 08:14:37 -0000
> @@ -46,16 +46,17 @@
> @./misc.exe echo - "-Wundef" >>gcc.opt
> @./misc.exe echo - "-Wcast-align" >>gcc.opt
> @./misc.exe echo - "-Wsign-compare" >>gcc.opt
> + @./misc.exe echo - "-D_IN_DJBUILD" >>gcc.opt
> @./misc.exe echo - "-nostdinc" >>gcc.opt
> @./misc.exe echo - "$(IQUOTE)" >>gcc.opt
>
> -
> gcc-l.opt: makefile.cfg
> @./misc.exe echo - "-MD" >gcc-l.opt
> @./misc.exe echo - "-O2" >>gcc-l.opt
> @./misc.exe echo - "$(MTUNE)" >>gcc-l.opt
> @./misc.exe echo - "-march=i386" >>gcc-l.opt
> @./misc.exe echo - "-Wall" >>gcc-l.opt
> + @./misc.exe echo - "-D_IN_DJBUILD" >>gcc-l.opt
> @./misc.exe echo - "-nostdinc" >>gcc-l.opt
> @./misc.exe echo - "$(IQUOTE)" >>gcc-l.opt
>
> Index: src/makefile.inc
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/makefile.inc,v
> retrieving revision 1.16
> diff -u -r1.16 makefile.inc
> --- src/makefile.inc 30 Apr 2015 18:50:42 -0000 1.16
> +++ src/makefile.inc 17 May 2015 08:14:37 -0000
> @@ -51,7 +51,7 @@
>
> # Find GCC own include directory and add it to CFLAGS
> GCC_INC_DIR := $(shell $(CROSS_GCC) -print-file-name=include)
> -CFLAGS += -I$(GCC_INC_DIR)
> +#CFLAGS += -I$(GCC_INC_DIR)
>
> # Pass defines as compiler/assembler switches
> CFLAGS += -DGAS_MAJOR=$(GAS_MAJOR)
>
> If this is acceptable (and works for you+everyone), a similar change
> needs to be done in the tests makefiles. (I've done that locally and
> cross-built the libc test programs without errors.)
>
> --
> O.S.
>
>
- Raw text -