2.14 Using GCC fallback when building Linux applications

When building Linux applications developed to build with GCC, there might be cases when the ARM Compiler toolchain cannot complete the build successfully, because of unsupported GCC-specific functionality. For such cases, GCC fallback can invoke the GCC toolchain to complete the build.

GCC fallback supports the CodeSourcery 2010Q1 GNU toolchain release.

You cannot use GCC fallback to build the Linux kernel, only user applications.

To specify GCC fallback, include the compiler option -Warmcc,--gcc_fallback. GCC is invoked with the same GCC-style command-line options that are given to armcc. Therefore, GCC fallback has the same effect as the following shell script:

armcc $myflags
if found-gcc-specific-coding; then
  gcc $myflags
endif

The whole build is still driven by the build script, makefile, or other infrastructure you are using, and that does not change. For example, a single compile step might fail when armcc tries to compile that step. armcc then attempts to perform that single compile step with gcc. If a link step fails, armcc attempts to perform the link with the GCC toolchain, using GNU ld. When armcc performs a compile or link step, the include paths, library paths, and Linux libraries it uses are identified in the ARM Linux configuration file. For fallback, you must either:

  • Use the --arm_linux_config_file compiler option to produce the configuration file by configuring armcc against an existing gcc.

  • Provide an explicit path to gcc if you are specifying other configuration options manually.

The GCC toolchain used for fallback is the one that the configuration was created against. Therefore, the paths and libraries used by armcc and gcc must be equivalent.

If armcc invokes GCC fallback, a warning message is displayed. If gcc also fails, an additional error is displayed, otherwise you get a message indicating that gcc succeeded. You also see the original error messages from armcc to inform you of the source file or files that failed to compile, and the cause of the problem.

Note:

  • There is no change to what the ARM Compiler tools link with when using GCC fallback. That is, the tools only link with whatever gcc links with, as identified in the configuration file generated with the --arm_linux_config_file compiler option. Therefore, it is your responsibility to ensure that licenses are adhered to, and in particular to check what you are linking with. You might have to explicitly override this if necessary. To do this, include the GNU options -nostdinc, -nodefaultlibs, and -nostdlib on the armcc command line.

  • armcc invokes the GNU tools in a separate process.

  • armcc does not optimize any code in any GCC intermediate representations.

To see the commands that are invoked during GCC fallback, specify the -Warmcc,--echo command-line option.

The following figure shows a high-level view of the GCC fallback process:

Figure 2-1 GCC fallback process diagram
To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.


Non-ConfidentialPDF file icon PDF versionARM DUI0472M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.