Hi David, > On 18 Aug 2021, at 20:54, David Malcolm via Gcc-patches > <gcc-patches@gcc.gnu.org> wrote: > > On Wed, 2021-08-18 at 20:40 +0100, Iain Sandoe wrote: >> Hi, >> >> * Note, the strategy in jit.exp has the assumption that >> $target==$host >> the patches here adhere to that - there is far less testsuite >> library >> support for host-side facilities (which we’d probably want to add >> if >> it was desirable to operate the Jit in a cross-compiler >> environment). > > Various people have expressed wanting to use libgccjit for ahead-of- > time cross-compilation, so that's a use-case we're going to want to > support at some point (e.g. the libgccjit-based rustc backend).
ack. That will be interesting to arrange; e.g. there will have to be some way to find N host-side libraries that correspond to N cross-toolchains + 1 host- side library that generates code for the host as a target. Given that we can only have one backend per library - although a standard toolchain layout can accommodate multiple cross-toolchains + the native. Probably, there’s a fair amount of test-suite library work to do to make it possible to query similar capability information about the host (to that that we currently query for targets). Finally, I guess, some way of offloading the built objects to the cross-target so that the execute portion can be done. >> ——— [snip] >> diff --git a/gcc/jit/docs/examples/tut04-toyvm/toyvm.cc >> b/gcc/jit/docs/examples/tut04-toyvm/toyvm.cc >> index 4b9c7651ee3..7e9550159ad 100644 >> --- a/gcc/jit/docs/examples/tut04-toyvm/toyvm.cc >> +++ b/gcc/jit/docs/examples/tut04-toyvm/toyvm.cc >> @@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see >> #include <stdlib.h> >> #include <string.h> >> >> -#include <dejagnu.h> >> +#include "jit-dejagnu.h" >> >> #include <libgccjit++.h> >> > > There's a Makefile in gcc/jit/docs/examples/tut04-toyvm which can be > used to build these, so do the > #include "jit-dejagnu.h" > will need to be adjusted to give a path that finds the new header? > That said, the Makefile seems to assume pkg-config, so it's not working > particularly well as-is, so maybe there's no need to fix this. I don’t think that the current Makefile has any provision for finding dejagnu.h; It will happen to work if that header is in one of the default include search paths - but not otherwise. Given that the Makefile seems to be designed for building the examples in- source, I could make a patch that adds -I ../../.. to it to include the jit root? Or we could symlink it - although presumably that would not work for hosts that do not support symlinks. > test-threads.c does some preprocessor hackery to make <dejagnu.h> > threadsafe which it would be nice to fix, but that feels like followup > work and not needed for this patch. thanks, I’ve applied it as-is - but happy to make one of the two changes above to the tut04 Makefile. thanks, Iain