Well, since no one else has responded, what would you say to this
(attached)?
If you like, I can write up a detailed description about why I believe
this is the way to go, but hopefully the comments and code speak for
themselves. This should give the correct definitions for 32bit, LP64
and LLP64.
If this is approved, someone else will have to commit it. git is not my
thing.
dw
On 7/20/2014 2:18 AM, Ozkan Sezer wrote:
Regarding gcc PR target/61662:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61662
http://gcc.gnu.org/viewcvs/gcc?view=revision&sortby=date&revision=212826
In our intrin.h (and stdlib.h), we are overriding the definitions
from ia32intrin.h possibly the original definition from gcc used
to be wrong with relation to _LLP64? Even if that were the case,
what we have is wrong because _lrotl and _lrotr accept and return
unsigned long for both win32 _and_ win64, and for windows that is
strictly 32 bits. We need to fix this.
--
O.S.
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
diff --git a/mingw-w64-headers/crt/intrin.h b/mingw-w64-headers/crt/intrin.h
index db4d7cd..8a08e9d 100644
--- a/mingw-w64-headers/crt/intrin.h
+++ b/mingw-w64-headers/crt/intrin.h
@@ -430,19 +430,19 @@ extern "C" {
__MACHINEIA64(__MINGW_EXTENSION __int64 __load128_acq(void *,__int64 *))
__MACHINEZ(void __cdecl longjmp(jmp_buf,int))
-#pragma push_macro ("_lrotl")
-#undef _lrotl
-#pragma push_macro ("_lrotr")
-#undef _lrotr
-#ifdef __x86_64__
- __MACHINE(__MINGW_EXTENSION unsigned long long __cdecl _lrotl(unsigned long long,int))
- __MACHINE(__MINGW_EXTENSION unsigned long long __cdecl _lrotr(unsigned long long,int))
-#else
- __MACHINE(unsigned __LONG32 __cdecl _lrotl(unsigned __LONG32,int))
- __MACHINE(unsigned __LONG32 __cdecl _lrotr(unsigned __LONG32,int))
-#endif
-#pragma pop_macro ("_lrotl")
-#pragma pop_macro ("_lrotr")
+/* If x86intrin.h has already been included, we already have these definitions */
+#ifndef _X86INTRIN_H_INCLUDED
+/* When using 4 byte longs (x86 or x64+native Windows) */
+#ifndef __LP64__
+ /* use the 32bit rotates in MSVCRT.dll */
+ __MACHINE(unsigned long __cdecl _lrotl(unsigned long,int))
+ __MACHINE(unsigned long __cdecl _lrotr(unsigned long,int))
+#else /* __LP64__ */
+/* Under systems that use 8 byte longs (like 64bit cygwin), we need 8 byte rotates */
+#define _lrotl(a,b) _rotl64((a), (b))
+#define _lrotr(a,b) _rotr64((a), (b))
+#endif /* __LP64__ */
+#endif /* _X86INTRIN_H_INCLUDED */
__MACHINEI(__MINGW_EXTENSION unsigned __int64 __ll_lshift(unsigned __int64,int))
__MACHINEI(__MINGW_EXTENSION __int64 __ll_rshift(__int64,int))
diff --git a/mingw-w64-headers/crt/stdlib.h b/mingw-w64-headers/crt/stdlib.h
index e38d481..18a569d 100644
--- a/mingw-w64-headers/crt/stdlib.h
+++ b/mingw-w64-headers/crt/stdlib.h
@@ -526,19 +526,20 @@ float __cdecl __MINGW_NOTHROW strtof(const char * __restrict__ _Str,char ** __re
_CRTIMP int __cdecl _atodbl_l(_CRT_DOUBLE *_Result,char *_Str,_locale_t _Locale);
_CRTIMP int __cdecl _atoldbl_l(_LDOUBLE *_Result,char *_Str,_locale_t _Locale);
_CRTIMP int __cdecl _atoflt_l(_CRT_FLOAT *_Result,char *_Str,_locale_t _Locale);
-#pragma push_macro ("_lrotr")
-#pragma push_macro ("_lrotl")
-#undef _lrotr
-#undef _lrotl
-#ifdef __x86_64__
- __MINGW_EXTENSION unsigned long long __cdecl _lrotl(unsigned long long _Val,int _Shift);
- __MINGW_EXTENSION unsigned long long __cdecl _lrotr(unsigned long long _Val,int _Shift);
-#else
- unsigned long __cdecl _lrotl(unsigned long _Val,int _Shift);
- unsigned long __cdecl _lrotr(unsigned long _Val,int _Shift);
-#endif
-#pragma pop_macro ("_lrotl")
-#pragma pop_macro ("_lrotr")
+
+ /* If x86intrin.h has already been included, we already have these definitions */
+#ifndef _X86INTRIN_H_INCLUDED
+/* When using 4 byte longs (x86 or x64+native Windows) */
+#ifndef __LP64__
+ /* use the 32bit rotates in MSVCRT.dll */
+ unsigned long __cdecl _lrotl(unsigned long,int);
+ unsigned long __cdecl _lrotr(unsigned long,int);
+#else /* __LP64__ */
+/* Under systems that use 8 byte longs (like 64bit cygwin), we need 8 byte rotates */
+#define _lrotl(a,b) _rotl64((a), (b))
+#define _lrotr(a,b) _rotr64((a), (b))
+#endif /* __LP64__ */
+#endif /* _X86INTRIN_H_INCLUDED */
_CRTIMP void __cdecl _makepath(char *_Path,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext);
_onexit_t __cdecl _onexit(_onexit_t _Func);
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public