* config/i386/xmmintrin.h: Only #include <mm_malloc.h> if __STDC_HOSTED__
@ 2017-12-09 17:40 Gerald Pfeifer
2017-12-09 18:46 ` Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Gerald Pfeifer @ 2017-12-09 17:40 UTC (permalink / raw)
To: gcc-patches; +Cc: Andreas Tobler, Alexander Kabaev
Some users on FreeBSD noticed a problem when trying to use GCC to
build things in a standalone environment that manifests itself as
/usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/xmmintrin.h:34 from
/usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/immintrin.h:29 from
/workspace/src/sys/crypto/aesni/intel_sha256.c:62
In function '_mm_malloc':
/usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/mm_malloc.h:39:
error: 'errno' undeclared (first use in this function)
It turns out the clang version of xmmintrin.h does not include mm_malloc.h
if !__STDC_HOSTED__ whereas ours unconditionally does so.
Andreas and Alexander have tested the simple patch below that essentially
mirrors what clang does.
Okay?
Gerald
2017-12-09 Gerald Pfeifer <gerald@pfeifer.com>
* config/i386/xmmintrin.h: Only #include <mm_malloc.h> if
__STDC_HOSTED__.
Index: config/i386/xmmintrin.h
===================================================================
--- config/i386/xmmintrin.h (revision 255523)
+++ config/i386/xmmintrin.h (working copy)
@@ -31,7 +31,9 @@
#include <mmintrin.h>
/* Get _mm_malloc () and _mm_free (). */
+#if __STDC_HOSTED__
#include <mm_malloc.h>
+#endif
/* Constants for use with _mm_prefetch. */
enum _mm_hint
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: config/i386/xmmintrin.h: Only #include <mm_malloc.h> if __STDC_HOSTED__
2017-12-09 17:40 config/i386/xmmintrin.h: Only #include <mm_malloc.h> if __STDC_HOSTED__ Gerald Pfeifer
@ 2017-12-09 18:46 ` Jakub Jelinek
2019-08-18 18:49 ` [PATCH,i386] Don't use errno when freestanding (was: config/i386/xmmintrin.h: Only #include <mm_malloc.h> if __STDC_HOSTED__) Gerald Pfeifer
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2017-12-09 18:46 UTC (permalink / raw)
To: Gerald Pfeifer; +Cc: gcc-patches, Andreas Tobler, Alexander Kabaev
On Sat, Dec 09, 2017 at 06:41:14PM +0100, Gerald Pfeifer wrote:
> Some users on FreeBSD noticed a problem when trying to use GCC to
> build things in a standalone environment that manifests itself as
>
> /usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/xmmintrin.h:34 from
> /usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/immintrin.h:29 from
> /workspace/src/sys/crypto/aesni/intel_sha256.c:62
> In function '_mm_malloc':
> /usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/mm_malloc.h:39:
> error: 'errno' undeclared (first use in this function)
>
> It turns out the clang version of xmmintrin.h does not include mm_malloc.h
> if !__STDC_HOSTED__ whereas ours unconditionally does so.
>
> Andreas and Alexander have tested the simple patch below that essentially
> mirrors what clang does.
>
> Okay?
Wouldn't it be better to just ifdef out parts of gmm_malloc.h (pmm_malloc.h
should be ok)?
#include <errno.h>
and
/* Error if align is not a power of two. */
if (__align & (__align - 1))
{
errno = EINVAL;
return ((void *) 0);
}
I don't see why the rest wouldn't work in a freestanding environment.
Or perhaps just the errno = EINVAL; and #include <errno.h> lines.
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH,i386] Don't use errno when freestanding (was: config/i386/xmmintrin.h: Only #include <mm_malloc.h> if __STDC_HOSTED__)
2017-12-09 18:46 ` Jakub Jelinek
@ 2019-08-18 18:49 ` Gerald Pfeifer
2019-08-19 23:33 ` Jeff Law
0 siblings, 1 reply; 4+ messages in thread
From: Gerald Pfeifer @ 2019-08-18 18:49 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches, Andreas Tobler, Alexander Kabaev
On Sat, 9 Dec 2017, Jakub Jelinek wrote:
>> Some users on FreeBSD noticed a problem when trying to use GCC to
>> build things in a standalone environment that manifests itself as
>>
>> /usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/xmmintrin.h:34 from
>> /usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/immintrin.h:29 from
>> /workspace/src/sys/crypto/aesni/intel_sha256.c:62
>> In function '_mm_malloc':
>> /usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/mm_malloc.h:39:
>> error: 'errno' undeclared (first use in this function)
>>
>> It turns out the clang version of xmmintrin.h does not include mm_malloc.h
>> if !__STDC_HOSTED__ whereas ours unconditionally does so.
>
> Wouldn't it be better to just ifdef out parts of gmm_malloc.h (pmm_malloc.h
> should be ok)?
Very good point, Jakub. Thank you!
Somehow I thought I had submitted this updated patch, but apparently
not so. :-( (This has been on my autotester for ages.)
Okay? And if so, okay for GCC 9 after a while?
Gerald
2019-08-18 Gerald Pfeifer <gerald@pfeifer.com>
* config/i386/gmm_malloc.h: Only include errno.h and use errno
if __STDC_HOSTED__.
Index: config/i386/gmm_malloc.h
===================================================================
--- config/i386/gmm_malloc.h (revision 274618)
+++ config/i386/gmm_malloc.h (working copy)
@@ -25,7 +25,9 @@
#define _MM_MALLOC_H_INCLUDED
#include <stdlib.h>
+#if __STDC_HOSTED__
#include <errno.h>
+#endif
static __inline__ void *
_mm_malloc (size_t __size, size_t __align)
@@ -36,7 +38,9 @@ _mm_malloc (size_t __size, size_t __align)
/* Error if align is not a power of two. */
if (__align & (__align - 1))
{
+#if __STDC_HOSTED__
errno = EINVAL;
+#endif
return ((void *) 0);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH,i386] Don't use errno when freestanding (was: config/i386/xmmintrin.h: Only #include <mm_malloc.h> if __STDC_HOSTED__)
2019-08-18 18:49 ` [PATCH,i386] Don't use errno when freestanding (was: config/i386/xmmintrin.h: Only #include <mm_malloc.h> if __STDC_HOSTED__) Gerald Pfeifer
@ 2019-08-19 23:33 ` Jeff Law
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2019-08-19 23:33 UTC (permalink / raw)
To: Gerald Pfeifer, Jakub Jelinek
Cc: gcc-patches, Andreas Tobler, Alexander Kabaev
On 8/18/19 10:29 AM, Gerald Pfeifer wrote:
> On Sat, 9 Dec 2017, Jakub Jelinek wrote:
>>> Some users on FreeBSD noticed a problem when trying to use GCC to
>>> build things in a standalone environment that manifests itself as
>>>
>>> /usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/xmmintrin.h:34 from
>>> /usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/immintrin.h:29 from
>>> /workspace/src/sys/crypto/aesni/intel_sha256.c:62
>>> In function '_mm_malloc':
>>> /usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/mm_malloc.h:39:
>>> error: 'errno' undeclared (first use in this function)
>>>
>>> It turns out the clang version of xmmintrin.h does not include mm_malloc.h
>>> if !__STDC_HOSTED__ whereas ours unconditionally does so.
>>
>> Wouldn't it be better to just ifdef out parts of gmm_malloc.h (pmm_malloc.h
>> should be ok)?
>
> Very good point, Jakub. Thank you!
>
> Somehow I thought I had submitted this updated patch, but apparently
> not so. :-( (This has been on my autotester for ages.)
>
> Okay? And if so, okay for GCC 9 after a while?
>
> Gerald
>
>
> 2019-08-18 Gerald Pfeifer <gerald@pfeifer.com>
>
> * config/i386/gmm_malloc.h: Only include errno.h and use errno
> if __STDC_HOSTED__.
OK.
jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-08-19 22:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-09 17:40 config/i386/xmmintrin.h: Only #include <mm_malloc.h> if __STDC_HOSTED__ Gerald Pfeifer
2017-12-09 18:46 ` Jakub Jelinek
2019-08-18 18:49 ` [PATCH,i386] Don't use errno when freestanding (was: config/i386/xmmintrin.h: Only #include <mm_malloc.h> if __STDC_HOSTED__) Gerald Pfeifer
2019-08-19 23:33 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).