Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

Linker Runs Too Long

From Texas Instruments Wiki
Jump to: navigation, search

Introduction

This page collects together material on why the linker may take a long time to finish, and what you might do about it.

Type Merging

Description

The most common source of long link time problems is type merging. What is type merging?

Consider this simple example. A header file named types.h defines a structure sss. The file types.h is included in every C source file. The debug type information describing the structure sss is built into every object file (unless --symdebug:none is used). Thus the linker sees multiple copies of the type information for sss. By default, the linker uses type merging to combine all those copies of the sss type information into one. This means the resulting linked .out file is that much smaller for having only one copy of the sss type information, and not many copies. With less type information to contend with, such a file loads into Code Composer Studio much faster. However, type merging is a compute intensive process. If there is lots of type information from many files, it can take a long time to complete.

Solutions

The simplest way to address this issue is to use the linker –b option to disable type merging. Note this means the resulting .out file will be larger and take longer to load. In some cases, it can be much larger and take a very long time to load.

Another option is to compile with --symdebug:none. That means there will be no debug information in the resulting files. Such code cannot effectively be debugged or even profiled.