README.md
1# Picolibc
2Copyright © 2018-2022 Keith Packard
3
4Picolibc is library offering standard C library APIs that targets
5small embedded systems with limited RAM. Picolibc was formed by blending
6code from [Newlib](http://sourceware.org/newlib/) and
7[AVR Libc](https://www.nongnu.org/avr-libc/).
8
9Build status:
10
11 * ![Linux](https://github.com/picolibc/picolibc/workflows/Linux/badge.svg?branch=main)
12 * ![Mac OS X](https://github.com/picolibc/picolibc/workflows/Mac%20OS%20X/badge.svg)
13
14## License
15
16Picolibc source comes from a variety of places and has a huge variety
17of copyright holders and license texts. While much of the code comes
18from Newlib, none of the GPL-related bits used to build the library
19are left in the repository, so all of the source code uses BSD-like
20licenses, a mixture of 2- and 3- clause BSD itself and a variety of
21other (mostly older) licenses with similar terms.
22
23There are two files used for testing printf, test/printf-tests.c and
24test/testcases.c which are licensed under the GPL version 2 or
25later. There is also a shell script, GeneratePicolibcCrossFile.sh
26which is licensed under the AGPL version 3 or later which is provided
27as a helper for people building the library, but not used by picolibc
28otherwise.
29
30The file COPYING.picolibc contains all of the current copyright and
31license information in the Debian standard machine-readable format. It
32was generated using the make-copyrights and find-copyright
33scripts.
34
35## Supported Architectures
36
37Picolibc inherited code for a *lot* of architectures from Newlib, but
38at this point only has code to build for the following targets:
39
40 * ARC (32- and 64- bit)
41 * ARM (32- and 64- bit)
42 * i386 (Native and Linux hosted, for testing)
43 * Microblaze (32-bit, big and little endian)
44 * Motorola 68000 (m68k)
45 * MIPS
46 * MSP430
47 * Nios II
48 * PowerPC (big and little endian)
49 * RISC-V (both 32- and 64- bit)
50 * Sparc64
51 * x86_64 (Native and Linux hosted, for testing)
52 * Xtensa (ESP8266, ESP32)
53
54Supporting architectures that already have Newlib code requires:
55
56 1. newlib/libc/machine/_architecture_/meson.build to build the
57 architecture-specific libc bits. This should at least include
58 setjmp/longjmp support as these cannot be performed in
59 architecture independent code and are needed by libstdc++.
60
61 2. Checking for atomic support for tinystdio. Tinystdio requires
62 atomics for ungetc to work correctly in a reentrant
63 environment. By default, it stores them in 16-bit values, but
64 some architectures only have 32-bit atomics. To avoid ABI
65 issues, the size selected isn't detected automatically, instead
66 it must be configured in newlib/libc/tinystdio/stdio.h.
67
68 3. newlib/libm/machine/_architecture_/meson.build to build any
69 architecture-specific libm bits
70
71 4. picocrt/machine/_architecture_ source code and build bits if you
72 need custom startup code for the architecture. Useful in all
73 cases, but this is necessary to run tests under qemu if your
74 platform can do that.
75
76 5. cross-_gcc-triple_.txt to configure the meson cross-compilation
77 mechanism to use the right tools
78
79 6. do-_architecture_-configure to make testing the cross-compilation
80 setup easier.
81
82 7. newlib/libc/picolib support. This should include whatever startup
83 helpers are required (like ARM interrupt vector) and TLS support
84 (if your compiler includes this).
85
86 8. run-_architecture_ script to run tests under QEMU. Look at the ARM
87 and RISC-V examples to get a sense of what this needs to do and
88 how it gets invoked from the cross-_gcc-triple_.txt configuration
89 file.
90
91## Relation to newlib
92
93Picolibc is mostly built from pieces of newlib, and retains the
94directory structure of that project. While there have been a lot of
95changes in the build system and per-thread data storage, the bulk of
96the source code remains unchanged.
97
98To keep picolibc and newlib code in sync, newlib changes will be
99regularly incorporated. To ease integration of these changes into
100picolibc, some care needs to be taken while editing the code:
101
102 * Files should not be renamed.
103 * Fixes that also benefit users of newlib should also be sent to the
104 newlib project
105 * Changes, where possible, should be made in a way compatible with
106 newlib design. For example, instead of using 'errno' (which is
107 valid in picolibc), use __errno_r(r), even when 'r' is not defined
108 in the local context.
109
110The bulk of newlib changes over the last several years have been in
111areas unrelated to the code used by picolibc, so keeping things in
112sync has not been difficult so far.
113
114## Documentation
115
116Introductory documentation. Read these first:
117
118 * [Building Picolibc](doc/build.md). Explains how to compile picolibc yourself.
119 * [Using Picolibc](doc/using.md). Shows how to compile and link
120 applications once you have picolibc built and installed.
121 * [Linking with Picolibc.ld](doc/linking.md). Provides more details
122 about the linking process.
123 * [Hello World](hello-world/README.md). Build and run a stand-alone C
124 application by following step-by-step instructions
125
126Detailed documentation. Use these to learn more details about how to
127use Picolibc:
128
129 * [Picolibc initialization](doc/init.md)
130 * [Operating System Support](doc/os.md).
131 * [Printf and Scanf in Picolibc](doc/printf.md)
132 * [Thread Local Storage](doc/tls.md)
133 * [Re-entrancy and Locking](doc/locking.md)
134 * [Picolibc as embedded source](doc/embedsource.md)
135 * [Releasing Picolibc](doc/releasing.md)
136 * [Copyright and license information](COPYING.picolibc)
137
138## Releases
139
140### Picolibc version 1.8.2
141
142 * Support _ZEPHYR_SOURCE macro which, like _POSIX_SOURCE et al,
143 controls whether the library expresses the Zephyr C library API.
144 This is also automatically selected when the __ZEPHYR__ macro is
145 defined and no other _*_SOURCE macro is defined.
146
147 * Add another cross compile property, 'libgcc', which specifies the
148 library containing soft float and other compiler support routines.
149
150 * Fix a couple of minor imprecisions in pow and 80-bit powl.
151
152 * Merge newlib changes that included an update to the ARM assembly
153 code.
154
155 * Replace inexact float/string conversion code with smaller code that
156 doesn't use floating point operations to save additional space on
157 soft float targets.
158
159 * More cmake fixes, including making the inexact printf and locale
160 options work.
161
162### Picolibc version 1.8.1
163
164 * Fix cmake build system to auto-detect compiler characteristics
165 instead of assuming the compiler is a recent version of GCC. This
166 allows building using cmake with clang.
167
168 * Fix cmake build system to leave out TLS support when TLS is
169 disabled on the cmake command line.
170
171 * Replace inline asm with attributes for __weak_reference macro
172
173 * Add allocation attributes to malloc and stdio functions. This
174 allows the compiler to detect allocation related mistakes as well
175 as perform some additional optimizations. Bugs found by this change
176 were also addressed.
177
178 * Add wchar_t support to tinystdio, eliminating the last missing
179 feature compared with the legacy stdio bits from newlib. With this,
180 libstdc++ can be built with wide char I/O support, eliminating the
181 last missing feature there as well.
182
183 * Eliminate use of command line tools when building with a new enough
184 version of meson. Thanks to Michael Platings.
185
186 * Add Microblaze support. Thanks to Alp Sayin.
187
188 * Switch semihosting to use binary mode when opening files. Thanks to
189 Hardy Griech.
190
191 * Build and install static library versions of the crt0 startup
192 code. These allows developers to reference them as libraries on the
193 command line instead of needing special compiler support to locate
194 the different variants, which is useful when using clang. Thanks to
195 Simon Tatham.
196
197 * Simplify the signal/raise implementation to use a single global
198 array of signal handlers and to not use getpid and kill, instead
199 raise now directly invokes _exit. This makes using assert and abort
200 simpler and doesn't cause a large TLS block to be allocated. Thanks
201 to Joe Nelson for discovering the use of a TLS variable here.
202
203### Picolibc version 1.8
204
205With the addition of nearly complete long double support in the math
206library, it seems like it's time to declare a larger version increment
207than usual.
208
209 * Improve arc and xtensa support, adding TLS helpers and other build fixes
210
211 * Fix FPSCR state for Arm8.1-M low overhead loops (thanks to David
212 Green)
213
214 * Add -Werror=double-promotion to default error set and fix related
215 errors. (thanks to Ryan McClelland)
216
217 * Fix locking bug in malloc out-of-memory path and freeing a locked
218 mutex in the tinystdio bufio code. These were found with lock
219 debugging code in Zephyr.
220
221 * Add some missing functions in tinystdio, strto*l_l, remove,
222 tmpname/tmpfile which were published in stdio.h but not included in
223 the library.
224
225 * Switch read/write functions to use POSIX types instead of legacy
226 cygwin types. This makes mapping to existing an POSIX api work
227 right.
228
229 * Add %b support to tinystdio printf and scanf. These are disabled by
230 default as they aren't yet standardized.
231
232 * Fix avr math function support. The avr version of gcc has modes
233 where double and long double are 32 or 64 bits, so the math library
234 code now detects all of that at compile time rather than build time
235 and reconfigures the functions to match the compiler types.
236
237 * Add nearly complete long double support from openlibm for 80-bit
238 Intel and 128-bit IEEE values (in addition to supporting 64-bit
239 long doubles). Still missing are Bessel functions and decimal
240 printf/scanf support.
241
242 * Add limited long double support for IBM 'double double' form. This
243 is enough to run some simple tests, but doesn't have any
244 significant math functions yet.
245
246 * Get Power9 code running under qemu with OPAL. This was mostly
247 needed to validate the big-endian and exception code for 128-bit
248 long doubles, but was also used to validate the double double
249 support.
250
251 * Provide times() and sysconf() implementations in semihosting. You
252 can now build and run the dhrystone benchmark without any further
253 code.
254
255 * Fix use of TLS variables with stricter alignment requirements in
256 the default linker script and startup code. (thanks to Joakim
257 Nohlgård and Alexander Richardson who found this issue while
258 working on lld support).
259
260### Picolibc version 1.7.9
261
262 * Support all Zephyr SDK targets
263
264 * Support relocating the toolchain by using GCC_EXEC_PREFIX for
265 sysroot-install when compiler doesn't use sysroot.
266
267 * Add MIPS, SPARC and ARC support
268
269 * Deal with RISC-V changes in gcc that don't reliably include zicsr
270
271 * Support Picolibc as default C library with -Dsystem-libc option.
272 With this, you can use picolibc without any extra compiler options.
273
274 * Merge current newlib bits to get code that doesn't use struct _reent
275
276 * Get rid of struct _reent in legacy stdio code
277
278 * Support 16-bit int targets by fixing a few places assuming
279 sizeof(int) == 4, object sizes not using size_t, wint_t for
280 ucs-4 values
281
282 * Add MSP430 support
283
284 * Fix a couple of clang bugs (one on Cortex M0)
285
286 * Support libc++ by adding non-standard mbstate_t.h
287
288 * Merge i686 and x86_64 code to allow x86 multilib builds
289
290 * Merge Xtensa newlib bits
291
292 * Support Xtensa ESP32 targets
293
294 * Add Nios II support
295
296### Picolibc version 1.7.8
297
298 1. Fix el/ix level 4 code type errors
299
300 2. Fix out-of-source CMake build (thanks Max Behensky)
301
302 3. Improve build.md docs (thanks Kalle Raiskila)
303
304 4. Fix cmake build for various architectures
305
306 5. Initialize lock in fdopen
307
308 6. Remove %M from linker paths in single-arch builds
309
310 7. Shrink tinystdio vfprintf and vfscanf a bit
311
312 8. Use -fno-builtin-malloc -fno-builtin-free (GCC 12 compat)
313
314 9. Use -fno-builtin-copysignl (GCC 12 compat)
315
316 10. Add _zicsr to -march for risc-v picocrt (binutils 2.38 compat)
317
318 11. Add -no-warn-rwx-segments to link spec (binutils 2.38 compat)
319
320### Picolibc version 1.7.7
321
322 1. Fix semihost gettimeofday, add a test.
323
324 2. Fix config option documentation. (Thanks to rdiez)
325
326 3. Document how re-entrant locking APIs are used. (Thanks to rdiez)
327
328 4. Fix some 16-bit int issues in tinystdio. (Thanks to Ayke van
329 Laethem)
330
331 5. Make header files a bit more POSIX compliant, installing rpc
332 headers, moving byte swapping macros to arpa/inet.h
333
334 6. Fix some stdio bugs found by Zephyr test suite: snprintf return
335 value on buffer overflow, add ftello/fseeko, fputc return value,
336 %0a formatting, clear EOF status after ungetc/fseek.
337
338 7. Re-do buffered I/O support to handle mixed read/write files
339 correctly. This adds setbuf, setbuffer, setlinebuf, setvbuf.
340
341 8. Add fmemopen and freopen.
342
343 9. Add enough cmake support to allow Zephyr to build picolibc as a
344 module using that, rather than meson.
345
346 10. Merge current newlib bits
347
348 11. Fix %p printf/scanf on ILP64 targets.
349
350### Picolibc version 1.7.6
351
352 1. Fix use with C++ applications caused by a syntax error in
353 picolibc.specs
354
355 2. Automatically include '-nostdlib' to options used while
356 evaluating build rules to ensure tests work as expected.
357
358 3. Publish aarch64 inline math functions, ensure that inline fma
359 functions work in installed applications for arm and risc-v.
360
361### Picolibc version 1.7.5
362
363 1. Fix build on big-endian systems (thanks to Thomas Daede)
364
365 2. Add m68k support (thanks to Thomas Daede).
366
367 3. Fix build issues with ARM Cortex-a9 target (thanks to Ilia
368 Sergachev).
369
370 4. Fix fwrite(x,0,y,z) in both tinystdio and legacy stdio. tinystdio
371 returned the wrong value and legacy stdio caused a divide-by-zero
372 fault.
373
374 5. Update Ryu code to match upstream (minor fixes)
375
376 6. Fix various __NEWLIB and __PICOLIBC macros; they were using a
377 single leading underscore instead of two (thanks to Vincent
378 Palatin).
379
380 7. Fix tinystdio error-handling bugs
381
382 8. Merge recent newlib changes (fixed ltdoa in legacy stdio)
383
384 9. Speed improvements for github CI system
385
386 10. Big-endian PowerPC support
387
388 11. Fail builds if most 'run_command' uses fail (thanks to Johan de
389 Claville Christiansen)
390
391 12. Positional parameters in tinystdio. With this, I think tinystdio
392 is feature complete.
393
394 13. Support for multiple build-styles of picolibc (minsize/release)
395 in one binary package. This still requires separate meson runs.
396
397 14. Testing with glibc test code. This uncovered numerous bugs,
398 mostly math errno/exception mistakes, but also a few serious
399 bugs, including a couple of places where the nano-malloc failed
400 to check for out-of-memory. Picolibc now passes all of the glibc
401 math tests except for jn, yn, lgamma and tgamma. The picolibc
402 versions of those functions are too inaccurate. Picolibc also
403 passes most other relevant glibc tests, including stdio,
404 string and stdlib areas.
405
406 15. Tinystdio version of fcvt now has a static buffer large enough to
407 hold the maximum return size.
408
409 16. Tinystdio versions of ecvtbuf and fcvtbuf have been replaced
410 with ecvt_r and fcvt_r equivalents, which take a 'len' parameter
411 to prevent buffer overruns.
412
413 17. Add the GeneratePicolibcCrossFile.sh script which provides a way
414 to isolate picolibc build scripts from the vagaries of meson
415 version shifts (thanks to R. Diez).
416
417 18. Add 'semihost' version of crt0 that calls 'exit' after main
418 returns. The ARM and RISC-V versions of this also include trap
419 handlers for exceptions that print out information and exit when
420 an exception occurs.
421
422### Picolibc version 1.7.4
423
424 1. Clean up meson build bits, including use of 'fs module (thanks to
425 Yasushi Shoji).
426
427 2. Speed up github actions by sharing Debian docker image (thanks to
428 Yasushi Shoji).
429
430 3. Reduce use of intermediate static libraries during build
431
432 4. Use standard Meson architecture names everywhere (thanks to
433 Yasushi Shoji).
434
435 5. Support building with -D_FORTIFY_SOURCE enabled.
436
437 6. Clean up 32-bit arm assembly code, eliminating __aeabi wrappers
438 where possible.
439
440 7. Add basename, dirname and fnmatch back.
441
442 8. Fix all old-style (K&R) function definitions.
443
444 9. Enable lots more compiler warning flags.
445
446 10. Remove last uses of alloca in legacy stdio code.
447
448 11. Add tests from musl libc-testsuite. There aren't many tests, but
449 these identified a few bugs.
450
451 12. Add lots more exception and errno tests for the math functions.
452
453 13. Restructure math library to always use the `__math_err` functions
454 to raise exceptions and set errno. This removes the w_*.c wrapper
455 functions and eliminates the `__ieee names`. This centralizes
456 compiler work-arounds to ensure run-time evaluation of
457 expressions intended to raise exceptions. In the process, all of
458 the libm/math files were reformatted with clang-format.
459
460 14. Make tinystdio '%a' compatible with glibc, including supporting
461 rounding and trimming trailing zeros when possible.
462
463 15. Remove floating point exception generation code on targets
464 without floating point exception support. This reduces code size
465 on soft float machines without affecting results.
466
467### Picolibc version 1.7.3
468
469 1. Add -Wall -Wextra to default builds. Fixed warnings this raised.
470
471 2. Add htonl and friends (based on __htonl). Thanks to Johan de
472 Claville Christiansen
473
474 3. Set errno in scalbn and scalbnf (patch forwarded to newlib).
475
476 4. Merge newlib recent changes which includes a couple of libm fixes.
477
478### Picolibc version 1.7.2
479
480 1. Fix picolibc.ld to split C++ exceptions back apart (thanks to
481 Khalil Estell)
482
483 2. Add vsscanf to tinystdio (required for libstdc++).
484
485 3. Also stick -isystem in C++ compile command to try and get
486 picolibc headers to be used instead of newlib.
487
488### Picolibc version 1.7.1
489
490 1. Add __cxa_atexit implementation to 'picoexit' path as required by
491 C++
492
493 2. Fix lack of 'hh' support in integer-only tinystdio printf path.
494
495 3. Fix tinystdio __file flag initialization for C++ apps
496
497### Picolibc version 1.7
498
499 1. Merge libc and libm into a single library. Having them split
500 doesn't offer any advantages while requiring that applications add
501 '-lm' to link successfully. Having them merged allows use of libm
502 calls from libc code.
503
504 2. Add hex float format to *printf, *scanf and strto{d,f,ld}. This is
505 required for C99 support.
506
507 3. Unify strto{d,f,ld} and *scanf floating point parsing code. This
508 ensures that the library is consistent in how floats are parsed.
509
510 4. Make strto{d,f,ld} set errno to ERANGE on overflow/underflow,
511 including when the result is a subnormal number.
512
513### Picolibc version 1.6.2
514
515 1. Change `restrict` keyword in published headers to `__restrict` to
516 restore compatibility with applications building with --std=c18.
517
518 2. Additional cleanups in time conversion funcs (Thanks to R. Riez)
519
520### Picolibc version 1.6.1
521
522 1. Code cleanups for time conversion funcs (Thanks to R. Diez)
523
524 2. Add '-fno-stack-protector' when supported by the C compiler
525 to avoid trouble building with native Ubuntu GCC.
526
527 3. Bug fix for converting denorms with sscanf and strto{d,f,ld}.
528
529 4. Use __asm__ for inline asm code to allow building applications
530 with --std=c18
531
532 5. Fix exit code for semihosting 'abort' call to make it visible
533 to the hosting system.
534
535 6. Add strfromf and strfromd implementations. These are simple
536 wrappers around sscanf, but strfromf handles float conversions
537 without requiring a pass through 'double' or special linker hacks.
538
539### Picolibc version 1.6
540
541 1. Bugfix for snprintf(buf, 0) and vsnprintf(buf, 0) to avoid
542 smashing memory
543
544 2. Support building libstdc++ on top of picolibc
545
546 3. Add 'hosted' crt0 variant that calls exit when main
547 returns. This makes testing easier without burdening embedded apps
548 with unused exit processing code.
549
550 4. Add 'minimal' crt0 variant that skips constructors to
551 save space on systems known to not use any.
552
553 5. Fix HW floating point initialization on 32-bit ARM processors to
554 perform 'dsb' and 'isb' instructions to ensure the FPU enabling
555 write is complete before executing any FPU instructions.
556
557 6. Create a new '--picolibc-prefix' GCC command line parameter that
558 sets the base of all picolibc file names.
559
560 7. Add bare-metal i386 and x86_64 initializatiton code (thanks to
561 Mike Haertel). These initalize the processor from power up to
562 running code without requiring any BIOS.
563
564 8. Merge newlib as of late April, 2021
565
566 9. Add 'timegm' function (thanks to R. Diez).
567
56810. Fix a number of tinystdio bugs: handle fread with size==0, parse
569 'NAN' and 'INF' in fscanf in a case-insensitive manner, fix
570 negative precision to '*' arguments in printf, fix handling of
571 'j', 'z' and 't' argument size specifiers (thanks to Sebastian
572 Meyer).
573
57411. Make the fenv API more consistent and more conformant with the
575 spec. All architectures now fall back to the default code
576 for soft float versions, which avoids having the various exception
577 and rounding modes get defined when not supported.
578
579### Picolibc version 1.5.1
580
581 1. Make riscv crt0 '_exit' symbol 'weak' to allow linking without
582 this function.
583
584### Picolibc version 1.5
585
586 1. Make picolibc more compatible with C++ compilers.
587
588 2. Add GCC specs file and linker script for building C++ applications
589 with G++ that enable exception handling by linking in call stack
590 information.
591
592 3. A few clang build fixes, including libm exception generation
593
594 4. Nano malloc fixes, especially for 'unusual' arguments
595
596 5. Merge in newlib 4.1.0 code
597
598 6. More libm exception/errno/infinity fixes, mostly in the gamma funcs.
599
600 7. Add tests for all semihost v2.0 functions.
601
602 8. A few RISC-V assembly fixes and new libm code.
603
604 9. Build fixes to reliably replace generic code with
605 architecture-specific implementations.
606
607With a patch which is pending for GCC 11, we'll be able to build C++
608applications that use picolibc with exceptions and iostream.
609
610### Picolibc version 1.4.7
611
612 1. Fix numerous libm exception and errno bugs. The math functions are
613 all now verified to match the C19 and Posix standards in this
614 area.
615
616 2. Change behavior of 'gamma' function to match glibc which returns
617 lgamma for this function. Applications should not use this
618 function, they should pick either lgamma or tgamma as appropriate.
619
620 3. Fix fma/fmaf on arm and RISC-V so that the machine-specific versions
621 are used when the hardware has support. Also fix the math library
622 to only use fma/fmaf when it is supported by the hardware.
623
624 4. Fix numerous nano-malloc bugs, especially with unusual parameters.
625
626 5. Change nano-malloc to always clear returned memory.
627
628 6. Improve nano-realloc to perform better in various ways, including
629 merging adjacent free blocks and expanding the heap.
630
631 7. Add malloc tests, both a basic functional test and a stress test.
632
633 8. Improve build portability to Windows. Picolibc should now build
634 using mingw.
635
636 9. Use hardware TLS register on ARM when available.
637
638 10. Support clang compiler. Thanks to Denis Feklushkin
639 <denis.feklushkin@gmail.com> and Joakim Nohlgård <joakim@nohlgard.se>.
640
641 11. Avoid implicit float/double conversions. Check this by having
642 clang builds use -Wdouble-promotion -Werror=double-promotion
643 flags
644
645 12. Have portable code check for machine-specific overrides by
646 matching filenames. This avoids building libraries with
647 duplicate symbols and retains compatibility with newlib (which
648 uses a different mechanism for this effect).
649
650 13. Patches to support building with [CompCert](http://compcert.inria.fr/), a
651 formally verified compiler. Thanks to Sebastian Meyer
652 <meyer@absint.com>.
653
654### Picolibc version 1.4.6
655
656 1. Install 'ssp' (stack smashing protection) header files. This fixes
657 compiling with -D_FORTIFY_SOURCE.
658
659 2. Make getc/ungetc re-entrant. This feature, which is enabled by
660 default, uses atomic instruction sequences that do not require
661 OS support.
662
663 3. Numerous iconv fixes, including enabling testing and switching
664 external CCS file loading to use stdio. By default, iconv provides
665 built-in CCS data for all of the supported encodings, which takes
666 a fairly large amount of read-only memory. Iconv is now always
667 included in picolibc as it isn't included in applications unless
668 explicitly referenced by them.
669
670 4. Add __getauxval stub implementation to make picolibc work with
671 GCC version 10 compiled for aarch64-linux-gnu.
672
673 5. Change how integer- and float- only versions of printf and scanf
674 are selected. Instead of re-defining the symbols using the C
675 preprocessor, picolibc now re-defines the symbols at link
676 time. This avoids having applications compiled with a mixture of
677 modes link in multiple versions of the underlying functions, while
678 still preserving the smallest possible integer-only
679 implementation.
680
681 6. Document how to use picolibc on a native POSIX system for
682 testing. Check out the [os.md](doc/os.md) file for details.
683
684 7. Merge current newlib bits in. This includes better fenv support,
685 for which tests are now included in the picolibc test suite.
686
687### Picolibc version 1.4.5
688
689 1. Fix section order in picolibc.ld to give applications correct
690 control over the layout of .preserve, .init and .fini regions.
691
692 2. Add startup and TLS support for aarch64 and non Cortex-M 32-bit
693 arm.
694
695### Picolibc version 1.4.4
696
697 1. Fix floating point 'g' format output in tinystdio. (e.g.,
698 for 10.0, print '10' instead of '1e+01'). There are tests which
699 verify a range of 'g' cases like these now.
700
701 2. Merge current newlib bits. The only thing which affects picolibc
702 is the addition of fenv support for arm.
703
704### Picolibc version 1.4.3
705
706 1. Make fix for CVE 2019-14871 - CVE 2019-14878 in original newlib
707 stdio code not call 'abort'. Allocation failures are now reported
708 back to the application.
709
710 2. Add 'exact' floating point print/scan code to tinystdio. Thanks
711 to Sreepathi Pai for pointing me at the Ryu code by Ulf
712 Adams.
713
714 3. Add regular expression functions from newlib. These were removed
715 by accident while removing POSIX filesystem-specific code.
716
717 4. Make tinystdio versions of [efg]cvt functions. This means that the
718 default tinystdio version of picolibc no longer calls malloc from
719 these functions.
720
721 5. More clang-compatibility fixes. (Thanks to Denis Feklushkin)
722
723 6. Remove stdatomic.h and tgmath.h. (they should not be provide by picolibc)
724
725### Picolibc version 1.4.2
726
727 1. Clang source compatibility. Clang should now be able to compile
728 the library. Thanks to Denis Feklushkin for figuring out how
729 to make this work.
730
731 2. aarch64 support. This enables the existing aarch64 code and
732 provides an example configuration file for getting it
733 built. Thanks for Anthony Anderson for this feature.
734
735 3. Testing on github on push and pull-request. For now, this is
736 limited to building the library due to a bug in qemu.
737
738 4. Get newlib stdio working again. You can now usefully use Newlib's
739 stdio. This requires a working malloc and is substantially larger
740 than tinystdio, but has more accurate floating point input. This
741 requires POSIX functions including read, write and a few others.
742
743 5. Fix long double strtold. The working version is only available
744 when using tinystdio; if using newlib stdio, strtold is simply not
745 available.
746
747 6. Improve tinystdio support for C99 printf/scanf additions.
748
749 7. Check for correct prefix when sysroot-install option is
750 selected. The value of this option depends on how gcc was
751 configured, and (alas) meson won't let us set it at runtime, so
752 instead we complain if the wrong value was given and display the
753 correct value.
754
755 8. Sync up with current newlib head.
756
757### Picolibc version 1.4.1
758
759This release contains an important TLS fix for ARM along with a few
760minor compatibility fixes
761
762 1. Make __aeabi_read_tp respect ARM ABI register requirements to
763 avoid clobbering register contents during TLS variable use.
764
765 2. Use cpu_family instead of cpu in meson config, which is 'more
766 correct' when building for a single cpu instead of multilib.
767
768 3. Make arm sample interrupt vector work with clang
769
770 4. Use __inline instead of inline in published headers to allow
771 compiling with -ansi
772
773 5. Make 'naked' RISC-V _start function contain only asm
774 statements as required by clang (and recommended by gcc).
775
776 6. Use -msave-restore in sample RISC-V cross-compile
777 configuration. This saves text space.
778
779### Picolibc version 1.4
780
781This release was focused on cleaning up the copyright and license
782information.
783
784 1. Copyright information should now be present in every source file.
785
786 2. License information, where it could be inferred from the
787 repository, was added to many files.
788
789 3. 4-clause BSD licenses were changed (with permission) to 3-clause
790
791 4. Fix RISC-V ieeefp.h exception bits
792
793 5. Merge past newlib 3.2.0
794
795 6. Add PICOLIBC_TLS preprocessor define when the library has TLS support
796
797### Picolibc version 1.3
798
799This release now includes tests, and fixes bugs found by them.
800
801 1. ESP8266 support added, thanks to Jonathan McDowell.
802
803 2. Numerous test cases from newlib have been fixed, and
804 precision requirements adjusted so that the library now
805 passes its own test suite on x86, RISC-V and ARM.
806
807 3. String/number conversion bug fixes. This includes fcvt/ecvt/gcvt
808 shared with newlib and tinystdio printf/scanf
809
810 4. A few RISC-V ABI fixes, including setting the TLS base correctly,
811 compiling with -mcmodel=medany, and enabling the FPU for libraries
812 built to use it.
813
814 5. Semihosting updates, including adding unlink, kill and getpid
815 (which are used by some tests).
816
817### Picolibc version 1.2
818
819This release includes important fixes in picolibc.ld and more
820semihosting support.
821
822 1. File I/O and clock support for semihosting. This enables fopen/fdopen
823 support in tinystdio along with an API to fetch a real time clock
824 value.
825
826 2. Fix picolibc.ld to not attempt to use redefined symbols for memory
827 space definitions. These re-definitions would fail and the default
828 values be used for system memory definitions. Instead, just use
829 the ? : operators each place the values are needed. Linker scripts
830 continue to mystify.
831
832 3. Expose library definitions in 'picolibc.h', instead of 'newlib.h'
833 and '_newlib_version.h'
834
835 4. Define HAVE_SEMIHOST when semihosting support is available. This
836 lets the 'hello-world' example do some semihost specific things.
837
838### Picolibc version 1.1
839
840A minor update from 1.0, this release includes:
841
842 1. semihost support. This adds console I/O and exit(3) support on ARM
843 and RISC-V hosts using the standard semihosting interfaces.
844
845 2. Posix I/O support in tinystdio. When -Dposix-io=true is included
846 in the meson command line (which is the default), tinystdio adds
847 support for fopen and fdopen by using malloc, open, close, read,
848 write and lseek. If -Dposix-console=true is also passed to meson,
849 then picolibc will direct stdin/stdout/stderr to the posix
850 standard file descriptors (0, 1, 2).
851
852 3. Merge recent upstream newlib code. This brings picolibc up to date
853 with current newlib sources.
854
855 4. Hello world example. This uses a simple Makefile to demonstrate
856 how to us picolibc when installed for ARM and RISC-V embedded
857 processors. The resulting executables can be run under qemu.
858
859 5. Remove newlib/libm/mathfp directory. This experimental code never
860 worked correctly anyways.
861
862### Picolibc version 1.0
863
864This is the first release of picolibc. Major changes from newlib
865include:
866
867 1. Remove all non-BSD licensed code. None of it was used in building
868 the embedded library, and removing it greatly simplifies the
869 license situation.
870
871 2. Move thread-local values to native TLS mechanism
872
873 3. Add smaller stdio from avr-libc, which is enabled by default
874
875 4. Switch build system to meson. This has two notable benefits; the first
876 is that building the library is much faster, the second is that
877 it isolates build system changes from newlib making merging of
878 newlib changes much easier.
879
880 5. Add simple startup code. This can be used in environments that
881 don't have complicated requirements, allowing small applications
882 to avoid needing to figure this out.
883
884