This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: libgomp platform customization
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Thu, 31 Jan 2019 10:29:40 +0100
- Subject: Re: libgomp platform customization
- References: <deaea3e1-d222-90ee-8ef8-e75a9493b87f@embedded-brains.de>
On Wed, Jan 30, 2019 at 3:46 PM Sebastian Huber
<sebastian.huber@embedded-brains.de> wrote:
>
> Hello,
>
> we would like to use libgomp in a quite constraint environment. In this
> environment using for example the C locale support, errno, malloc(),
> realloc(), free(), and abort() are problematic. One option would be to
> introduce a new header file "config/*/platform.h" which is included in
> libgomp.h right after the #include "config.h". A platform could then do
> something like this:
>
> #define malloc(size) platform_malloc(size)
> ...
>
> In env.c there are some uses of strto*() like this:
>
> errno = 0;
> stride = strtol (env, &env, 10);
> if (errno)
> return false;
>
> I would like to introduce a new header file "strto.h" which defines
> something like this:
>
> static inline char *
> gomp_strtol (char *s, long *value)
> {
> char *end;
>
> errno = 0;
> *value = strtol (s, &end, 10);
> if (errno != 0)
> return NULL;
>
> return end;
> }
>
> Then use:
>
> env = gomp_strtol (env, &stride);
> if (env == NULL)
> return false;
>
> A platform could then provide its own "config/*/strto.h" with an
> alternative implementation.
>
> Would this be acceptable after the GCC 9 release?
I guess you could look at what nvptx and HSA (and GCN on some branch)
do here?
Richard.
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail : sebastian.huber@embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>