[PATCH] CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE

Joel Sherrill joel at rtems.org
Thu Sep 10 14:40:19 UTC 2020


How is the user/system integrator supposed to figure out the size of the
TLS? It is not known until the application is linked and thus varies based
on the total set of code linked.

As far as I can tell, this makes this type of task creation unsuitable for
use in libraries where the end system is unknown.

It is at least fragile in tightly controlled applications and subject to
someone guessing a number larger than required which wastes memory and goes
against the intent of the statically allocated thread resources.

If there is a practical and portable way to know this number, it needs to
be explained quite well in the documentation and always used in any tests
or examples.

--joel

On Thu, Sep 10, 2020 at 9:33 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> Document this application configuration option.
>
> Update #4074.
> ---
>  c-user/config/classic-api.rst | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>
> diff --git a/c-user/config/classic-api.rst b/c-user/config/classic-api.rst
> index f0fbe6f..d7002ad 100644
> --- a/c-user/config/classic-api.rst
> +++ b/c-user/config/classic-api.rst
> @@ -366,6 +366,41 @@ NOTES:
>      the addition of a new configuration parameter to specify the number of
>      tasks which enable floating point support.
>
> +.. index:: CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE
> +
> +.. _CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE:
> +
> +CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE
> +-------------------------------------------
> +
> +CONSTANT:
> +    ``CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE``
> +
> +OPTION TYPE:
> +    This configuration option is an integer define.
> +
> +DEFAULT VALUE:
> +    The default value is 0.
> +
> +VALUE CONSTRAINTS:
> +    The value of this configuration option shall be greater than or equal
> to 0
> +    and less than or equal to `SIZE_MAX <
> https://en.cppreference.com/w/c/types/limits>`_.
> +
> +DESCRIPTION:
> +    If the value of this configuration option is greater than zero, then
> it
> +    defines the maximum thread-local storage size, otherwise the
> thread-local
> +    storage size is defined by the linker depending on the thread-local
> storage
> +    objects used by the application in the statically-linked executable.
> +
> +NOTES:
> +    This configuration option can be used to reserve space for the
> dynamic linking
> +    of modules with thread-local storage objects.
> +
> +    If the thread-local storage size defined by the thread-local storage
> +    objects used by the application in the statically-linked executable
> is greater
> +    than a non-zero value of this configuration option, then a fatal
> error will
> +    occur during system initialization.
> +
>  .. index:: CONFIGURE_MAXIMUM_TIMERS
>
>  .. _CONFIGURE_MAXIMUM_TIMERS:
> --
> 2.26.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200910/07590044/attachment.html>


More information about the devel mailing list