4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-23 07:27:21 +08:00
Sebastian Huber 03e815a91b Use weak reference for _REENT_SMALL
Avoid a strong reference to __sfp[] for _impure_data.  The __sfp[] is linked in
if __sinit() is used for example.
2022-05-19 19:01:49 +02:00

23 lines
901 B
C

#include <reent.h>
/* Redeclare these symbols locally as weak so that the file containing
their definitions (along with a lot of other stuff) isn't sucked in
unless they are actually used by other compilation units. This is
important to reduce image size for targets with very small amounts
of memory. */
#ifdef _REENT_SMALL
#ifdef _REENT_GLOBAL_STDIO_STREAMS
extern __FILE __sf[3] _ATTRIBUTE ((weak));
#else
extern const struct __sFILE_fake __sf_fake_stdin _ATTRIBUTE ((weak));
extern const struct __sFILE_fake __sf_fake_stdout _ATTRIBUTE ((weak));
extern const struct __sFILE_fake __sf_fake_stderr _ATTRIBUTE ((weak));
#endif
#endif
struct _reent __ATTRIBUTE_IMPURE_DATA__ _impure_data = _REENT_INIT (_impure_data);
#ifdef __CYGWIN__
extern struct _reent reent_data __attribute__ ((alias("_impure_data")));
#endif
struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr = &_impure_data;