Search code examples
cgccgnugnu-assemblergnu-arm

Excluding GNU as (GAS) standard startup code


I want the GCC to exclude the startup code it link automatically with building process

what should i do?

So that i have my Own Startup assembly code defining labels (_start, _exit,..etc)


Solution

  • GCC provides the -nostartfiles, -nodefaultlibs and -nostdlib options. See documentation.

    Alternatively, you can call linker (ld) directly: it doesn't add anything by default, all objects (including the linker script) has to be specified manually. For an example of the ld invocation, run gcc with -v option: it would print full command lines of all other tools (including linker) it invokes.