You copied the Doc URL to your clipboard.

Program design when exploiting the C library

The functions you must re-implement depend on how much of the library functionality you require:

  • If you want only the compiler support functions for division, structure copy, and floating-point arithmetic, you must provide __rt_raise(). This also enables very simple library functions such as those in errno.h, setjmp.h, and most of string.h to work.

  • If you call setlocale() explicitly, locale-dependent functions are activated. This enables you to use the atoi family, sprintf(), sscanf(), and the functions in ctype.h.

  • Programs that use floating-point must call _fp_init(). If you select software floating-point in an IEEE standards compliant mode (the default in ARM Compiler 6, and is disabled by the armclang command-line option -ffast-math), the program must also provide __rt_fp_status_addr().

  • Implementing high-level input/output support is necessary for functions that use fprintf() or fputs(). The high-level output functions depend on fputc() and ferror(). The high-level input functions depend on fgetc() and __backspace().

Implementing these functions and the heap enables you to use almost the entire library.

Was this page helpful? Yes No