[Main] Title=Global Imports Subsections=global_imports_conditional, global_imports_auto [Top] Just like startup sections, the concept of global imports is unique to the TIGCC linker. Global imports and startup sections are closely related to each other: It is best to keep startup sections in archive files, so they can be imported as needed, but the existing method of importing archive file members does not work. Usually, an archive file member is imported if a symbol it exports is referenced in a relocation entry. However, code that requires a specific startup section to be included does not necessarily reference any of the symbols in the corresponding archive member; it just needs the startup code to be there. A global import solves this problem by importing an archive member without inserting its address anywhere.

Actually, a global import imports all archive members that export the symbol referenced by the import (and even more, see Conditional Reaction to Global Imports). If no archive member exports this symbol, a warning is emitted. This way, it is very easy to create archive files that react to multiple imports; for example: A global import for A would cause the files 1 and 3 to be included in the program. If it could only import one file, 6 files would be needed to get the same result: Global import can be created using the __ref_all_... control symbol. Some global imports are also created automatically by the linker on certain conditions.