On Wed, Dec 12, 2018 at 02:02:20PM +0100, Tom de Vries wrote:
> This RFC patch implements that approach for getpid and gethostname (I
> wonder though whether it's not possible to turn the corresponding
> configure tests into link tests, which could also fix this for nvptx).
> 
> Another problem we're running into is missing istty, pulled in by
> fwrite. The nvptx newlib port does support write, but I'm unsure in what
> form I should handle this.  Add configure tests for fwrite and write? Or
> special case the files in the config/nvptx dir? Any advice here?
> 
> Thanks,
> - Tom

> [RFC][libgomp, nvptx] Fix target-5.c compilation
> 
> Libgomp test-case libgomp.c/target-5.c is failing to compile with nvptx
> accelerator due to missing:
> - getpid
> - gethostname
> - isatty (pulled in by fwrite)
> in the nvptx newlib.
> 
> This demonstrator patch fixes that by minimally guarding all related locations
> with ifndef LIBGOMP_OFFLOADED_ONLY, which allows the test-case (and others) to
> pass.

I guess my preference would be something similar to what
libgomp/config/mingw32/affinity-fmt.c does now, so override the file,
define/undefine something in there and include the common affinity-fmt.c.
Perhaps for the fwrite stuff define introduce a function that does that
(say
void
gomp_print_string (const char *str, size_t len)
{
  fwrite (str, 1, len, stderr);
},
because it is in more than one file, make it hidden in libgomp.h.
config/nvptx/error.c then has what you could also use in
config/nvptx/affinity-fmt.c.
And for hostname/getpid maybe just #undef those with a comment?

        Jakub

Reply via email to