2.11. Specifying Source Files and File Extensions

The following command-line options specify source file type treatment and extensions.

armcl Option (and alias)

tiarmclang Option

--asm_file=<file> (-fa=<file>)

-x assembler

-x assembler-with-cpp

-x ti-asm

The armcl compiler provides the --asm_file option to identify a specific file as an assembly source file regardless of its extension.

The tiarmclang compiler processes source files specified on the command line after the ‘-x <type>’ option as source files of an indicated type. For assembly source files, there are 3 different <type> arguments that can be specified for the -x option:

  • assembler - assume that source files that follow the ‘-x assembler’ option contain GNU-style assembly source.

  • assembler-with-cpp - assume that source files that follow the ‘-x assembler-with-cpp’ option contain GNU-style assembly source that contains pre-processing directives that must be processed before the GNU-style assembler is invoked on the GNU-style assembly source.

  • ti-asm - assume that source files that follow the ‘-x ti-asm’ option contain legacy TI-style assembly source. Instead of calling the default GNU-style assembler to process the source file, the legacy TI-style assembler, tiarmasm, will be used to process the source file. For more details on using tiarmclang to invoke the legacy TI-style assembler, please see “Invoking the Legacy TI- Style Assembler from tiarmclang”.

Note that like other instances of the tiarmclang compiler’s -x option, the source file type indicated by a given -x option will determine how source files which follow that -x option are interpreted until another -x option that specifies a different source file type is encountered.

armcl Option (and alias)

tiarmclang Option

--c_file=<file> (-fc=<file>)

-x c

The armcl compiler provides the --c_file option to identify a specific file as a C source file regardless of its extension.

The tiarmclang compiler processes source files specified on the command line after the ‘-x c’ option as C source files. Like other instances of the tiarmclang compiler’s -x option, the source file type indicated by a given -x option will determine how source files which follow that -x option are interpreted until another -x option that specifies a different source file type is encountered.

armcl Option (and alias)

tiarmclang Option

--cpp_default (-fg)

-x c++

--cpp_file=<file> (-fp=<file>)

The armcl compiler provides the --cpp_default file option to indicate that C files (with ‘.c’ file extension) should be interpreted as C++ source files. The armcl compiler also provides the --cpp_file option to identify a specific file as a C++ source file regardless of its extension.

The tiarmclang compiler processes source files specified on the command line after the ‘-x c++’ option as C source files. Like other instances of the tiarmclang compiler’s -x option, the source file type indicated by a given -x option will determine how source files which follow that -x option are interpreted until another -x option that specifies a different source file type is encountered.

armcl Option (and alias)

tiarmclang Option

--obj_file=<file> (-fo=<file>)

not supported

The armcl compiler provides the --obj_file option to identify a specific file as an object file regardless of its extension.

The tiarmclang compiler does not provide an explicit option to tell the compiler to interpret a given file as an object file, regardless of extension. However, provided there are no -x options preceding an object file specification on the tiarmclang command- line, the tiarmclang compiler will detect that the specified file contains object code and pass the file along to be included in the link step.

Alternatively, if there are -x options on the tiarmclang command- line that would interfere with the proper interpretation of an object files specification, you may precede the object file specification with a -Xlinker option to indicate that the object file is intended as input to the linker.

armcl Option

tiarmclang Option

--preinclude=<file>

-include <file>

The armcl compiler provides the --preinclude option to include a source file at the beginning of compilation.

The tiarmclang compiler’s -include option provides the same functionality.

armcl Option (and alias)

tiarmclang Option

--asm_extension=<ext> (-ea=<ext>)

not supported

The armcl compiler provides the --asm_extension option to indicate that files with the specified extension (<ext>) should be interpreted as assembly source files. In addition, assembly files that are generated by the compiler will have the specified extension.

The tiarmclang compiler does not provide support for changing default file extensions. Files with an .s (lower-case) extension are treated as GNU-style assembly source. The .S (upper-case) extension indicates that a GNU-style assembly source file requires preprocessing.

armcl Option (and alias)

tiarmclang Option

--c_extension=<ext> (-ec=<ext>)

not supported

The armcl compiler provides the --c_extension option to indicate that files with the specified extension (<ext>) should be interpreted as C source files.

The tiarmclang compiler does not provide support for changing default file extensions. Files with the .c extension are compiled as C.

armcl Option (and alias)

tiarmclang Option

--cpp_extension=<ext> (-ep=<ext>)

not supported

The armcl compiler provides the --cpp_extension option to indicate that files with the specified extension (<ext>) should be interpreted as C++ source files.

The tiarmclang compiler does not provide support for changing default file extensions. Files with the .cpp, .cxx, .c+, .cc, and .CC extensions are compiled as C++. You may also use the -x c++ option to indicate that any source file that follows the -x c++ option should be interpreted as a C++ source file (until another -x option is encountered on the tiarmclang command-line).

armcl Option (and alias)

tiarmclang Option

--listing_extension=<ext> (-es=<ext>)

not supported

The armcl compiler provides the --listing_extension option to indicate that assembly listing files that are generated by the compiler will have the specified extension (<ext>).

The tiarmclang compiler does not provide support for generating assembly listing files. Instead you may choose to use one of the available binary utilities to display the content of an object file.

armcl Option (and alias)

tiarmclang Option

--obj_extension=<ext> (-eo=<ext>)

not supported

The armcl compiler provides the --obj_extension option to indicate that files with the specified extension (<ext>) should be interpreted as object files. In addition, object files that are generated by the compiler will have the specified extension.

The tiarmclang compiler does not provide support for changing default file extensions. The tiarmclang compiler will attach a ‘.o’ extension to regular object files. The -o option can be used to specify the name of the linked output file.

There are some exceptions to this. For example, the tiarmclang compiler will interpret ‘.c’ file extensions as C source files, ‘.cpp’ file extensions as C++ source files, and ‘.s’ file extensions as GNU-style assembly source files.