public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* 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

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).