libgomp platform customization

Sebastian Huber sebastian.huber@embedded-brains.de
Thu Jan 31 09:37:00 GMT 2019


On 31/01/2019 10:29, Richard Biener wrote:
> 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?

My problem is that our real-time operating system (RTEMS) is somewhere 
in between a full blown Linux and the offload hardware. I would like to 
get rid of stuff which depends on the Newlib struct _reent since this 
pulls in a lot of dependencies. The heavy weight functions are just used 
for the initialization (env.c) and error reporting. Containing the heap 
allocation functions helps to control the memory used by OpenMP 
computations.

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



More information about the Gcc mailing list