You copied the Doc URL to your clipboard.

Using the libraries in a nonsemihosting environment

Some C library functions use semihosting. If you do not want to use semihosting, either:

  • Remove all calls to semihosting functions.

  • Re-implement the lower-level functions, for example, fputc(). You are not required to re-implement all semihosting functions. You must, however, re-implement the functions you are using in your application.

    (You must re-implement functions that the C library uses to isolate itself from target dependencies. For example, if you use printf() you must re-implement fputc(). If you do not use the higher-level input/output functions like printf(), you do not have to re-implement the lower-level functions like fputc(). )

  • Implement a handler for all of the semihosting calls to be handled in your own specific way. One such example is for the handler to intercept the calls, redirecting them to your own nonsemihosted, that is, target-specific, functions.

To guarantee that no functions using semihosting are included in your application, use either:

  • IMPORT __use_no_semihosting from armasm assembly language.

  • asm(" .global __use_no_semihosting\n"); from C.


The symbol only has to be added to a single C source file. It is unnecessary to add these inserts to every single source file.

If you include a library function that uses semihosting and also reference __use_no_semihosting, the library detects the conflicting symbols and the linker reports an error. To determine which objects are using semihosting:

  1. Link with --verbose --list=out.txt.

  2. Search the output for the symbol.

  3. Determine what object referenced it.

There are no target-dependent functions in the C++ library, although some C++ functions use underlying C library functions that are target-dependent.