SUBJ: Passing arguments to the LTO

Hi everyone,

We are implementing a profiling instrumentation tool as a part of clang’s LTO. The tool inserts code at compile time that makes calls to a runtime library (written as a C file) during program execution. The runtime library can collect different kinds of profile information depending on user input.

Previously, the user had to manually link the correct profiling library to the application’s object code. We would like to automatically link the in the profiling library (stored on disk in LLVM bitcode), through the ld command, by modifying LTOCodeGenerator.cpp.

We are having troubling sending command-line arguments to the LTO code, because LTO is called by the system ld. However, we’ve noticed the declaration static cl::opt DisableInline in LTOCodeGenerator.cpp.

How is the DisableInline argument passed to LTO, and how would we be able to pass similar arguments, declared as cl::opt, to the LTO code?

Thanks for your help,
Melanie and Kui