Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
.github/ | 18-Mar-2025 | - | 1,154 | 921 | ||
cmake/ | 18-Mar-2025 | - | 854 | 707 | ||
doc/ | 18-Mar-2025 | - | 2,061 | 1,501 | ||
dummyhost/ | 18-Mar-2025 | - | 182 | 90 | ||
hello-world/ | 18-Mar-2025 | - | 744 | 279 | ||
newlib/ | 18-Mar-2025 | - | 494,946 | 340,002 | ||
picocrt/ | 18-Mar-2025 | - | 3,116 | 2,002 | ||
scripts/ | 18-Mar-2025 | - | 6,431 | 2,891 | ||
semihost/ | 18-Mar-2025 | - | 9,158 | 4,290 | ||
test/ | 18-Mar-2025 | - | 107,501 | 100,935 | ||
zephyr/ | 18-Mar-2025 | - | 133 | 116 | ||
.clang-format | D | 18-Mar-2025 | 16.6 KiB | 561 | 556 | |
.editorconfig | D | 18-Mar-2025 | 141 | 12 | 9 | |
.gitattributes | D | 18-Mar-2025 | 613 | 21 | 18 | |
.gitignore | D | 18-Mar-2025 | 363 | 48 | 37 | |
CMakeLists.txt | D | 18-Mar-2025 | 17.5 KiB | 620 | 484 | |
CODE_OF_CONDUCT.md | D | 18-Mar-2025 | 3.3 KiB | 78 | 57 | |
CONTRIBUTING.md | D | 18-Mar-2025 | 3.3 KiB | 97 | 65 | |
COPYING.GPL2 | D | 18-Mar-2025 | 17.6 KiB | 341 | 281 | |
COPYING.NEWLIB | D | 18-Mar-2025 | 76.4 KiB | 1,573 | 1,272 | |
COPYING.picolibc | D | 18-Mar-2025 | 229.3 KiB | 6,336 | 5,850 | |
README.md | D | 18-Mar-2025 | 43.1 KiB | 1,193 | 814 | |
cross.tmpl | D | 18-Mar-2025 | 334 | 25 | 18 | |
find-copyright | D | 18-Mar-2025 | 18.2 KiB | 492 | 439 | |
make-copyrights | D | 18-Mar-2025 | 85 | 5 | 3 | |
meson.build | D | 18-Mar-2025 | 67.8 KiB | 1,726 | 1,503 | |
meson_options.txt | D | 18-Mar-2025 | 15.7 KiB | 319 | 280 | |
picolibc.h.in | D | 18-Mar-2025 | 10.7 KiB | 479 | 274 | |
picolibc.ld.in | D | 18-Mar-2025 | 11.4 KiB | 343 | 301 | |
picolibc.specs.in | D | 18-Mar-2025 | 540 | 27 | 19 |
README.md
1# Picolibc 2Copyright © 2018-2023 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 *  12 *  13 *  14 15## License 16 17Picolibc source comes from a variety of places and has a huge variety 18of copyright holders and license texts. While much of the code comes 19from Newlib, none of the GPL-related bits used to build the library 20are left in the repository, so all of the source code uses BSD-like 21licenses, a mixture of 2- and 3- clause BSD itself and a variety of 22other (mostly older) licenses with similar terms. 23 24There are two files used for testing printf, test/printf-tests.c and 25test/testcases.c which are licensed under the GPL version 2 or 26later. There is also a shell script, GeneratePicolibcCrossFile.sh 27which is licensed under the AGPL version 3 or later which is provided 28as a helper for people building the library, but not used by picolibc 29otherwise. 30 31The file COPYING.picolibc contains all of the current copyright and 32license information in the Debian standard machine-readable format. It 33was generated using the make-copyrights and find-copyright 34scripts. 35 36## Supported Architectures 37 38Picolibc has integrated testing support for many architectures which 39is used to validate the code for all patch integration: 40 41 * ARC (32- and 64- bit) 42 * ARM (32- and 64- bit) 43 * i386 (Native and Linux hosted, for testing) 44 * Motorola 68000 (m68k) 45 * MIPS 46 * MSP430 47 * Nios II 48 * Power9 49 * RISC-V (both 32- and 64- bit) 50 * SparcV8 (32 bit) 51 * x86_64 (Native and Linux hosted, for testing) 52 53There is also build infrastructure and continuous build validation, 54but no integrated testing available for additional architectures: 55 56 * Microblaze (32-bit, big and little endian) 57 * PowerPC (big and little endian) 58 * Sparc64 59 * Xtensa (ESP8266, ESP32) 60 61Supporting architectures that already have Newlib code requires: 62 63 1. newlib/libc/machine/_architecture_/meson.build to build the 64 architecture-specific libc bits. This should at least include 65 setjmp/longjmp support as these cannot be performed in 66 architecture independent code and are needed by libstdc++. 67 68 2. Checking for atomic support for tinystdio. Tinystdio requires 69 atomics for ungetc to work correctly in a reentrant 70 environment. By default, it stores them in 16-bit values, but 71 some architectures only have 32-bit atomics. To avoid ABI 72 issues, the size selected isn't detected automatically, instead 73 it must be configured in newlib/libc/tinystdio/stdio.h. 74 75 3. newlib/libm/machine/_architecture_/meson.build to build any 76 architecture-specific libm bits 77 78 4. picocrt/machine/_architecture_ source code and build bits 79 for startup code needed for the architecture. Useful in all 80 cases, but this is necessary to run tests under qemu if your 81 platform can do that. 82 83 5. cross-_gcc-triple_.txt to configure the meson cross-compilation 84 mechanism to use the right tools 85 86 6. do-_architecture_-configure to make testing the cross-compilation 87 setup easier. 88 89 7. newlib/libc/picolib support. This should include whatever startup 90 helpers are required (like ARM interrupt vector) and TLS support 91 (if your compiler includes this). 92 93 8. run-_architecture_ script to run tests under QEMU. Look at the ARM 94 and RISC-V examples to get a sense of what this needs to do and 95 how it gets invoked from the cross-_gcc-triple_.txt configuration 96 file. 97 98## Relation to newlib 99 100Picolibc is mostly built from pieces of newlib, and retains the 101directory structure of that project. While there have been a lot of 102changes in the build system and per-thread data storage, the bulk of 103the source code remains unchanged. 104 105To keep picolibc and newlib code in sync, newlib changes will be 106regularly incorporated. To ease integration of these changes into 107picolibc, some care needs to be taken while editing the code: 108 109 * Files should not be renamed. 110 * Fixes that also benefit users of newlib should also be sent to the 111 newlib project 112 * Changes, where possible, should be made in a way compatible with 113 newlib design. For example, instead of using 'errno' (which is 114 valid in picolibc), use __errno_r(r), even when 'r' is not defined 115 in the local context. 116 117The bulk of newlib changes over the last several years have been in 118areas unrelated to the code used by picolibc, so keeping things in 119sync has not been difficult so far. 120 121## Documentation 122 123Introductory documentation. Read these first: 124 125 * [Building Picolibc](doc/build.md). Explains how to compile picolibc yourself. 126 * [Using Picolibc](doc/using.md). Shows how to compile and link 127 applications once you have picolibc built and installed. 128 * [Linking with Picolibc.ld](doc/linking.md). Provides more details 129 about the linking process. 130 * [Hello World](hello-world/README.md). Build and run a stand-alone C 131 application by following step-by-step instructions 132 133Detailed documentation. Use these to learn more details about how to 134use Picolibc: 135 136 * [Picolibc initialization](doc/init.md) 137 * [Operating System Support](doc/os.md). 138 * [Printf and Scanf in Picolibc](doc/printf.md) 139 * [Thread Local Storage](doc/tls.md) 140 * [Re-entrancy and Locking](doc/locking.md) 141 * [Selecting ctype implementation](doc/ctype.md) 142 * [Picolibc as embedded source](doc/embedsource.md) 143 * [Releasing Picolibc](doc/releasing.md) 144 * [Copyright and license information](COPYING.picolibc) 145 146## Releases 147 148### Picolibc release 1.8.8 149 150 * Fixed 3 bugs in the powf computation. Thanks to Fabian Schriever. 151 152 * Fixed a bunch of build issues found by Zephyr. 153 154 * Improve C++ testing and compatibility. 155 156### Picolibc release 1.8.7 157 158 * Support ARM v8.1-m BTI and PAC features 159 160 * Fix stdio buffered backend automatic flushing of stdout when 161 reading stdin. 162 163 * Support _FORTIFY_SOURCE=3 164 165 * Fix several fesetround implementations to return an error when 166 passed an invalid argument. Thanks to Abdallah Abdelhafeez. 167 168 * Document headers which the compiler must provide. Thanks to Alexey 169 Brodkin. 170 171 * Generate mktemp/tmpnam filenames using random() so they don't 172 repeat even if they aren't used before another name is generated. 173 174 * Set error flag when fgetc is called on an file without read 175 mode. Thanks to Mohamed Moawad. 176 177 * Add type casting to CMPLX, CMPLXF and CMPLXL macros (as glibc 178 does). Thanks to Mostafa Salman. 179 180 * Add mips64 support and build the library during CI. 181 182 * Make fgets return any accumulated string on EOF instead of 183 always returning NULL. Thanks to Hana Ashour. 184 185 * Use C99 minimum array size in asctime_r and ctime_r API 186 declarations ('[static 26]'). Bounds check the generated value and 187 return NULL/EOVERFLOW on overflow. 188 189 * Make Zephyr's -Oz cmake option enable 190 PREFER_SIZE_OVER_SPEED. Thanks to Jonathon Penix. 191 192 * Add funopen to tinystdio. 193 194 * Validate all public headers with a C++ compiler to make sure they 195 at least compile successfully. Fix time.h. 196 197 * Stop using -include picolibc.h during library build. 198 199 * Add -Wmissing-declarations and -Wmissing-prototypes to library 200 build flags. Fix a rather large pile of missing prototypes caused 201 by source files failing to add _GNU_SOURCE or _DEFAULT_SOURCE 202 definitions. 203 204 * Add POSIX "unlocked" I/O functions to tinystdio. These don't 205 actually do anything because tinystdio doesn't do any 206 locking. However, flockfile/funlockfile grab the global C library 207 lock so applications synchronizing with that API will "work". 208 209 * Fix wide orientation handling in tinystdio. Thanks to Ahmed Shehab. 210 211 * Add aarch64 soft float support for armv8. Clang allows this with 212 -march=armv8-a+nofp -mabi=aapcs-soft. This required building a 213 custom toolchain that included a compiler-rt library built with the 214 right options. 215 216 * Add fgetpos and fsetpos to tinystdio. Thanks to Hana Ashour. 217 218 * Restore missing members of 'struct sigevent'. Over eager removal of 219 _POSIX_THREADS support caused these to be accidentally deleted some 220 time ago. 221 222 * Test on i386 native target. 223 224 * Fix hex float scanning and printing. Thanks to Hana Ashour and 225 Ahmed Shehab. 226 227 * Fix double rounding in %f printf. Thanks to Ahmed Shehab for 228 constructing a test case that identified the issue. 229 230 * Add mem_align to the "big" malloc version. Thanks to Simon Tatham. 231 232 * Adjust POSIX and C headers to limit symbol exposure to that 233 specified in the standards. 234 235 * Fix rounding in float scanf. This does round twice for input longer 236 than the required number of digits, but that's permitted by the C 237 specification. 238 239 * Support %a/%A in scanf. Support arbitrary precision in %a/%A 240 printf. Fix NaN/INF formatting in %a/%A printf. Thanks to Ahmed 241 Shehab. 242 243 * Provide a build-time option to enable %n in printf. This is 244 disabled by default for security concerns, but supported in case 245 someone needs strict C conformance. Thanks to Ahmed Shehab. 246 247 * Make freopen clear the unget buffer. Thanks to Mostafa Salman. 248 249 * Fix wide and multi-byte character support in printf and scanf. For 250 strict standards conformance, there's now an option that enables 251 %lc/%ls in printf even if multi-byte support is not enabled. 252 253 * Enable MMU in picocrt on A profile ARM and AARCH64 targets when 254 present. This is required by the latest qemu which now more 255 accurately emulates this hardware. Thanks to Alex Richardson. 256 257 * Fix AARCH64 asm code in ILP32 mode. 258 259 * Parse NaN(<string>) in sscanf. This is required by the standard, 260 although picolibc doesn't do anything with <string>. Thanks to 261 Mohamed Moawad. 262 263 * Clean up header files. Picolibc tries to limit symbol definitions 264 to those specified in the C and POSIX specs. 265 266 * Add support for C's Annex K functions. These are bounds-checking 267 versions of various memory and string functions. Thanks to Mostafa 268 Salman. 269 270 * Perform locale string validation in newlocale even when _MB_CAPABLE 271 isn't defined. Thanks to Mostafa Salman. 272 273 * Place compiler-rt library after C library when linking 274 tests. Thanks to Oliver Stannard. 275 276### Picolibc version 1.8.6 277 278 * Fix some FORTITY_SOURCE issues with tinystdio 279 280 * Add __eh_* symbols to picolibc.ld for LLVM libunwind. Thanks Alex 281 Richardson. 282 283 * Merge in newlib annual release (4.4.0). Some minor updates to 284 aarch64 assembly code formatting (thanks to Sebastian Huber) and a 285 few other fixes. 286 287 * Enable 32-bit SPARC for testing. 288 289 * Fix a bunch of fmemopen bugs and add some tests. Thanks to Alex 290 Richardson. 291 292 * Finish support for targets with unusual float types, mapping 293 target types to 32-, 64-, 80- and 128- bit picolibc code. 294 295 * Add SuperH support, including testing infrastructure. Thanks to 296 Adrian Siekierka for help with this. 297 298 * Improve debugger stack trace in risc-v exception code. Thanks to 299 Alex Richardson. 300 301 * Add an option (-Dfast-bufio=true) for more efficient fread/fwrite 302 implementations when layered atop bufio. Thanks for the suggestion 303 from Zachary Yedidia. 304 305 * Fix cmake usage of FORMAT_ variables (note the lack of a leading 306 underscore). 307 308 * Remove explicit _POSIX_C_SOURCE definition in zephyr/zephr.cmake. 309 310 * Clean up public inline functions to share a common mechanism for 311 using gnu_inline semantics. Fix isblank. This ensures that no 312 static inline declarations exist in public API headers which are 313 required to be external linkage ("real") symbols. 314 315 * Create an alternate ctype implementation that avoids using the 316 _ctype_ array and just does direct value comparisons. This only 317 works when picolibc is limited to ASCII. Applications can select 318 whether they want this behavior at application compilation time 319 without needing to rebuild the C library. Thanks to P. Frost for 320 the suggestion. 321 322 * Unify most fenv implementations to use gnu_inline instead of 323 regular functions to improve performance. x86 was left out because 324 those fenv functions are complicated by the mix of 8087 and modern 325 FPU support. 326 327 * Add a separate FILE for stderr when using POSIX I/O. Split 328 stdin/stdout/stderr into three files to avoid pulling in 329 those which aren't used. Thanks to Zachary Yedidia. 330 331### Picolibc version 1.8.5 332 333 * Detect clang multi-lib support correctly by passing compiler flags. 334 Thanks to xbjfk for identifying the problem. 335 336 * Create a new 'long-long' printf variant. This provides enough 337 variety to satisfy the Zephyr cbprintf options without needing to 338 build the library from scratch. 339 340 * Adjust use of custom binary to decimal conversion code so that it 341 is only enabled for types beyond the register size of the 342 target. This avoids the cost of this code when the application is 343 already likely to be using the soft division routines. 344 345### Picolibc version 1.8.4 346 347 * Make math overflow and underflow handlers respect rounding modes. 348 349 * Add full precision fma/fmaf fallbacks by adapting the long-double 350 code which uses two floats/doubles and some careful exponent 351 management to ensure that only a single rounding operation occurs. 352 353 * Fix more m68k 80-bit float bugs 354 355 * Fix m68k asm ABI by returning pointers in %a0 and %d0 356 357 * Use an m68k-unknown-elf toolchain for m68k testing, including 358 multi-lib to check various FPU configurations on older and more 359 modern 68k targets. 360 361 * Improve CI speed by using ccache on zephyr and mac tests, 362 compressing the docker images and automatically canceling jobs when 363 the related PR is updated. Thanks to Peter Jonsson. 364 365 * Move a bunch of read-only data out of RAM and into flash by adding 366 'const' attributes in various places. 367 368 * Add a new linker symbol, `__heap_size_min`, which specifies a 369 minimum heap size. The linker will emit an error if this much space 370 is not available between the end of static data and the stack. 371 372 * Fix a bunch of bugs on targets with 16-bit int type. Thanks to 373 Peter Jonsson for many of these. 374 375 * Work around a handful of platform bugs on MSP430. I think these are 376 compiler bugs as they occur using both the binutils simulator and 377 mspsim. 378 379 * Run tests on MSP430 using the simulator that comes with gdb. Thanks to 380 Peter Jonsson for spliting tests apart to make them small enough to 381 link in under 1MB. This requires a patch adding primitive 382 semihosting to the simulator. 383 384 * Provide a division-free binary to decimal conversion option for 385 printf at friends. This is useful on targets without hardware 386 divide as it avoids pulling in a (usually large) software 387 implementation. This is controlled with the 'printf-small-ultoa' 388 meson option and is 'false' by default. 389 390 * Add 'minimal' printf and scanf variants. These reduce functionality 391 by removing code that acts on most data modifers including width 392 and precision fields and alternate presentation modes. A new config 393 variable, minimal-io-long-long, controls whether that code supports 394 long long types. 395 396 * Add a 'assert-verbose' option which controls whether the assert 397 macro is chatty by default. It is 'true' by default, which 398 preserves the existing code, but when set to 'false', then a 399 failing assert calls __assert_no_msg with no arguments, saving the 400 memory usually occupied by the filename, function name and 401 expression. 402 403 * Fix arm asm syntax for mrc/mcr instructions to make clang happy. 404 Thanks to Radovan Blažek for this patch. 405 406### Picolibc version 1.8.3 407 408 * Fix bugs in floor and ceil implementations. 409 410 * Use -fanalyzer to find and fix a range of issues. 411 412 * Add __ubsan_handle_out_of_bounds implementation. This enables 413 building applications with -fsanitize=bounds and 414 -fno-sanitize-undefined-trap-on-error. 415 416 * Validate exception configuration on targets with mixed exception 417 support where some types have exceptions and others don't. Right 418 now, that's only arm platforms where any soft float implementations 419 don't build with exception support. 420 421 * Fix bugs in nexttowards/nextafter on clang caused by the compiler 422 re-ordering code and causing incorrect exception generation. 423 424 * Use the small/slow string code when -fsanitize=address is used 425 while building the library. This avoids reading beyond the end of 426 strings and triggering faults. 427 428 * Handle soft float on x86 and sparc targets. That mostly required 429 disabling the hardware exception API, along with a few other minor 430 bug fixes. 431 432 * Add runtime support for arc, mips, nios2 and m68k. This enables CI 433 testing on these architectures using qemu. 434 435 * Fix 80-bit floating math library support for m68k targets. 436 437 * Fix arm testing infra to use various qemu models that expand 438 testing to all standard multi-lib configurations. 439 440 * Adjust floating exception stubs to return success when appropriate, 441 instead of always returning ENOSYS. 442 443 * Make sure sNaN raises FE_INVALID and is converted to qNaN in 444 truncl, frexpl and roundl 445 446 * Avoid NaN result from fmal caused by multiply overflow when 447 addend is infinity (-inf + inf results in NaN in that case). 448 449### Picolibc version 1.8.2 450 451 * Support _ZEPHYR_SOURCE macro which, like _POSIX_SOURCE et al, 452 controls whether the library expresses the Zephyr C library API. 453 This is also automatically selected when the __ZEPHYR__ macro is 454 defined and no other _*_SOURCE macro is defined. 455 456 * Add another cross compile property, 'libgcc', which specifies the 457 library containing soft float and other compiler support routines. 458 459 * Fix a couple of minor imprecisions in pow and 80-bit powl. 460 461 * Merge newlib changes that included an update to the ARM assembly 462 code. 463 464 * Replace inexact float/string conversion code with smaller code that 465 doesn't use floating point operations to save additional space on 466 soft float targets. 467 468 * More cmake fixes, including making the inexact printf and locale 469 options work. 470 471### Picolibc version 1.8.1 472 473 * Fix cmake build system to auto-detect compiler characteristics 474 instead of assuming the compiler is a recent version of GCC. This 475 allows building using cmake with clang. 476 477 * Fix cmake build system to leave out TLS support when TLS is 478 disabled on the cmake command line. 479 480 * Replace inline asm with attributes for __weak_reference macro 481 482 * Add allocation attributes to malloc and stdio functions. This 483 allows the compiler to detect allocation related mistakes as well 484 as perform some additional optimizations. Bugs found by this change 485 were also addressed. 486 487 * Add wchar_t support to tinystdio, eliminating the last missing 488 feature compared with the legacy stdio bits from newlib. With this, 489 libstdc++ can be built with wide char I/O support, eliminating the 490 last missing feature there as well. 491 492 * Eliminate use of command line tools when building with a new enough 493 version of meson. Thanks to Michael Platings. 494 495 * Add Microblaze support. Thanks to Alp Sayin. 496 497 * Switch semihosting to use binary mode when opening files. Thanks to 498 Hardy Griech. 499 500 * Build and install static library versions of the crt0 startup 501 code. These allows developers to reference them as libraries on the 502 command line instead of needing special compiler support to locate 503 the different variants, which is useful when using clang. Thanks to 504 Simon Tatham. 505 506 * Simplify the signal/raise implementation to use a single global 507 array of signal handlers and to not use getpid and kill, instead 508 raise now directly invokes _exit. This makes using assert and abort 509 simpler and doesn't cause a large TLS block to be allocated. Thanks 510 to Joe Nelson for discovering the use of a TLS variable here. 511 512### Picolibc version 1.8 513 514With the addition of nearly complete long double support in the math 515library, it seems like it's time to declare a larger version increment 516than usual. 517 518 * Improve arc and xtensa support, adding TLS helpers and other build fixes 519 520 * Fix FPSCR state for Arm8.1-M low overhead loops (thanks to David 521 Green) 522 523 * Add -Werror=double-promotion to default error set and fix related 524 errors. (thanks to Ryan McClelland) 525 526 * Fix locking bug in malloc out-of-memory path and freeing a locked 527 mutex in the tinystdio bufio code. These were found with lock 528 debugging code in Zephyr. 529 530 * Add some missing functions in tinystdio, strto*l_l, remove, 531 tmpname/tmpfile which were published in stdio.h but not included in 532 the library. 533 534 * Switch read/write functions to use POSIX types instead of legacy 535 cygwin types. This makes mapping to existing an POSIX api work 536 right. 537 538 * Add %b support to tinystdio printf and scanf. These are disabled by 539 default as they aren't yet standardized. 540 541 * Fix avr math function support. The avr version of gcc has modes 542 where double and long double are 32 or 64 bits, so the math library 543 code now detects all of that at compile time rather than build time 544 and reconfigures the functions to match the compiler types. 545 546 * Add nearly complete long double support from openlibm for 80-bit 547 Intel and 128-bit IEEE values (in addition to supporting 64-bit 548 long doubles). Still missing are Bessel functions and decimal 549 printf/scanf support. 550 551 * Add limited long double support for IBM 'double double' form. This 552 is enough to run some simple tests, but doesn't have any 553 significant math functions yet. 554 555 * Get Power9 code running under qemu with OPAL. This was mostly 556 needed to validate the big-endian and exception code for 128-bit 557 long doubles, but was also used to validate the double double 558 support. 559 560 * Provide times() and sysconf() implementations in semihosting. You 561 can now build and run the dhrystone benchmark without any further 562 code. 563 564 * Fix use of TLS variables with stricter alignment requirements in 565 the default linker script and startup code. (thanks to Joakim 566 Nohlgård and Alexander Richardson who found this issue while 567 working on lld support). 568 569### Picolibc version 1.7.9 570 571 * Support all Zephyr SDK targets 572 573 * Support relocating the toolchain by using GCC_EXEC_PREFIX for 574 sysroot-install when compiler doesn't use sysroot. 575 576 * Add MIPS, SPARC and ARC support 577 578 * Deal with RISC-V changes in gcc that don't reliably include zicsr 579 580 * Support Picolibc as default C library with -Dsystem-libc option. 581 With this, you can use picolibc without any extra compiler options. 582 583 * Merge current newlib bits to get code that doesn't use struct _reent 584 585 * Get rid of struct _reent in legacy stdio code 586 587 * Support 16-bit int targets by fixing a few places assuming 588 sizeof(int) == 4, object sizes not using size_t, wint_t for 589 ucs-4 values 590 591 * Add MSP430 support 592 593 * Fix a couple of clang bugs (one on Cortex M0) 594 595 * Support libc++ by adding non-standard mbstate_t.h 596 597 * Merge i686 and x86_64 code to allow x86 multilib builds 598 599 * Merge Xtensa newlib bits 600 601 * Support Xtensa ESP32 targets 602 603 * Add Nios II support 604 605### Picolibc version 1.7.8 606 607 1. Fix el/ix level 4 code type errors 608 609 2. Fix out-of-source CMake build (thanks Max Behensky) 610 611 3. Improve build.md docs (thanks Kalle Raiskila) 612 613 4. Fix cmake build for various architectures 614 615 5. Initialize lock in fdopen 616 617 6. Remove %M from linker paths in single-arch builds 618 619 7. Shrink tinystdio vfprintf and vfscanf a bit 620 621 8. Use -fno-builtin-malloc -fno-builtin-free (GCC 12 compat) 622 623 9. Use -fno-builtin-copysignl (GCC 12 compat) 624 625 10. Add _zicsr to -march for risc-v picocrt (binutils 2.38 compat) 626 627 11. Add -no-warn-rwx-segments to link spec (binutils 2.38 compat) 628 629### Picolibc version 1.7.7 630 631 1. Fix semihost gettimeofday, add a test. 632 633 2. Fix config option documentation. (Thanks to rdiez) 634 635 3. Document how re-entrant locking APIs are used. (Thanks to rdiez) 636 637 4. Fix some 16-bit int issues in tinystdio. (Thanks to Ayke van 638 Laethem) 639 640 5. Make header files a bit more POSIX compliant, installing rpc 641 headers, moving byte swapping macros to arpa/inet.h 642 643 6. Fix some stdio bugs found by Zephyr test suite: snprintf return 644 value on buffer overflow, add ftello/fseeko, fputc return value, 645 %0a formatting, clear EOF status after ungetc/fseek. 646 647 7. Re-do buffered I/O support to handle mixed read/write files 648 correctly. This adds setbuf, setbuffer, setlinebuf, setvbuf. 649 650 8. Add fmemopen and freopen. 651 652 9. Add enough cmake support to allow Zephyr to build picolibc as a 653 module using that, rather than meson. 654 655 10. Merge current newlib bits 656 657 11. Fix %p printf/scanf on ILP64 targets. 658 659### Picolibc version 1.7.6 660 661 1. Fix use with C++ applications caused by a syntax error in 662 picolibc.specs 663 664 2. Automatically include '-nostdlib' to options used while 665 evaluating build rules to ensure tests work as expected. 666 667 3. Publish aarch64 inline math functions, ensure that inline fma 668 functions work in installed applications for arm and risc-v. 669 670### Picolibc version 1.7.5 671 672 1. Fix build on big-endian systems (thanks to Thomas Daede) 673 674 2. Add m68k support (thanks to Thomas Daede). 675 676 3. Fix build issues with ARM Cortex-a9 target (thanks to Ilia 677 Sergachev). 678 679 4. Fix fwrite(x,0,y,z) in both tinystdio and legacy stdio. tinystdio 680 returned the wrong value and legacy stdio caused a divide-by-zero 681 fault. 682 683 5. Update Ryu code to match upstream (minor fixes) 684 685 6. Fix various __NEWLIB and __PICOLIBC macros; they were using a 686 single leading underscore instead of two (thanks to Vincent 687 Palatin). 688 689 7. Fix tinystdio error-handling bugs 690 691 8. Merge recent newlib changes (fixed ltdoa in legacy stdio) 692 693 9. Speed improvements for github CI system 694 695 10. Big-endian PowerPC support 696 697 11. Fail builds if most 'run_command' uses fail (thanks to Johan de 698 Claville Christiansen) 699 700 12. Positional parameters in tinystdio. With this, I think tinystdio 701 is feature complete. 702 703 13. Support for multiple build-styles of picolibc (minsize/release) 704 in one binary package. This still requires separate meson runs. 705 706 14. Testing with glibc test code. This uncovered numerous bugs, 707 mostly math errno/exception mistakes, but also a few serious 708 bugs, including a couple of places where the nano-malloc failed 709 to check for out-of-memory. Picolibc now passes all of the glibc 710 math tests except for jn, yn, lgamma and tgamma. The picolibc 711 versions of those functions are too inaccurate. Picolibc also 712 passes most other relevant glibc tests, including stdio, 713 string and stdlib areas. 714 715 15. Tinystdio version of fcvt now has a static buffer large enough to 716 hold the maximum return size. 717 718 16. Tinystdio versions of ecvtbuf and fcvtbuf have been replaced 719 with ecvt_r and fcvt_r equivalents, which take a 'len' parameter 720 to prevent buffer overruns. 721 722 17. Add the GeneratePicolibcCrossFile.sh script which provides a way 723 to isolate picolibc build scripts from the vagaries of meson 724 version shifts (thanks to R. Diez). 725 726 18. Add 'semihost' version of crt0 that calls 'exit' after main 727 returns. The ARM and RISC-V versions of this also include trap 728 handlers for exceptions that print out information and exit when 729 an exception occurs. 730 731### Picolibc version 1.7.4 732 733 1. Clean up meson build bits, including use of 'fs module (thanks to 734 Yasushi Shoji). 735 736 2. Speed up github actions by sharing Debian docker image (thanks to 737 Yasushi Shoji). 738 739 3. Reduce use of intermediate static libraries during build 740 741 4. Use standard Meson architecture names everywhere (thanks to 742 Yasushi Shoji). 743 744 5. Support building with -D_FORTIFY_SOURCE enabled. 745 746 6. Clean up 32-bit arm assembly code, eliminating __aeabi wrappers 747 where possible. 748 749 7. Add basename, dirname and fnmatch back. 750 751 8. Fix all old-style (K&R) function definitions. 752 753 9. Enable lots more compiler warning flags. 754 755 10. Remove last uses of alloca in legacy stdio code. 756 757 11. Add tests from musl libc-testsuite. There aren't many tests, but 758 these identified a few bugs. 759 760 12. Add lots more exception and errno tests for the math functions. 761 762 13. Restructure math library to always use the `__math_err` functions 763 to raise exceptions and set errno. This removes the w_*.c wrapper 764 functions and eliminates the `__ieee names`. This centralizes 765 compiler work-arounds to ensure run-time evaluation of 766 expressions intended to raise exceptions. In the process, all of 767 the libm/math files were reformatted with clang-format. 768 769 14. Make tinystdio '%a' compatible with glibc, including supporting 770 rounding and trimming trailing zeros when possible. 771 772 15. Remove floating point exception generation code on targets 773 without floating point exception support. This reduces code size 774 on soft float machines without affecting results. 775 776### Picolibc version 1.7.3 777 778 1. Add -Wall -Wextra to default builds. Fixed warnings this raised. 779 780 2. Add htonl and friends (based on __htonl). Thanks to Johan de 781 Claville Christiansen 782 783 3. Set errno in scalbn and scalbnf (patch forwarded to newlib). 784 785 4. Merge newlib recent changes which includes a couple of libm fixes. 786 787### Picolibc version 1.7.2 788 789 1. Fix picolibc.ld to split C++ exceptions back apart (thanks to 790 Khalil Estell) 791 792 2. Add vsscanf to tinystdio (required for libstdc++). 793 794 3. Also stick -isystem in C++ compile command to try and get 795 picolibc headers to be used instead of newlib. 796 797### Picolibc version 1.7.1 798 799 1. Add __cxa_atexit implementation to 'picoexit' path as required by 800 C++ 801 802 2. Fix lack of 'hh' support in integer-only tinystdio printf path. 803 804 3. Fix tinystdio __file flag initialization for C++ apps 805 806### Picolibc version 1.7 807 808 1. Merge libc and libm into a single library. Having them split 809 doesn't offer any advantages while requiring that applications add 810 '-lm' to link successfully. Having them merged allows use of libm 811 calls from libc code. 812 813 2. Add hex float format to *printf, *scanf and strto{d,f,ld}. This is 814 required for C99 support. 815 816 3. Unify strto{d,f,ld} and *scanf floating point parsing code. This 817 ensures that the library is consistent in how floats are parsed. 818 819 4. Make strto{d,f,ld} set errno to ERANGE on overflow/underflow, 820 including when the result is a subnormal number. 821 822### Picolibc version 1.6.2 823 824 1. Change `restrict` keyword in published headers to `__restrict` to 825 restore compatibility with applications building with --std=c18. 826 827 2. Additional cleanups in time conversion funcs (Thanks to R. Riez) 828 829### Picolibc version 1.6.1 830 831 1. Code cleanups for time conversion funcs (Thanks to R. Diez) 832 833 2. Add '-fno-stack-protector' when supported by the C compiler 834 to avoid trouble building with native Ubuntu GCC. 835 836 3. Bug fix for converting denorms with sscanf and strto{d,f,ld}. 837 838 4. Use __asm__ for inline asm code to allow building applications 839 with --std=c18 840 841 5. Fix exit code for semihosting 'abort' call to make it visible 842 to the hosting system. 843 844 6. Add strfromf and strfromd implementations. These are simple 845 wrappers around sscanf, but strfromf handles float conversions 846 without requiring a pass through 'double' or special linker hacks. 847 848### Picolibc version 1.6 849 850 1. Bugfix for snprintf(buf, 0) and vsnprintf(buf, 0) to avoid 851 smashing memory 852 853 2. Support building libstdc++ on top of picolibc 854 855 3. Add 'hosted' crt0 variant that calls exit when main 856 returns. This makes testing easier without burdening embedded apps 857 with unused exit processing code. 858 859 4. Add 'minimal' crt0 variant that skips constructors to 860 save space on systems known to not use any. 861 862 5. Fix HW floating point initialization on 32-bit ARM processors to 863 perform 'dsb' and 'isb' instructions to ensure the FPU enabling 864 write is complete before executing any FPU instructions. 865 866 6. Create a new '--picolibc-prefix' GCC command line parameter that 867 sets the base of all picolibc file names. 868 869 7. Add bare-metal i386 and x86_64 initializatiton code (thanks to 870 Mike Haertel). These initalize the processor from power up to 871 running code without requiring any BIOS. 872 873 8. Merge newlib as of late April, 2021 874 875 9. Add 'timegm' function (thanks to R. Diez). 876 87710. Fix a number of tinystdio bugs: handle fread with size==0, parse 878 'NAN' and 'INF' in fscanf in a case-insensitive manner, fix 879 negative precision to '*' arguments in printf, fix handling of 880 'j', 'z' and 't' argument size specifiers (thanks to Sebastian 881 Meyer). 882 88311. Make the fenv API more consistent and more conformant with the 884 spec. All architectures now fall back to the default code 885 for soft float versions, which avoids having the various exception 886 and rounding modes get defined when not supported. 887 888### Picolibc version 1.5.1 889 890 1. Make riscv crt0 '_exit' symbol 'weak' to allow linking without 891 this function. 892 893### Picolibc version 1.5 894 895 1. Make picolibc more compatible with C++ compilers. 896 897 2. Add GCC specs file and linker script for building C++ applications 898 with G++ that enable exception handling by linking in call stack 899 information. 900 901 3. A few clang build fixes, including libm exception generation 902 903 4. Nano malloc fixes, especially for 'unusual' arguments 904 905 5. Merge in newlib 4.1.0 code 906 907 6. More libm exception/errno/infinity fixes, mostly in the gamma funcs. 908 909 7. Add tests for all semihost v2.0 functions. 910 911 8. A few RISC-V assembly fixes and new libm code. 912 913 9. Build fixes to reliably replace generic code with 914 architecture-specific implementations. 915 916With a patch which is pending for GCC 11, we'll be able to build C++ 917applications that use picolibc with exceptions and iostream. 918 919### Picolibc version 1.4.7 920 921 1. Fix numerous libm exception and errno bugs. The math functions are 922 all now verified to match the C19 and Posix standards in this 923 area. 924 925 2. Change behavior of 'gamma' function to match glibc which returns 926 lgamma for this function. Applications should not use this 927 function, they should pick either lgamma or tgamma as appropriate. 928 929 3. Fix fma/fmaf on arm and RISC-V so that the machine-specific versions 930 are used when the hardware has support. Also fix the math library 931 to only use fma/fmaf when it is supported by the hardware. 932 933 4. Fix numerous nano-malloc bugs, especially with unusual parameters. 934 935 5. Change nano-malloc to always clear returned memory. 936 937 6. Improve nano-realloc to perform better in various ways, including 938 merging adjacent free blocks and expanding the heap. 939 940 7. Add malloc tests, both a basic functional test and a stress test. 941 942 8. Improve build portability to Windows. Picolibc should now build 943 using mingw. 944 945 9. Use hardware TLS register on ARM when available. 946 947 10. Support clang compiler. Thanks to Denis Feklushkin 948 <denis.feklushkin@gmail.com> and Joakim Nohlgård <joakim@nohlgard.se>. 949 950 11. Avoid implicit float/double conversions. Check this by having 951 clang builds use -Wdouble-promotion -Werror=double-promotion 952 flags 953 954 12. Have portable code check for machine-specific overrides by 955 matching filenames. This avoids building libraries with 956 duplicate symbols and retains compatibility with newlib (which 957 uses a different mechanism for this effect). 958 959 13. Patches to support building with [CompCert](http://compcert.inria.fr/), a 960 formally verified compiler. Thanks to Sebastian Meyer 961 <meyer@absint.com>. 962 963### Picolibc version 1.4.6 964 965 1. Install 'ssp' (stack smashing protection) header files. This fixes 966 compiling with -D_FORTIFY_SOURCE. 967 968 2. Make getc/ungetc re-entrant. This feature, which is enabled by 969 default, uses atomic instruction sequences that do not require 970 OS support. 971 972 3. Numerous iconv fixes, including enabling testing and switching 973 external CCS file loading to use stdio. By default, iconv provides 974 built-in CCS data for all of the supported encodings, which takes 975 a fairly large amount of read-only memory. Iconv is now always 976 included in picolibc as it isn't included in applications unless 977 explicitly referenced by them. 978 979 4. Add __getauxval stub implementation to make picolibc work with 980 GCC version 10 compiled for aarch64-linux-gnu. 981 982 5. Change how integer- and float- only versions of printf and scanf 983 are selected. Instead of re-defining the symbols using the C 984 preprocessor, picolibc now re-defines the symbols at link 985 time. This avoids having applications compiled with a mixture of 986 modes link in multiple versions of the underlying functions, while 987 still preserving the smallest possible integer-only 988 implementation. 989 990 6. Document how to use picolibc on a native POSIX system for 991 testing. Check out the [os.md](doc/os.md) file for details. 992 993 7. Merge current newlib bits in. This includes better fenv support, 994 for which tests are now included in the picolibc test suite. 995 996### Picolibc version 1.4.5 997 998 1. Fix section order in picolibc.ld to give applications correct 999 control over the layout of .preserve, .init and .fini regions. 1000 1001 2. Add startup and TLS support for aarch64 and non Cortex-M 32-bit 1002 arm. 1003 1004### Picolibc version 1.4.4 1005 1006 1. Fix floating point 'g' format output in tinystdio. (e.g., 1007 for 10.0, print '10' instead of '1e+01'). There are tests which 1008 verify a range of 'g' cases like these now. 1009 1010 2. Merge current newlib bits. The only thing which affects picolibc 1011 is the addition of fenv support for arm. 1012 1013### Picolibc version 1.4.3 1014 1015 1. Make fix for CVE 2019-14871 - CVE 2019-14878 in original newlib 1016 stdio code not call 'abort'. Allocation failures are now reported 1017 back to the application. 1018 1019 2. Add 'exact' floating point print/scan code to tinystdio. Thanks 1020 to Sreepathi Pai for pointing me at the Ryu code by Ulf 1021 Adams. 1022 1023 3. Add regular expression functions from newlib. These were removed 1024 by accident while removing POSIX filesystem-specific code. 1025 1026 4. Make tinystdio versions of [efg]cvt functions. This means that the 1027 default tinystdio version of picolibc no longer calls malloc from 1028 these functions. 1029 1030 5. More clang-compatibility fixes. (Thanks to Denis Feklushkin) 1031 1032 6. Remove stdatomic.h and tgmath.h. (they should not be provide by picolibc) 1033 1034### Picolibc version 1.4.2 1035 1036 1. Clang source compatibility. Clang should now be able to compile 1037 the library. Thanks to Denis Feklushkin for figuring out how 1038 to make this work. 1039 1040 2. aarch64 support. This enables the existing aarch64 code and 1041 provides an example configuration file for getting it 1042 built. Thanks for Anthony Anderson for this feature. 1043 1044 3. Testing on github on push and pull-request. For now, this is 1045 limited to building the library due to a bug in qemu. 1046 1047 4. Get newlib stdio working again. You can now usefully use Newlib's 1048 stdio. This requires a working malloc and is substantially larger 1049 than tinystdio, but has more accurate floating point input. This 1050 requires POSIX functions including read, write and a few others. 1051 1052 5. Fix long double strtold. The working version is only available 1053 when using tinystdio; if using newlib stdio, strtold is simply not 1054 available. 1055 1056 6. Improve tinystdio support for C99 printf/scanf additions. 1057 1058 7. Check for correct prefix when sysroot-install option is 1059 selected. The value of this option depends on how gcc was 1060 configured, and (alas) meson won't let us set it at runtime, so 1061 instead we complain if the wrong value was given and display the 1062 correct value. 1063 1064 8. Sync up with current newlib head. 1065 1066### Picolibc version 1.4.1 1067 1068This release contains an important TLS fix for ARM along with a few 1069minor compatibility fixes 1070 1071 1. Make __aeabi_read_tp respect ARM ABI register requirements to 1072 avoid clobbering register contents during TLS variable use. 1073 1074 2. Use cpu_family instead of cpu in meson config, which is 'more 1075 correct' when building for a single cpu instead of multilib. 1076 1077 3. Make arm sample interrupt vector work with clang 1078 1079 4. Use __inline instead of inline in published headers to allow 1080 compiling with -ansi 1081 1082 5. Make 'naked' RISC-V _start function contain only asm 1083 statements as required by clang (and recommended by gcc). 1084 1085 6. Use -msave-restore in sample RISC-V cross-compile 1086 configuration. This saves text space. 1087 1088### Picolibc version 1.4 1089 1090This release was focused on cleaning up the copyright and license 1091information. 1092 1093 1. Copyright information should now be present in every source file. 1094 1095 2. License information, where it could be inferred from the 1096 repository, was added to many files. 1097 1098 3. 4-clause BSD licenses were changed (with permission) to 3-clause 1099 1100 4. Fix RISC-V ieeefp.h exception bits 1101 1102 5. Merge past newlib 3.2.0 1103 1104 6. Add PICOLIBC_TLS preprocessor define when the library has TLS support 1105 1106### Picolibc version 1.3 1107 1108This release now includes tests, and fixes bugs found by them. 1109 1110 1. ESP8266 support added, thanks to Jonathan McDowell. 1111 1112 2. Numerous test cases from newlib have been fixed, and 1113 precision requirements adjusted so that the library now 1114 passes its own test suite on x86, RISC-V and ARM. 1115 1116 3. String/number conversion bug fixes. This includes fcvt/ecvt/gcvt 1117 shared with newlib and tinystdio printf/scanf 1118 1119 4. A few RISC-V ABI fixes, including setting the TLS base correctly, 1120 compiling with -mcmodel=medany, and enabling the FPU for libraries 1121 built to use it. 1122 1123 5. Semihosting updates, including adding unlink, kill and getpid 1124 (which are used by some tests). 1125 1126### Picolibc version 1.2 1127 1128This release includes important fixes in picolibc.ld and more 1129semihosting support. 1130 1131 1. File I/O and clock support for semihosting. This enables fopen/fdopen 1132 support in tinystdio along with an API to fetch a real time clock 1133 value. 1134 1135 2. Fix picolibc.ld to not attempt to use redefined symbols for memory 1136 space definitions. These re-definitions would fail and the default 1137 values be used for system memory definitions. Instead, just use 1138 the ? : operators each place the values are needed. Linker scripts 1139 continue to mystify. 1140 1141 3. Expose library definitions in 'picolibc.h', instead of 'newlib.h' 1142 and '_newlib_version.h' 1143 1144 4. Define HAVE_SEMIHOST when semihosting support is available. This 1145 lets the 'hello-world' example do some semihost specific things. 1146 1147### Picolibc version 1.1 1148 1149A minor update from 1.0, this release includes: 1150 1151 1. semihost support. This adds console I/O and exit(3) support on ARM 1152 and RISC-V hosts using the standard semihosting interfaces. 1153 1154 2. Posix I/O support in tinystdio. When -Dposix-io=true is included 1155 in the meson command line (which is the default), tinystdio adds 1156 support for fopen and fdopen by using malloc, open, close, read, 1157 write and lseek. If -Dposix-console=true is also passed to meson, 1158 then picolibc will direct stdin/stdout/stderr to the posix 1159 standard file descriptors (0, 1, 2). 1160 1161 3. Merge recent upstream newlib code. This brings picolibc up to date 1162 with current newlib sources. 1163 1164 4. Hello world example. This uses a simple Makefile to demonstrate 1165 how to us picolibc when installed for ARM and RISC-V embedded 1166 processors. The resulting executables can be run under qemu. 1167 1168 5. Remove newlib/libm/mathfp directory. This experimental code never 1169 worked correctly anyways. 1170 1171### Picolibc version 1.0 1172 1173This is the first release of picolibc. Major changes from newlib 1174include: 1175 1176 1. Remove all non-BSD licensed code. None of it was used in building 1177 the embedded library, and removing it greatly simplifies the 1178 license situation. 1179 1180 2. Move thread-local values to native TLS mechanism 1181 1182 3. Add smaller stdio from avr-libc, which is enabled by default 1183 1184 4. Switch build system to meson. This has two notable benefits; the first 1185 is that building the library is much faster, the second is that 1186 it isolates build system changes from newlib making merging of 1187 newlib changes much easier. 1188 1189 5. Add simple startup code. This can be used in environments that 1190 don't have complicated requirements, allowing small applications 1191 to avoid needing to figure this out. 1192 1193