我要评分
获取效率
正确性
完整性
易理解

-finline-force=<value>

Description

This option is a link-time option used together with -flto to instruct the target static library or object file to be inlined during LTO linking. This option enhances the inlining of functions within the object files, including the following inlining features:

  • When the calling function and the called function use different architecture options, such as march/mcpu, it will attempt to unify the architecture options of the called function with those of the calling function and perform inline compilation.
  • The inline keyword is similar to adding the inline keyword to the called function, indicating that if the function body is found during compilation, it should be inlined wherever possible.
  • The always_inline attribute is similar to adding the __attribute__((always_inline)) attribute to the called function.

Usage

Add the following content to the option. If there are multiple file names, separate them with commas (,).

1
-flto -finline-force=liba.a,libb.a 

Example:

1
2
3
4
gcc -O2 -fPIC -flto -c fa.c -o fa.o
gcc-ar rcs liba.a fa.o

gcc -O2 -fPIC -flto -finline-force=liba.a main.c liba.a -o exe

Note: -finline-force, without specifying an object file name, is only used for global inline debugging and analysis, and should not be used directly.