You copied the Doc URL to your clipboard.

Arm Compiler armclang Reference Guide : -fno-builtin

-fno-builtin

Disables special handling and optimizations of standard C library functions, for example for printf(), strlen(), and malloc().

When compiling without -fno-builtin, the compiler can replace calls to certain standard C library functions with inline code or with calls to other library functions. Subsequently, your re-implementations of the standard C library functions might not be used, and might be removed by the linker.

Default

-fno-builtin is disabled by default.

Example

This example shows the result of compiling the following program with and without -fno-builtin:

#include "stdio.h"

void foo( void )
{
    printf("Hello\n");
}
  1. Compile without -fno-builtin:

    armclang -c -O2 -g --target=arm-arm-none-eabi -mcpu=cortex-a9 -mfpu=none -nostdlib foo.c -o foo.o
  2. Run the following fromelf command to show the disassembled output:

    fromelf --disassemble foo.o -o foo.s
    ...
    ||foo|| PROC
            ADR      r0,|L3.8|
            B        puts
    |L3.8|
            DCD      0x6c6c6548
            DCD      0x0000006f
            ENDP
    ...

    Note

    The compiler has replaced the printf() function with the puts() function.
  3. Compile with -fno-builtin:

    armclang -c -O2 -g --target=arm-arm-none-eabi -mcpu=cortex-a9 -mfpu=none -nostdlib -fno-builtin foo.c -o foo.o
  4. Run the following fromelf command to show the disassembled output:

    fromelf --disassemble foo.o -o foo.s
    ...
    ||foo|| PROC
            ADR      r0,|L3.8|
            B        printf
    |L3.8|
            DCD      0x6c6c6548
            DCD      0x00000a6f
            ENDP
    ...

    Note

    The compiler has not replaced the printf() function with the puts() function when using the -fno-builtin option.
Was this page helpful? Yes No