[RSB 1/3] 6/7: Update Newlib

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Jul 20 07:03:21 UTC 2022

On 20/07/2022 02:24, Chris Johns wrote:
> On 19/7/2022 5:18 pm, Sebastian Huber wrote:
>> On 13/07/2022 11:24, Sebastian Huber wrote:
>>> This makes the --enable-newlib-reent-thread-local (_REENT_THREAD_LOCAL_STORAGE)
>>> Newlib configuration option available.
>> Any comments with respect to using the Newlib thread-local storage configuration
>> option for arm, i386, microblaze, nios2, powerpc, riscv, and sparc?
> Do these archs have working TLS support? It seems Microblaze has issues which
> our tests are not picking up. It would be good to know why our tests are not
> picking up the reported problem.

There seems to be an issue with i386:

08:09:56 runner ['/opt/rtems/6/bin/rtems-ld', '-C', 
'/opt/rtems/6/bin/i386-rtems6-gcc', '-c', '-MMD -Wall 
-Wmissing-prototypes -Wimplicit-function-declaration -Wstrict-prototypes 
-Wnested-externs -mtune=pentiumpro -march=pentium', '-O', 'rap', '-b', 
'/tmp/sh/b-rtems/i386/pc686/testsuites/libtests/dl06/dl06.pre', '-e', 
'rtems_main', '-s', '-o', 
'/tmp/sh/b-rtems/i386/pc686/testsuites/libtests/dl06/dl06-o2.o', '-lm']
error: libc.a:libc_a-lcong48.o at 922544: symbol not found: 

I will remove i386 from the patch.

I can't say much about the microblaze.

> Which archs in the list have you run the testsuite on?

I did test runs with simulators on aarch64, arm, powerpc, riscv, and sparc.

> Has any of newlib's tests been run? Can we run newlib tests?

Are there Newlib tests? We added a newlib01 test which tests some Newlib 

> Did the switch to TLS exceptions end up on 6? I cannot see anything in the RSB
> commit history mentioning it.

No, I wait for your feedback. Here is a back port from GCC 13 to GCC 12:


> Are these TLS allocations in newlib based on a single use of a newlib call that
> brings in the reent stuff? How does that work?

No, each TLS object is defined in the translation unit which uses the 
object. The goal is to get only those objects linked in which are 
needed. Currently, the Newlib thread delete hook pulls in some objects, 
however, this dependency will go away once the TLS destructors are 

> Does this change effect libdl users? TLS has not been implemented in libdl and
> the current reent model still works for those users dependent on libdl

It could affect libdl users. Can you load parts of libc.a with libdl? 
The libdl users could add TLS support or disable the Newlib 
configuration option. To disable the options, we probably need an RSB 
--without-newlib-tls support or use something like --with-newlib-tls=yes 
or --with-newlib-tls=no.

On powerpc/psim for example I get an error like this in dl06:

] load: /dl06.rap
] dlopen failed: global symbol not found: _tls_rand48_add

embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:

More information about the devel mailing list