This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: nvptx offloading patches [3/n], RFD
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Ilya Verbin <iverbin at gmail dot com>, Bernd Schmidt <bernds at codesourcery dot com>, Thomas Schwinge <thomas at codesourcery dot com>, Richard Biener <richard dot guenther at gmail dot com>, Jan Hubicka <hubicka at ucw dot cz>, <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 17 Feb 2015 16:21:06 +0000
- Subject: Re: nvptx offloading patches [3/n], RFD
- Authentication-results: sourceware.org; auth=none
- References: <5454CAB9 dot 3040907 at codesourcery dot com> <20150204113817 dot GO1746 at tucnak dot redhat dot com> <CAFiYyc11FF2EeOQzqVmQu=q9-Uh-YCN0e38jUn-jmhD9gUrWsw at mail dot gmail dot com> <20150216210812 dot GO1746 at tucnak dot redhat dot com> <20150217133206 dot GA62715 at msticlxl57 dot ims dot intel dot com> <20150217153918 dot GX1746 at tucnak dot redhat dot com>
On Tue, 17 Feb 2015, Jakub Jelinek wrote:
> Third attempt failed with:
> ../../../libgcc/config/nvptx/realloc.c:24:20: fatal error: stdlib.h: No such file or directory
> compilation terminated.
> ../../../libgcc/static-object.mk:17: recipe for target 'realloc.o' failed
> make[2]: *** [realloc.o] Error 1
> make[2]: *** Waiting for unfinished jobs....
> make[2]: Leaving directory '/usr/src/gcc/objnvptx/nvptx-none/libgcc'
> I have nvptx-newlib symlinked into the gcc tree as newlib, so I expected it
> would be built in-tree, is that not the case (at least wiki/Offloading
> mentions that). Or is it just that libgcc can't really have dependencies on
> newlib headers as newlib is built after libgcc?
I've committed this patch to fix this last issue (the header dependence,
that is; I don't know about the in-tree build).
2015-02-17 Joseph Myers <joseph@codesourcery.com>
* config/nvptx/realloc.c: Include <stddef.h> instead of <stdlib.h>
and <string.h>.
(__nvptx_realloc): Call __builtin_memcpy instead of memcpy.
Index: libgcc/config/nvptx/realloc.c
===================================================================
--- libgcc/config/nvptx/realloc.c (revision 220763)
+++ libgcc/config/nvptx/realloc.c (working copy)
@@ -21,8 +21,7 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#include <stdlib.h>
-#include <string.h>
+#include <stddef.h>
#include "nvptx-malloc.h"
void *
@@ -44,7 +43,7 @@ __nvptx_realloc (void *ptr, size_t newsz)
oldsz = *sp;
}
if (oldsz != 0)
- memcpy (newptr, ptr, oldsz > newsz ? newsz : oldsz);
+ __builtin_memcpy (newptr, ptr, oldsz > newsz ? newsz : oldsz);
__nvptx_free (ptr);
return newptr;
--
Joseph S. Myers
joseph@codesourcery.com