Why the switch from newlib to newlib-cygwin?

Asked by lilvinz

When using newlib time api functions like mktime or localtime, heap is required in newlib-cygwin but is not required in newlib. Why did the 2015q2 release switch over to newlib-cygwin?

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
lilvinz
Solved:
Last query:
Last reply:
Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#1

Hi Lilvinz,

Newlib and Cygwin have merged their git repository into the new newlib-cygwin repository. The old repositories don't receive any commit anymore and all new development to one of these component is made in newlib-cygwin repository. Since we always package the latest version of newlib, we just adapted the repository to pull changes from where they are.

Best regards.

Revision history for this message
lilvinz (lilvinz) said :
#2

Hi Thomas,

thanks for the quick answer.
I am still investigating a solution to use mktime without pulling in malloc.
The issue is that mktime calls _tzset_unlocked_r which uses sscanf.
Are you aware of a clean way to use mktime without heap or should this question be asked at newlib-cygwin?
This basically breaks all my projects and i am probably not the only one affected.

Thanks again and best regards

Vinz

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#3

Hi lilvinz,

I tracked the history of the patch to understand its purpose to a discussion in 2011[1], followed in 2013[2] and again in 2015[3] (just follow the "Follow-up link on each of these pages).

[1] https://sourceware.org/ml/newlib/2011/msg00297.html
[2] https://sourceware.org/ml/newlib/2013/msg00438.html
[3] https://sourceware.org/ml/newlib/2015/msg00330.html

The patch was added to update the timezone info when the TZ environment variable is changed. One of the reply says that if you are not changing TZ, you can define an empty tzset_r function which I hope would avoid pulling in malloc. If not I suggest you contact the newlib community (adding Corinna Vinschen as a Cc) to ask for some help.

Best regards.

Revision history for this message
lilvinz (lilvinz) said :
#4

Hi Thomas,

thanks for the advice.
Providing an empty _tzset_unlocked_r solves the issue for me.

Cheers

Vinz