8.3.14 O: Specify Output File

The -o option specifies the base name and directory of the output file.

Note that both the driver and linker have -o options. Typically you would use the driver version of this option, as it also affects temporary filenames. To use the driver option, do not prefix the option with -Wl,.

The option -o main.elf, for example, will place the generated output in a file called main.elf. The name of an existing directory can be specified with the file name, for example -o build/main.elf, so that the output file will appear in that directory.

You cannot use this option to change the type (format) of the output file.