1.3.9. Passing Options to Other Tools from c29clang

This section of the c29clang Compiler User Manual describes how the c29clang’s -W<x>, and -X<y> options can be used to pass options from c29clang to other tools in the compiler toolchain.

1.3.9.1. Passing Linker Options: -Wl, and -Xlinker

While the -Wl, (W + lowercase L + comma) option allows you to pass multiple linker options from c29clang to the linker using a single instance of the -Wl, option, the -Xlinker alternative may be useful when you want to explicitly control each particular linker option in a c29clang command line.

1.3.9.1.1. Using the -Wl, Option

The c29clang -Wl, option can be used to identify one or more linker command line options to be forwarded from c29clang to the linker when the linker is invoked from the c29clang command line.

c29clang [options] [filenames] -Wl,*<opt-list>*

  • -Wl, - is the c29clang option that prefixes a list of linker options

  • <opt-list> - is a comma-separated list of one or more linker options

In the following example, the -Wl, option passes both the --rom_model linker option and the lnkme.cmd linker command file directly to the linker:

c29clang -mcpu=c29.c0 hello.c -o a.out -Wl,--rom_model,lnkme.cmd

1.3.9.1.2. Using -Xlinker Options

Alternatively, you can use the c29clang -Xlinker option to identify a single linker command line option to be forwarded from c29clang to the linker when the linker is invoked from the c29clang command line.

c29clang [options] [filenames] -Xlinker <option>

  • -Xlinker - is the c29clang option that prefixes a single linker option

  • <option> - is the linker option to be passed to the linker

The example command for the -Wl, option could also be written using the -Xlinker option as follows:

c29clang -mcpu=c29.c0 hello.c -o a.out -Xlinker --rom_model -Xlinker lnkme.cmd

You can find more information about linker options in the Linker Options section.

1.3.9.2. Passing Preprocessor Options: -Wp, and -Xpreprocessor

See Preprocessor Options for a list of options that can be used to control the preprocessor.

-Wp,<arg1>,<arg2>...

Pass the comma separated arguments in <argN> to the preprocessor.

-Xpreprocessor <option>

Pass <option> to the preprocessor.